@powerhousedao/connect 6.0.0-dev.23 → 6.0.0-dev.230
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/.env +1 -1
- package/dist/AddDriveModal-B9BPORvo.js +89 -0
- package/dist/AddDriveModal-B9BPORvo.js.map +1 -0
- package/dist/ClearStorageModal-K1H6NgT6.js +44 -0
- package/dist/ClearStorageModal-K1H6NgT6.js.map +1 -0
- package/dist/CookiesPolicyModal-CnVx2R_8.js +30 -0
- package/dist/CookiesPolicyModal-CnVx2R_8.js.map +1 -0
- package/dist/CreateDocumentModal-TtG7E62x.js +28 -0
- package/dist/CreateDocumentModal-TtG7E62x.js.map +1 -0
- package/dist/DebugSettingsModal-CriX2NsN.js +169 -0
- package/dist/DebugSettingsModal-CriX2NsN.js.map +1 -0
- package/dist/DeleteDriveModal-Cb43NeNu.js +40 -0
- package/dist/DeleteDriveModal-Cb43NeNu.js.map +1 -0
- package/dist/DeleteItemModal-Brq4QKdd.js +39 -0
- package/dist/DeleteItemModal-Brq4QKdd.js.map +1 -0
- package/dist/DisclaimerModal-Dk6PpkZU.js +21 -0
- package/dist/DisclaimerModal-Dk6PpkZU.js.map +1 -0
- package/dist/DriveSettingsModal-BdcjrRh9.js +48 -0
- package/dist/DriveSettingsModal-BdcjrRh9.js.map +1 -0
- package/dist/ExportDocumentWithErrorsModal-DNRr3cjI.js +41 -0
- package/dist/ExportDocumentWithErrorsModal-DNRr3cjI.js.map +1 -0
- package/dist/InspectorModal-EDrjiXPs.js +372 -0
- package/dist/InspectorModal-EDrjiXPs.js.map +1 -0
- package/dist/MissingPackageModal-BfblPbd8.js +34 -0
- package/dist/MissingPackageModal-BfblPbd8.js.map +1 -0
- package/dist/SettingsModal-5hkkt5lV.js +294 -0
- package/dist/SettingsModal-5hkkt5lV.js.map +1 -0
- package/dist/UpgradeDriveModal-CBLALaaQ.js +31 -0
- package/dist/UpgradeDriveModal-CBLALaaQ.js.map +1 -0
- package/dist/build-info-CMRmLn5Q.js +12 -0
- package/dist/build-info-CMRmLn5Q.js.map +1 -0
- package/dist/connect.config-Cuh0hj_Q.js +139 -0
- package/dist/connect.config-Cuh0hj_Q.js.map +1 -0
- package/dist/i18n-Ch408v5-.js +125 -0
- package/dist/i18n-Ch408v5-.js.map +1 -0
- package/dist/load-Dy0OZx9L.js +109 -0
- package/dist/load-Dy0OZx9L.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +9 -0
- package/dist/main.js.map +1 -0
- package/dist/package-C3I4TZuv.js +114 -0
- package/dist/package-C3I4TZuv.js.map +1 -0
- package/dist/pglite-runtime-C1g-4Jxl.js +132 -0
- package/dist/pglite-runtime-C1g-4Jxl.js.map +1 -0
- package/dist/pglite-seed-BtXWFpHf.js +46 -0
- package/dist/pglite-seed-BtXWFpHf.js.map +1 -0
- package/dist/pglite.worker.d.ts +1 -0
- package/dist/pglite.worker.js +15 -0
- package/dist/pglite.worker.js.map +1 -0
- package/dist/pglite.worker.legacy.d.ts +1 -0
- package/dist/pglite.worker.legacy.js +15 -0
- package/dist/pglite.worker.legacy.js.map +1 -0
- package/dist/reactor-Nm3jOev1.js +783 -0
- package/dist/reactor-Nm3jOev1.js.map +1 -0
- package/dist/registerServiceWorker-LI8_JXt3.js +76 -0
- package/dist/registerServiceWorker-LI8_JXt3.js.map +1 -0
- package/dist/sidebar-BCkxH2f3.js +1566 -0
- package/dist/sidebar-BCkxH2f3.js.map +1 -0
- package/dist/start-connect.d.ts +21 -0
- package/dist/start-connect.d.ts.map +1 -0
- package/dist/start-connect.js +16 -0
- package/dist/start-connect.js.map +1 -0
- package/{lib → dist}/style.css +2185 -311
- package/dist/toast-DnODOv28.js +20 -0
- package/dist/toast-DnODOv28.js.map +1 -0
- package/dist/useRegistryPackages-BOX4NMAb.js +125 -0
- package/dist/useRegistryPackages-BOX4NMAb.js.map +1 -0
- package/package.json +57 -121
- package/public/ph-packages.json +3 -0
- package/dist/assets/AddDriveModal-DBaGaeEv.js +0 -1
- package/dist/assets/ClearStorageModal-C-Eq31x6.js +0 -1
- package/dist/assets/CookiesPolicyModal-DDnLiRMa.js +0 -1
- package/dist/assets/CreateDocumentModal-CCWA7rsK.js +0 -1
- package/dist/assets/DebugSettingsModal-MX6tAmFS.js +0 -1
- package/dist/assets/DeleteDriveModal-BDKQZ4HZ.js +0 -1
- package/dist/assets/DeleteItemModal-B2q5Bzm0.js +0 -1
- package/dist/assets/DisclaimerModal-3N95_i1A.js +0 -1
- package/dist/assets/DriveSettingsModal-6Odc4iBB.js +0 -1
- package/dist/assets/ExportDocumentWithErrorsModal-BxgdM4Cn.js +0 -1
- package/dist/assets/SettingsModal-DxiLUh4m.js +0 -1
- package/dist/assets/UpgradeDriveModal-BNV5YhHT.js +0 -1
- package/dist/assets/_virtual_ph_external-packages-CM1tCR4L.js +0 -1
- package/dist/assets/config-CU-aFfVJ.js +0 -1
- package/dist/assets/connect-loader-CvOC68Ih.mp4 +0 -0
- package/dist/assets/design_system-uuqt99TZ.js +0 -45
- package/dist/assets/design_system_connect-DdtsYVPZ.js +0 -47
- package/dist/assets/design_system_ui-Duj5Ll6i.js +0 -1
- package/dist/assets/document_drive-Bubv8iix.js +0 -316
- package/dist/assets/document_engineering-C09a5UIJ.js +0 -1
- package/dist/assets/document_model-_oCbt5YE.js +0 -230
- package/dist/assets/document_model_editor-ohJ7LI9a.js +0 -25
- package/dist/assets/drive_explorer-gMzxtIW2.js +0 -2
- package/dist/assets/graphql-AKTCpY7l.js +0 -75
- package/dist/assets/graphql-editor-CKzx1Jnw.js +0 -73
- package/dist/assets/graphql_request-BJtmW2JS.js +0 -3
- package/dist/assets/hmr-LMNkvzP7.js +0 -1
- package/dist/assets/home-bg-BEhF9NuW.png +0 -0
- package/dist/assets/home-bg-BRYzhkhi.avif +0 -0
- package/dist/assets/hooks-CsZvAIjq.js +0 -12
- package/dist/assets/index-CiT5oJyj.js +0 -18
- package/dist/assets/index-DYdiZMfn.css +0 -1
- package/dist/assets/index-DZ0uz05k.js +0 -28
- package/dist/assets/json-editor-CN0vAdTn.js +0 -1
- package/dist/assets/nodefs-De9muFtb.js +0 -1
- package/dist/assets/opfs-ahp-DWJ33Mjx.js +0 -3
- package/dist/assets/pg_dump-CW0pN9tG.wasm +0 -0
- package/dist/assets/postgres-CkP7QCDB.data +0 -0
- package/dist/assets/postgres-CyuUVpXN.wasm +0 -0
- package/dist/assets/powerhouse-rounded-CeKGGUG4.png +0 -0
- package/dist/assets/react/jsx-runtime-DldvXD6N.js +0 -1
- package/dist/assets/react-DQSxOgtG.js +0 -1
- package/dist/assets/react-dom/client-BVPiT_FE.js +0 -9
- package/dist/assets/react-dom-D6zQJsh6.js +0 -1
- package/dist/assets/reactor_browser-7kCiebAa.js +0 -129
- package/dist/assets/renown-short-hover-BiSLBV7L.png +0 -0
- package/dist/assets/rwa-report-Bb0W5-ac.png +0 -0
- package/dist/assets/sentry_browser-B4YoBIIG.js +0 -498
- package/dist/assets/sentry_react-cODD7zWc.js +0 -3
- package/dist/assets/state-schemas-Ed8-N-Nl.js +0 -2
- package/dist/assets/tailwind_merge-Dr4f9Rms.js +0 -1
- package/dist/assets/zod-9j67vCAu.js +0 -39
- package/dist/icon.ico +0 -0
- package/dist/index.html +0 -51
- package/dist/robots.txt +0 -3
- package/dist/settings.png +0 -0
- package/heroku/Dockerfile +0 -101
- package/heroku/Procfile +0 -1
- package/heroku/config/nginx.conf.template +0 -77
- package/heroku/heroku-entrypoint.sh +0 -38
- package/lib/cypress/e2e/navigation.cy.d.ts +0 -2
- package/lib/cypress/e2e/navigation.cy.d.ts.map +0 -1
- package/lib/cypress/e2e/navigation.cy.js +0 -221
- package/lib/cypress/e2e/navigation.cy.js.map +0 -1
- package/lib/cypress/e2e/utils/index.d.ts +0 -15
- package/lib/cypress/e2e/utils/index.d.ts.map +0 -1
- package/lib/cypress/e2e/utils/index.js +0 -121
- package/lib/cypress/e2e/utils/index.js.map +0 -1
- package/lib/cypress/support/commands.d.ts +0 -2
- package/lib/cypress/support/commands.d.ts.map +0 -1
- package/lib/cypress/support/commands.js +0 -29
- package/lib/cypress/support/commands.js.map +0 -1
- package/lib/cypress/support/e2e.d.ts +0 -2
- package/lib/cypress/support/e2e.d.ts.map +0 -1
- package/lib/cypress/support/e2e.js +0 -19
- package/lib/cypress/support/e2e.js.map +0 -1
- package/lib/cypress.config.d.ts +0 -3
- package/lib/cypress.config.d.ts.map +0 -1
- package/lib/cypress.config.js +0 -15
- package/lib/cypress.config.js.map +0 -1
- package/lib/package.copy.json +0 -177
- package/lib/scripts/render-skeleton.d.ts +0 -2
- package/lib/scripts/render-skeleton.d.ts.map +0 -1
- package/lib/scripts/render-skeleton.js +0 -11
- package/lib/scripts/render-skeleton.js.map +0 -1
- package/lib/src/components/analytics.d.ts +0 -8
- package/lib/src/components/analytics.d.ts.map +0 -1
- package/lib/src/components/analytics.js +0 -30
- package/lib/src/components/analytics.js.map +0 -1
- package/lib/src/components/app-loader.d.ts +0 -3
- package/lib/src/components/app-loader.d.ts.map +0 -1
- package/lib/src/components/app-loader.js +0 -20
- package/lib/src/components/app-loader.js.map +0 -1
- package/lib/src/components/app-skeleton.d.ts +0 -3
- package/lib/src/components/app-skeleton.d.ts.map +0 -1
- package/lib/src/components/app-skeleton.js +0 -38
- package/lib/src/components/app-skeleton.js.map +0 -1
- package/lib/src/components/app.d.ts +0 -2
- package/lib/src/components/app.d.ts.map +0 -1
- package/lib/src/components/app.js +0 -29
- package/lib/src/components/app.js.map +0 -1
- package/lib/src/components/button.d.ts +0 -3
- package/lib/src/components/button.d.ts.map +0 -1
- package/lib/src/components/button.js +0 -7
- package/lib/src/components/button.js.map +0 -1
- package/lib/src/components/cookie-banner.d.ts +0 -2
- package/lib/src/components/cookie-banner.d.ts.map +0 -1
- package/lib/src/components/cookie-banner.js +0 -48
- package/lib/src/components/cookie-banner.js.map +0 -1
- package/lib/src/components/document-editor-container.d.ts +0 -2
- package/lib/src/components/document-editor-container.d.ts.map +0 -1
- package/lib/src/components/document-editor-container.js +0 -65
- package/lib/src/components/document-editor-container.js.map +0 -1
- package/lib/src/components/dots-loader.d.ts +0 -2
- package/lib/src/components/dots-loader.d.ts.map +0 -1
- package/lib/src/components/dots-loader.js +0 -15
- package/lib/src/components/dots-loader.js.map +0 -1
- package/lib/src/components/drive-editor-container.d.ts +0 -2
- package/lib/src/components/drive-editor-container.d.ts.map +0 -1
- package/lib/src/components/drive-editor-container.js +0 -22
- package/lib/src/components/drive-editor-container.js.map +0 -1
- package/lib/src/components/drive-icon.d.ts +0 -5
- package/lib/src/components/drive-icon.d.ts.map +0 -1
- package/lib/src/components/drive-icon.js +0 -15
- package/lib/src/components/drive-icon.js.map +0 -1
- package/lib/src/components/editor-loader.d.ts +0 -9
- package/lib/src/components/editor-loader.d.ts.map +0 -1
- package/lib/src/components/editor-loader.js +0 -19
- package/lib/src/components/editor-loader.js.map +0 -1
- package/lib/src/components/editors.d.ts +0 -10
- package/lib/src/components/editors.d.ts.map +0 -1
- package/lib/src/components/editors.js +0 -87
- package/lib/src/components/editors.js.map +0 -1
- package/lib/src/components/error-boundary.d.ts +0 -103
- package/lib/src/components/error-boundary.d.ts.map +0 -1
- package/lib/src/components/error-boundary.js +0 -104
- package/lib/src/components/error-boundary.js.map +0 -1
- package/lib/src/components/footer.d.ts +0 -2
- package/lib/src/components/footer.d.ts.map +0 -1
- package/lib/src/components/footer.js +0 -16
- package/lib/src/components/footer.js.map +0 -1
- package/lib/src/components/index.d.ts +0 -22
- package/lib/src/components/index.d.ts.map +0 -1
- package/lib/src/components/index.js +0 -22
- package/lib/src/components/index.js.map +0 -1
- package/lib/src/components/login.d.ts +0 -2
- package/lib/src/components/login.d.ts.map +0 -1
- package/lib/src/components/login.js +0 -12
- package/lib/src/components/login.js.map +0 -1
- package/lib/src/components/modal/index.d.ts +0 -18
- package/lib/src/components/modal/index.d.ts.map +0 -1
- package/lib/src/components/modal/index.js +0 -18
- package/lib/src/components/modal/index.js.map +0 -1
- package/lib/src/components/modal/modals/AddDriveModal.d.ts +0 -2
- package/lib/src/components/modal/modals/AddDriveModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/AddDriveModal.js +0 -121
- package/lib/src/components/modal/modals/AddDriveModal.js.map +0 -1
- package/lib/src/components/modal/modals/ClearStorageModal.d.ts +0 -2
- package/lib/src/components/modal/modals/ClearStorageModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/ClearStorageModal.js +0 -35
- package/lib/src/components/modal/modals/ClearStorageModal.js.map +0 -1
- package/lib/src/components/modal/modals/CookiesPolicyModal.d.ts +0 -2
- package/lib/src/components/modal/modals/CookiesPolicyModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/CookiesPolicyModal.js +0 -16
- package/lib/src/components/modal/modals/CookiesPolicyModal.js.map +0 -1
- package/lib/src/components/modal/modals/CreateDocumentModal.d.ts +0 -2
- package/lib/src/components/modal/modals/CreateDocumentModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/CreateDocumentModal.js +0 -24
- package/lib/src/components/modal/modals/CreateDocumentModal.js.map +0 -1
- package/lib/src/components/modal/modals/DebugSettingsModal.d.ts +0 -2
- package/lib/src/components/modal/modals/DebugSettingsModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/DebugSettingsModal.js +0 -108
- package/lib/src/components/modal/modals/DebugSettingsModal.js.map +0 -1
- package/lib/src/components/modal/modals/DeleteDriveModal.d.ts +0 -2
- package/lib/src/components/modal/modals/DeleteDriveModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/DeleteDriveModal.js +0 -32
- package/lib/src/components/modal/modals/DeleteDriveModal.js.map +0 -1
- package/lib/src/components/modal/modals/DeleteItemModal.d.ts +0 -3
- package/lib/src/components/modal/modals/DeleteItemModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/DeleteItemModal.js +0 -33
- package/lib/src/components/modal/modals/DeleteItemModal.js.map +0 -1
- package/lib/src/components/modal/modals/DisclaimerModal.d.ts +0 -3
- package/lib/src/components/modal/modals/DisclaimerModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/DisclaimerModal.js +0 -12
- package/lib/src/components/modal/modals/DisclaimerModal.js.map +0 -1
- package/lib/src/components/modal/modals/DriveSettingsModal.d.ts +0 -2
- package/lib/src/components/modal/modals/DriveSettingsModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/DriveSettingsModal.js +0 -28
- package/lib/src/components/modal/modals/DriveSettingsModal.js.map +0 -1
- package/lib/src/components/modal/modals/ExportDocumentWithErrorsModal.d.ts +0 -2
- package/lib/src/components/modal/modals/ExportDocumentWithErrorsModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/ExportDocumentWithErrorsModal.js +0 -30
- package/lib/src/components/modal/modals/ExportDocumentWithErrorsModal.js.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.d.ts +0 -2
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.js +0 -29
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.js.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/index.d.ts +0 -2
- package/lib/src/components/modal/modals/InspectorModal/index.d.ts.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/index.js +0 -2
- package/lib/src/components/modal/modals/InspectorModal/index.js.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.d.ts +0 -31
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.d.ts.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.js +0 -211
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.js.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.d.ts +0 -4
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.d.ts.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.js +0 -12
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.js.map +0 -1
- package/lib/src/components/modal/modals/SettingsModal.d.ts +0 -3
- package/lib/src/components/modal/modals/SettingsModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/SettingsModal.js +0 -45
- package/lib/src/components/modal/modals/SettingsModal.js.map +0 -1
- package/lib/src/components/modal/modals/UpgradeDriveModal.d.ts +0 -3
- package/lib/src/components/modal/modals/UpgradeDriveModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/UpgradeDriveModal.js +0 -21
- package/lib/src/components/modal/modals/UpgradeDriveModal.js.map +0 -1
- package/lib/src/components/modal/modals/settings/about.d.ts +0 -2
- package/lib/src/components/modal/modals/settings/about.d.ts.map +0 -1
- package/lib/src/components/modal/modals/settings/about.js +0 -10
- package/lib/src/components/modal/modals/settings/about.js.map +0 -1
- package/lib/src/components/modal/modals/settings/danger-zone.d.ts +0 -2
- package/lib/src/components/modal/modals/settings/danger-zone.d.ts.map +0 -1
- package/lib/src/components/modal/modals/settings/danger-zone.js +0 -15
- package/lib/src/components/modal/modals/settings/danger-zone.js.map +0 -1
- package/lib/src/components/modal/modals/settings/default-editor.d.ts +0 -2
- package/lib/src/components/modal/modals/settings/default-editor.d.ts.map +0 -1
- package/lib/src/components/modal/modals/settings/default-editor.js +0 -18
- package/lib/src/components/modal/modals/settings/default-editor.js.map +0 -1
- package/lib/src/components/modal/modals/settings/package-manager.d.ts +0 -3
- package/lib/src/components/modal/modals/settings/package-manager.d.ts.map +0 -1
- package/lib/src/components/modal/modals/settings/package-manager.js +0 -87
- package/lib/src/components/modal/modals/settings/package-manager.js.map +0 -1
- package/lib/src/components/modal/modals-container.d.ts +0 -2
- package/lib/src/components/modal/modals-container.d.ts.map +0 -1
- package/lib/src/components/modal/modals-container.js +0 -66
- package/lib/src/components/modal/modals-container.js.map +0 -1
- package/lib/src/components/ph-logo.d.ts +0 -2
- package/lib/src/components/ph-logo.d.ts.map +0 -1
- package/lib/src/components/ph-logo.js +0 -7
- package/lib/src/components/ph-logo.js.map +0 -1
- package/lib/src/components/reload-connect-toast.d.ts +0 -2
- package/lib/src/components/reload-connect-toast.d.ts.map +0 -1
- package/lib/src/components/reload-connect-toast.js +0 -7
- package/lib/src/components/reload-connect-toast.js.map +0 -1
- package/lib/src/components/root.d.ts +0 -2
- package/lib/src/components/root.d.ts.map +0 -1
- package/lib/src/components/root.js +0 -8
- package/lib/src/components/root.js.map +0 -1
- package/lib/src/components/router.d.ts +0 -2
- package/lib/src/components/router.d.ts.map +0 -1
- package/lib/src/components/router.js +0 -41
- package/lib/src/components/router.js.map +0 -1
- package/lib/src/components/search-bar.d.ts +0 -2
- package/lib/src/components/search-bar.d.ts.map +0 -1
- package/lib/src/components/search-bar.js +0 -36
- package/lib/src/components/search-bar.js.map +0 -1
- package/lib/src/components/sidebar.d.ts +0 -2
- package/lib/src/components/sidebar.d.ts.map +0 -1
- package/lib/src/components/sidebar.js +0 -28
- package/lib/src/components/sidebar.js.map +0 -1
- package/lib/src/connect.config.d.ts +0 -115
- package/lib/src/connect.config.d.ts.map +0 -1
- package/lib/src/connect.config.js +0 -148
- package/lib/src/connect.config.js.map +0 -1
- package/lib/src/context/index.d.ts +0 -4
- package/lib/src/context/index.d.ts.map +0 -1
- package/lib/src/context/index.js +0 -4
- package/lib/src/context/index.js.map +0 -1
- package/lib/src/context/processor-manager.d.ts +0 -3
- package/lib/src/context/processor-manager.d.ts.map +0 -1
- package/lib/src/context/processor-manager.js +0 -189
- package/lib/src/context/processor-manager.js.map +0 -1
- package/lib/src/context/read-mode.d.ts +0 -2
- package/lib/src/context/read-mode.d.ts.map +0 -1
- package/lib/src/context/read-mode.js +0 -219
- package/lib/src/context/read-mode.js.map +0 -1
- package/lib/src/context/sentry-provider.d.ts +0 -6
- package/lib/src/context/sentry-provider.d.ts.map +0 -1
- package/lib/src/context/sentry-provider.js +0 -6
- package/lib/src/context/sentry-provider.js.map +0 -1
- package/lib/src/feature-flags.d.ts +0 -53
- package/lib/src/feature-flags.d.ts.map +0 -1
- package/lib/src/feature-flags.js +0 -186
- package/lib/src/feature-flags.js.map +0 -1
- package/lib/src/globals.d.ts +0 -9
- package/lib/src/globals.d.ts.map +0 -1
- package/lib/src/globals.js +0 -2
- package/lib/src/globals.js.map +0 -1
- package/lib/src/hmr.d.ts +0 -3
- package/lib/src/hmr.d.ts.map +0 -1
- package/lib/src/hmr.js +0 -2
- package/lib/src/hmr.js.map +0 -1
- package/lib/src/hooks/index.d.ts +0 -10
- package/lib/src/hooks/index.d.ts.map +0 -1
- package/lib/src/hooks/index.js +0 -10
- package/lib/src/hooks/index.js.map +0 -1
- package/lib/src/hooks/useAcceptedCookies.d.ts +0 -9
- package/lib/src/hooks/useAcceptedCookies.d.ts.map +0 -1
- package/lib/src/hooks/useAcceptedCookies.js +0 -34
- package/lib/src/hooks/useAcceptedCookies.js.map +0 -1
- package/lib/src/hooks/useCheckLatestVersion.d.ts +0 -2
- package/lib/src/hooks/useCheckLatestVersion.d.ts.map +0 -1
- package/lib/src/hooks/useCheckLatestVersion.js +0 -33
- package/lib/src/hooks/useCheckLatestVersion.js.map +0 -1
- package/lib/src/hooks/useClientErrorHandler.d.ts +0 -6
- package/lib/src/hooks/useClientErrorHandler.d.ts.map +0 -1
- package/lib/src/hooks/useClientErrorHandler.js +0 -131
- package/lib/src/hooks/useClientErrorHandler.js.map +0 -1
- package/lib/src/hooks/useCookieBanner.d.ts +0 -5
- package/lib/src/hooks/useCookieBanner.d.ts.map +0 -1
- package/lib/src/hooks/useCookieBanner.js +0 -32
- package/lib/src/hooks/useCookieBanner.js.map +0 -1
- package/lib/src/hooks/useInitSentry.d.ts +0 -2
- package/lib/src/hooks/useInitSentry.d.ts.map +0 -1
- package/lib/src/hooks/useInitSentry.js +0 -80
- package/lib/src/hooks/useInitSentry.js.map +0 -1
- package/lib/src/hooks/useNodeActions.d.ts +0 -6
- package/lib/src/hooks/useNodeActions.d.ts.map +0 -1
- package/lib/src/hooks/useNodeActions.js +0 -35
- package/lib/src/hooks/useNodeActions.js.map +0 -1
- package/lib/src/hooks/useUndoRedoShortcuts.d.ts +0 -8
- package/lib/src/hooks/useUndoRedoShortcuts.d.ts.map +0 -1
- package/lib/src/hooks/useUndoRedoShortcuts.js +0 -26
- package/lib/src/hooks/useUndoRedoShortcuts.js.map +0 -1
- package/lib/src/hooks/useWindowSize.d.ts +0 -5
- package/lib/src/hooks/useWindowSize.d.ts.map +0 -1
- package/lib/src/hooks/useWindowSize.js +0 -21
- package/lib/src/hooks/useWindowSize.js.map +0 -1
- package/lib/src/hooks/utils.d.ts +0 -7
- package/lib/src/hooks/utils.d.ts.map +0 -1
- package/lib/src/hooks/utils.js +0 -46
- package/lib/src/hooks/utils.js.map +0 -1
- package/lib/src/i18n/index.d.ts +0 -4
- package/lib/src/i18n/index.d.ts.map +0 -1
- package/lib/src/i18n/index.js +0 -26
- package/lib/src/i18n/index.js.map +0 -1
- package/lib/src/i18n/locales/en.json +0 -114
- package/lib/src/index.d.ts +0 -2
- package/lib/src/index.d.ts.map +0 -1
- package/lib/src/index.js +0 -2
- package/lib/src/index.js.map +0 -1
- package/lib/src/main.d.ts +0 -2
- package/lib/src/main.d.ts.map +0 -1
- package/lib/src/main.js +0 -5
- package/lib/src/main.js.map +0 -1
- package/lib/src/pages/content.d.ts +0 -2
- package/lib/src/pages/content.d.ts.map +0 -1
- package/lib/src/pages/content.js +0 -39
- package/lib/src/pages/content.js.map +0 -1
- package/lib/src/pages/demo/atlas-import.d.ts +0 -2
- package/lib/src/pages/demo/atlas-import.d.ts.map +0 -1
- package/lib/src/pages/demo/atlas-import.js +0 -122
- package/lib/src/pages/demo/atlas-import.js.map +0 -1
- package/lib/src/pages/index.d.ts +0 -4
- package/lib/src/pages/index.d.ts.map +0 -1
- package/lib/src/pages/index.js +0 -4
- package/lib/src/pages/index.js.map +0 -1
- package/lib/src/pages/settings.d.ts +0 -4
- package/lib/src/pages/settings.d.ts.map +0 -1
- package/lib/src/pages/settings.js +0 -9
- package/lib/src/pages/settings.js.map +0 -1
- package/lib/src/service-worker.d.ts +0 -2
- package/lib/src/service-worker.d.ts.map +0 -1
- package/lib/src/service-worker.js +0 -58
- package/lib/src/service-worker.js.map +0 -1
- package/lib/src/services/hmr.d.ts +0 -13
- package/lib/src/services/hmr.d.ts.map +0 -1
- package/lib/src/services/hmr.js +0 -85
- package/lib/src/services/hmr.js.map +0 -1
- package/lib/src/services/index.d.ts +0 -10
- package/lib/src/services/index.d.ts.map +0 -1
- package/lib/src/services/index.js +0 -9
- package/lib/src/services/index.js.map +0 -1
- package/lib/src/services/logger.d.ts +0 -2
- package/lib/src/services/logger.d.ts.map +0 -1
- package/lib/src/services/logger.js +0 -28
- package/lib/src/services/logger.js.map +0 -1
- package/lib/src/services/renown/browser.d.ts +0 -2
- package/lib/src/services/renown/browser.d.ts.map +0 -1
- package/lib/src/services/renown/browser.js +0 -6
- package/lib/src/services/renown/browser.js.map +0 -1
- package/lib/src/services/renown/constants.d.ts +0 -130
- package/lib/src/services/renown/constants.d.ts.map +0 -1
- package/lib/src/services/renown/constants.js +0 -41
- package/lib/src/services/renown/constants.js.map +0 -1
- package/lib/src/services/renown/utils.d.ts +0 -7
- package/lib/src/services/renown/utils.d.ts.map +0 -1
- package/lib/src/services/renown/utils.js +0 -20
- package/lib/src/services/renown/utils.js.map +0 -1
- package/lib/src/services/storage/base-storage.d.ts +0 -9
- package/lib/src/services/storage/base-storage.d.ts.map +0 -1
- package/lib/src/services/storage/base-storage.js +0 -21
- package/lib/src/services/storage/base-storage.js.map +0 -1
- package/lib/src/services/storage/browser.d.ts +0 -5
- package/lib/src/services/storage/browser.d.ts.map +0 -1
- package/lib/src/services/storage/browser.js +0 -25
- package/lib/src/services/storage/browser.js.map +0 -1
- package/lib/src/services/storage/types.d.ts +0 -6
- package/lib/src/services/storage/types.d.ts.map +0 -1
- package/lib/src/services/storage/types.js +0 -2
- package/lib/src/services/storage/types.js.map +0 -1
- package/lib/src/services/toast.d.ts +0 -8
- package/lib/src/services/toast.d.ts.map +0 -1
- package/lib/src/services/toast.js +0 -11
- package/lib/src/services/toast.js.map +0 -1
- package/lib/src/store/document-model.d.ts +0 -3
- package/lib/src/store/document-model.d.ts.map +0 -1
- package/lib/src/store/document-model.js +0 -80
- package/lib/src/store/document-model.js.map +0 -1
- package/lib/src/store/editor.d.ts +0 -5
- package/lib/src/store/editor.d.ts.map +0 -1
- package/lib/src/store/editor.js +0 -31
- package/lib/src/store/editor.js.map +0 -1
- package/lib/src/store/external-packages.d.ts +0 -4
- package/lib/src/store/external-packages.d.ts.map +0 -1
- package/lib/src/store/external-packages.js +0 -36
- package/lib/src/store/external-packages.js.map +0 -1
- package/lib/src/store/index.d.ts +0 -7
- package/lib/src/store/index.d.ts.map +0 -1
- package/lib/src/store/index.js +0 -7
- package/lib/src/store/index.js.map +0 -1
- package/lib/src/store/reactor.d.ts +0 -3
- package/lib/src/store/reactor.d.ts.map +0 -1
- package/lib/src/store/reactor.js +0 -272
- package/lib/src/store/reactor.js.map +0 -1
- package/lib/src/store/user.d.ts +0 -2
- package/lib/src/store/user.d.ts.map +0 -1
- package/lib/src/store/user.js +0 -16
- package/lib/src/store/user.js.map +0 -1
- package/lib/src/store/utils.d.ts +0 -2
- package/lib/src/store/utils.d.ts.map +0 -1
- package/lib/src/store/utils.js +0 -59
- package/lib/src/store/utils.js.map +0 -1
- package/lib/src/utils/browser.d.ts +0 -2
- package/lib/src/utils/browser.d.ts.map +0 -1
- package/lib/src/utils/browser.js +0 -9
- package/lib/src/utils/browser.js.map +0 -1
- package/lib/src/utils/document-editor-debug-tools.d.ts +0 -17
- package/lib/src/utils/document-editor-debug-tools.d.ts.map +0 -1
- package/lib/src/utils/document-editor-debug-tools.js +0 -55
- package/lib/src/utils/document-editor-debug-tools.js.map +0 -1
- package/lib/src/utils/drive-preservation.d.ts +0 -19
- package/lib/src/utils/drive-preservation.d.ts.map +0 -1
- package/lib/src/utils/drive-preservation.js +0 -51
- package/lib/src/utils/drive-preservation.js.map +0 -1
- package/lib/src/utils/drive-sections.d.ts +0 -31
- package/lib/src/utils/drive-sections.d.ts.map +0 -1
- package/lib/src/utils/drive-sections.js +0 -63
- package/lib/src/utils/drive-sections.js.map +0 -1
- package/lib/src/utils/index.d.ts +0 -12
- package/lib/src/utils/index.d.ts.map +0 -1
- package/lib/src/utils/index.js +0 -12
- package/lib/src/utils/index.js.map +0 -1
- package/lib/src/utils/join.d.ts +0 -2
- package/lib/src/utils/join.d.ts.map +0 -1
- package/lib/src/utils/join.js +0 -11
- package/lib/src/utils/join.js.map +0 -1
- package/lib/src/utils/openUrl.d.ts +0 -2
- package/lib/src/utils/openUrl.d.ts.map +0 -1
- package/lib/src/utils/openUrl.js +0 -3
- package/lib/src/utils/openUrl.js.map +0 -1
- package/lib/src/utils/path.d.ts +0 -4
- package/lib/src/utils/path.d.ts.map +0 -1
- package/lib/src/utils/path.js +0 -17
- package/lib/src/utils/path.js.map +0 -1
- package/lib/src/utils/reactor.d.ts +0 -26
- package/lib/src/utils/reactor.d.ts.map +0 -1
- package/lib/src/utils/reactor.js +0 -115
- package/lib/src/utils/reactor.js.map +0 -1
- package/lib/src/utils/registerServiceWorker.d.ts +0 -12
- package/lib/src/utils/registerServiceWorker.d.ts.map +0 -1
- package/lib/src/utils/registerServiceWorker.js +0 -97
- package/lib/src/utils/registerServiceWorker.js.map +0 -1
- package/lib/src/utils/signature.d.ts +0 -4
- package/lib/src/utils/signature.d.ts.map +0 -1
- package/lib/src/utils/signature.js +0 -36
- package/lib/src/utils/signature.js.map +0 -1
- package/lib/src/utils/slug.d.ts +0 -2
- package/lib/src/utils/slug.d.ts.map +0 -1
- package/lib/src/utils/slug.js +0 -4
- package/lib/src/utils/slug.js.map +0 -1
- package/lib/src/workers/pglite-worker.d.ts +0 -2
- package/lib/src/workers/pglite-worker.d.ts.map +0 -1
- package/lib/src/workers/pglite-worker.js +0 -32
- package/lib/src/workers/pglite-worker.js.map +0 -1
- package/lib/test/utils/signer.test.d.ts +0 -2
- package/lib/test/utils/signer.test.d.ts.map +0 -1
- package/lib/test/utils/signer.test.js +0 -330
- package/lib/test/utils/signer.test.js.map +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/lib/vite.config.d.ts +0 -3
- package/lib/vite.config.d.ts.map +0 -1
- package/lib/vite.config.js +0 -59
- package/lib/vite.config.js.map +0 -1
- package/lib/vitest.config.d.ts +0 -3
- package/lib/vitest.config.d.ts.map +0 -1
- package/lib/vitest.config.js +0 -8
- package/lib/vitest.config.js.map +0 -1
- package/nginx.conf +0 -77
- package/package.copy.json +0 -177
- package/src/index.css +0 -5
|
@@ -0,0 +1,1566 @@
|
|
|
1
|
+
import { n as defaultPHAppConfig, r as defaultPHDocumentEditorConfig, t as connectConfig } from "./connect.config-Cuh0hj_Q.js";
|
|
2
|
+
import { n as toast, t as ToastContainer } from "./toast-DnODOv28.js";
|
|
3
|
+
import { t as i18n } from "./i18n-Ch408v5-.js";
|
|
4
|
+
import { c as subscribeReactorPgMajor, d as createFileDataStore, f as idbError, l as IDB_STORE_NAME, m as readPgVersionFile, p as openIdb, r as getCachedReactorPgMajor, u as PRIMARY_IDB_NAMES } from "./pglite-runtime-C1g-4Jxl.js";
|
|
5
|
+
import { t as serviceWorkerManager } from "./registerServiceWorker-LI8_JXt3.js";
|
|
6
|
+
import { addRemoteDrive, driveCollectionId, exportFile, getRevisionFromDate, logout, openRenown, setPHAppConfig, setPHDocumentEditorConfig, setRevisionHistoryVisible, setSelectedDrive, setSelectedNode, showPHModal, useAppModuleById, useDefaultAppModule, useDocumentById, useDocumentModelModuleById, useDocumentOperations, useDrives, useEditorModuleById, useFallbackEditorModule, useNodeParentFolderById, usePHModal, usePackageDiscoveryService, useReactorClient, useRevisionHistoryVisible, useSelectedDocument, useSelectedDocumentId, useSelectedDrive, useSelectedDriveSafe, useSelectedFolder, useSelectedTimelineItem, useSyncList, useUser, validateDocument } from "@powerhousedao/reactor-browser";
|
|
7
|
+
import { childLogger } from "document-model";
|
|
8
|
+
import React, { StrictMode, Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
9
|
+
import { Trans, useTranslation } from "react-i18next";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Outlet, RouterProvider, createBrowserRouter, createRoutesFromChildren, matchRoutes, useLocation, useNavigate, useNavigationType, useParams } from "react-router-dom";
|
|
12
|
+
import { useHotkeys } from "react-hotkeys-hook";
|
|
13
|
+
import { AnimatedLoader, ConnectSidebar, ConnectTooltipProvider, CookieBanner, DefaultEditorLoader, DropZoneWrapper, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, RevisionHistory, SidebarAddDriveItem, SidebarItem, useEns } from "@powerhousedao/design-system/connect";
|
|
14
|
+
import { GenericDriveExplorer } from "@powerhousedao/powerhouse-vetra-packages/editors";
|
|
15
|
+
import { Icon, PowerhouseButton } from "@powerhousedao/design-system";
|
|
16
|
+
import { ErrorBoundary } from "react-error-boundary";
|
|
17
|
+
import { PGlite } from "@electric-sql/pglite";
|
|
18
|
+
import { PackageInstallModal } from "@powerhousedao/design-system/connect/index";
|
|
19
|
+
import { redo, undo } from "@powerhousedao/shared/document-model";
|
|
20
|
+
import { gql, request } from "graphql-request";
|
|
21
|
+
//#region src/hooks/useAcceptedCookies.ts
|
|
22
|
+
const ACCEPTED_COOKIES_KEY_STORAGE = `${connectConfig.routerBasename}:acceptedCookies`;
|
|
23
|
+
const listeners$3 = /* @__PURE__ */ new Set();
|
|
24
|
+
let cookies = getInitial$1();
|
|
25
|
+
function getInitial$1() {
|
|
26
|
+
try {
|
|
27
|
+
const value = localStorage.getItem(ACCEPTED_COOKIES_KEY_STORAGE);
|
|
28
|
+
return value ? JSON.parse(value) : {
|
|
29
|
+
analytics: false,
|
|
30
|
+
marketing: false,
|
|
31
|
+
functional: false
|
|
32
|
+
};
|
|
33
|
+
} catch {
|
|
34
|
+
return {
|
|
35
|
+
analytics: false,
|
|
36
|
+
marketing: false,
|
|
37
|
+
functional: false
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function getCookies() {
|
|
42
|
+
return cookies;
|
|
43
|
+
}
|
|
44
|
+
function setCookies(setter) {
|
|
45
|
+
cookies = setter(cookies);
|
|
46
|
+
localStorage.setItem(ACCEPTED_COOKIES_KEY_STORAGE, JSON.stringify(cookies));
|
|
47
|
+
listeners$3.forEach((fn) => fn());
|
|
48
|
+
}
|
|
49
|
+
function subscribe$1(fn) {
|
|
50
|
+
listeners$3.add(fn);
|
|
51
|
+
return () => listeners$3.delete(fn);
|
|
52
|
+
}
|
|
53
|
+
const useAcceptedCookies = () => {
|
|
54
|
+
return [useSyncExternalStore(subscribe$1, getCookies, getCookies), setCookies];
|
|
55
|
+
};
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/hooks/usePendingInstallations.ts
|
|
58
|
+
const emptyArray = [];
|
|
59
|
+
function usePendingInstallations() {
|
|
60
|
+
const discoveryService = usePackageDiscoveryService();
|
|
61
|
+
return useSyncExternalStore((cb) => discoveryService?.subscribePending(cb) ?? (() => {}), () => discoveryService?.getPendingInstallations() ?? emptyArray);
|
|
62
|
+
}
|
|
63
|
+
const COOKIE_BANNER_KEY_STORAGE = `${connectConfig.routerBasename}:display-cookie-banner`;
|
|
64
|
+
const listeners$2 = /* @__PURE__ */ new Set();
|
|
65
|
+
let bannerShown = getInitial();
|
|
66
|
+
function getInitial() {
|
|
67
|
+
try {
|
|
68
|
+
return localStorage.getItem(COOKIE_BANNER_KEY_STORAGE) !== "false";
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error(error);
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function getCookieBannerState() {
|
|
75
|
+
return bannerShown;
|
|
76
|
+
}
|
|
77
|
+
function setCookieBannerState(state) {
|
|
78
|
+
bannerShown = state;
|
|
79
|
+
localStorage.setItem(COOKIE_BANNER_KEY_STORAGE, JSON.stringify(state));
|
|
80
|
+
}
|
|
81
|
+
function subscribe(fn) {
|
|
82
|
+
listeners$2.add(fn);
|
|
83
|
+
return () => listeners$2.delete(fn);
|
|
84
|
+
}
|
|
85
|
+
const useCookieBanner = () => {
|
|
86
|
+
return [useSyncExternalStore(subscribe, getCookieBannerState, getCookieBannerState), setCookieBannerState];
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/hooks/useInitSentry.ts
|
|
90
|
+
const logger$2 = childLogger(["sentry"]);
|
|
91
|
+
let clientStarted = false;
|
|
92
|
+
async function getSentry() {
|
|
93
|
+
return await import("@sentry/react");
|
|
94
|
+
}
|
|
95
|
+
async function initSentry() {
|
|
96
|
+
connectConfig.sentry;
|
|
97
|
+
const Sentry = await getSentry();
|
|
98
|
+
const integrations = [
|
|
99
|
+
Sentry.httpClientIntegration(),
|
|
100
|
+
Sentry.extraErrorDataIntegration({ depth: 5 }),
|
|
101
|
+
Sentry.replayIntegration(),
|
|
102
|
+
Sentry.captureConsoleIntegration({ levels: ["error"] })
|
|
103
|
+
];
|
|
104
|
+
if (connectConfig.sentry.tracing) integrations.push(Sentry.reactRouterV6BrowserTracingIntegration({
|
|
105
|
+
useEffect: React.useEffect,
|
|
106
|
+
useLocation,
|
|
107
|
+
useNavigationType,
|
|
108
|
+
createRoutesFromChildren,
|
|
109
|
+
matchRoutes
|
|
110
|
+
}));
|
|
111
|
+
Sentry.init({
|
|
112
|
+
release: connectConfig.sentry.release,
|
|
113
|
+
dsn: connectConfig.sentry.dsn,
|
|
114
|
+
environment: connectConfig.sentry.env,
|
|
115
|
+
integrations,
|
|
116
|
+
ignoreErrors: [
|
|
117
|
+
"User is not allowed to create files",
|
|
118
|
+
"User is not allowed to move documents",
|
|
119
|
+
"The user aborted a request."
|
|
120
|
+
],
|
|
121
|
+
sendDefaultPii: true,
|
|
122
|
+
tracesSampleRate: 1,
|
|
123
|
+
replaysSessionSampleRate: .1,
|
|
124
|
+
replaysOnErrorSampleRate: 1,
|
|
125
|
+
beforeSend(event, hint) {
|
|
126
|
+
const error = hint.originalException;
|
|
127
|
+
if (error instanceof TypeError && error.message.includes("Failed to fetch") && !navigator.onLine) return null;
|
|
128
|
+
return event;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
clientStarted = true;
|
|
132
|
+
}
|
|
133
|
+
async function closeClient() {
|
|
134
|
+
if (!clientStarted) return;
|
|
135
|
+
return (await getSentry()).getClient()?.close();
|
|
136
|
+
}
|
|
137
|
+
function useInitSentry() {
|
|
138
|
+
const [acceptedCookies] = useAcceptedCookies();
|
|
139
|
+
const { analytics } = acceptedCookies;
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
if (!analytics) {
|
|
142
|
+
closeClient().catch((error) => logger$2.error("@error", error));
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (clientStarted || !connectConfig.sentry.dsn || connectConfig.sentry.dsn === "") return;
|
|
146
|
+
initSentry().catch((error) => logger$2.error("@error", error));
|
|
147
|
+
}, [analytics]);
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/hooks/useUndoRedoShortcuts.ts
|
|
151
|
+
const useUndoRedoShortcuts = (props) => {
|
|
152
|
+
const { undo, redo, canRedo, canUndo } = props;
|
|
153
|
+
const isMac = window.navigator.userAgent.includes("Mac");
|
|
154
|
+
let undoShortcut = "ctrl+z";
|
|
155
|
+
let redoShortcut = "ctrl+y";
|
|
156
|
+
if (isMac) {
|
|
157
|
+
undoShortcut = "mod+z";
|
|
158
|
+
redoShortcut = "mod+shift+z";
|
|
159
|
+
}
|
|
160
|
+
useHotkeys(undoShortcut, (event) => {
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
if (canUndo) undo();
|
|
163
|
+
}, {}, [canUndo, undo]);
|
|
164
|
+
useHotkeys(redoShortcut, (event) => {
|
|
165
|
+
event.preventDefault();
|
|
166
|
+
if (canRedo) redo();
|
|
167
|
+
}, {}, [canRedo, redo]);
|
|
168
|
+
};
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/components/analytics.tsx
|
|
171
|
+
function gtag(...args) {
|
|
172
|
+
window.dataLayer?.push(...args);
|
|
173
|
+
}
|
|
174
|
+
const Analytics = () => {
|
|
175
|
+
const gaTrackingId = connectConfig.gaTrackingId;
|
|
176
|
+
const [{ analytics }] = useAcceptedCookies();
|
|
177
|
+
const useAnalytics = gaTrackingId && analytics;
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
if (useAnalytics) {
|
|
180
|
+
const script = document.createElement("script");
|
|
181
|
+
script.src = `https://www.googletagmanager.com/gtag/js?id=${gaTrackingId}`;
|
|
182
|
+
script.async = true;
|
|
183
|
+
document.head.appendChild(script);
|
|
184
|
+
window.dataLayer = window.dataLayer || [];
|
|
185
|
+
gtag("js", /* @__PURE__ */ new Date());
|
|
186
|
+
gtag("config", gaTrackingId);
|
|
187
|
+
return () => {
|
|
188
|
+
document.head.removeChild(script);
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}, [useAnalytics, gaTrackingId]);
|
|
192
|
+
return null;
|
|
193
|
+
};
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/components/document-editor-container.tsx
|
|
196
|
+
function DocumentEditorContainer() {
|
|
197
|
+
const [selectedDocument] = useSelectedDocument();
|
|
198
|
+
const parentFolder = useNodeParentFolderById(selectedDocument.header.id);
|
|
199
|
+
const onExport = useCallback(() => {
|
|
200
|
+
if (validateDocument(selectedDocument).length) showPHModal({
|
|
201
|
+
type: "exportDocumentWithErrors",
|
|
202
|
+
documentId: selectedDocument.header.id
|
|
203
|
+
});
|
|
204
|
+
else exportFile(selectedDocument).catch((error) => {
|
|
205
|
+
console.error(error);
|
|
206
|
+
toast(`Failed to export document: ${error instanceof Error ? error.message : JSON.stringify(error, null, 1)}`);
|
|
207
|
+
});
|
|
208
|
+
}, [selectedDocument]);
|
|
209
|
+
const onOpenSwitchboardLink = useMemo(() => {
|
|
210
|
+
return async () => {};
|
|
211
|
+
}, []);
|
|
212
|
+
const onClose = useCallback(() => {
|
|
213
|
+
setSelectedNode(parentFolder);
|
|
214
|
+
}, [parentFolder, setSelectedNode]);
|
|
215
|
+
return /* @__PURE__ */ jsx("div", {
|
|
216
|
+
id: "document-editor-container",
|
|
217
|
+
className: "flex-1",
|
|
218
|
+
"data-document-type": selectedDocument.header.documentType,
|
|
219
|
+
children: /* @__PURE__ */ jsx(DocumentEditor, {
|
|
220
|
+
document: selectedDocument,
|
|
221
|
+
onClose,
|
|
222
|
+
onExport,
|
|
223
|
+
onOpenSwitchboardLink
|
|
224
|
+
})
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/components/editor-loader.tsx
|
|
229
|
+
function EditorLoader(props) {
|
|
230
|
+
const [showLoading, setShowLoading] = useState(false);
|
|
231
|
+
useEffect(() => {
|
|
232
|
+
setTimeout(() => {
|
|
233
|
+
setShowLoading(true);
|
|
234
|
+
}, props.loadingTimeout ?? 200);
|
|
235
|
+
}, [props]);
|
|
236
|
+
if (!showLoading) return null;
|
|
237
|
+
const { customEditorLoader, ...defaultProps } = props;
|
|
238
|
+
if (customEditorLoader) return /* @__PURE__ */ jsx(Fragment, { children: customEditorLoader });
|
|
239
|
+
return /* @__PURE__ */ jsx(DefaultEditorLoader, { ...defaultProps });
|
|
240
|
+
}
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/components/error-boundary.tsx
|
|
243
|
+
const logger$1 = childLogger(["Connect"]);
|
|
244
|
+
function hasCustomFallback(props) {
|
|
245
|
+
return "fallbackRender" in props;
|
|
246
|
+
}
|
|
247
|
+
function SilentFallback() {
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Simple text-based fallback component.
|
|
252
|
+
* Displays a centered message when an error occurs.
|
|
253
|
+
*/
|
|
254
|
+
function TextFallback({ message = "Something went wrong" }) {
|
|
255
|
+
return /* @__PURE__ */ jsx("div", {
|
|
256
|
+
className: "text-center",
|
|
257
|
+
children: message
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Detailed fallback component showing full error information.
|
|
262
|
+
* Displays error message with a collapsible details section.
|
|
263
|
+
* Useful for development and debugging purposes.
|
|
264
|
+
*/
|
|
265
|
+
function DetailedFallback({ error, resetErrorBoundary }) {
|
|
266
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
267
|
+
const errorDetails = error instanceof Error ? error.stack ?? String(error.cause) : JSON.stringify(error, null, 2);
|
|
268
|
+
return /* @__PURE__ */ jsx("div", {
|
|
269
|
+
className: "z-10 mx-auto flex max-w-[80%] flex-1 items-center justify-center p-6",
|
|
270
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
271
|
+
className: "w-full max-w-lg rounded-lg border border-gray-500 bg-white p-6 shadow-sm",
|
|
272
|
+
children: [
|
|
273
|
+
/* @__PURE__ */ jsxs("div", {
|
|
274
|
+
className: "mb-3 flex items-center gap-2",
|
|
275
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
276
|
+
name: "Error",
|
|
277
|
+
className: "size-5 shrink-0"
|
|
278
|
+
}), /* @__PURE__ */ jsx("h1", {
|
|
279
|
+
className: "text-lg font-semibold",
|
|
280
|
+
children: "Something went wrong"
|
|
281
|
+
})]
|
|
282
|
+
}),
|
|
283
|
+
/* @__PURE__ */ jsx("p", {
|
|
284
|
+
className: "mb-4 text-sm text-gray-700",
|
|
285
|
+
children: errorMessage
|
|
286
|
+
}),
|
|
287
|
+
errorDetails !== "{}" && /* @__PURE__ */ jsxs("details", {
|
|
288
|
+
className: "group",
|
|
289
|
+
children: [/* @__PURE__ */ jsx("summary", {
|
|
290
|
+
className: "cursor-pointer select-none text-sm font-medium text-gray-700 underline hover:text-gray-700",
|
|
291
|
+
children: "Show details"
|
|
292
|
+
}), /* @__PURE__ */ jsx("pre", {
|
|
293
|
+
className: "mt-2 max-h-48 overflow-auto rounded bg-gray-100 p-3 text-xs",
|
|
294
|
+
children: errorDetails
|
|
295
|
+
})]
|
|
296
|
+
}),
|
|
297
|
+
/* @__PURE__ */ jsx(PowerhouseButton, {
|
|
298
|
+
type: "button",
|
|
299
|
+
onClick: resetErrorBoundary,
|
|
300
|
+
className: "text-md mt-4 px-3 py-1.5 font-medium",
|
|
301
|
+
children: "Try again"
|
|
302
|
+
})
|
|
303
|
+
]
|
|
304
|
+
})
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Centered error message fallback component.
|
|
309
|
+
* Displays the error message in a centered, full-size container.
|
|
310
|
+
* Suitable for use as a custom fallbackRender when you need simple error display.
|
|
311
|
+
*/
|
|
312
|
+
function CenteredErrorMessage({ error }) {
|
|
313
|
+
return /* @__PURE__ */ jsx("div", {
|
|
314
|
+
className: "flex size-full items-center justify-center",
|
|
315
|
+
children: /* @__PURE__ */ jsx("h3", {
|
|
316
|
+
className: "text-lg font-semibold",
|
|
317
|
+
children: error instanceof Error ? error.message : String(error)
|
|
318
|
+
})
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
function getFallbackComponent(variant, fallbackMessage) {
|
|
322
|
+
switch (variant) {
|
|
323
|
+
case "silent": return SilentFallback;
|
|
324
|
+
case "text": return () => /* @__PURE__ */ jsx(TextFallback, { message: fallbackMessage });
|
|
325
|
+
case "detailed": return DetailedFallback;
|
|
326
|
+
default: return CenteredErrorMessage;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Unified error boundary component for catching and handling React errors.
|
|
331
|
+
*
|
|
332
|
+
* Built on top of `react-error-boundary`, this component provides:
|
|
333
|
+
* - Automatic error logging with configurable context
|
|
334
|
+
* - Multiple fallback UI variants (silent, text, detailed)
|
|
335
|
+
* - Support for custom fallback render functions
|
|
336
|
+
* - Reset capability via `resetKeys`
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* // Using a predefined variant
|
|
340
|
+
* <ErrorBoundary variant="detailed" loggerContext={["Connect", "Editor"]}>
|
|
341
|
+
* <EditorComponent />
|
|
342
|
+
* </ErrorBoundary>
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* // Using a custom message with the text variant
|
|
346
|
+
* <ErrorBoundary variant="text" fallbackMessage="Failed to load drives">
|
|
347
|
+
* <DrivesList />
|
|
348
|
+
* </ErrorBoundary>
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* // Using a custom fallback render
|
|
352
|
+
* <ErrorBoundary
|
|
353
|
+
* fallbackRender={CenteredErrorMessage}
|
|
354
|
+
* onError={(error) => trackError(error)}
|
|
355
|
+
* >
|
|
356
|
+
* <MyComponent />
|
|
357
|
+
* </ErrorBoundary>
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* // Silent mode for modals (renders null on error)
|
|
361
|
+
* <ErrorBoundary variant="silent" loggerContext={["Connect", "Modals"]}>
|
|
362
|
+
* <ModalContent />
|
|
363
|
+
* </ErrorBoundary>
|
|
364
|
+
*/
|
|
365
|
+
function ErrorBoundary$1(props) {
|
|
366
|
+
const { children, onError, resetKeys, loggerContext } = props;
|
|
367
|
+
const handleError = (error, info) => {
|
|
368
|
+
if (error.message.includes("Failed to fetch dynamically imported module") && error.message.includes("node_modules/.vite")) {
|
|
369
|
+
console.error(error);
|
|
370
|
+
console.log("Outdated chunk detected, reloading page...");
|
|
371
|
+
window.location.reload();
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
(loggerContext ? childLogger(loggerContext) : logger$1).error("@error @info", error, info);
|
|
375
|
+
onError?.(error, info);
|
|
376
|
+
};
|
|
377
|
+
return /* @__PURE__ */ jsx(ErrorBoundary, {
|
|
378
|
+
fallbackRender: hasCustomFallback(props) ? props.fallbackRender : getFallbackComponent(props.variant, props.fallbackMessage),
|
|
379
|
+
onError: handleError,
|
|
380
|
+
resetKeys,
|
|
381
|
+
children
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region src/components/app-container.tsx
|
|
386
|
+
function AppContainer() {
|
|
387
|
+
const [selectedDrive] = useSelectedDrive();
|
|
388
|
+
const selectedDocumentId = useSelectedDocumentId();
|
|
389
|
+
const app = useAppModuleById(selectedDrive.header.meta?.preferredEditor);
|
|
390
|
+
const defaultApp = useDefaultAppModule();
|
|
391
|
+
const AppComponent = app?.Component ?? defaultApp?.Component ?? GenericDriveExplorer.Component;
|
|
392
|
+
if (!AppComponent) throw new Error("No app component found");
|
|
393
|
+
return /* @__PURE__ */ jsx(ErrorBoundary$1, {
|
|
394
|
+
variant: "detailed",
|
|
395
|
+
resetKeys: [selectedDrive.header.id],
|
|
396
|
+
loggerContext: ["Connect", "App"],
|
|
397
|
+
children: /* @__PURE__ */ jsx(Suspense, {
|
|
398
|
+
fallback: /* @__PURE__ */ jsx(EditorLoader, {}),
|
|
399
|
+
children: /* @__PURE__ */ jsx(DropZoneWrapper, {
|
|
400
|
+
className: "flex h-full flex-col overflow-auto",
|
|
401
|
+
children: /* @__PURE__ */ jsx(AppComponent, { children: selectedDocumentId ? /* @__PURE__ */ jsx(DocumentEditorContainer, {}) : null })
|
|
402
|
+
})
|
|
403
|
+
})
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/utils/browser.ts
|
|
408
|
+
function getBasePath() {
|
|
409
|
+
if (typeof document === "undefined") return "/";
|
|
410
|
+
return document.querySelector("base")?.getAttribute("href") || "/";
|
|
411
|
+
}
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region src/utils/document-editor-debug-tools.ts
|
|
414
|
+
var DocumentEditorDebugTools = class {
|
|
415
|
+
document;
|
|
416
|
+
operations = [];
|
|
417
|
+
constructor(document) {
|
|
418
|
+
if (document) this.document = document;
|
|
419
|
+
}
|
|
420
|
+
operationsToTableObject(operations) {
|
|
421
|
+
return operations.map((op) => ({
|
|
422
|
+
...op,
|
|
423
|
+
input: JSON.stringify(op.action.input)
|
|
424
|
+
}));
|
|
425
|
+
}
|
|
426
|
+
setDocument(document) {
|
|
427
|
+
this.document = document;
|
|
428
|
+
}
|
|
429
|
+
getDocument() {
|
|
430
|
+
return this.document;
|
|
431
|
+
}
|
|
432
|
+
getOperations() {
|
|
433
|
+
return this.operations;
|
|
434
|
+
}
|
|
435
|
+
pushOperation(operation) {
|
|
436
|
+
this.operations.push(operation);
|
|
437
|
+
}
|
|
438
|
+
operationsTable() {
|
|
439
|
+
if (!this.document) console.warn("No document");
|
|
440
|
+
const ops = Object.values(this.document?.operations || {}).filter((array) => array !== void 0).flatMap((array) => array).sort((a, b) => a.index - b.index);
|
|
441
|
+
console.table(this.operationsToTableObject(ops));
|
|
442
|
+
}
|
|
443
|
+
scopeOperationsTable(scope) {
|
|
444
|
+
if (!this.document) console.warn("No document");
|
|
445
|
+
const ops = this.document?.operations[scope] || [];
|
|
446
|
+
console.table(this.operationsToTableObject(ops));
|
|
447
|
+
}
|
|
448
|
+
operationsLog() {
|
|
449
|
+
console.log(this.operations);
|
|
450
|
+
}
|
|
451
|
+
operationsLogTable() {
|
|
452
|
+
console.table(this.operationsToTableObject(this.operations));
|
|
453
|
+
}
|
|
454
|
+
clear() {
|
|
455
|
+
this.operations = [];
|
|
456
|
+
this.document = void 0;
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region src/components/migration-status.ts
|
|
461
|
+
let current = null;
|
|
462
|
+
const listeners$1 = /* @__PURE__ */ new Set();
|
|
463
|
+
function setMigrationStatus(status) {
|
|
464
|
+
current = status;
|
|
465
|
+
for (const l of listeners$1) l();
|
|
466
|
+
}
|
|
467
|
+
function getMigrationStatus() {
|
|
468
|
+
return current;
|
|
469
|
+
}
|
|
470
|
+
function subscribeMigrationStatus(cb) {
|
|
471
|
+
listeners$1.add(cb);
|
|
472
|
+
return () => {
|
|
473
|
+
listeners$1.delete(cb);
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/utils/pglite-migration.ts
|
|
478
|
+
const BACKUP_PREFIX = "ph-pglite-backup::";
|
|
479
|
+
const BACKUP_INDEX_KEY = "ph:pglite-backups";
|
|
480
|
+
const BACKUP_RETENTION_MS = 720 * 60 * 60 * 1e3;
|
|
481
|
+
const LEGACY_DUMPERS = { 16: async () => {
|
|
482
|
+
const [{ PGlite: LegacyPGlite }, { pgDump }] = await Promise.all([import("pglite-legacy-02"), import("pglite-tools-legacy-02/pg_dump")]);
|
|
483
|
+
return async (idbName) => {
|
|
484
|
+
const pg = new LegacyPGlite(`idb://${idbName.replace(/^\/pglite\//, "")}`);
|
|
485
|
+
try {
|
|
486
|
+
await pg.waitReady;
|
|
487
|
+
return await (await pgDump({ pg })).text();
|
|
488
|
+
} finally {
|
|
489
|
+
await pg.close();
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
} };
|
|
493
|
+
function deleteIdb(name, timeoutMs = 15e3) {
|
|
494
|
+
return new Promise((resolve, reject) => {
|
|
495
|
+
const req = indexedDB.deleteDatabase(name);
|
|
496
|
+
let settled = false;
|
|
497
|
+
const done = (fn) => {
|
|
498
|
+
if (settled) return;
|
|
499
|
+
settled = true;
|
|
500
|
+
fn();
|
|
501
|
+
};
|
|
502
|
+
const timer = setTimeout(() => done(() => reject(/* @__PURE__ */ new Error(`IDB delete timed out for ${name} after ${timeoutMs}ms`))), timeoutMs);
|
|
503
|
+
req.onsuccess = () => done(() => {
|
|
504
|
+
clearTimeout(timer);
|
|
505
|
+
resolve();
|
|
506
|
+
});
|
|
507
|
+
req.onerror = () => done(() => {
|
|
508
|
+
clearTimeout(timer);
|
|
509
|
+
reject(idbError(req, `IDB delete failed for ${name}`));
|
|
510
|
+
});
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
async function clearFileData(name) {
|
|
514
|
+
const db = await openIdb(name, 21, createFileDataStore);
|
|
515
|
+
try {
|
|
516
|
+
await new Promise((resolve, reject) => {
|
|
517
|
+
const tx = db.transaction(IDB_STORE_NAME, "readwrite");
|
|
518
|
+
tx.oncomplete = () => resolve();
|
|
519
|
+
tx.onerror = () => reject(idbError(tx, `FILE_DATA clear failed for ${name}`));
|
|
520
|
+
tx.onabort = () => reject(idbError(tx, `FILE_DATA clear aborted for ${name}`));
|
|
521
|
+
tx.objectStore(IDB_STORE_NAME).clear();
|
|
522
|
+
});
|
|
523
|
+
} finally {
|
|
524
|
+
db.close();
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
async function cloneFileData(sourceName, destName) {
|
|
528
|
+
const source = await openIdb(sourceName, 21, createFileDataStore);
|
|
529
|
+
try {
|
|
530
|
+
const dest = await openIdb(destName, 21, createFileDataStore);
|
|
531
|
+
try {
|
|
532
|
+
const readStore = source.transaction(IDB_STORE_NAME, "readonly").objectStore(IDB_STORE_NAME);
|
|
533
|
+
const entries = await new Promise((resolve, reject) => {
|
|
534
|
+
const out = [];
|
|
535
|
+
const req = readStore.openCursor();
|
|
536
|
+
req.onerror = () => reject(idbError(req, `FILE_DATA read cursor failed for ${sourceName}`));
|
|
537
|
+
req.onsuccess = () => {
|
|
538
|
+
const cursor = req.result;
|
|
539
|
+
if (!cursor) return resolve(out);
|
|
540
|
+
out.push({
|
|
541
|
+
key: cursor.key,
|
|
542
|
+
value: cursor.value
|
|
543
|
+
});
|
|
544
|
+
cursor.continue();
|
|
545
|
+
};
|
|
546
|
+
});
|
|
547
|
+
await new Promise((resolve, reject) => {
|
|
548
|
+
const writeTx = dest.transaction(IDB_STORE_NAME, "readwrite");
|
|
549
|
+
writeTx.oncomplete = () => resolve();
|
|
550
|
+
writeTx.onerror = () => reject(idbError(writeTx, `FILE_DATA write failed for ${destName}`));
|
|
551
|
+
writeTx.onabort = () => reject(idbError(writeTx, `FILE_DATA write aborted for ${destName}`));
|
|
552
|
+
const writeStore = writeTx.objectStore(IDB_STORE_NAME);
|
|
553
|
+
writeStore.clear();
|
|
554
|
+
for (const { key, value } of entries) writeStore.put(value, key);
|
|
555
|
+
});
|
|
556
|
+
} finally {
|
|
557
|
+
dest.close();
|
|
558
|
+
}
|
|
559
|
+
} finally {
|
|
560
|
+
source.close();
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
function readBackupIndex() {
|
|
564
|
+
try {
|
|
565
|
+
const raw = localStorage.getItem(BACKUP_INDEX_KEY);
|
|
566
|
+
if (!raw) return [];
|
|
567
|
+
const parsed = JSON.parse(raw);
|
|
568
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
569
|
+
} catch {
|
|
570
|
+
return [];
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
function writeBackupIndex(records) {
|
|
574
|
+
try {
|
|
575
|
+
localStorage.setItem(BACKUP_INDEX_KEY, JSON.stringify(records));
|
|
576
|
+
} catch {}
|
|
577
|
+
}
|
|
578
|
+
function registerBackup(rec) {
|
|
579
|
+
writeBackupIndex([...readBackupIndex(), rec]);
|
|
580
|
+
}
|
|
581
|
+
function forgetBackup(name) {
|
|
582
|
+
writeBackupIndex(readBackupIndex().filter((r) => r.name !== name));
|
|
583
|
+
}
|
|
584
|
+
async function janitor() {
|
|
585
|
+
const cutoff = Date.now() - BACKUP_RETENTION_MS;
|
|
586
|
+
const keep = [];
|
|
587
|
+
for (const rec of readBackupIndex()) {
|
|
588
|
+
if (rec.createdAt >= cutoff) {
|
|
589
|
+
keep.push(rec);
|
|
590
|
+
continue;
|
|
591
|
+
}
|
|
592
|
+
try {
|
|
593
|
+
await deleteIdb(rec.name);
|
|
594
|
+
} catch (err) {
|
|
595
|
+
console.warn(`Failed to delete expired pglite backup ${rec.name}`, err);
|
|
596
|
+
keep.push(rec);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
writeBackupIndex(keep);
|
|
600
|
+
}
|
|
601
|
+
function publishPhase(idbName, phase) {
|
|
602
|
+
setMigrationStatus({
|
|
603
|
+
idbName,
|
|
604
|
+
phase
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
async function migrateIdbIfNeeded(idbName) {
|
|
608
|
+
const major = await readPgVersionFile(idbName);
|
|
609
|
+
if (major === null || major === 17) return;
|
|
610
|
+
const loader = LEGACY_DUMPERS[major];
|
|
611
|
+
if (!loader) throw new Error(`Unsupported legacy PGlite data dir: PG_VERSION=${major} for ${idbName}`);
|
|
612
|
+
const backupName = `${BACKUP_PREFIX}${idbName}::${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
613
|
+
const backupRec = {
|
|
614
|
+
name: backupName,
|
|
615
|
+
idbName,
|
|
616
|
+
createdAt: Date.now()
|
|
617
|
+
};
|
|
618
|
+
publishPhase(idbName, "clone");
|
|
619
|
+
await cloneFileData(idbName, backupName);
|
|
620
|
+
registerBackup(backupRec);
|
|
621
|
+
let sql;
|
|
622
|
+
try {
|
|
623
|
+
publishPhase(idbName, "dump");
|
|
624
|
+
sql = await (await loader())(idbName);
|
|
625
|
+
} catch (err) {
|
|
626
|
+
await deleteIdb(backupName).catch(() => {});
|
|
627
|
+
forgetBackup(backupName);
|
|
628
|
+
throw err;
|
|
629
|
+
}
|
|
630
|
+
try {
|
|
631
|
+
await clearFileData(idbName);
|
|
632
|
+
publishPhase(idbName, "restore");
|
|
633
|
+
const pg = new PGlite(`idb://${idbName.replace(/^\/pglite\//, "")}`, { relaxedDurability: false });
|
|
634
|
+
try {
|
|
635
|
+
await pg.waitReady;
|
|
636
|
+
console.info(`[pglite-migration] Dump preamble (first 500 chars):\n${sql.slice(0, 500)}`);
|
|
637
|
+
try {
|
|
638
|
+
await pg.exec("SET standard_conforming_strings = off;");
|
|
639
|
+
} catch (gucErr) {
|
|
640
|
+
console.warn("[pglite-migration] Could not force standard_conforming_strings=off", gucErr);
|
|
641
|
+
}
|
|
642
|
+
try {
|
|
643
|
+
await pg.exec(sql);
|
|
644
|
+
} catch (execErr) {
|
|
645
|
+
logRestoreFailure(idbName, sql, execErr);
|
|
646
|
+
throw execErr;
|
|
647
|
+
}
|
|
648
|
+
} finally {
|
|
649
|
+
await pg.close();
|
|
650
|
+
}
|
|
651
|
+
} catch (err) {
|
|
652
|
+
await rollbackFromBackup(idbName, backupName, err);
|
|
653
|
+
throw err;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
function logRestoreFailure(idbName, sql, err) {
|
|
657
|
+
const errObj = err;
|
|
658
|
+
const position = typeof errObj.position === "string" ? parseInt(errObj.position, 10) : typeof errObj.position === "number" ? errObj.position : NaN;
|
|
659
|
+
console.error(`[pglite-migration] Restore failed for ${idbName}`, {
|
|
660
|
+
message: errObj.message,
|
|
661
|
+
code: errObj.code,
|
|
662
|
+
severity: errObj.severity,
|
|
663
|
+
detail: errObj.detail,
|
|
664
|
+
where: errObj.where,
|
|
665
|
+
position: errObj.position,
|
|
666
|
+
sqlLength: sql.length
|
|
667
|
+
});
|
|
668
|
+
if (Number.isFinite(position) && position > 0) {
|
|
669
|
+
const zeroBased = position - 1;
|
|
670
|
+
const start = Math.max(0, zeroBased - 200);
|
|
671
|
+
const end = Math.min(sql.length, zeroBased + 200);
|
|
672
|
+
const before = sql.slice(start, zeroBased);
|
|
673
|
+
const at = sql.slice(zeroBased, zeroBased + 1);
|
|
674
|
+
const after = sql.slice(zeroBased + 1, end);
|
|
675
|
+
console.error(`[pglite-migration] SQL context around position ${position}:\n${before}»${at}«${after}`);
|
|
676
|
+
const lineStart = sql.lastIndexOf("\n", zeroBased) + 1;
|
|
677
|
+
const lineEnd = sql.indexOf("\n", zeroBased);
|
|
678
|
+
const line = sql.slice(lineStart, lineEnd === -1 ? sql.length : lineEnd);
|
|
679
|
+
console.error(`[pglite-migration] Failing line (truncated to 500 chars):\n${line.slice(0, 500)}`);
|
|
680
|
+
} else console.error(`[pglite-migration] No position info. First 2000 chars of dump:\n${sql.slice(0, 2e3)}`);
|
|
681
|
+
}
|
|
682
|
+
async function rollbackFromBackup(idbName, backupName, originalError) {
|
|
683
|
+
try {
|
|
684
|
+
await clearFileData(idbName).catch(() => {});
|
|
685
|
+
await cloneFileData(backupName, idbName);
|
|
686
|
+
} catch (rollbackErr) {
|
|
687
|
+
console.error(`PGlite migration failed AND rollback failed for ${idbName}. Primary error:`, originalError, "Rollback error:", rollbackErr);
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
await deleteIdb(backupName).catch(() => {});
|
|
691
|
+
forgetBackup(backupName);
|
|
692
|
+
}
|
|
693
|
+
async function migrateAllLocked() {
|
|
694
|
+
for (const idbName of PRIMARY_IDB_NAMES) await migrateIdbIfNeeded(idbName);
|
|
695
|
+
setMigrationStatus(null);
|
|
696
|
+
}
|
|
697
|
+
async function migrateAllIfNeeded() {
|
|
698
|
+
janitor().catch((err) => console.warn("PGlite backup janitor failed", err));
|
|
699
|
+
if (!(typeof navigator !== "undefined" && "locks" in navigator && typeof navigator.locks.request === "function")) {
|
|
700
|
+
await migrateAllLocked();
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
await navigator.locks.request("ph-pglite-migration", { mode: "exclusive" }, async () => {
|
|
704
|
+
await migrateAllLocked();
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
//#endregion
|
|
708
|
+
//#region src/components/app-skeleton.tsx
|
|
709
|
+
const LOADER_DELAY = 250;
|
|
710
|
+
const PHASE_LABEL = {
|
|
711
|
+
clone: "Backing up local database…",
|
|
712
|
+
dump: "Exporting data from previous version…",
|
|
713
|
+
restore: "Restoring data into the new database…"
|
|
714
|
+
};
|
|
715
|
+
const MigrationOverlay = () => {
|
|
716
|
+
const status = useSyncExternalStore(subscribeMigrationStatus, getMigrationStatus, () => null);
|
|
717
|
+
if (!status) return null;
|
|
718
|
+
return /* @__PURE__ */ jsx("div", {
|
|
719
|
+
className: "absolute inset-0 z-20 flex items-center justify-center",
|
|
720
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
721
|
+
className: "rounded-lg bg-white/90 px-6 py-4 text-sm text-gray-900 shadow-lg",
|
|
722
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
723
|
+
className: "font-medium",
|
|
724
|
+
children: "Upgrading local database…"
|
|
725
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
726
|
+
className: "text-gray-600",
|
|
727
|
+
children: PHASE_LABEL[status.phase]
|
|
728
|
+
})]
|
|
729
|
+
})
|
|
730
|
+
});
|
|
731
|
+
};
|
|
732
|
+
const Loader = ({ delay = LOADER_DELAY }) => {
|
|
733
|
+
const isSSR = typeof window === "undefined";
|
|
734
|
+
const showInitialLoader = typeof document !== "undefined" && document.body.getAttribute("data-show-loader") === "true";
|
|
735
|
+
const [showLoading, setShowLoading] = useState(!delay || showInitialLoader);
|
|
736
|
+
useEffect(() => {
|
|
737
|
+
const id = setTimeout(() => {
|
|
738
|
+
setShowLoading(true);
|
|
739
|
+
}, delay);
|
|
740
|
+
return () => clearTimeout(id);
|
|
741
|
+
}, []);
|
|
742
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
743
|
+
className: `skeleton-loader absolute inset-0 z-10 flex items-center justify-center ${showLoading ? "" : "hidden"}`,
|
|
744
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
745
|
+
className: "animate-pulse overflow-hidden rounded-full shadow-lg",
|
|
746
|
+
children: /* @__PURE__ */ jsx(AnimatedLoader, {})
|
|
747
|
+
}), isSSR ? /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: `setTimeout(() => {
|
|
748
|
+
document.querySelector('.skeleton-loader')?.classList.remove('hidden');
|
|
749
|
+
document.body.setAttribute('data-show-loader', 'true');
|
|
750
|
+
}, ${delay})` } }) : null]
|
|
751
|
+
});
|
|
752
|
+
};
|
|
753
|
+
const AppSkeleton = (props) => {
|
|
754
|
+
const isSSR = typeof window === "undefined";
|
|
755
|
+
const isHomeScreen = !isSSR && window.location.pathname === getBasePath();
|
|
756
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
757
|
+
className: "flex h-screen overflow-hidden",
|
|
758
|
+
children: [
|
|
759
|
+
/* @__PURE__ */ jsx(ConnectSidebar, {
|
|
760
|
+
className: "animate-pulse",
|
|
761
|
+
onLogin: void 0,
|
|
762
|
+
onDisconnect: void 0,
|
|
763
|
+
onClickSettings: void 0,
|
|
764
|
+
address: void 0
|
|
765
|
+
}),
|
|
766
|
+
/* @__PURE__ */ jsx(HomeScreen, {
|
|
767
|
+
containerClassName: isSSR || !isHomeScreen ? "hidden home-screen" : void 0,
|
|
768
|
+
children: props.children ?? null
|
|
769
|
+
}),
|
|
770
|
+
isSSR ? /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: `
|
|
771
|
+
const baseEl = document.querySelector('base');
|
|
772
|
+
const href = baseEl?.getAttribute('href');
|
|
773
|
+
const basePath = href || '/';
|
|
774
|
+
if (window.location.pathname === basePath) {
|
|
775
|
+
document.querySelector('.home-screen')?.classList.remove('hidden')
|
|
776
|
+
}` } }) : null,
|
|
777
|
+
!props.children ? /* @__PURE__ */ jsx(Loader, {}) : null,
|
|
778
|
+
/* @__PURE__ */ jsx(MigrationOverlay, {})
|
|
779
|
+
]
|
|
780
|
+
});
|
|
781
|
+
};
|
|
782
|
+
//#endregion
|
|
783
|
+
//#region src/components/migration-banner.tsx
|
|
784
|
+
let dismissed = false;
|
|
785
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
786
|
+
function notify() {
|
|
787
|
+
for (const l of listeners) l();
|
|
788
|
+
}
|
|
789
|
+
function dismiss() {
|
|
790
|
+
dismissed = true;
|
|
791
|
+
notify();
|
|
792
|
+
}
|
|
793
|
+
function subscribeDismissed(cb) {
|
|
794
|
+
listeners.add(cb);
|
|
795
|
+
return () => {
|
|
796
|
+
listeners.delete(cb);
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
function getDismissed() {
|
|
800
|
+
return dismissed;
|
|
801
|
+
}
|
|
802
|
+
const MigrationBanner = () => {
|
|
803
|
+
const isDismissed = useSyncExternalStore(subscribeDismissed, getDismissed, () => false);
|
|
804
|
+
const major = useSyncExternalStore(subscribeReactorPgMajor, getCachedReactorPgMajor, () => void 0);
|
|
805
|
+
const [migrating, setMigrating] = useState(false);
|
|
806
|
+
const [error, setError] = useState(null);
|
|
807
|
+
if (major === void 0 || major === null || major === 17) return null;
|
|
808
|
+
if (isDismissed) return null;
|
|
809
|
+
const handleMigrate = () => {
|
|
810
|
+
setError(null);
|
|
811
|
+
setMigrating(true);
|
|
812
|
+
migrateAllIfNeeded().then(() => {
|
|
813
|
+
window.location.reload();
|
|
814
|
+
}).catch((err) => {
|
|
815
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
816
|
+
setMigrating(false);
|
|
817
|
+
});
|
|
818
|
+
};
|
|
819
|
+
return /* @__PURE__ */ jsx("div", {
|
|
820
|
+
className: "absolute inset-x-0 top-0 z-30 flex justify-center p-3",
|
|
821
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
822
|
+
className: "flex max-w-3xl items-center gap-3 rounded-lg border border-yellow-500 bg-yellow-400 px-4 py-3 text-sm text-gray-900 shadow-lg",
|
|
823
|
+
children: [
|
|
824
|
+
/* @__PURE__ */ jsxs("div", {
|
|
825
|
+
className: "flex-1",
|
|
826
|
+
children: [
|
|
827
|
+
/* @__PURE__ */ jsxs("div", {
|
|
828
|
+
className: "font-semibold",
|
|
829
|
+
children: [
|
|
830
|
+
"Your local database uses Postgres ",
|
|
831
|
+
major,
|
|
832
|
+
"."
|
|
833
|
+
]
|
|
834
|
+
}),
|
|
835
|
+
/* @__PURE__ */ jsxs("div", {
|
|
836
|
+
className: "text-gray-800",
|
|
837
|
+
children: [
|
|
838
|
+
"Migrate to Postgres ",
|
|
839
|
+
17,
|
|
840
|
+
" to pick up the latest features. Your data will be backed up first."
|
|
841
|
+
]
|
|
842
|
+
}),
|
|
843
|
+
error && /* @__PURE__ */ jsxs("div", {
|
|
844
|
+
className: "mt-2 font-medium text-red-900",
|
|
845
|
+
children: ["Migration failed: ", error]
|
|
846
|
+
})
|
|
847
|
+
]
|
|
848
|
+
}),
|
|
849
|
+
/* @__PURE__ */ jsx("button", {
|
|
850
|
+
type: "button",
|
|
851
|
+
disabled: migrating,
|
|
852
|
+
onClick: handleMigrate,
|
|
853
|
+
className: "rounded bg-gray-900 px-3 py-1 text-sm font-medium text-white hover:bg-gray-800 disabled:opacity-50",
|
|
854
|
+
children: migrating ? "Migrating…" : "Migrate now"
|
|
855
|
+
}),
|
|
856
|
+
/* @__PURE__ */ jsx("button", {
|
|
857
|
+
type: "button",
|
|
858
|
+
disabled: migrating,
|
|
859
|
+
onClick: dismiss,
|
|
860
|
+
className: "rounded border border-gray-900 bg-transparent px-3 py-1 text-sm font-medium text-gray-900 hover:bg-gray-900/10 disabled:opacity-50",
|
|
861
|
+
children: "Dismiss"
|
|
862
|
+
})
|
|
863
|
+
]
|
|
864
|
+
})
|
|
865
|
+
});
|
|
866
|
+
};
|
|
867
|
+
//#endregion
|
|
868
|
+
//#region src/components/modal/modals-container.tsx
|
|
869
|
+
const AddDriveModal$1 = lazy(() => import("./AddDriveModal-B9BPORvo.js").then((m) => ({ default: m.AddDriveModal })));
|
|
870
|
+
const ClearStorageModal = lazy(() => import("./ClearStorageModal-K1H6NgT6.js").then((m) => ({ default: m.ClearStorageModal })));
|
|
871
|
+
const CookiesPolicyModal = lazy(() => import("./CookiesPolicyModal-CnVx2R_8.js").then((m) => ({ default: m.CookiesPolicyModal })));
|
|
872
|
+
const CreateDocumentModal$1 = lazy(() => import("./CreateDocumentModal-TtG7E62x.js").then((m) => ({ default: m.CreateDocumentModal })));
|
|
873
|
+
const DebugSettingsModal = lazy(() => import("./DebugSettingsModal-CriX2NsN.js").then((m) => ({ default: m.DebugSettingsModal })));
|
|
874
|
+
const DeleteDriveModal = lazy(() => import("./DeleteDriveModal-Cb43NeNu.js").then((m) => ({ default: m.DeleteDriveModal })));
|
|
875
|
+
const DeleteItemModal = lazy(() => import("./DeleteItemModal-Brq4QKdd.js").then((m) => ({ default: m.DeleteItemModal })));
|
|
876
|
+
const DisclaimerModal = lazy(() => import("./DisclaimerModal-Dk6PpkZU.js").then((m) => ({ default: m.DisclaimerModal })));
|
|
877
|
+
const DriveSettingsModal$1 = lazy(() => import("./DriveSettingsModal-BdcjrRh9.js").then((m) => ({ default: m.DriveSettingsModal })));
|
|
878
|
+
const ExportDocumentWithErrorsModal = lazy(() => import("./ExportDocumentWithErrorsModal-DNRr3cjI.js").then((m) => ({ default: m.ExportDocumentWithErrorsModal })));
|
|
879
|
+
const SettingsModal$1 = lazy(() => import("./SettingsModal-5hkkt5lV.js").then((m) => ({ default: m.SettingsModal })));
|
|
880
|
+
const UpgradeDriveModal = lazy(() => import("./UpgradeDriveModal-CBLALaaQ.js").then((m) => ({ default: m.UpgradeDriveModal })));
|
|
881
|
+
const modalComponents = {
|
|
882
|
+
addDrive: AddDriveModal$1,
|
|
883
|
+
clearStorage: ClearStorageModal,
|
|
884
|
+
cookiesPolicy: CookiesPolicyModal,
|
|
885
|
+
createDocument: CreateDocumentModal$1,
|
|
886
|
+
debugSettings: DebugSettingsModal,
|
|
887
|
+
deleteDrive: DeleteDriveModal,
|
|
888
|
+
deleteItem: DeleteItemModal,
|
|
889
|
+
disclaimer: DisclaimerModal,
|
|
890
|
+
driveSettings: DriveSettingsModal$1,
|
|
891
|
+
exportDocumentWithErrors: ExportDocumentWithErrorsModal,
|
|
892
|
+
inspector: lazy(() => import("./InspectorModal-EDrjiXPs.js").then((m) => ({ default: m.InspectorModal }))),
|
|
893
|
+
settings: SettingsModal$1,
|
|
894
|
+
upgradeDrive: UpgradeDriveModal,
|
|
895
|
+
missingPackage: lazy(() => import("./MissingPackageModal-BfblPbd8.js").then((m) => ({ default: m.ConnectMissingPackageModal })))
|
|
896
|
+
};
|
|
897
|
+
const ModalsContainer = lazy(async () => {
|
|
898
|
+
return { default: () => {
|
|
899
|
+
const phModal = usePHModal();
|
|
900
|
+
if (!phModal?.type) return null;
|
|
901
|
+
const ModalComponent = modalComponents[phModal.type];
|
|
902
|
+
return ModalComponent ? /* @__PURE__ */ jsx(ErrorBoundary$1, {
|
|
903
|
+
variant: "silent",
|
|
904
|
+
loggerContext: ["Connect", "Modals"],
|
|
905
|
+
children: /* @__PURE__ */ jsx(Suspense, {
|
|
906
|
+
fallback: null,
|
|
907
|
+
children: /* @__PURE__ */ jsx(ModalComponent, {})
|
|
908
|
+
})
|
|
909
|
+
}) : null;
|
|
910
|
+
} };
|
|
911
|
+
});
|
|
912
|
+
//#endregion
|
|
913
|
+
//#region src/components/app-loader.tsx
|
|
914
|
+
const AppLoader = (props) => {
|
|
915
|
+
const Load = lazy(() => import("./load-Dy0OZx9L.js").then((m) => m.loadComponent(props.localPackage)));
|
|
916
|
+
return /* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsxs(ErrorBoundary$1, {
|
|
917
|
+
fallbackRender: (props) => /* @__PURE__ */ jsx(AppSkeleton, { children: /* @__PURE__ */ jsx(DetailedFallback, { ...props }) }),
|
|
918
|
+
resetKeys: [props.localPackage],
|
|
919
|
+
loggerContext: ["Connect"],
|
|
920
|
+
children: [
|
|
921
|
+
/* @__PURE__ */ jsx(Suspense, {
|
|
922
|
+
fallback: /* @__PURE__ */ jsx(AppSkeleton, {}),
|
|
923
|
+
name: "AppLoader",
|
|
924
|
+
children: /* @__PURE__ */ jsx(Load, {
|
|
925
|
+
...props,
|
|
926
|
+
children: /* @__PURE__ */ jsx(App, {})
|
|
927
|
+
})
|
|
928
|
+
}),
|
|
929
|
+
/* @__PURE__ */ jsx(Suspense, {
|
|
930
|
+
name: "CookieBanner",
|
|
931
|
+
children: /* @__PURE__ */ jsx(CookieBanner$1, {})
|
|
932
|
+
}),
|
|
933
|
+
/* @__PURE__ */ jsx(Suspense, {
|
|
934
|
+
name: "ModalsContainer",
|
|
935
|
+
children: /* @__PURE__ */ jsx(ModalsContainer, {})
|
|
936
|
+
}),
|
|
937
|
+
/* @__PURE__ */ jsx(MigrationBanner, {})
|
|
938
|
+
]
|
|
939
|
+
}) });
|
|
940
|
+
};
|
|
941
|
+
//#endregion
|
|
942
|
+
//#region src/context/sentry-provider.tsx
|
|
943
|
+
const SentryProvider = ({ children }) => {
|
|
944
|
+
useInitSentry();
|
|
945
|
+
return children;
|
|
946
|
+
};
|
|
947
|
+
//#endregion
|
|
948
|
+
//#region src/components/package-install-prompt.tsx
|
|
949
|
+
function PackageInstallPrompt() {
|
|
950
|
+
const pendingInstallations = usePendingInstallations();
|
|
951
|
+
const discoveryService = usePackageDiscoveryService();
|
|
952
|
+
if (!discoveryService || pendingInstallations.length === 0) return null;
|
|
953
|
+
return /* @__PURE__ */ jsx(PackageInstallModal, {
|
|
954
|
+
pendingInstallations: pendingInstallations.flatMap((p) => p.packageNames.map((packageName) => ({
|
|
955
|
+
documentType: p.documentType,
|
|
956
|
+
packageName
|
|
957
|
+
}))),
|
|
958
|
+
onInstall: (packageName) => discoveryService.approveInstallation(packageName),
|
|
959
|
+
onDismiss: (packageName) => discoveryService.dismissInstallation(packageName)
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
//#endregion
|
|
963
|
+
//#region src/components/app.tsx
|
|
964
|
+
const App = () => {
|
|
965
|
+
useEffect(() => {
|
|
966
|
+
const handlePreloadError = (event) => {
|
|
967
|
+
const payload = event.payload;
|
|
968
|
+
const failedUrl = (payload instanceof Error ? payload.message : String(payload ?? "")).match(/https?:\/\/[^\s"']+/)?.[0];
|
|
969
|
+
if (failedUrl && !failedUrl.startsWith(window.location.origin)) {
|
|
970
|
+
console.debug(`[Connect] Skipping reload — vite:preloadError for off-origin URL: ${failedUrl}`);
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
console.log("Outdated chunks detected, reloading page...");
|
|
974
|
+
window.location.reload();
|
|
975
|
+
};
|
|
976
|
+
window.addEventListener("vite:preloadError", handlePreloadError);
|
|
977
|
+
return () => {
|
|
978
|
+
window.removeEventListener("vite:preloadError", handlePreloadError);
|
|
979
|
+
};
|
|
980
|
+
}, []);
|
|
981
|
+
useEffect(() => {
|
|
982
|
+
if (import.meta.env.MODE === "development") window.documentEditorDebugTools = new DocumentEditorDebugTools();
|
|
983
|
+
else serviceWorkerManager.registerServiceWorker(false);
|
|
984
|
+
}, []);
|
|
985
|
+
return /* @__PURE__ */ jsxs(SentryProvider, { children: [
|
|
986
|
+
/* @__PURE__ */ jsx(ToastContainer, { position: "bottom-right" }),
|
|
987
|
+
/* @__PURE__ */ jsx(Router, {}),
|
|
988
|
+
/* @__PURE__ */ jsx(PackageInstallPrompt, {}),
|
|
989
|
+
/* @__PURE__ */ jsx(Analytics, {})
|
|
990
|
+
] });
|
|
991
|
+
};
|
|
992
|
+
//#endregion
|
|
993
|
+
//#region src/components/cookie-banner.tsx
|
|
994
|
+
const isCookieAccepted = (cookies, id) => {
|
|
995
|
+
return cookies.some((cookie) => cookie.id === id && cookie.value);
|
|
996
|
+
};
|
|
997
|
+
const CookieBanner$1 = () => {
|
|
998
|
+
const { t } = useTranslation(void 0, {
|
|
999
|
+
useSuspense: true,
|
|
1000
|
+
i18n
|
|
1001
|
+
});
|
|
1002
|
+
const [showBanner, setShowBanner] = useCookieBanner();
|
|
1003
|
+
const [, setAcceptedCookies] = useAcceptedCookies();
|
|
1004
|
+
const cookiesInput = [{
|
|
1005
|
+
id: "analytics-cookie",
|
|
1006
|
+
label: t("cookieBanner.cookies.analytics"),
|
|
1007
|
+
value: true
|
|
1008
|
+
}];
|
|
1009
|
+
const handleAccept = (cookies) => {
|
|
1010
|
+
setShowBanner(false);
|
|
1011
|
+
if (isCookieAccepted(cookies, "analytics-cookie")) setAcceptedCookies((acceptedCookies) => ({
|
|
1012
|
+
...acceptedCookies,
|
|
1013
|
+
analytics: true
|
|
1014
|
+
}));
|
|
1015
|
+
};
|
|
1016
|
+
const handleReject = () => {
|
|
1017
|
+
setShowBanner(false);
|
|
1018
|
+
setAcceptedCookies(() => ({
|
|
1019
|
+
analytics: false,
|
|
1020
|
+
functional: false,
|
|
1021
|
+
marketing: false
|
|
1022
|
+
}));
|
|
1023
|
+
};
|
|
1024
|
+
if (!showBanner) return null;
|
|
1025
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1026
|
+
className: "absolute inset-0 z-[10000] backdrop-blur-sm",
|
|
1027
|
+
children: [/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black opacity-15" }), /* @__PURE__ */ jsx("div", {
|
|
1028
|
+
className: "absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",
|
|
1029
|
+
children: /* @__PURE__ */ jsx(CookieBanner, {
|
|
1030
|
+
className: "max-w-[1024px]",
|
|
1031
|
+
cookies: cookiesInput,
|
|
1032
|
+
onSubmit: handleAccept,
|
|
1033
|
+
onReject: handleReject,
|
|
1034
|
+
submitLabel: t("cookieBanner.accept"),
|
|
1035
|
+
rejectLabel: t("cookieBanner.reject"),
|
|
1036
|
+
children: /* @__PURE__ */ jsx("p", {
|
|
1037
|
+
className: "font-semibold text-gray-500",
|
|
1038
|
+
children: /* @__PURE__ */ jsx(Trans, {
|
|
1039
|
+
i18nKey: "cookieBanner.message",
|
|
1040
|
+
components: { a: /* @__PURE__ */ jsx("a", {
|
|
1041
|
+
onClick: () => showPHModal({ type: "cookiesPolicy" }),
|
|
1042
|
+
className: "cursor-pointer text-gray-900 hover:underline"
|
|
1043
|
+
}, "cookieBanner.message-link") }
|
|
1044
|
+
}, "cookieBanner.message")
|
|
1045
|
+
})
|
|
1046
|
+
})
|
|
1047
|
+
})]
|
|
1048
|
+
});
|
|
1049
|
+
};
|
|
1050
|
+
//#endregion
|
|
1051
|
+
//#region src/components/drive-icon.tsx
|
|
1052
|
+
function DriveIcon({ drive }) {
|
|
1053
|
+
const remotes = useSyncList();
|
|
1054
|
+
const isRemoteDrive = useMemo(() => {
|
|
1055
|
+
if (!drive) return false;
|
|
1056
|
+
return remotes.some((remote) => remote.collectionId === driveCollectionId("main", drive.header.id));
|
|
1057
|
+
}, [remotes, drive]);
|
|
1058
|
+
const driveIconSrc = drive?.state.global.icon;
|
|
1059
|
+
if (driveIconSrc) return /* @__PURE__ */ jsx("img", {
|
|
1060
|
+
src: driveIconSrc,
|
|
1061
|
+
alt: drive.header.name,
|
|
1062
|
+
height: 32,
|
|
1063
|
+
width: 32
|
|
1064
|
+
});
|
|
1065
|
+
if (!isRemoteDrive) return /* @__PURE__ */ jsx(Icon, {
|
|
1066
|
+
name: "Hdd",
|
|
1067
|
+
size: 32
|
|
1068
|
+
});
|
|
1069
|
+
return /* @__PURE__ */ jsx(Icon, {
|
|
1070
|
+
name: "Server",
|
|
1071
|
+
size: 32
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
//#endregion
|
|
1075
|
+
//#region src/components/editors.tsx
|
|
1076
|
+
function EditorError({ message }) {
|
|
1077
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1078
|
+
className: "flex size-full items-center justify-center",
|
|
1079
|
+
children: /* @__PURE__ */ jsx("h3", {
|
|
1080
|
+
className: "text-lg font-semibold",
|
|
1081
|
+
children: message
|
|
1082
|
+
})
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
const DocumentEditor = (props) => {
|
|
1086
|
+
const { document: initialDocument, onClose, onExport, onOpenSwitchboardLink } = props;
|
|
1087
|
+
const selectedTimelineItem = useSelectedTimelineItem();
|
|
1088
|
+
const revisionHistoryVisible = useRevisionHistoryVisible();
|
|
1089
|
+
const [document, dispatch] = useDocumentById(initialDocument.header.id);
|
|
1090
|
+
const documentId = document?.header.id ?? void 0;
|
|
1091
|
+
const documentName = document?.header.name ?? void 0;
|
|
1092
|
+
const documentType = document?.header.documentType ?? void 0;
|
|
1093
|
+
const preferredEditor = document?.header.meta?.preferredEditor ?? void 0;
|
|
1094
|
+
const { globalOperations, localOperations, isLoading: isLoadingOperations, refetch: refetchOperations } = useDocumentOperations(documentId);
|
|
1095
|
+
useEffect(() => {
|
|
1096
|
+
if (revisionHistoryVisible) refetchOperations();
|
|
1097
|
+
}, [revisionHistoryVisible, refetchOperations]);
|
|
1098
|
+
const globalRevisionNumber = document?.header.revision.global ?? 0;
|
|
1099
|
+
const localRevisionNumber = document?.header.revision.local ?? 0;
|
|
1100
|
+
const documentModelModule = useDocumentModelModuleById(documentType);
|
|
1101
|
+
const preferredEditorModule = useEditorModuleById(preferredEditor);
|
|
1102
|
+
const fallbackEditorModule = useFallbackEditorModule(documentType);
|
|
1103
|
+
const editorModule = preferredEditorModule ?? fallbackEditorModule;
|
|
1104
|
+
const isLoadingDocument = !document;
|
|
1105
|
+
const isLoadingEditor = editorModule && documentType && !editorModule.documentTypes.includes(documentType) && !editorModule.documentTypes.includes("*");
|
|
1106
|
+
const canUndo = globalRevisionNumber > 0 || localRevisionNumber > 0;
|
|
1107
|
+
const canRedo = !!document?.clipboard.length;
|
|
1108
|
+
const addUndoAction = () => dispatch(undo());
|
|
1109
|
+
const addRedoAction = () => dispatch(redo());
|
|
1110
|
+
useUndoRedoShortcuts({
|
|
1111
|
+
undo: addUndoAction,
|
|
1112
|
+
redo: addRedoAction,
|
|
1113
|
+
canUndo,
|
|
1114
|
+
canRedo
|
|
1115
|
+
});
|
|
1116
|
+
useEffect(() => {
|
|
1117
|
+
return () => {
|
|
1118
|
+
window.documentEditorDebugTools?.clear();
|
|
1119
|
+
};
|
|
1120
|
+
}, []);
|
|
1121
|
+
const [editorError, setEditorError] = useState(void 0);
|
|
1122
|
+
useEffect(() => {
|
|
1123
|
+
if (editorError && editorError.documentId !== documentId) setEditorError(void 0);
|
|
1124
|
+
}, [editorError, documentId]);
|
|
1125
|
+
const handleEditorError = (error, info) => {
|
|
1126
|
+
setEditorError({
|
|
1127
|
+
error,
|
|
1128
|
+
documentId,
|
|
1129
|
+
info
|
|
1130
|
+
});
|
|
1131
|
+
};
|
|
1132
|
+
if (isLoadingEditor) return /* @__PURE__ */ jsx(EditorLoader, { message: "Loading editor" });
|
|
1133
|
+
if (isLoadingDocument) return /* @__PURE__ */ jsx(EditorLoader, { message: "Loading document" });
|
|
1134
|
+
if (!documentModelModule) return /* @__PURE__ */ jsx(EditorError, { message: /* @__PURE__ */ jsxs("div", {
|
|
1135
|
+
className: "text-center leading-10",
|
|
1136
|
+
children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
1137
|
+
"Unable to open the document because the document model \"",
|
|
1138
|
+
documentType,
|
|
1139
|
+
"\" is not supported."
|
|
1140
|
+
] }), /* @__PURE__ */ jsxs("p", { children: [
|
|
1141
|
+
"Go to the",
|
|
1142
|
+
" ",
|
|
1143
|
+
/* @__PURE__ */ jsx("button", {
|
|
1144
|
+
type: "button",
|
|
1145
|
+
className: "cursor-pointer underline",
|
|
1146
|
+
onClick: () => {
|
|
1147
|
+
showPHModal({ type: "settings" });
|
|
1148
|
+
},
|
|
1149
|
+
children: "package manager"
|
|
1150
|
+
}),
|
|
1151
|
+
" ",
|
|
1152
|
+
"to install this document model"
|
|
1153
|
+
] })]
|
|
1154
|
+
}) });
|
|
1155
|
+
if (!editorModule) return /* @__PURE__ */ jsx(EditorError, { message: /* @__PURE__ */ jsxs("div", {
|
|
1156
|
+
className: "text-center leading-10",
|
|
1157
|
+
children: [/* @__PURE__ */ jsx("p", { children: "Unable to open the document because no editor has been found" }), /* @__PURE__ */ jsxs("p", { children: [
|
|
1158
|
+
"Go to the",
|
|
1159
|
+
" ",
|
|
1160
|
+
/* @__PURE__ */ jsx("button", {
|
|
1161
|
+
type: "button",
|
|
1162
|
+
className: "cursor-pointer underline",
|
|
1163
|
+
onClick: () => {
|
|
1164
|
+
showPHModal({ type: "settings" });
|
|
1165
|
+
},
|
|
1166
|
+
children: "package manager"
|
|
1167
|
+
}),
|
|
1168
|
+
" ",
|
|
1169
|
+
"an editor for the \"$",
|
|
1170
|
+
documentType,
|
|
1171
|
+
"\" document type"
|
|
1172
|
+
] })]
|
|
1173
|
+
}) });
|
|
1174
|
+
const EditorComponent = editorModule.Component;
|
|
1175
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1176
|
+
className: "relative h-full",
|
|
1177
|
+
id: "document-editor-context",
|
|
1178
|
+
"data-editor": editorModule.config.id,
|
|
1179
|
+
"data-document-type": documentType,
|
|
1180
|
+
children: revisionHistoryVisible ? isLoadingOperations ? /* @__PURE__ */ jsx(EditorLoader, { message: "Loading operations" }) : /* @__PURE__ */ jsx(RevisionHistory, {
|
|
1181
|
+
documentTitle: documentName ?? "",
|
|
1182
|
+
documentId: documentId ?? "",
|
|
1183
|
+
globalOperations,
|
|
1184
|
+
localOperations,
|
|
1185
|
+
onClose: () => setRevisionHistoryVisible(false),
|
|
1186
|
+
documentState: document.state,
|
|
1187
|
+
onCopyState: () => {
|
|
1188
|
+
toast("Copied document state to clipboard", { type: "success" });
|
|
1189
|
+
},
|
|
1190
|
+
onCopyDocId: () => {
|
|
1191
|
+
toast("Copied document ID to clipboard", { type: "success" });
|
|
1192
|
+
}
|
|
1193
|
+
}, documentId) : /* @__PURE__ */ jsx(Suspense, {
|
|
1194
|
+
fallback: /* @__PURE__ */ jsx(EditorLoader, { message: "Loading editor" }),
|
|
1195
|
+
name: "EditorLoader",
|
|
1196
|
+
children: /* @__PURE__ */ jsx(ErrorBoundary$1, {
|
|
1197
|
+
fallbackRender: CenteredErrorMessage,
|
|
1198
|
+
resetKeys: [documentId],
|
|
1199
|
+
onError: handleEditorError,
|
|
1200
|
+
loggerContext: ["Connect", "DocumentEditor"],
|
|
1201
|
+
children: !editorError?.error && /* @__PURE__ */ jsx(EditorComponent, {
|
|
1202
|
+
context: {
|
|
1203
|
+
readMode: !!selectedTimelineItem,
|
|
1204
|
+
selectedTimelineRevision: getRevisionFromDate(selectedTimelineItem?.startDate, selectedTimelineItem?.endDate, globalOperations)
|
|
1205
|
+
},
|
|
1206
|
+
documentId: document.header.id
|
|
1207
|
+
}, documentId)
|
|
1208
|
+
})
|
|
1209
|
+
})
|
|
1210
|
+
});
|
|
1211
|
+
};
|
|
1212
|
+
//#endregion
|
|
1213
|
+
//#region src/components/root.tsx
|
|
1214
|
+
function Root() {
|
|
1215
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1216
|
+
className: "h-screen",
|
|
1217
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1218
|
+
className: `flex h-screen items-stretch overflow-auto`,
|
|
1219
|
+
role: "presentation",
|
|
1220
|
+
tabIndex: 0,
|
|
1221
|
+
children: /* @__PURE__ */ jsxs(Suspense, {
|
|
1222
|
+
name: "Root",
|
|
1223
|
+
children: [/* @__PURE__ */ jsx(Sidebar, {}), /* @__PURE__ */ jsx("div", {
|
|
1224
|
+
className: "relative flex-1 overflow-auto",
|
|
1225
|
+
children: /* @__PURE__ */ jsx(Outlet, {})
|
|
1226
|
+
})]
|
|
1227
|
+
})
|
|
1228
|
+
})
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
//#endregion
|
|
1232
|
+
//#region src/pages/content.tsx
|
|
1233
|
+
function Content() {
|
|
1234
|
+
const [selectedDrive] = useSelectedDriveSafe();
|
|
1235
|
+
const selectedFolder = useSelectedFolder();
|
|
1236
|
+
const selectedDocumentId = useSelectedDocumentId();
|
|
1237
|
+
useEffect(() => {
|
|
1238
|
+
if (!selectedDocumentId) setPHDocumentEditorConfig(defaultPHDocumentEditorConfig);
|
|
1239
|
+
}, [selectedDocumentId]);
|
|
1240
|
+
useEffect(() => {
|
|
1241
|
+
if (!selectedDrive) setPHAppConfig(defaultPHAppConfig);
|
|
1242
|
+
}, [selectedDrive]);
|
|
1243
|
+
return /* @__PURE__ */ jsx(ContentContainer, { children: !selectedDocumentId && !selectedDrive && !selectedFolder ? /* @__PURE__ */ jsx(HomeScreenContainer, {}) : /* @__PURE__ */ jsx(AppContainer, {}) });
|
|
1244
|
+
}
|
|
1245
|
+
function ContentContainer({ children }) {
|
|
1246
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1247
|
+
className: "flex h-full flex-col overflow-auto",
|
|
1248
|
+
id: "content-view",
|
|
1249
|
+
children
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
function DriveItem({ drive }) {
|
|
1253
|
+
const description = useAppModuleById(drive.header.meta?.preferredEditor)?.config.name || "Drive Explorer App";
|
|
1254
|
+
return /* @__PURE__ */ jsx(HomeScreenItem, {
|
|
1255
|
+
title: drive.state.global.name || drive.header.name,
|
|
1256
|
+
description,
|
|
1257
|
+
icon: /* @__PURE__ */ jsx(DriveIcon, { drive }),
|
|
1258
|
+
onClick: () => setSelectedDrive(drive)
|
|
1259
|
+
}, drive.header.id);
|
|
1260
|
+
}
|
|
1261
|
+
function HomeScreenContainer() {
|
|
1262
|
+
const drives = useDrives();
|
|
1263
|
+
const config = connectConfig;
|
|
1264
|
+
return /* @__PURE__ */ jsxs(HomeScreen, { children: [drives?.map((drive) => {
|
|
1265
|
+
return /* @__PURE__ */ jsx(DriveItem, { drive }, drive.header.id);
|
|
1266
|
+
}), config.drives.addDriveEnabled && /* @__PURE__ */ jsx(HomeScreenAddDriveItem, {})] });
|
|
1267
|
+
}
|
|
1268
|
+
//#endregion
|
|
1269
|
+
//#region src/pages/demo/atlas-import.tsx
|
|
1270
|
+
const REACTOR_URL = "https://apps.powerhouse.io/sky-atlas/staging/switchboard";
|
|
1271
|
+
const MIN_LOADING_TIME = 2e3;
|
|
1272
|
+
function useReactorUrl() {
|
|
1273
|
+
const { search } = useLocation();
|
|
1274
|
+
return useMemo(() => {
|
|
1275
|
+
const url = new URLSearchParams(search).get("reactorUrl") ?? REACTOR_URL;
|
|
1276
|
+
return url.endsWith("/") ? url : `${url}/`;
|
|
1277
|
+
}, [search]);
|
|
1278
|
+
}
|
|
1279
|
+
async function forkAtlas(docId, reactorUrl) {
|
|
1280
|
+
const document = gql`
|
|
1281
|
+
mutation ForkAtlas($docId: PHID) {
|
|
1282
|
+
ForkAtlas(docId: $docId)
|
|
1283
|
+
}
|
|
1284
|
+
`;
|
|
1285
|
+
return await request(`${reactorUrl}graphql`, document, { docId });
|
|
1286
|
+
}
|
|
1287
|
+
function AtlasImport() {
|
|
1288
|
+
const status = useRef("initial");
|
|
1289
|
+
const reactor = useReactorClient();
|
|
1290
|
+
const { documentId } = useParams();
|
|
1291
|
+
const reactorUrl = useReactorUrl();
|
|
1292
|
+
const navigate = useNavigate();
|
|
1293
|
+
const [driveId, setDriveId] = useState(void 0);
|
|
1294
|
+
const [error, setError] = useState(void 0);
|
|
1295
|
+
const [loading, setLoading] = useState(true);
|
|
1296
|
+
const hasError = status.current === "error";
|
|
1297
|
+
useEffect(() => {
|
|
1298
|
+
if (error) {
|
|
1299
|
+
console.error("Error forking Atlas:", error);
|
|
1300
|
+
toast("Error forking Atlas", { type: "error" });
|
|
1301
|
+
}
|
|
1302
|
+
}, [error]);
|
|
1303
|
+
async function forkAtlasDocument(documentId) {
|
|
1304
|
+
const driveId = (await forkAtlas(documentId, reactorUrl)).ForkAtlas;
|
|
1305
|
+
status.current = "forked";
|
|
1306
|
+
setDriveId(driveId);
|
|
1307
|
+
}
|
|
1308
|
+
const redirectToDrive = useCallback(() => {
|
|
1309
|
+
if (driveId && !loading) navigate(`/d/${driveId}`, { replace: true });
|
|
1310
|
+
}, [
|
|
1311
|
+
driveId,
|
|
1312
|
+
navigate,
|
|
1313
|
+
loading
|
|
1314
|
+
]);
|
|
1315
|
+
const addForkDrive = useCallback(async (driveId) => {
|
|
1316
|
+
console.log("Adding remote drive:", driveId);
|
|
1317
|
+
const driveUrl = `${reactorUrl}d/${driveId}`;
|
|
1318
|
+
try {
|
|
1319
|
+
const addedDrive = await addRemoteDrive(driveUrl);
|
|
1320
|
+
status.current = "done";
|
|
1321
|
+
console.log("Added remote drive:", addedDrive);
|
|
1322
|
+
setTimeout(() => {
|
|
1323
|
+
setLoading(false);
|
|
1324
|
+
}, MIN_LOADING_TIME);
|
|
1325
|
+
} catch (error) {
|
|
1326
|
+
status.current = "error";
|
|
1327
|
+
setLoading(false);
|
|
1328
|
+
setError(error);
|
|
1329
|
+
}
|
|
1330
|
+
}, [
|
|
1331
|
+
addRemoteDrive,
|
|
1332
|
+
navigate,
|
|
1333
|
+
reactorUrl
|
|
1334
|
+
]);
|
|
1335
|
+
useEffect(() => {
|
|
1336
|
+
if (!documentId || status.current !== "initial") return;
|
|
1337
|
+
status.current = "forking";
|
|
1338
|
+
forkAtlasDocument(documentId).catch((error) => {
|
|
1339
|
+
status.current = "error";
|
|
1340
|
+
setError(error);
|
|
1341
|
+
});
|
|
1342
|
+
}, [documentId, status]);
|
|
1343
|
+
useEffect(() => {
|
|
1344
|
+
if (!driveId || !reactor || status.current !== "forked") return;
|
|
1345
|
+
status.current = "addingDrive";
|
|
1346
|
+
new Promise((resolve) => {
|
|
1347
|
+
setTimeout(resolve, 500);
|
|
1348
|
+
}).then(() => addForkDrive(driveId)).catch((error) => {
|
|
1349
|
+
status.current = "error";
|
|
1350
|
+
setError(error);
|
|
1351
|
+
});
|
|
1352
|
+
}, [
|
|
1353
|
+
driveId,
|
|
1354
|
+
reactor,
|
|
1355
|
+
status
|
|
1356
|
+
]);
|
|
1357
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1358
|
+
className: "flex size-full justify-center gap-x-4 bg-gray-50",
|
|
1359
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1360
|
+
className: "w-full max-w-[850px] rounded-2xl bg-white p-6 drop-shadow-sm",
|
|
1361
|
+
children: [/* @__PURE__ */ jsx("h1", {
|
|
1362
|
+
className: "text-lg font-medium text-gray-900",
|
|
1363
|
+
children: "Welcome to the Atlas Explorer"
|
|
1364
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1365
|
+
className: "mt-4 rounded-xl border border-gray-200 bg-gray-50 p-6",
|
|
1366
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1367
|
+
className: "flex min-h-80 flex-col items-center justify-center rounded-2xl bg-slate-50",
|
|
1368
|
+
children: [
|
|
1369
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("svg", {
|
|
1370
|
+
width: "28",
|
|
1371
|
+
height: "32",
|
|
1372
|
+
viewBox: "0 0 28 32",
|
|
1373
|
+
fill: "none",
|
|
1374
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1375
|
+
children: [
|
|
1376
|
+
/* @__PURE__ */ jsx("path", {
|
|
1377
|
+
fillRule: "evenodd",
|
|
1378
|
+
clipRule: "evenodd",
|
|
1379
|
+
d: "M0.05092 23.7286L0.000163347 23.9993L0 23.9995L0.207853 24.067L27.6823 24.067L27.9995 23.9995L27.9161 23.6913L14.2182 0.209032L13.9998 0L13.749 0.246353L0.05092 23.7286ZM20.9994 11.9999L7.0003 11.9999L13.9998 23.999L20.9994 11.9999Z",
|
|
1380
|
+
fill: "url(#paint0_radial_319_20865)"
|
|
1381
|
+
}),
|
|
1382
|
+
/* @__PURE__ */ jsx("path", {
|
|
1383
|
+
d: "M14 0L0 23.9998V7.99993L14 0Z",
|
|
1384
|
+
fill: "url(#paint1_linear_319_20865)"
|
|
1385
|
+
}),
|
|
1386
|
+
/* @__PURE__ */ jsx("path", {
|
|
1387
|
+
d: "M28 24L7.82013e-05 24L14 31.9999L28 24Z",
|
|
1388
|
+
fill: "url(#paint2_linear_319_20865)"
|
|
1389
|
+
}),
|
|
1390
|
+
/* @__PURE__ */ jsx("path", {
|
|
1391
|
+
d: "M14 0L28 23.9998V7.99993L14 0Z",
|
|
1392
|
+
fill: "url(#paint3_linear_319_20865)"
|
|
1393
|
+
}),
|
|
1394
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
1395
|
+
/* @__PURE__ */ jsxs("radialGradient", {
|
|
1396
|
+
id: "paint0_radial_319_20865",
|
|
1397
|
+
cx: "0",
|
|
1398
|
+
cy: "0",
|
|
1399
|
+
r: "1",
|
|
1400
|
+
gradientUnits: "userSpaceOnUse",
|
|
1401
|
+
gradientTransform: "translate(13.9994 16.0344) rotate(-89.9988) scale(16.0344 16.201)",
|
|
1402
|
+
children: [/* @__PURE__ */ jsx("stop", {
|
|
1403
|
+
offset: "0.181008",
|
|
1404
|
+
stopColor: "#FFCD6B"
|
|
1405
|
+
}), /* @__PURE__ */ jsx("stop", {
|
|
1406
|
+
offset: "1",
|
|
1407
|
+
stopColor: "#EB5EDF"
|
|
1408
|
+
})]
|
|
1409
|
+
}),
|
|
1410
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
1411
|
+
id: "paint1_linear_319_20865",
|
|
1412
|
+
x1: "-0.031454",
|
|
1413
|
+
y1: "24.041",
|
|
1414
|
+
x2: "13.801",
|
|
1415
|
+
y2: "-0.142908",
|
|
1416
|
+
gradientUnits: "userSpaceOnUse",
|
|
1417
|
+
children: [/* @__PURE__ */ jsx("stop", { stopColor: "#4331E9" }), /* @__PURE__ */ jsx("stop", {
|
|
1418
|
+
offset: "1",
|
|
1419
|
+
stopColor: "#A273FF"
|
|
1420
|
+
})]
|
|
1421
|
+
}),
|
|
1422
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
1423
|
+
id: "paint2_linear_319_20865",
|
|
1424
|
+
x1: "-0.0310093",
|
|
1425
|
+
y1: "24",
|
|
1426
|
+
x2: "28.0444",
|
|
1427
|
+
y2: "24",
|
|
1428
|
+
gradientUnits: "userSpaceOnUse",
|
|
1429
|
+
children: [/* @__PURE__ */ jsx("stop", { stopColor: "#A273FF" }), /* @__PURE__ */ jsx("stop", {
|
|
1430
|
+
offset: "1",
|
|
1431
|
+
stopColor: "#4331E9"
|
|
1432
|
+
})]
|
|
1433
|
+
}),
|
|
1434
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
1435
|
+
id: "paint3_linear_319_20865",
|
|
1436
|
+
x1: "28.0315",
|
|
1437
|
+
y1: "24.041",
|
|
1438
|
+
x2: "14.199",
|
|
1439
|
+
y2: "-0.142908",
|
|
1440
|
+
gradientUnits: "userSpaceOnUse",
|
|
1441
|
+
children: [/* @__PURE__ */ jsx("stop", { stopColor: "#A273FF" }), /* @__PURE__ */ jsx("stop", {
|
|
1442
|
+
offset: "1",
|
|
1443
|
+
stopColor: "#4331E9"
|
|
1444
|
+
})]
|
|
1445
|
+
})
|
|
1446
|
+
] })
|
|
1447
|
+
]
|
|
1448
|
+
}) }),
|
|
1449
|
+
hasError ? /* @__PURE__ */ jsx("div", {
|
|
1450
|
+
className: "mt-3 text-sm text-gray-800",
|
|
1451
|
+
children: "Error forking Atlas scope. Please try again."
|
|
1452
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
1453
|
+
className: "mt-3 text-sm text-gray-500",
|
|
1454
|
+
children: "Forking Atlas scope..."
|
|
1455
|
+
}),
|
|
1456
|
+
/* @__PURE__ */ jsx(PowerhouseButton, {
|
|
1457
|
+
onClick: hasError ? window.location.reload.bind(window.location) : redirectToDrive,
|
|
1458
|
+
size: "small",
|
|
1459
|
+
color: "light",
|
|
1460
|
+
className: "mt-4 h-9 border border-gray-200 bg-white px-3 text-gray-600",
|
|
1461
|
+
children: hasError ? "Retry" : loading ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("svg", {
|
|
1462
|
+
className: "animate-spin",
|
|
1463
|
+
width: "16",
|
|
1464
|
+
height: "16",
|
|
1465
|
+
viewBox: "0 0 16 16",
|
|
1466
|
+
fill: "none",
|
|
1467
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1468
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
1469
|
+
d: "M15.6867 8.03333C15.4933 7.83999 15.1733 7.83999 14.98 8.03333L14.6733 8.34001V8C14.6733 4.32 11.68 1.32666 7.99999 1.32666C5.96666 1.32666 4.06666 2.23999 2.79333 3.82666C2.61999 4.03999 2.65332 4.35999 2.87332 4.52665C3.08666 4.69999 3.40666 4.66666 3.57332 4.44666C4.65999 3.09332 6.27332 2.31999 7.99999 2.31999C11.1267 2.31999 13.6733 4.86666 13.6733 7.99333V8.32666L13.3667 8.02002C13.1733 7.82669 12.8533 7.82669 12.66 8.02002C12.4667 8.21335 12.4667 8.53335 12.66 8.72668L13.82 9.88668C13.8667 9.93334 13.92 9.96666 13.98 9.99333C14.04 10.02 14.1067 10.0333 14.1733 10.0333C14.24 10.0333 14.3 10.02 14.3667 9.99333C14.4267 9.96666 14.48 9.93334 14.5267 9.88668L15.6867 8.72668C15.88 8.54668 15.88 8.22666 15.6867 8.03333Z",
|
|
1470
|
+
fill: "#6C7275"
|
|
1471
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
1472
|
+
d: "M13.1267 11.4666C12.9133 11.2933 12.5933 11.3266 12.4267 11.5466C11.34 12.9 9.72665 13.6733 7.99998 13.6733C4.87332 13.6733 2.32665 11.1266 2.32665 7.99996V7.66663L2.63332 7.97331C2.73332 8.07331 2.85999 8.11996 2.98665 8.11996C3.11332 8.11996 3.23999 8.07331 3.33999 7.97331C3.53332 7.77998 3.53332 7.45998 3.33999 7.26664L2.17998 6.10661C2.13332 6.05994 2.07998 6.02663 2.01998 5.99996C1.89998 5.94663 1.75998 5.94663 1.63998 5.99996C1.57998 6.02663 1.52665 6.05994 1.47999 6.10661L0.319988 7.26664C0.126654 7.45998 0.126654 7.77998 0.319988 7.97331C0.513321 8.16664 0.833319 8.16664 1.02665 7.97331L1.33332 7.66663V7.99996C1.33332 11.68 4.32665 14.6733 8.00665 14.6733C10.04 14.6733 11.94 13.76 13.2133 12.1733C13.38 11.96 13.3467 11.64 13.1267 11.4666Z",
|
|
1473
|
+
fill: "#6C7275"
|
|
1474
|
+
})]
|
|
1475
|
+
}), "Loading"] }) : "Continue"
|
|
1476
|
+
})
|
|
1477
|
+
]
|
|
1478
|
+
})
|
|
1479
|
+
})]
|
|
1480
|
+
})
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
//#endregion
|
|
1484
|
+
//#region src/components/router.tsx
|
|
1485
|
+
function createRouter(routes) {
|
|
1486
|
+
const routerBasename = connectConfig.routerBasename;
|
|
1487
|
+
return createBrowserRouter(routes, {
|
|
1488
|
+
basename: routerBasename,
|
|
1489
|
+
future: {
|
|
1490
|
+
v7_fetcherPersist: true,
|
|
1491
|
+
v7_relativeSplatPath: true
|
|
1492
|
+
}
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
function createRoutes() {
|
|
1496
|
+
return [{
|
|
1497
|
+
element: /* @__PURE__ */ jsx(Suspense, {
|
|
1498
|
+
name: "RouteRoot",
|
|
1499
|
+
children: /* @__PURE__ */ jsx(Root, {})
|
|
1500
|
+
}),
|
|
1501
|
+
children: [{
|
|
1502
|
+
index: true,
|
|
1503
|
+
path: "d?/:driveId?/*?",
|
|
1504
|
+
element: /* @__PURE__ */ jsx(Suspense, {
|
|
1505
|
+
name: "Drive",
|
|
1506
|
+
children: /* @__PURE__ */ jsx(Content, {})
|
|
1507
|
+
})
|
|
1508
|
+
}, {
|
|
1509
|
+
path: "import/:documentId",
|
|
1510
|
+
element: /* @__PURE__ */ jsx(Suspense, {
|
|
1511
|
+
name: "AtlasImport",
|
|
1512
|
+
children: /* @__PURE__ */ jsx(AtlasImport, {})
|
|
1513
|
+
})
|
|
1514
|
+
}]
|
|
1515
|
+
}];
|
|
1516
|
+
}
|
|
1517
|
+
const router = createRouter(createRoutes());
|
|
1518
|
+
const Router = () => {
|
|
1519
|
+
return /* @__PURE__ */ jsx(RouterProvider, { router });
|
|
1520
|
+
};
|
|
1521
|
+
//#endregion
|
|
1522
|
+
//#region src/components/sidebar.tsx
|
|
1523
|
+
function Sidebar() {
|
|
1524
|
+
const user = useUser();
|
|
1525
|
+
const drives = useDrives();
|
|
1526
|
+
const [selectedDrive] = useSelectedDriveSafe();
|
|
1527
|
+
const connectDebug = localStorage.getItem("CONNECT_DEBUG") === "true";
|
|
1528
|
+
const ensName = user?.ens?.name || user?.profile?.username || void 0;
|
|
1529
|
+
const avatarUrl = user?.ens?.avatarUrl || user?.profile?.userImage || void 0;
|
|
1530
|
+
const ensInfo = useEns(!avatarUrl ? user?.address : void 0);
|
|
1531
|
+
const onClickSettings = () => {
|
|
1532
|
+
showPHModal({ type: "settings" });
|
|
1533
|
+
};
|
|
1534
|
+
const onAddDriveClick = () => {
|
|
1535
|
+
showPHModal({ type: "addDrive" });
|
|
1536
|
+
};
|
|
1537
|
+
const etherscanUrl = user?.address ? `https://etherscan.io/address/${user.address}` : "";
|
|
1538
|
+
return /* @__PURE__ */ jsx(ConnectTooltipProvider, { children: /* @__PURE__ */ jsx(ConnectSidebar, {
|
|
1539
|
+
id: "sidebar",
|
|
1540
|
+
onClick: () => setSelectedDrive(void 0),
|
|
1541
|
+
onClickSettings,
|
|
1542
|
+
address: user?.address,
|
|
1543
|
+
onLogin: openRenown,
|
|
1544
|
+
onDisconnect: logout,
|
|
1545
|
+
ensName: ensName || ensInfo.data?.ens,
|
|
1546
|
+
avatarUrl: avatarUrl || ensInfo.data?.avatar_small || ensInfo.data?.avatar_url || void 0,
|
|
1547
|
+
etherscanUrl,
|
|
1548
|
+
showDebug: connectDebug,
|
|
1549
|
+
onDebugClick: () => showPHModal({ type: "debugSettings" }),
|
|
1550
|
+
children: /* @__PURE__ */ jsxs(ErrorBoundary$1, {
|
|
1551
|
+
variant: "text",
|
|
1552
|
+
fallbackMessage: "There was an error loading drives",
|
|
1553
|
+
loggerContext: ["Connect", "Sidebar"],
|
|
1554
|
+
children: [drives?.map((drive, index) => /* @__PURE__ */ jsx(SidebarItem, {
|
|
1555
|
+
title: drive.header.name,
|
|
1556
|
+
onClick: () => setSelectedDrive(drive),
|
|
1557
|
+
active: selectedDrive?.header.id === drive.header.id,
|
|
1558
|
+
icon: /* @__PURE__ */ jsx(DriveIcon, { drive })
|
|
1559
|
+
}, index)), connectConfig.drives.addDriveEnabled && /* @__PURE__ */ jsx(SidebarAddDriveItem, { onClick: onAddDriveClick })]
|
|
1560
|
+
})
|
|
1561
|
+
}) });
|
|
1562
|
+
}
|
|
1563
|
+
//#endregion
|
|
1564
|
+
export { AppLoader as t };
|
|
1565
|
+
|
|
1566
|
+
//# sourceMappingURL=sidebar-BCkxH2f3.js.map
|