@powerhousedao/connect 6.2.3-dev.61 → 6.2.3-dev.63

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.
Files changed (178) hide show
  1. package/README.md +101 -0
  2. package/dist/{AddDriveModal-C5odBO8y.js → AddDriveModal-D_3jDwjp.js} +6 -6
  3. package/dist/AddDriveModal-D_3jDwjp.js.map +1 -0
  4. package/dist/{ClearStorageModal-nzpz8MeW.js → ClearStorageModal-CAPjV674.js} +9 -11
  5. package/dist/ClearStorageModal-CAPjV674.js.map +1 -0
  6. package/dist/{ConfirmDocumentUpgradeModal-k79v2wM6.js → ConfirmDocumentUpgradeModal-CrU2Z1CL.js} +5 -5
  7. package/dist/{ConfirmDocumentUpgradeModal-k79v2wM6.js.map → ConfirmDocumentUpgradeModal-CrU2Z1CL.js.map} +1 -1
  8. package/dist/{CookiesPolicyModal-BLw4pnhn.js → CookiesPolicyModal-DQwsgDI9.js} +5 -5
  9. package/dist/{CookiesPolicyModal-BLw4pnhn.js.map → CookiesPolicyModal-DQwsgDI9.js.map} +1 -1
  10. package/dist/{CreateDocumentModal-Bmv0V-kY.js → CreateDocumentModal-Cf1APibL.js} +4 -4
  11. package/dist/{CreateDocumentModal-Bmv0V-kY.js.map → CreateDocumentModal-Cf1APibL.js.map} +1 -1
  12. package/dist/{DebugSettingsModal-BW0HWI1D.js → DebugSettingsModal-CuxHqpMv.js} +8 -8
  13. package/dist/{DebugSettingsModal-BW0HWI1D.js.map → DebugSettingsModal-CuxHqpMv.js.map} +1 -1
  14. package/dist/{DeleteDriveModal-CjGnG0ht.js → DeleteDriveModal-lE9eCBua.js} +5 -5
  15. package/dist/{DeleteDriveModal-CjGnG0ht.js.map → DeleteDriveModal-lE9eCBua.js.map} +1 -1
  16. package/dist/{DeleteItemModal-BbY_4_xT.js → DeleteItemModal-BFgcGsm3.js} +6 -6
  17. package/dist/{DeleteItemModal-BbY_4_xT.js.map → DeleteItemModal-BFgcGsm3.js.map} +1 -1
  18. package/dist/{DisclaimerModal-DuglmEwL.js → DisclaimerModal-CF6JkIIu.js} +6 -6
  19. package/dist/{DisclaimerModal-DuglmEwL.js.map → DisclaimerModal-CF6JkIIu.js.map} +1 -1
  20. package/dist/{DocumentVersionUnsupportedModal-C4fy7fZ6.js → DocumentVersionUnsupportedModal-Cm9Jb9W7.js} +5 -5
  21. package/dist/DocumentVersionUnsupportedModal-Cm9Jb9W7.js.map +1 -0
  22. package/dist/{DownloadDocumentWithErrorsModal-BsPQ5qgy.js → DownloadDocumentWithErrorsModal-CShKhfEQ.js} +5 -5
  23. package/dist/{DownloadDocumentWithErrorsModal-BsPQ5qgy.js.map → DownloadDocumentWithErrorsModal-CShKhfEQ.js.map} +1 -1
  24. package/dist/{DriveAuthRequiredModal-CtsB0kwH.js → DriveAuthRequiredModal-CMwPUyZf.js} +5 -5
  25. package/dist/{DriveAuthRequiredModal-CtsB0kwH.js.map → DriveAuthRequiredModal-CMwPUyZf.js.map} +1 -1
  26. package/dist/{DriveSettingsModal-d1L0eYof.js → DriveSettingsModal-BSImj4BH.js} +5 -5
  27. package/dist/{DriveSettingsModal-d1L0eYof.js.map → DriveSettingsModal-BSImj4BH.js.map} +1 -1
  28. package/dist/FloatingTanStackRouterDevtools-CqogiFob-dxj8lrTP.js +2565 -0
  29. package/dist/FloatingTanStackRouterDevtools-CqogiFob-dxj8lrTP.js.map +1 -0
  30. package/dist/{InspectorModal-Dpf-3LVT.js → InspectorModal-BQBTvrkT.js} +9 -9
  31. package/dist/{InspectorModal-Dpf-3LVT.js.map → InspectorModal-BQBTvrkT.js.map} +1 -1
  32. package/dist/{LoginModal-CI0ogC2-.js → LoginModal-DT_05uva.js} +6 -6
  33. package/dist/{LoginModal-CI0ogC2-.js.map → LoginModal-DT_05uva.js.map} +1 -1
  34. package/dist/{MissingPackageModal-DS3dgJ1K.js → MissingPackageModal-DtISKgub.js} +6 -6
  35. package/dist/{MissingPackageModal-DS3dgJ1K.js.map → MissingPackageModal-DtISKgub.js.map} +1 -1
  36. package/dist/{OpenFileDocumentsModal-BOmFtxS1.js → OpenFileDocumentsModal-X9GnX2Bk.js} +13 -12
  37. package/dist/OpenFileDocumentsModal-X9GnX2Bk.js.map +1 -0
  38. package/dist/{UpgradeDriveModal-CXX6D5Au.js → UpgradeDriveModal-DvM-PNWe.js} +6 -6
  39. package/dist/{UpgradeDriveModal-CXX6D5Au.js.map → UpgradeDriveModal-DvM-PNWe.js.map} +1 -1
  40. package/dist/app-layout-BIq-ZW-6.js +394 -0
  41. package/dist/app-layout-BIq-ZW-6.js.map +1 -0
  42. package/dist/app-loader-Dig98EdR.js +1291 -0
  43. package/dist/app-loader-Dig98EdR.js.map +1 -0
  44. package/dist/app-loader-YjBKjkOv.js +4 -0
  45. package/dist/{app-skeleton-CBN4tenZ.js → app-skeleton-DYLZ7npI.js} +3 -3
  46. package/dist/{app-skeleton--Me5zlSz.js → app-skeleton-gzg8cRzm.js} +7 -7
  47. package/dist/app-skeleton-gzg8cRzm.js.map +1 -0
  48. package/dist/{boot-CNW7ypcB.js → boot-CC_DgQKX.js} +32 -9
  49. package/dist/boot-CC_DgQKX.js.map +1 -0
  50. package/dist/{build-info-DNKZUbvY.js → build-info-CTKeq43y.js} +5 -5
  51. package/dist/{build-info-DNKZUbvY.js.map → build-info-CTKeq43y.js.map} +1 -1
  52. package/dist/components-DzTqdJzC.js +120 -0
  53. package/dist/components-DzTqdJzC.js.map +1 -0
  54. package/dist/connect-router-KmNBGS0G.js +434 -0
  55. package/dist/connect-router-KmNBGS0G.js.map +1 -0
  56. package/dist/{connect.config-CB78ZsFz.js → connect.config-uZF-gnvV.js} +7 -7
  57. package/dist/{connect.config-CB78ZsFz.js.map → connect.config-uZF-gnvV.js.map} +1 -1
  58. package/dist/{connection-state-BDikOGKo.js → connection-state-C_477Kr_.js} +6 -6
  59. package/dist/{connection-state-BDikOGKo.js.map → connection-state-C_477Kr_.js.map} +1 -1
  60. package/dist/context-De2EB1AA-Ni0d829Q.js +1759 -0
  61. package/dist/context-De2EB1AA-Ni0d829Q.js.map +1 -0
  62. package/dist/{cookie-banner-D05DZRqY.js → cookie-banner-HPgyuHM5.js} +6 -6
  63. package/dist/{cookie-banner-D05DZRqY.js.map → cookie-banner-HPgyuHM5.js.map} +1 -1
  64. package/dist/drive-icon-BiVP8yJc.js +38 -0
  65. package/dist/drive-icon-BiVP8yJc.js.map +1 -0
  66. package/dist/esm-BDACZntJ.js +148 -0
  67. package/dist/esm-BDACZntJ.js.map +1 -0
  68. package/dist/index-UrZFqSgm.d.ts +166 -0
  69. package/dist/index-UrZFqSgm.d.ts.map +1 -0
  70. package/dist/layout.d.ts +29 -0
  71. package/dist/layout.d.ts.map +1 -0
  72. package/dist/layout.js +6 -0
  73. package/dist/{load-BxQ82Cxc.js → load-f-BRwdCc.js} +48 -48
  74. package/dist/load-f-BRwdCc.js.map +1 -0
  75. package/dist/main.js +2 -2
  76. package/dist/{multi-reactor-BG-DqUcm.js → multi-reactor-fSKpLBjT.js} +10 -7
  77. package/dist/multi-reactor-fSKpLBjT.js.map +1 -0
  78. package/dist/open-file-uploads-BcyWmUZn.js +183 -0
  79. package/dist/open-file-uploads-BcyWmUZn.js.map +1 -0
  80. package/dist/{package-manager-BPVMRBoV.js → package-manager-BkFRzovd.js} +52 -45
  81. package/dist/package-manager-BkFRzovd.js.map +1 -0
  82. package/dist/{pglite-migrate-core-BcXcImng.js → pglite-migrate-core-DBlU6HIc.js} +4 -4
  83. package/dist/pglite-migrate-core-DBlU6HIc.js.map +1 -0
  84. package/dist/{pglite-seed-CQJ97bEt.js → pglite-seed-BsEPByVM.js} +4 -4
  85. package/dist/{pglite-seed-CQJ97bEt.js.map → pglite-seed-BsEPByVM.js.map} +1 -1
  86. package/dist/{preferences-store-Cm0BoiHA.js → preferences-store-DANUajdg.js} +4 -4
  87. package/dist/{preferences-store-Cm0BoiHA.js.map → preferences-store-DANUajdg.js.map} +1 -1
  88. package/dist/prerendered-shell-DxCUDEXL.js +45 -0
  89. package/dist/prerendered-shell-DxCUDEXL.js.map +1 -0
  90. package/dist/{reactor-DHJyk5ow.js → reactor-B_aOB2bl.js} +50 -46
  91. package/dist/reactor-B_aOB2bl.js.map +1 -0
  92. package/dist/reactor-chat-LAB-9G3G.js +50 -0
  93. package/dist/reactor-chat-LAB-9G3G.js.map +1 -0
  94. package/dist/reactor.worker.js +85 -27
  95. package/dist/reactor.worker.js.map +1 -1
  96. package/dist/{registerServiceWorker-DT6t8wjg.js → registerServiceWorker-CkVxA2KC.js} +4 -4
  97. package/dist/{registerServiceWorker-DT6t8wjg.js.map → registerServiceWorker-CkVxA2KC.js.map} +1 -1
  98. package/dist/route-components-BkztQruF.js +148 -0
  99. package/dist/route-components-BkztQruF.js.map +1 -0
  100. package/dist/route-tree.d.ts +2229 -0
  101. package/dist/route-tree.d.ts.map +1 -0
  102. package/dist/route-tree.js +211 -0
  103. package/dist/route-tree.js.map +1 -0
  104. package/dist/router-BQACPBhO.js +4 -0
  105. package/dist/router-CLly15sT.js +604 -0
  106. package/dist/router-CLly15sT.js.map +1 -0
  107. package/dist/router.d.ts +4 -0
  108. package/dist/router.js +7 -0
  109. package/dist/{runtime-config-DI5OfIC6.js → runtime-config-DdN1Frg7.js} +6 -9
  110. package/dist/runtime-config-DdN1Frg7.js.map +1 -0
  111. package/dist/{sentry-jfDyrxdX.js → sentry-CJb7--mu.js} +7 -4
  112. package/dist/{sentry-jfDyrxdX.js.map → sentry-CJb7--mu.js.map} +1 -1
  113. package/dist/settings-CjvK8OKA.js +91 -0
  114. package/dist/settings-CjvK8OKA.js.map +1 -0
  115. package/dist/{SettingsModal-BJVPEHbo.js → settings-KUPb4Ccj.js} +126 -83
  116. package/dist/settings-KUPb4Ccj.js.map +1 -0
  117. package/dist/shell-head.html +1 -0
  118. package/dist/shell.html +1 -0
  119. package/dist/sidebar-BXf8OEwm.d.ts +34 -0
  120. package/dist/sidebar-BXf8OEwm.d.ts.map +1 -0
  121. package/dist/sidebar-lAVFRsni.js +31 -0
  122. package/dist/sidebar-lAVFRsni.js.map +1 -0
  123. package/dist/start-connect.d.ts +4 -1
  124. package/dist/start-connect.d.ts.map +1 -1
  125. package/dist/start-connect.js +9 -5
  126. package/dist/start-connect.js.map +1 -1
  127. package/dist/style.css +36 -18
  128. package/dist/{useRegistryPackages-3EcR3GOh.js → useRegistryPackages-BqIWwXV-.js} +5 -5
  129. package/dist/{useRegistryPackages-3EcR3GOh.js.map → useRegistryPackages-BqIWwXV-.js.map} +1 -1
  130. package/fonts.css +177 -0
  131. package/package.json +51 -22
  132. package/scripts/critical-css.ts +243 -0
  133. package/scripts/prerender-shell.ts +100 -0
  134. package/src/routeTree.gen.ts +293 -0
  135. package/src/router/connect-router.ts +170 -0
  136. package/src/router/drive-route-loader.ts +116 -0
  137. package/src/router/index.ts +51 -0
  138. package/src/router/navigation.ts +230 -0
  139. package/src/router/perf-marks.test.tsx +98 -0
  140. package/src/router/perf-marks.ts +97 -0
  141. package/src/router/register.ts +9 -0
  142. package/src/router/route-components.tsx +98 -0
  143. package/src/router/route-tree.ts +88 -0
  144. package/src/router/scroll.ts +69 -0
  145. package/src/router/search.ts +66 -0
  146. package/src/router/settings.ts +120 -0
  147. package/src/router/sidebar.ts +55 -0
  148. package/src/router/titles.test.ts +24 -0
  149. package/src/router/titles.ts +33 -0
  150. package/src/routes/__root.tsx +28 -0
  151. package/src/routes/core/_app/$.tsx +13 -0
  152. package/src/routes/core/_app/_content/d/$driveSlug/{-$nodeSlug}.tsx +52 -0
  153. package/src/routes/core/_app/_content/index.tsx +3 -0
  154. package/src/routes/core/_app/_content.tsx +9 -0
  155. package/src/routes/core/_app/settings/about.tsx +20 -0
  156. package/src/routes/core/_app/settings/ai-assistant.tsx +20 -0
  157. package/src/routes/core/_app/settings/danger-zone.tsx +21 -0
  158. package/src/routes/core/_app/settings/default-editors.tsx +20 -0
  159. package/src/routes/core/_app/settings/package-manager.tsx +20 -0
  160. package/src/routes/core/_app/settings.tsx +35 -0
  161. package/src/routes/core/_app.tsx +10 -0
  162. package/dist/AddDriveModal-C5odBO8y.js.map +0 -1
  163. package/dist/ClearStorageModal-nzpz8MeW.js.map +0 -1
  164. package/dist/DocumentVersionUnsupportedModal-C4fy7fZ6.js.map +0 -1
  165. package/dist/OpenFileDocumentsModal-BOmFtxS1.js.map +0 -1
  166. package/dist/SettingsModal-BJVPEHbo.js.map +0 -1
  167. package/dist/app-loader-CNCzLxgV.js +0 -2379
  168. package/dist/app-loader-CNCzLxgV.js.map +0 -1
  169. package/dist/app-loader-DvnGgSyC.js +0 -4
  170. package/dist/app-skeleton--Me5zlSz.js.map +0 -1
  171. package/dist/boot-CNW7ypcB.js.map +0 -1
  172. package/dist/components-BKUI79po.js +0 -5
  173. package/dist/load-BxQ82Cxc.js.map +0 -1
  174. package/dist/multi-reactor-BG-DqUcm.js.map +0 -1
  175. package/dist/package-manager-BPVMRBoV.js.map +0 -1
  176. package/dist/pglite-migrate-core-BcXcImng.js.map +0 -1
  177. package/dist/reactor-DHJyk5ow.js.map +0 -1
  178. package/dist/runtime-config-DI5OfIC6.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-loader-CNCzLxgV.js","sources":["../src/components/error-boundary.tsx","../src/components/analytics.tsx","../src/hooks/usePluginComposition.ts","../src/components/if-plugin.tsx","../src/services/openpanel/client.ts","../src/services/openpanel/events.json","../src/services/openpanel/events.ts","../src/services/openpanel/processor.ts","../src/services/openpanel/factory.ts","../src/components/openpanel-traits.ts","../src/components/openpanel.tsx","../src/components/document-editor-container.tsx","../src/components/editor-loader.tsx","../src/components/app-container.tsx","../src/hooks/useFailedInstallations.ts","../src/hooks/useInitSentry.ts","../src/hooks/usePendingInstallations.ts","../src/hooks/useUndoRedoShortcuts.ts","../src/context/sentry-provider.tsx","../src/utils/document-editor-debug-tools.ts","../src/utils/launch-queue.ts","../src/utils/open-file-uploads.ts","../src/utils/openUrl.ts","../src/utils/pglite-migration.ts","../src/components/reactor-chat.tsx","../src/components/missing-model-banner.tsx","../src/components/open-file-upload-list.tsx","../src/components/package-install-prompt.tsx","../src/components/renown-adapter-descriptors.ts","../src/components/renown-wallet-providers.tsx","../src/components/app.tsx","../src/components/dots-loader.tsx","../src/components/drive-icon.tsx","../src/components/document-upgrade-toast.tsx","../src/components/editors.tsx","../src/components/footer.tsx","../src/components/root.tsx","../src/components/use-drive-auth-gate.ts","../src/pages/content.tsx","../src/components/router.tsx","../src/components/search-bar.tsx","../src/components/sidebar.tsx","../src/components/connection-banner.tsx","../src/components/migration-banner.tsx","../src/components/modal/modals-container.tsx","../src/components/service-worker-update-prompt.tsx","../src/components/stored-documents-refused.tsx","../src/components/app-loader.tsx"],"sourcesContent":["import { Icon, PowerhouseButton } from \"@powerhousedao/design-system\";\nimport { childLogger } from \"document-model\";\nimport type { ReactNode } from \"react\";\nimport {\n ErrorBoundary as ReactErrorBoundary,\n type FallbackProps,\n} from \"react-error-boundary\";\n\nconst logger = childLogger([\"Connect\"]);\n\n/**\n * Available fallback UI variants for the ErrorBoundary component.\n *\n * - `\"silent\"` - Renders nothing when an error occurs (useful for modals)\n * - `\"text\"` - Displays a simple centered text message\n * - `\"detailed\"` - Shows full error details including message and JSON representation\n */\ntype ErrorFallbackVariant = \"silent\" | \"text\" | \"detailed\";\n\n/**\n * Base props shared by all ErrorBoundary configurations.\n */\ntype BaseErrorBoundaryProps = {\n /** Content to wrap with error boundary protection */\n children: ReactNode;\n /** Optional callback invoked when an error is caught (in addition to logging) */\n onError?: (error: Error, info: React.ErrorInfo) => void;\n /** When any value in this array changes, the error boundary resets */\n resetKeys?: unknown[];\n /** Logger context path for error logging (e.g., [\"Connect\", \"Editor\"]) */\n loggerContext?: string[];\n};\n\n/**\n * Props for using a predefined fallback variant.\n */\ntype VariantErrorBoundaryProps = BaseErrorBoundaryProps & {\n /** The fallback UI variant to display on error */\n variant: ErrorFallbackVariant;\n /** Custom message for the \"text\" variant (default: \"Something went wrong\") */\n fallbackMessage?: string;\n};\n\n/**\n * Props for using a custom fallback render function.\n */\ntype CustomFallbackErrorBoundaryProps = BaseErrorBoundaryProps & {\n /** Custom render function for the fallback UI */\n fallbackRender: (props: FallbackProps) => ReactNode;\n};\n\n/**\n * Union type for all ErrorBoundary prop configurations.\n * Use either a variant or a custom fallbackRender, but not both.\n */\ntype ErrorBoundaryProps =\n | VariantErrorBoundaryProps\n | CustomFallbackErrorBoundaryProps;\n\nfunction hasCustomFallback(\n props: ErrorBoundaryProps,\n): props is CustomFallbackErrorBoundaryProps {\n return \"fallbackRender\" in props;\n}\n\nfunction SilentFallback() {\n return null;\n}\n\n/**\n * Simple text-based fallback component.\n * Displays a centered message when an error occurs.\n */\nfunction TextFallback({\n message = \"Something went wrong\",\n}: {\n message?: string;\n}) {\n return (\n <div className=\"text-center wrap-break-word text-foreground\">{message}</div>\n );\n}\n\n/**\n * Detailed fallback component showing full error information.\n * Displays error message with a collapsible details section.\n * Useful for development and debugging purposes.\n */\nfunction DetailedFallback({ error, resetErrorBoundary }: FallbackProps) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n const errorDetails =\n error instanceof Error\n ? (error.stack ?? String(error.cause))\n : JSON.stringify(error, null, 2);\n const hasDetails = errorDetails !== \"{}\";\n\n return (\n <div className=\"z-10 mx-auto flex max-w-[80%] flex-1 items-center justify-center p-6\">\n <div className=\"w-full max-w-lg rounded-lg border border-border bg-card p-6 text-foreground shadow-sm\">\n <div className=\"mb-3 flex items-center gap-2\">\n <Icon name=\"Error\" className=\"size-5 shrink-0 text-destructive\" />\n <h1 className=\"text-lg font-semibold text-foreground\">\n Something went wrong\n </h1>\n </div>\n <p className=\"mb-4 text-sm wrap-break-word text-foreground\">\n {errorMessage}\n </p>\n {hasDetails && (\n <details className=\"group\">\n <summary className=\"cursor-pointer text-sm font-medium text-foreground underline select-none hover:hover-effect\">\n Show details\n </summary>\n <pre className=\"mt-2 max-h-48 overflow-auto rounded-sm bg-muted p-3 text-xs text-foreground\">\n {errorDetails}\n </pre>\n </details>\n )}\n <PowerhouseButton\n type=\"button\"\n onClick={resetErrorBoundary}\n className=\"mt-4 px-3 py-1.5 text-base font-medium\"\n >\n Try again\n </PowerhouseButton>\n </div>\n </div>\n );\n}\n\n/**\n * Centered error message fallback component.\n * Displays the error message in a centered, full-size container.\n * Suitable for use as a custom fallbackRender when you need simple error display.\n */\nfunction CenteredErrorMessage({ error }: FallbackProps) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return (\n <div className=\"flex size-full items-center justify-center p-6\">\n <h3 className=\"max-w-lg min-w-0 text-center text-lg font-semibold wrap-break-word text-foreground\">\n {errorMessage}\n </h3>\n </div>\n );\n}\n\nfunction getFallbackComponent(\n variant: ErrorFallbackVariant,\n fallbackMessage?: string,\n): (props: FallbackProps) => ReactNode {\n switch (variant) {\n case \"silent\":\n return SilentFallback;\n case \"text\":\n return () => <TextFallback message={fallbackMessage} />;\n case \"detailed\":\n return DetailedFallback;\n default:\n return CenteredErrorMessage;\n }\n}\n\n/**\n * Unified error boundary component for catching and handling React errors.\n *\n * Built on top of `react-error-boundary`, this component provides:\n * - Automatic error logging with configurable context\n * - Multiple fallback UI variants (silent, text, detailed)\n * - Support for custom fallback render functions\n * - Reset capability via `resetKeys`\n *\n * @example\n * // Using a predefined variant\n * <ErrorBoundary variant=\"detailed\" loggerContext={[\"Connect\", \"Editor\"]}>\n * <EditorComponent />\n * </ErrorBoundary>\n *\n * @example\n * // Using a custom message with the text variant\n * <ErrorBoundary variant=\"text\" fallbackMessage=\"Failed to load drives\">\n * <DrivesList />\n * </ErrorBoundary>\n *\n * @example\n * // Using a custom fallback render\n * <ErrorBoundary\n * fallbackRender={CenteredErrorMessage}\n * onError={(error) => trackError(error)}\n * >\n * <MyComponent />\n * </ErrorBoundary>\n *\n * @example\n * // Silent mode for modals (renders null on error)\n * <ErrorBoundary variant=\"silent\" loggerContext={[\"Connect\", \"Modals\"]}>\n * <ModalContent />\n * </ErrorBoundary>\n */\nexport function ErrorBoundary(props: ErrorBoundaryProps) {\n const { children, onError, resetKeys, loggerContext } = props;\n\n const handleError = (error: Error, info: React.ErrorInfo) => {\n if (\n error.message.includes(\"Failed to fetch dynamically imported module\") &&\n error.message.includes(\"node_modules/.vite\")\n ) {\n console.error(error);\n console.log(\"Outdated chunk detected, reloading page...\");\n window.location.reload();\n return;\n }\n\n const contextLogger = loggerContext ? childLogger(loggerContext) : logger;\n contextLogger.error(\"@error @info\", error, info);\n onError?.(error, info);\n };\n\n const fallbackRender = hasCustomFallback(props)\n ? props.fallbackRender\n : getFallbackComponent(props.variant, props.fallbackMessage);\n\n return (\n <ReactErrorBoundary\n fallbackRender={fallbackRender}\n onError={handleError}\n resetKeys={resetKeys}\n >\n {children}\n </ReactErrorBoundary>\n );\n}\n\nexport { CenteredErrorMessage, DetailedFallback, TextFallback };\nexport type { FallbackProps };\n","import { connectConfig } from \"@powerhousedao/connect/config\";\nimport { useAcceptedCookies } from \"../hooks/preferences-store.js\";\nimport { useEffect } from \"react\";\n\ndeclare global {\n interface Window {\n gtag?: (...args: any[]) => void;\n dataLayer?: any[];\n }\n}\n\nfunction gtag(...args: (string | Date)[]) {\n window.dataLayer?.push(...args);\n}\n\nexport const Analytics = () => {\n const gaTrackingId = connectConfig.gaTrackingId;\n const [{ analytics }] = useAcceptedCookies();\n const useAnalytics = gaTrackingId && analytics;\n\n useEffect(() => {\n if (useAnalytics) {\n // Create the GA script tag\n const script = document.createElement(\"script\");\n script.src = `https://www.googletagmanager.com/gtag/js?id=${gaTrackingId}`;\n script.async = true;\n document.head.appendChild(script);\n\n // Initialize GA\n window.dataLayer = window.dataLayer || [];\n\n gtag(\"js\", new Date());\n gtag(\"config\", gaTrackingId);\n\n // Clean up the script if no longer enabled\n return () => {\n document.head.removeChild(script);\n };\n }\n }, [useAnalytics, gaTrackingId]);\n\n return null;\n};\n","import type { PHConnectCompositionEntry } from \"@powerhousedao/shared/clis\";\nimport { getRuntimeConfig } from \"../runtime-config.js\";\n\n/**\n * Plugin-presence reads for the UI (rewire R3, step toward generic-shell\n * deletability). The served runtime config carries `connect.composition` — the\n * list of plugins the host declared — when uniform runners project it. UI can\n * gate on a plugin being present (\"presence is activation\").\n *\n * Classic semantics are preserved: when there is NO declared composition\n * (flag-off, or a host without a plugins list), `null` is returned and every\n * plugin is treated as active — so the classic chrome renders exactly as\n * before. Gating only hides something when a composition IS declared and the\n * plugin is absent from it.\n */\nexport function getActivePluginModules(): ReadonlySet<string> | null {\n try {\n const composition = getRuntimeConfig().connect?.composition as\n | PHConnectCompositionEntry[]\n | undefined;\n if (!composition) return null;\n return new Set(composition.map((entry) => entry.module));\n } catch {\n // Config cache not warm (shouldn't happen post-boot) — fail open to classic.\n return null;\n }\n}\n\nexport function isPluginActive(module: string): boolean {\n const active = getActivePluginModules();\n return active === null ? true : active.has(module);\n}\n\n/** Hook form; the composition is fixed for the page's lifetime, so this is a\n * plain synchronous read (no subscription needed). */\nexport function useIsPluginActive(module: string): boolean {\n return isPluginActive(module);\n}\n","import type { ReactNode } from \"react\";\nimport { useIsPluginActive } from \"../hooks/usePluginComposition.js\";\n\n/**\n * Renders its children only when a plugin is present in the served\n * composition — the runtime gate for generic-chrome deletability (rewire R3).\n *\n * This is the demonstration step ahead of extracting the generic components\n * into their own package: it makes \"remove the generic plugin → the chrome is\n * gone\" true at render time while the code still lives in the Connect app.\n * When those components move to `@powerhousedao/connect-generic`, this gate\n * becomes the seam where the package is dynamically imported (or not) instead\n * of merely not rendered.\n *\n * Presence is activation, classic-preserving: with no declared composition,\n * every plugin reads active, so the chrome renders unchanged.\n */\nexport function IfPlugin(props: {\n module: string;\n children: ReactNode;\n /** Rendered when the plugin is absent from a declared composition. */\n fallback?: ReactNode;\n}): ReactNode {\n const active = useIsPluginActive(props.module);\n return active ? props.children : (props.fallback ?? null);\n}\n","import type { OpenPanel } from \"@openpanel/web\";\n\nimport { clearOpenPanelBuffer, drainOpenPanelBuffer } from \"./buffer.js\";\nimport type { OpenPanelConfig } from \"./types.js\";\n\nlet client: OpenPanel | undefined;\n\n/**\n * Returns the cached `OpenPanel` singleton, building it on first call.\n *\n * When `config.clientId` is empty it returns `undefined` without importing\n * `@openpanel/web`, so the bundler can tree-shake the SDK out of production.\n */\nexport async function getOpenPanelClient(\n config: OpenPanelConfig,\n): Promise<OpenPanel | undefined> {\n if (!config.clientId) {\n return undefined;\n }\n\n if (client) {\n return client;\n }\n\n // Dynamic import keeps @openpanel/web out of the initial chunk.\n const { OpenPanel: OpenPanelClass } = await import(\"@openpanel/web\");\n\n client = new OpenPanelClass({\n clientId: config.clientId,\n ...(config.apiUrl ? { apiUrl: config.apiUrl } : {}),\n trackScreenViews: true,\n trackOutgoingLinks: true,\n });\n\n // The web SDK has no `globalProperties` constructor option.\n client.setGlobalProperties({ app: \"connect\" });\n\n // Runs once (the `if (client)` guard above), so the buffer is never\n // double-drained.\n drainOpenPanelBuffer(client);\n\n return client;\n}\n\n/**\n * Clears the cached singleton and the pre-init buffer. Call on consent\n * revocation or during tests; buffered events are discarded, not replayed.\n */\nexport function resetOpenPanelClient(): void {\n client = undefined;\n clearOpenPanelBuffer();\n}\n","","import type { OperationWithContext } from \"@powerhousedao/shared/document-model\";\nimport { z } from \"zod\";\n\nimport type { OpenPanelEventMapping } from \"./types.js\";\nimport rawEvents from \"./events.json\" with { type: \"json\" };\n\nconst EventMappingSchema = z\n .object({\n documentType: z.string().min(1),\n actionTypes: z.array(z.string().min(1)).min(1),\n alias: z.string().optional(),\n })\n .strict();\n\nconst EventMappingsSchema = z.array(EventMappingSchema).readonly();\n\n/**\n * Parses and validates the event mapping table, returning the validated array\n * and an O(1) lookup map. Accepts a `raw` override for tests. Throws on zod\n * failures and on duplicate `(documentType, actionType)` pairs.\n */\nexport function loadEvents(raw: unknown = rawEvents): {\n mappings: readonly OpenPanelEventMapping[];\n lookupMap: Map<string, Map<string, OpenPanelEventMapping>>;\n} {\n const result = EventMappingsSchema.safeParse(raw);\n if (!result.success) {\n throw new Error(`Invalid OpenPanel events.json: ${result.error.message}`);\n }\n\n const mappings = result.data as readonly OpenPanelEventMapping[];\n const lookupMap = new Map<string, Map<string, OpenPanelEventMapping>>();\n\n for (const mapping of mappings) {\n let inner = lookupMap.get(mapping.documentType);\n if (!inner) {\n inner = new Map<string, OpenPanelEventMapping>();\n lookupMap.set(mapping.documentType, inner);\n }\n\n for (const actionType of mapping.actionTypes) {\n if (inner.has(actionType)) {\n throw new Error(\n `Duplicate OpenPanel event mapping for ${mapping.documentType}/${actionType}`,\n );\n }\n inner.set(actionType, mapping);\n }\n }\n\n return { mappings, lookupMap };\n}\n\nconst { mappings: defaultMappings, lookupMap: defaultLookupMap } = loadEvents();\n\n/** Validated mapping array from the bundled events.json. */\nexport const eventMappings: readonly OpenPanelEventMapping[] = defaultMappings;\n\n/** O(1) lookup map: documentType → actionType → mapping. */\nexport const eventLookupMap: Map<\n string,\n Map<string, OpenPanelEventMapping>\n> = defaultLookupMap;\n\n/**\n * Normalizes a document type into a safe event-name segment: lowercased, `/`\n * replaced with `.`, and any character outside `[a-z0-9._-]` stripped.\n * e.g. `powerhouse/document-drive` → `powerhouse.document-drive`.\n */\nexport function normalize(documentType: string): string {\n return documentType\n .toLowerCase()\n .replace(/\\//g, \".\")\n .replace(/[^a-z0-9._-]/g, \"\");\n}\n\n/**\n * Derives the OpenPanel event name: `mapping.alias` when present, otherwise\n * `${normalize(documentType)}.${actionType.toLowerCase()}`.\n */\nexport function deriveEventName(\n mapping: OpenPanelEventMapping,\n op: OperationWithContext,\n): string {\n if (mapping.alias) {\n return mapping.alias;\n }\n return `${normalize(op.context.documentType)}.${op.operation.action.type.toLowerCase()}`;\n}\n\n/**\n * Builds the default properties attached to every OpenPanel event. The `app`\n * property is stamped globally by the client, not here.\n */\nexport function buildDefaultProperties(op: OperationWithContext): {\n documentType: string;\n actionType: string;\n documentId: string;\n scope: string;\n branch: string;\n} {\n return {\n documentType: op.context.documentType,\n actionType: op.operation.action.type,\n documentId: op.context.documentId,\n scope: op.context.scope,\n branch: op.context.branch,\n };\n}\n","import type { OperationWithContext } from \"@powerhousedao/shared/document-model\";\nimport type { IProcessor } from \"@powerhousedao/shared/processors\";\n\nimport { buildDefaultProperties, deriveEventName } from \"./events.js\";\nimport type { OpenPanelEventMapping } from \"./types.js\";\n\n/**\n * Minimal structural type for the injected analytics client. Keeps\n * `@openpanel/web` out of the runtime import graph and makes test fakes\n * trivial; the real `OpenPanel` instance satisfies it structurally.\n */\nexport type OpenPanelTracker = {\n track: (name: string, properties?: Record<string, unknown>) => unknown;\n flush?: () => void;\n};\n\n/**\n * Read-only reactor `IProcessor` that translates matching document operations\n * into OpenPanel analytics events. Operations whose `(documentType, actionType)`\n * pair is absent from the lookup map are skipped; per-operation errors are\n * routed to `onError` and never thrown back to the manager.\n */\nexport class OpenPanelProcessor implements IProcessor {\n constructor(\n private readonly client: OpenPanelTracker,\n private readonly lookupMap: Map<string, Map<string, OpenPanelEventMapping>>,\n private readonly onError: (\n err: unknown,\n op?: OperationWithContext,\n ) => void = (err) =>\n console.warn(\"[OpenPanelProcessor] Error tracking event:\", err),\n ) {}\n\n async onOperations(operations: OperationWithContext[]): Promise<void> {\n for (const op of operations) {\n const inner = this.lookupMap.get(op.context.documentType);\n if (!inner) continue;\n\n const mapping = inner.get(op.operation.action.type);\n if (!mapping) continue;\n\n const name = deriveEventName(mapping, op);\n const payload = buildDefaultProperties(op);\n\n try {\n await this.client.track(name, payload);\n } catch (err) {\n this.onError(err, op);\n }\n }\n }\n\n onDisconnect(): Promise<void> {\n this.client.flush?.();\n return Promise.resolve();\n }\n}\n","import type { OperationWithContext } from \"@powerhousedao/shared/document-model\";\nimport type { PHDocumentHeader } from \"@powerhousedao/shared/document-model\";\nimport type {\n ProcessorFactory,\n ProcessorRecord,\n} from \"@powerhousedao/shared/processors\";\n\nimport { OpenPanelProcessor, type OpenPanelTracker } from \"./processor.js\";\nimport type { OpenPanelEventMapping } from \"./types.js\";\n\nexport type OpenPanelProcessorFactoryConfig = {\n /** The initialized analytics client to forward events to. */\n client: OpenPanelTracker;\n\n /** Loaded event mapping data, as returned by `loadEvents()`. */\n events: {\n mappings: readonly OpenPanelEventMapping[];\n lookupMap: Map<string, Map<string, OpenPanelEventMapping>>;\n };\n\n /** Replay window. Defaults to `\"current\"` (no historical replay). */\n startFrom?: \"current\" | \"beginning\";\n\n /** Error handler; defaults to `console.warn`. */\n onError?: (err: unknown, op?: OperationWithContext) => void;\n};\n\n/**\n * Returns a `ProcessorFactory` that, for each drive, creates a single\n * `OpenPanelProcessor` record whose `filter.documentType` is the union of all\n * document types present in the event mapping table.\n */\nexport function createOpenPanelProcessorFactory(\n config: OpenPanelProcessorFactoryConfig,\n): ProcessorFactory {\n return function openPanelProcessorFactory(\n _driveHeader: PHDocumentHeader,\n ): ProcessorRecord[] {\n const documentType = Array.from(config.events.lookupMap.keys());\n\n const processor = new OpenPanelProcessor(\n config.client,\n config.events.lookupMap,\n config.onError,\n );\n\n const record: ProcessorRecord = {\n processor,\n filter: { documentType },\n startFrom: config.startFrom ?? \"current\",\n };\n\n return [record];\n };\n}\n","import type { User } from \"@renown/sdk\";\n\n/**\n * Builds the OpenPanel identity traits from a renown User.\n *\n * Canonical trait schema (shared with Renown and Vetra — each app sends every\n * field it has data for, under these names):\n * - `address`, `did`, `networkId`, `chainId`, `caip2` — wallet/chain facts.\n * - `ensName`, `ensAvatar` — raw ENS facts.\n * - `username`, `userImage`, `profileDocumentId`, `profileCreatedAt` — raw\n * Renown profile facts.\n * - `accountType` — wallet-adapter concept; only Renown has it.\n *\n * Rules:\n * - `credential` (contains a JWT) is **never** forwarded.\n * - Traits carry raw facts only; resolved presentation values (avatar,\n * display name) go in OpenPanel's native identify fields — see\n * {@link buildIdentifyPayload}.\n * - Optional fields (`ens`, `profile`) are only included when their value is\n * non-nullish (guards against `null` from `RenownProfile` fields as well\n * as plain `undefined`).\n *\n * Mirror the Sentry pattern in `store/user.ts`: destructure off `credential`\n * first, then assemble the trait payload from the remainder.\n */\nexport function buildTraits(user: User): Record<string, unknown> {\n // Destructure credential off so it can never accidentally make it into the\n // returned object.\n const { credential: _credential, ...rest } = user;\n\n const traits: Record<string, unknown> = {\n address: rest.address,\n did: rest.did,\n networkId: rest.networkId,\n chainId: rest.chainId,\n caip2: `${rest.networkId}:${rest.chainId}`,\n };\n\n // ens fields — optional on the User type\n if (rest.ens?.name != null) {\n traits.ensName = rest.ens.name;\n }\n if (rest.ens?.avatarUrl != null) {\n traits.ensAvatar = rest.ens.avatarUrl;\n }\n\n // profile fields — optional on InternalUser; RenownProfile members can be\n // null, so guard with != null (catches both null and undefined)\n if (rest.profile?.username != null) {\n traits.username = rest.profile.username;\n }\n if (rest.profile?.userImage != null) {\n traits.userImage = rest.profile.userImage;\n }\n if (rest.profile?.documentId != null) {\n traits.profileDocumentId = rest.profile.documentId;\n }\n if (rest.profile?.createdAt != null) {\n traits.profileCreatedAt = rest.profile.createdAt;\n }\n\n return traits;\n}\n\n/**\n * Builds the full `identify()` payload:\n * - `profileId` is the wallet address — the cross-app profile key shared with\n * Renown and Vetra.\n * - `avatar` / `firstName` are OpenPanel's native profile fields (they drive\n * the picture and name in the dashboard UI), resolved as\n * `userImage ?? ensAvatar` and `ensName ?? username`.\n * - `properties` are the raw traits from {@link buildTraits}.\n */\nexport function buildIdentifyPayload(user: User): {\n profileId: string;\n avatar?: string;\n firstName?: string;\n properties: Record<string, unknown>;\n} {\n const avatar = user.profile?.userImage ?? user.ens?.avatarUrl;\n const firstName = user.ens?.name ?? user.profile?.username;\n\n return {\n profileId: user.address,\n ...(avatar != null ? { avatar } : {}),\n ...(firstName != null ? { firstName } : {}),\n properties: buildTraits(user),\n };\n}\n","import type { OpenPanel as OpenPanelClient } from \"@openpanel/web\";\nimport { connectConfig } from \"@powerhousedao/connect/config\";\nimport { useAcceptedCookies } from \"../hooks/preferences-store.js\";\nimport {\n createOpenPanelProcessorFactory,\n eventLookupMap,\n eventMappings,\n getOpenPanelClient,\n resetOpenPanelClient,\n} from \"@powerhousedao/connect/services\";\nimport {\n useReactorClientModule,\n useUser,\n} from \"@powerhousedao/reactor-browser\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport { buildIdentifyPayload } from \"./openpanel-traits.js\";\n\ndeclare global {\n interface Window {\n openPanel?: OpenPanelClient;\n }\n}\n\n/**\n * `OpenPanel` is a `null`-rendering component that manages the full lifecycle\n * of the OpenPanel analytics subsystem.\n *\n * Gates:\n * - `useAcceptedCookies().analytics === true` — the existing analytics cookie.\n * - `connectConfig.openPanel.clientId` non-empty — no client ID → no-op.\n *\n * Behaviour when both gates pass:\n * 1. Lazy-imports `@openpanel/web` and builds the singleton via\n * `getOpenPanelClient(connectConfig.openPanel)`.\n * 2. Exposes the client on `window.openPanel` for the card-6\n * `useOpenPanelAnalytics()` hook to consume.\n * 3. If `connectConfig.openPanel.trackOperations`, registers the processor\n * factory against `processorManager` so document operations are forwarded.\n * 4. Calls `client.identify()` when the renown user transitions from\n * `undefined` → defined (login). The profile ID is the wallet address —\n * the cross-app key shared with Renown and Vetra.\n * 5. Calls `client.clear()` when the user transitions from defined →\n * `undefined` (logout).\n *\n * Teardown (unmount **or** consent revocation):\n * - `unregisterFactory(\"openpanel\")` to remove the processor.\n * - `resetOpenPanelClient()` to clear the singleton.\n * - `window.openPanel` is cleared.\n *\n * Mirrors the Sentry pattern in `store/user.ts` for login/logout detection.\n * Analytics failures are caught and forwarded to `console.warn` — they must\n * never throw into the application.\n *\n * Mounted next to `<Analytics />` in `app.tsx`.\n */\nexport function OpenPanel(): null {\n const [{ analytics }] = useAcceptedCookies();\n const user = useUser();\n const module = useReactorClientModule();\n const reactorClientModule = module?.kind === \"browser\" ? module : undefined;\n\n const [client, setClient] = useState<OpenPanelClient | undefined>();\n\n /**\n * Tracks the previous `user` value so we can detect the two transitions:\n * undefined → defined (login)\n * defined → undefined (logout)\n */\n const prevUserRef = useRef<ReturnType<typeof useUser>>(undefined);\n\n const enabled = analytics && !!connectConfig.openPanel.clientId;\n const processorManager = reactorClientModule?.reactorModule?.processorManager;\n\n useEffect(() => {\n if (!enabled) return;\n\n let cancelled = false;\n\n // Read via a call — TS would otherwise narrow direct reads to always-false.\n const isCancelled = () => cancelled;\n\n const setup = async () => {\n let builtClient: OpenPanelClient | undefined;\n try {\n builtClient = await getOpenPanelClient(connectConfig.openPanel);\n } catch (err) {\n console.warn(\"[OpenPanel] Failed to build client:\", err);\n return;\n }\n\n if (isCancelled() || !builtClient) return;\n\n setClient(builtClient);\n window.openPanel = builtClient;\n\n if (connectConfig.openPanel.trackOperations && processorManager) {\n try {\n await processorManager.registerFactory(\n \"openpanel\",\n createOpenPanelProcessorFactory({\n client: builtClient,\n events: { mappings: eventMappings, lookupMap: eventLookupMap },\n startFrom: \"current\",\n }),\n );\n // Guard against teardown happening while registerFactory was in flight.\n if (isCancelled()) {\n await processorManager\n .unregisterFactory(\"openpanel\")\n .catch((err: unknown) =>\n console.warn(\n \"[OpenPanel] Failed to unregister factory after cancellation:\",\n err,\n ),\n );\n }\n } catch (err) {\n console.warn(\n \"[OpenPanel] Failed to register processor factory:\",\n err,\n );\n }\n }\n };\n\n void setup();\n\n return () => {\n cancelled = true;\n\n // Reset the user-tracking ref so that when consent is re-granted (and a\n // new client is built) any currently-logged-in user is re-identified.\n prevUserRef.current = undefined;\n\n if (connectConfig.openPanel.trackOperations && processorManager) {\n void processorManager\n .unregisterFactory(\"openpanel\")\n .catch((err: unknown) =>\n console.warn(\n \"[OpenPanel] Failed to unregister processor factory:\",\n err,\n ),\n );\n }\n\n resetOpenPanelClient();\n window.openPanel = undefined;\n setClient(undefined);\n };\n }, [enabled, processorManager]);\n\n // detect login/logout transitions\n useEffect(() => {\n if (!enabled || !client) return;\n\n const prev = prevUserRef.current;\n prevUserRef.current = user;\n\n if (!prev && user) {\n // Login: undefined → defined (or client became available with user\n // already logged in — prevUserRef is undefined in both cases).\n try {\n void client.identify(buildIdentifyPayload(user));\n } catch (err) {\n console.warn(\"[OpenPanel] Failed to identify user:\", err);\n }\n } else if (prev && !user) {\n // Logout: defined → undefined\n try {\n void client.clear();\n } catch (err) {\n console.warn(\"[OpenPanel] Failed to clear user:\", err);\n }\n }\n }, [client, user, enabled]);\n\n return null;\n}\n","import { DocumentEditor } from \"@powerhousedao/connect/components\";\nimport {\n setSelectedNode,\n useNodeParentFolderById,\n useSelectedDocument,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useMemo } from \"react\";\n\nexport function DocumentEditorContainer() {\n const [selectedDocument] = useSelectedDocument();\n const parentFolder = useNodeParentFolderById(selectedDocument.header.id);\n\n // TODO: unused\n const _onOpenSwitchboardLink = useMemo(() => {\n return async () => {\n //\n };\n }, []);\n\n const _onClose = useCallback(() => {\n setSelectedNode(parentFolder);\n }, [parentFolder]);\n\n return (\n <div\n id=\"document-editor-container\"\n className=\"flex-1\"\n data-document-type={selectedDocument.header.documentType}\n >\n <DocumentEditor document={selectedDocument} />\n </div>\n );\n}\n","import { DefaultEditorLoader } from \"@powerhousedao/design-system/connect\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { useEffect, useState } from \"react\";\n\ntype Props = ComponentProps<typeof DefaultEditorLoader> & {\n loadingTimeout?: number;\n customEditorLoader?: ReactNode;\n};\nexport function EditorLoader(props: Props) {\n const [showLoading, setShowLoading] = useState(false);\n\n // only shows the loader after some time has passed\n useEffect(() => {\n setTimeout(() => {\n setShowLoading(true);\n }, props.loadingTimeout ?? 200);\n }, [props]);\n\n if (!showLoading) return null;\n\n const { customEditorLoader, ...defaultProps } = props;\n\n if (customEditorLoader) return <>{customEditorLoader}</>;\n\n return <DefaultEditorLoader {...defaultProps} />;\n}\n","import { DropZoneWrapper } from \"@powerhousedao/design-system/connect\";\nimport { GenericDriveExplorer } from \"@powerhousedao/powerhouse-vetra-packages/editors\";\nimport {\n useAppModuleById,\n useDefaultAppModule,\n useSelectedDocumentId,\n useSelectedDriveSafe,\n} from \"@powerhousedao/reactor-browser\";\nimport { Suspense } from \"react\";\nimport { DocumentEditorContainer } from \"./document-editor-container.js\";\nimport { EditorLoader } from \"./editor-loader.js\";\nimport { ErrorBoundary } from \"./error-boundary.js\";\n\nexport function AppContainer() {\n const [selectedDrive] = useSelectedDriveSafe();\n const selectedDocumentId = useSelectedDocumentId();\n\n const app = useAppModuleById(selectedDrive?.header.meta?.preferredEditor);\n const defaultApp = useDefaultAppModule();\n\n if (!selectedDrive) {\n return <EditorLoader />;\n }\n\n const AppComponent =\n app?.Component ?? defaultApp?.Component ?? GenericDriveExplorer.Component;\n\n if (!AppComponent) {\n throw new Error(\"No app component found\");\n }\n return (\n <ErrorBoundary\n variant=\"detailed\"\n resetKeys={[selectedDrive.header.id]}\n loggerContext={[\"Connect\", \"App\"]}\n >\n <Suspense fallback={<EditorLoader />}>\n <DropZoneWrapper className=\"flex h-full flex-col overflow-auto\">\n <AppComponent>\n {selectedDocumentId ? <DocumentEditorContainer /> : null}\n </AppComponent>\n </DropZoneWrapper>\n </Suspense>\n </ErrorBoundary>\n );\n}\n","import {\n usePackageDiscoveryService,\n type FailedInstallation,\n} from \"@powerhousedao/reactor-browser\";\nimport { useSyncExternalStore } from \"react\";\n\nconst emptyArray: FailedInstallation[] = [];\n\nexport function useFailedInstallations() {\n const discoveryService = usePackageDiscoveryService();\n return useSyncExternalStore(\n (cb) => discoveryService?.subscribeFailed(cb) ?? (() => {}),\n () => discoveryService?.getFailedInstallations() ?? emptyArray,\n );\n}\n","import { connectConfig } from \"@powerhousedao/connect/config\";\n\nimport type { BrowserOptions } from \"@sentry/react\";\n\nimport { childLogger } from \"document-model\";\nimport React, { useEffect } from \"react\";\nimport {\n createRoutesFromChildren,\n matchRoutes,\n useLocation,\n useNavigationType,\n} from \"react-router-dom\";\nimport { setSentryModule } from \"../services/sentry.js\";\nimport { useAcceptedCookies } from \"./preferences-store.js\";\n\nconst logger = childLogger([\"sentry\"]);\n\nlet clientStarted = false;\n\nasync function getSentry() {\n return await import(\"@sentry/react\");\n}\n\nasync function initSentry() {\n const Sentry = await getSentry();\n const integrations: BrowserOptions[\"integrations\"] = [\n Sentry.httpClientIntegration(),\n Sentry.extraErrorDataIntegration({ depth: 5 }),\n Sentry.replayIntegration(),\n Sentry.captureConsoleIntegration({ levels: [\"error\"] }),\n ];\n if (connectConfig.sentry.tracing) {\n integrations.push(\n Sentry.reactRouterV6BrowserTracingIntegration({\n useEffect: React.useEffect,\n useLocation,\n useNavigationType,\n createRoutesFromChildren,\n matchRoutes,\n }),\n );\n }\n\n Sentry.init({\n release: connectConfig.sentry.release,\n dsn: connectConfig.sentry.dsn ?? undefined,\n environment: connectConfig.sentry.env,\n integrations,\n ignoreErrors: [\n \"User is not allowed to create files\",\n \"User is not allowed to move documents\",\n \"The user aborted a request.\",\n ],\n sendDefaultPii: true,\n tracesSampleRate: 1.0,\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1.0,\n beforeSend(event, hint) {\n const error = hint.originalException;\n if (\n error instanceof TypeError &&\n error.message.includes(\"Failed to fetch\") &&\n !navigator.onLine\n ) {\n // If fetch fails because user is offline then ignores the error\n return null;\n }\n return event;\n },\n });\n\n setSentryModule(Sentry);\n clientStarted = true;\n}\n\nasync function closeClient() {\n if (!clientStarted) {\n return;\n }\n const sentry = await getSentry();\n setSentryModule(undefined);\n const client = sentry.getClient();\n return client?.close();\n}\n\nexport function useInitSentry() {\n const [acceptedCookies] = useAcceptedCookies();\n const { analytics } = acceptedCookies;\n\n useEffect(() => {\n if (!analytics) {\n closeClient().catch((error: unknown) => logger.error(\"@error\", error));\n return;\n }\n\n // Sentry is disabled when `dsn` is null, undefined, or an empty\n // string — covers both the new schema default (`null`) and any\n // hand-edited config that omits the DSN.\n if (\n clientStarted ||\n connectConfig.sentry.dsn === null ||\n connectConfig.sentry.dsn === undefined ||\n connectConfig.sentry.dsn === \"\"\n ) {\n return;\n }\n\n initSentry().catch((error: unknown) => logger.error(\"@error\", error));\n }, [analytics]);\n}\n","import {\n usePackageDiscoveryService,\n type PendingInstallation,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useRef, useSyncExternalStore } from \"react\";\n\nconst emptyArray: readonly PendingInstallation[] = [];\n\nexport function usePendingInstallations() {\n const discoveryService = usePackageDiscoveryService();\n const cacheRef = useRef<readonly PendingInstallation[]>(emptyArray);\n\n const getSnapshot = useCallback(() => {\n if (!discoveryService) return emptyArray;\n const next = discoveryService.getPendingInstallations() ?? emptyArray;\n const prev = cacheRef.current;\n if (\n next === prev ||\n (next.length === prev.length && next.every((p, i) => p === prev[i]))\n ) {\n return prev;\n }\n cacheRef.current = next;\n return next;\n }, [discoveryService]);\n\n return useSyncExternalStore(\n (cb) => discoveryService?.subscribePending(cb) ?? (() => {}),\n getSnapshot,\n );\n}\n","import { useHotkeys } from \"react-hotkeys-hook\";\n\nexport interface UseUndoRedoShortcutsProps {\n undo: () => void;\n redo: () => void;\n canUndo: boolean;\n canRedo: boolean;\n}\n\nexport const useUndoRedoShortcuts = (props: UseUndoRedoShortcutsProps) => {\n const { undo, redo, canRedo, canUndo } = props;\n const isMac = window.navigator.userAgent.includes(\"Mac\");\n\n let undoShortcut = \"ctrl+z\";\n let redoShortcut = \"ctrl+y\";\n\n if (isMac) {\n undoShortcut = \"mod+z\";\n redoShortcut = \"mod+shift+z\";\n }\n\n // set handler for undo\n useHotkeys(\n undoShortcut,\n (event) => {\n event.preventDefault();\n if (canUndo) {\n undo();\n }\n },\n {},\n [canUndo, undo],\n );\n\n // set handler for redo\n useHotkeys(\n redoShortcut,\n (event) => {\n event.preventDefault();\n if (canRedo) {\n redo();\n }\n },\n {},\n [canRedo, redo],\n );\n};\n","import { useInitSentry } from \"@powerhousedao/connect/hooks\";\n\ninterface SentryProviderProps {\n children?: React.ReactNode;\n}\n\nexport const SentryProvider: React.FC<SentryProviderProps> = ({ children }) => {\n useInitSentry();\n\n return children;\n};\n","import type {\n Operation,\n PHDocument,\n} from \"@powerhousedao/shared/document-model\";\n\nexport class DocumentEditorDebugTools {\n private document: PHDocument | undefined;\n private operations: Operation[] = [];\n\n constructor(document?: PHDocument) {\n if (document) {\n this.document = document;\n }\n }\n\n private operationsToTableObject(operations: Operation[]) {\n return operations.map((op) => ({\n ...op,\n input: JSON.stringify(op.action.input),\n }));\n }\n\n public setDocument(document: PHDocument) {\n this.document = document;\n }\n\n public getDocument() {\n return this.document;\n }\n\n public getOperations() {\n return this.operations;\n }\n\n public pushOperation(operation: Operation) {\n this.operations.push(operation);\n }\n\n public operationsTable() {\n if (!this.document) {\n console.warn(\"No document\");\n }\n const ops = Object.values(this.document?.operations || {})\n .filter((array): array is Operation[] => array !== undefined)\n .flatMap((array) => array)\n .sort((a, b) => a.index - b.index);\n\n console.table(this.operationsToTableObject(ops));\n }\n\n public scopeOperationsTable(scope: string) {\n if (!this.document) {\n console.warn(\"No document\");\n }\n const ops = this.document?.operations[scope] || [];\n console.table(this.operationsToTableObject(ops));\n }\n\n public operationsLog() {\n console.log(this.operations);\n }\n\n public operationsLogTable() {\n console.table(this.operationsToTableObject(this.operations));\n }\n\n public clear() {\n this.operations = [];\n this.document = undefined;\n }\n}\n","import { showPHModal } from \"@powerhousedao/reactor-browser\";\n\n// PWA launch handling: consume the files the OS hands the installed Connect app\n// via window.launchQueue when a document is opened through its file association\n// (manifest file_handlers) — stash the files in the pending store below and open\n// the openFileDocuments modal (drive picking + import).\n//\n// Same shape as registerServiceWorker.ts: a module singleton with a tiny\n// external store consumed via useSyncExternalStore.\n\n// External store holding files launched but not yet imported. Repeated\n// launches into an already-focused window (launch_handler: focus-existing)\n// merge into it.\nlet pendingImportFiles: File[] = [];\nconst pendingListeners = new Set<() => void>();\n\nfunction notifyPendingListeners() {\n for (const listener of pendingListeners) listener();\n}\n\nexport function getPendingImportFiles(): File[] {\n return pendingImportFiles;\n}\n\n/** Stable identity of a pending file (also the picker's pre-check cache key). */\nexport function pendingFileKey(file: File): string {\n return `${file.name}|${file.size}|${file.lastModified}`;\n}\n\nexport function addPendingImportFiles(files: File[]) {\n // Re-opening a file that is already waiting (e.g. after detouring to create\n // a drive) must not queue it twice.\n const seen = new Set(pendingImportFiles.map(pendingFileKey));\n const fresh = files.filter((file) => {\n const key = pendingFileKey(file);\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n if (fresh.length === 0) return;\n pendingImportFiles = [...pendingImportFiles, ...fresh];\n notifyPendingListeners();\n}\n\nexport function clearPendingImportFiles() {\n if (pendingImportFiles.length === 0) return;\n pendingImportFiles = [];\n notifyPendingListeners();\n}\n\nexport function subscribePendingImportFiles(cb: () => void): () => void {\n pendingListeners.add(cb);\n return () => {\n pendingListeners.delete(cb);\n };\n}\n\nasync function handleLaunchParams(params: LaunchParams) {\n const handles = params.files.filter(\n (handle): handle is FileSystemFileHandle => handle.kind === \"file\",\n );\n if (handles.length === 0) return;\n\n const files: File[] = [];\n for (const handle of handles) {\n try {\n files.push(await handle.getFile());\n } catch (error) {\n // Permission/IO failure on one file must not drop the rest.\n console.error(\"Failed to read launched file:\", handle.name, error);\n }\n }\n if (files.length === 0) return;\n\n addPendingImportFiles(files);\n showPHModal({ type: \"openFileDocuments\" });\n}\n\n// Re-surface the picker when another modal closes while launched files are\n// still waiting — e.g. after the zero-drives detour through the create-drive\n// modal, so the user doesn't have to open the file again. Cancelling the\n// import clears the pending store BEFORE closing, so this can't loop.\nfunction maybeReopenImportModal() {\n if (getPendingImportFiles().length === 0) return;\n if (window.ph?.modal !== undefined) return;\n showPHModal({ type: \"openFileDocuments\" });\n}\n\nlet initialized = false;\n\n/**\n * Register the launchQueue consumer that receives files opened with Connect\n * through the OS file association. Idempotent (safe under StrictMode double\n * effects) and a no-op where the File Handling API doesn't exist — Firefox,\n * Safari, and any context without an installed PWA manifest simply never\n * deliver launches.\n */\nexport function initLaunchQueueFileHandling() {\n if (initialized) return;\n initialized = true;\n window.addEventListener(\"ph:modalUpdated\", maybeReopenImportModal);\n window.launchQueue?.setConsumer((params) => {\n void handleLaunchParams(params);\n });\n}\n","import {\n formatFileSize,\n mapProgressStageToStatus,\n type UploadFileListContainerProps,\n} from \"@powerhousedao/design-system/connect\";\nimport {\n addFileWithProgress,\n setSelectedNode,\n} from \"@powerhousedao/reactor-browser\";\nimport type { FileNode } from \"@powerhousedao/shared/document-drive\";\n\n// Progress store + import driver for documents opened through the OS file\n// association. Imports run OUTSIDE React (the picker modal closes the moment\n// the user confirms), reporting into a module store rendered by\n// OpenFileUploadList through the same floating panel UI drag-and-drop uses.\n// Memory-only on purpose: persisting rows (as DropZone does) leaves stale\n// frozen \"uploading\" entries after a reload, and launched imports are\n// one-shot. Rows are cleared only by user action, like drag-and-drop.\n\n/** Row shape the design-system upload panel consumes (UploadTracker). */\nexport type OpenFileUpload = NonNullable<\n UploadFileListContainerProps[\"uploadsArray\"][number]\n>;\n\nlet uploads: OpenFileUpload[] = [];\nconst listeners = new Set<() => void>();\n\nfunction notifyUploadListeners() {\n for (const listener of listeners) listener();\n}\n\nexport function getOpenFileUploads(): OpenFileUpload[] {\n return uploads;\n}\n\nexport function subscribeOpenFileUploads(cb: () => void): () => void {\n listeners.add(cb);\n return () => {\n listeners.delete(cb);\n };\n}\n\nexport function removeOpenFileUpload(id: string) {\n const next = uploads.filter((upload) => upload.id !== id);\n if (next.length === uploads.length) return;\n uploads = next;\n notifyUploadListeners();\n}\n\nexport function clearOpenFileUploads() {\n if (uploads.length === 0) return;\n uploads = [];\n notifyUploadListeners();\n}\n\nfunction addOpenFileUploads(rows: OpenFileUpload[]) {\n uploads = [...uploads, ...rows];\n notifyUploadListeners();\n}\n\nfunction patchOpenFileUpload(id: string, patch: Partial<OpenFileUpload>) {\n uploads = uploads.map((upload) =>\n upload.id === id ? { ...upload, ...patch } : upload,\n );\n notifyUploadListeners();\n}\n\nexport type PlannedOpenFileImport = {\n file: File;\n /** Final (possibly renamed) name the document is stored under. */\n name: string;\n};\n\nlet uploadCounter = 0;\n// Batches are serialized: a second OS launch confirmed mid-upload must not\n// race addDocument calls against the same drive.\nlet importChain: Promise<void> = Promise.resolve();\n\n/**\n * Import one file and resolve once the flow truly ends. Completion is\n * tracked through the progress stages, NOT the returned promise — the\n * package-discovery retry path resolves early and keeps reporting through\n * the callback. `resolveConflict: \"duplicate\"` is always passed: duplicates\n * were resolved in the picker (rename), so the conflict stage must never\n * fire — this also covers a duplicate appearing between pre-check and import.\n */\nfunction importOne(\n row: { id: string; file: File; name: string },\n driveId: string,\n documentTypes: string[] | undefined,\n): Promise<FileNode | undefined> {\n return new Promise((resolve) => {\n let settled = false;\n const settle = (fileNode?: FileNode) => {\n if (settled) return;\n settled = true;\n resolve(fileNode);\n };\n addFileWithProgress(\n row.file,\n driveId,\n row.name,\n undefined, // drive root\n (progress) => {\n patchOpenFileUpload(row.id, {\n status: mapProgressStageToStatus(progress.stage),\n progress: progress.progress,\n ...(progress.error ? { errorDetails: progress.error } : {}),\n ...(progress.documentType\n ? { documentType: progress.documentType }\n : {}),\n ...(progress.fileNode ? { fileNode: progress.fileNode } : {}),\n });\n switch (progress.stage) {\n case \"complete\":\n settle(progress.fileNode);\n break;\n case \"failed\":\n case \"unsupported-document-type\":\n settle(undefined);\n break;\n default:\n break;\n }\n },\n documentTypes,\n \"duplicate\",\n ).catch(() => {\n // A terminal stage was already reported through the callback (the\n // action always emits one before throwing); keep the batch going.\n settle(undefined);\n });\n });\n}\n\n/**\n * Run a confirmed batch of imports into a drive, feeding the floating upload\n * panel. Rows appear immediately (queued), files import sequentially, and a\n * single-file batch that succeeds opens its document in the editor.\n */\nexport function runOpenFileImports(args: {\n driveId: string;\n imports: PlannedOpenFileImport[];\n documentTypes: string[] | undefined;\n}): Promise<void> {\n const { driveId, imports, documentTypes } = args;\n if (imports.length === 0) return importChain;\n\n const rows = imports.map(({ file, name }) => ({\n id: `open-file-${++uploadCounter}`,\n file,\n name,\n }));\n addOpenFileUploads(\n rows.map((row) => ({\n id: row.id,\n fileName: row.name,\n fileSize: formatFileSize(row.file.size),\n status: \"pending\",\n progress: 0,\n })),\n );\n\n const run = async () => {\n const results: (FileNode | undefined)[] = [];\n for (const row of rows) {\n results.push(await importOne(row, driveId, documentTypes));\n }\n // Auto-open only for a single-file batch; several files land on the\n // drive and the panel rows carry their own \"Open Document\" links.\n if (rows.length === 1 && results[0]) {\n setSelectedNode(results[0]);\n }\n };\n importChain = importChain.then(run, run);\n return importChain;\n}\n","const openBrowserUrl = (url: string) => window.open(url, \"_blank\");\n\nexport const openUrl = openBrowserUrl;\n","import { setMigrationStatus } from \"../components/migration-status.js\";\nimport { idbError } from \"./pglite-idb.js\";\nimport {\n type BackupStrategy,\n cloneFileData,\n migrateIdb,\n} from \"./pglite-migrate-core.js\";\nimport { PRIMARY_IDB_NAMES } from \"./storage-namespace.js\";\n\nconst BACKUP_PREFIX = \"ph-pglite-backup::\";\nconst BACKUP_INDEX_KEY = \"ph:pglite-backups\";\nconst BACKUP_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;\n\ntype BackupRecord = { name: string; idbName: string; createdAt: number };\n\nfunction deleteIdb(name: string, timeoutMs = 15_000): Promise<void> {\n return new Promise((resolve, reject) => {\n const req = indexedDB.deleteDatabase(name);\n let settled = false;\n const done = (fn: () => void) => {\n if (settled) return;\n settled = true;\n fn();\n };\n const timer = setTimeout(\n () =>\n done(() =>\n reject(\n new Error(`IDB delete timed out for ${name} after ${timeoutMs}ms`),\n ),\n ),\n timeoutMs,\n );\n req.onsuccess = () =>\n done(() => {\n clearTimeout(timer);\n resolve();\n });\n req.onerror = () =>\n done(() => {\n clearTimeout(timer);\n reject(idbError(req, `IDB delete failed for ${name}`));\n });\n });\n}\n\nfunction readBackupIndex(): BackupRecord[] {\n try {\n const raw = localStorage.getItem(BACKUP_INDEX_KEY);\n if (!raw) return [];\n const parsed: unknown = JSON.parse(raw);\n return Array.isArray(parsed) ? (parsed as BackupRecord[]) : [];\n } catch {\n return [];\n }\n}\n\nfunction writeBackupIndex(records: BackupRecord[]): void {\n try {\n localStorage.setItem(BACKUP_INDEX_KEY, JSON.stringify(records));\n } catch {\n // ignore quota errors — janitor is best-effort\n }\n}\n\nfunction registerBackup(rec: BackupRecord): void {\n writeBackupIndex([...readBackupIndex(), rec]);\n}\n\nfunction forgetBackup(name: string): void {\n writeBackupIndex(readBackupIndex().filter((r) => r.name !== name));\n}\n\nasync function janitor(): Promise<void> {\n const cutoff = Date.now() - BACKUP_RETENTION_MS;\n const keep: BackupRecord[] = [];\n for (const rec of readBackupIndex()) {\n if (rec.createdAt >= cutoff) {\n keep.push(rec);\n continue;\n }\n try {\n await deleteIdb(rec.name);\n } catch (err) {\n console.warn(`Failed to delete expired pglite backup ${rec.name}`, err);\n keep.push(rec);\n }\n }\n writeBackupIndex(keep);\n}\n\n// Persistent backup to an IDB dir, indexed in localStorage with 30-day\n// retention (the janitor reaps expired ones); success keeps the backup.\nfunction createPersistentBackup(): BackupStrategy {\n return {\n snapshot: async (idbName) => {\n const backupName = `${BACKUP_PREFIX}${idbName}::${new Date().toISOString()}`;\n await cloneFileData(idbName, backupName);\n registerBackup({ name: backupName, idbName, createdAt: Date.now() });\n return backupName;\n },\n rollback: async (handle, idbName, cause) => {\n const backupName = handle as string;\n try {\n // clone clears-and-replaces in one txn; no pre-clear (which could empty the dir).\n await cloneFileData(backupName, idbName);\n } catch (rollbackErr) {\n console.error(\n `PGlite migration rollback failed for ${idbName}; backup ${backupName} retained. Primary migration error:`,\n cause,\n \"Rollback error:\",\n rollbackErr,\n );\n return;\n }\n await deleteIdb(backupName).catch(() => undefined);\n forgetBackup(backupName);\n },\n discard: async (handle) => {\n const backupName = handle as string;\n await deleteIdb(backupName).catch(() => undefined);\n forgetBackup(backupName);\n },\n commit: () => Promise.resolve(),\n };\n}\n\nasync function migrateAllLocked(): Promise<void> {\n const backup = createPersistentBackup();\n try {\n for (const idbName of PRIMARY_IDB_NAMES) {\n await migrateIdb(\n idbName,\n (phase) => setMigrationStatus({ idbName, phase }),\n backup,\n );\n }\n } finally {\n setMigrationStatus(null);\n }\n}\n\nexport async function migrateAllIfNeeded(): Promise<void> {\n janitor().catch((err) => console.warn(\"PGlite backup janitor failed\", err));\n\n const hasLocks =\n typeof navigator !== \"undefined\" &&\n \"locks\" in navigator &&\n typeof navigator.locks.request === \"function\";\n\n if (!hasLocks) {\n await migrateAllLocked();\n return;\n }\n\n await navigator.locks.request(\n \"ph-pglite-migration\",\n { mode: \"exclusive\" },\n async () => {\n await migrateAllLocked();\n },\n );\n}\n","import { createReactorMcpProvider } from \"@powerhousedao/reactor-mcp/tools\";\nimport type { IReactorClient } from \"@powerhousedao/reactor\";\nimport {\n ReactorChatFab,\n createSwitchboardSchemaTool,\n type AiToolDescriptor,\n} from \"@powerhousedao/reactor-browser/ai\";\n\n/**\n * Resolves the reactor tool descriptors for the chat agent from the\n * browser's live reactor client. Built lazily at send time so the reactor\n * (and its SharedWorker) do not need to be ready at render time.\n */\nfunction getReactorTools(): Promise<AiToolDescriptor[]> {\n const ph = window.ph;\n // The typed global is the minimal browser-client contract; the runtime\n // client (in-process or worker-backed) is always the full IReactorClient.\n const client = ph?.reactorClient as IReactorClient | undefined;\n if (!client) {\n return Promise.reject(\n new Error(\"The reactor client is not available yet. Try again shortly.\"),\n );\n }\n const syncManager =\n ph?.reactorClientModule?.reactorModule?.syncModule?.syncManager;\n return createReactorMcpProvider({ client, syncManager }).then((provider) => {\n const builtInTools = Object.values(provider.tools).map((tool) => ({\n ...tool,\n inputSchema: tool.inputSchema ?? {},\n }));\n // Packages may contribute their own tools via the `aiTools` export\n // (see DocumentModelLib.aiTools). Built-in tools win on name\n // collisions; duplicates across packages keep the first.\n const taken: Set<string> = new Set(builtInTools.map((tool) => tool.name));\n const packageTools = (ph?.vetraPackageManager?.packages ?? []).flatMap(\n (pkg) =>\n (pkg.aiTools ?? []).filter((tool) => {\n if (taken.has(tool.name)) {\n console.warn(\n `[Connect][AI] Package tool \"${tool.name}\" shadows an existing tool and was ignored.`,\n );\n return false;\n }\n taken.add(tool.name);\n return true;\n }),\n );\n return [...builtInTools, createSwitchboardSchemaTool(), ...packageTools];\n });\n}\n\n/** Connect's bottom-right AI chat FAB, bound to the browser reactor. */\nexport function ConnectReactorChatFab() {\n return <ReactorChatFab getTools={getReactorTools} />;\n}\n","import { Icon, Modal } from \"@powerhousedao/design-system\";\nimport {\n usePackageDiscoveryService,\n type FailedInstallation,\n type FailedInstallationReason,\n} from \"@powerhousedao/reactor-browser\";\nimport { useEffect, useState } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { useFailedInstallations } from \"../hooks/useFailedInstallations.js\";\n\nconst reasonLabels: Record<FailedInstallationReason, string> = {\n \"no-registry\": \"No package registry is configured.\",\n \"not-in-registry\": \"No matching package found in the registry.\",\n \"registry-error\": \"Couldn't reach the package registry.\",\n \"install-failed\": \"Package failed to install.\",\n dismissed: \"Installation was dismissed.\",\n offline: \"You're offline — this package can't be loaded until you reconnect.\",\n};\n\nfunction canRetry(reason: FailedInstallationReason): boolean {\n return reason !== \"no-registry\";\n}\n\nexport function MissingModelBanner() {\n const failed = useFailedInstallations();\n const discoveryService = usePackageDiscoveryService();\n const [open, setOpen] = useState(false);\n const [dismissed, setDismissed] = useState(false);\n\n useEffect(() => {\n return discoveryService?.subscribeEvents((event) => {\n if (event.type === \"load-failed\") {\n setDismissed(false);\n }\n });\n }, [discoveryService]);\n\n if (failed.length === 0) return null;\n\n return (\n <>\n {dismissed ? null : (\n <div className=\"absolute inset-x-0 top-0 z-200 bg-background\">\n <div className=\"flex items-center justify-between gap-3 bg-warning/10 px-4 py-2 text-sm text-warning\">\n <span>\n {failed.length === 1\n ? \"1 document type couldn't load (missing model).\"\n : `${failed.length} document types couldn't load (missing models).`}\n </span>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setOpen(true)}\n className=\"rounded-md border border-warning bg-background px-3 py-1 text-warning hover:hover-effect\"\n >\n View\n </button>\n <button\n type=\"button\"\n onClick={() => setDismissed(true)}\n aria-label=\"Dismiss\"\n className=\"flex items-center text-warning hover:hover-effect\"\n >\n <Icon name=\"XmarkLight\" size={16} />\n </button>\n </div>\n </div>\n </div>\n )}\n <MissingModelDetailsModal\n open={open}\n failed={failed}\n onClose={() => setOpen(false)}\n />\n </>\n );\n}\n\ntype DetailsProps = {\n readonly open: boolean;\n readonly failed: FailedInstallation[];\n readonly onClose: () => void;\n};\n\nfunction MissingModelDetailsModal(props: DetailsProps) {\n const { open, failed, onClose } = props;\n const discoveryService = usePackageDiscoveryService();\n const [retrying, setRetrying] = useState<Set<string>>(() => new Set());\n\n async function handleRetry(documentType: string) {\n if (!discoveryService) return;\n setRetrying((prev) => new Set(prev).add(documentType));\n try {\n await discoveryService.retryInstallation(documentType);\n } finally {\n setRetrying((prev) => {\n const next = new Set(prev);\n next.delete(documentType);\n return next;\n });\n }\n }\n\n return (\n <Modal\n open={open}\n onOpenChange={(isOpen) => {\n if (!isOpen) onClose();\n }}\n contentProps={{ className: \"rounded-3xl\" }}\n >\n <div className=\"w-[520px] max-w-[90vw] bg-background p-6\">\n <div className=\"border-b border-border pb-2 text-2xl font-bold text-foreground\">\n Missing document models\n </div>\n <div className=\"my-4 text-sm text-foreground\">\n The following document types couldn't be loaded. Documents using them\n won't display until the underlying package is installed.\n </div>\n {failed.length === 0 ? (\n <div className=\"rounded-xl bg-background p-4 text-sm text-foreground\">\n No outstanding failures.\n </div>\n ) : (\n <div className=\"flex max-h-[60vh] flex-col gap-3 overflow-y-auto\">\n {failed.map((entry) => {\n const isRetrying = retrying.has(entry.documentType);\n const retryDisabled = !canRetry(entry.reason) || isRetrying;\n return (\n <div\n key={entry.documentType}\n className=\"rounded-xl bg-background p-4\"\n >\n <div className=\"mb-1 font-mono text-sm font-semibold text-foreground\">\n {entry.documentType}\n </div>\n <div className=\"mb-2 text-xs text-foreground\">\n {reasonLabels[entry.reason]}\n </div>\n {entry.packageNames.length > 0 ? (\n <div className=\"mb-2 text-xs text-muted-foreground\">\n Package{entry.packageNames.length > 1 ? \"s\" : \"\"}:{\" \"}\n {entry.packageNames.join(\", \")}\n </div>\n ) : null}\n {entry.error ? (\n <div className=\"mb-2 font-mono text-xs wrap-break-word text-destructive\">\n {entry.error.message}\n </div>\n ) : null}\n <div className=\"flex justify-end\">\n <button\n type=\"button\"\n onClick={() => void handleRetry(entry.documentType)}\n disabled={retryDisabled}\n title={\n canRetry(entry.reason)\n ? undefined\n : \"No registry is configured; nothing to retry against.\"\n }\n className={twMerge(\n \"min-h-[32px] rounded-xl px-3 py-1 text-sm font-semibold text-foreground transition-all hover:hover-effect\",\n retryDisabled\n ? \"cursor-not-allowed bg-secondary hover:hover-effect\"\n : \"bg-primary text-primary-foreground active:active-effect\",\n )}\n >\n {isRetrying ? \"Retrying...\" : \"Try install again\"}\n </button>\n </div>\n </div>\n );\n })}\n </div>\n )}\n <div className=\"mt-4 flex justify-end\">\n <button\n type=\"button\"\n onClick={onClose}\n className=\"min-h-[36px] rounded-xl border border-border bg-background px-4 py-2 text-sm font-semibold text-foreground hover:hover-effect\"\n >\n Close\n </button>\n </div>\n </div>\n </Modal>\n );\n}\n","import {\n clearOpenFileUploads,\n getOpenFileUploads,\n removeOpenFileUpload,\n subscribeOpenFileUploads,\n} from \"@powerhousedao/connect/utils\";\nimport { UploadFileListContainer } from \"@powerhousedao/design-system/connect\";\nimport { setSelectedNode } from \"@powerhousedao/reactor-browser\";\nimport { useSyncExternalStore } from \"react\";\n\n// The floating \"Uploading N documents\" panel for files opened through the OS\n// file association — the same design-system panel drag-and-drop uses, driven\n// by the open-file upload store instead of DropZone's instance-local tracker.\n// Renders nothing while no uploads are tracked.\nexport function OpenFileUploadList() {\n const uploads = useSyncExternalStore(\n subscribeOpenFileUploads,\n getOpenFileUploads,\n );\n\n return (\n <UploadFileListContainer\n uploadsArray={uploads}\n uploadsCount={uploads.length}\n removeUpload={removeOpenFileUpload}\n clearAllUploads={clearOpenFileUploads}\n setSelectedNode={setSelectedNode}\n />\n );\n}\n","import {\n PackageInstallModal,\n type PendingPackageInstallation,\n} from \"@powerhousedao/design-system/connect\";\nimport { usePackageDiscoveryService } from \"@powerhousedao/reactor-browser\";\nimport { usePendingInstallations } from \"../hooks/usePendingInstallations.js\";\n\nexport function PackageInstallPrompt() {\n const pendingInstallations = usePendingInstallations();\n const discoveryService = usePackageDiscoveryService();\n\n if (!discoveryService || pendingInstallations.length === 0) return null;\n\n const installations: PendingPackageInstallation[] =\n pendingInstallations.flatMap((p) =>\n p.packageNames.map((packageName) => ({\n documentType: p.documentType,\n packageName,\n })),\n );\n\n return (\n <PackageInstallModal\n pendingInstallations={installations}\n onInstall={(packageName) =>\n discoveryService.approveInstallation(packageName)\n }\n onDismiss={(packageName) =>\n discoveryService.dismissInstallation(packageName)\n }\n />\n );\n}\n","import type { PHConnectRenownAdapters } from \"@powerhousedao/shared/clis\";\nimport type { WalletAdapterDescriptor } from \"@renown/sdk/wallet\";\nimport {\n mockAdapter,\n type MockLoginMethod,\n type PHRenownMockAdapterConfig,\n} from \"@renown/sdk/wallet/mock\";\nimport { privyAdapter, type PrivyLoginMethod } from \"@renown/sdk/wallet/privy\";\nimport { rainbowAdapter } from \"@renown/sdk/wallet/rainbow\";\nimport {\n arbitrum,\n base,\n type Chain,\n mainnet,\n optimism,\n polygon,\n sepolia,\n} from \"wagmi/chains\";\n\n// `mock` is deliberately absent from the published config schema (TEST/DEV only\n// — it signs with a well-known key), so it is read off the runtime config here.\nexport type ConnectRenownAdapters = PHConnectRenownAdapters & {\n mock?: PHRenownMockAdapterConfig;\n};\n\n// Adapters validate `methods` eagerly and throw on one they can't drive. This\n// runs during render, so a config typo costs one button, not the whole app.\nfunction describe(\n id: string,\n build: () => WalletAdapterDescriptor,\n): WalletAdapterDescriptor[] {\n try {\n return [build()];\n } catch (error) {\n console.error(\n `[connect] Ignoring the \"${id}\" wallet adapter: connect.renown.adapters.${id} was rejected.`,\n error,\n );\n return [];\n }\n}\n\n// `connect.renown.chainId` is an id, but the adapter needs the chain object, so\n// only a listed chain can be offered.\nconst CHAINS_BY_ID = new Map<number, Chain>(\n [mainnet, sepolia, polygon, optimism, arbitrum, base].map((chain) => [\n chain.id,\n chain,\n ]),\n);\n\n// Renown issues on one chain and rejects a session from any other, so the wallet\n// UI has to offer that chain and no other.\nfunction chainsFor(\n chainId: number | undefined,\n): readonly [Chain, ...Chain[]] | undefined {\n if (chainId === undefined) return undefined;\n const chain = CHAINS_BY_ID.get(chainId);\n if (!chain) {\n console.error(\n `[connect] connect.renown.chainId ${chainId} is not a chain Connect can offer, so in-page sign-in will be rejected. Supported: ${[...CHAINS_BY_ID.keys()].join(\", \")}.`,\n );\n return undefined;\n }\n return [chain];\n}\n\n/** Map Connect's declarative `connect.renown.adapters` config to the descriptors `RenownWalletProvider` takes. Array order sets the order of the login buttons. A rejected adapter config is dropped (logged), leaving the others working. `chainId` is `connect.renown.chainId`, the chain Renown issues credentials on. */\nexport function configToDescriptors(\n config: ConnectRenownAdapters | undefined,\n chainId?: number,\n): WalletAdapterDescriptor[] {\n if (!config) return [];\n const { rainbow, privy, mock } = config;\n const descriptors: WalletAdapterDescriptor[] = [];\n const chains = chainsFor(chainId);\n // Every adapter Connect can offer is imported statically (hence Connect\n // installs all their peers), but each library stays behind a lazy loader.\n if (rainbow) {\n descriptors.push(\n ...describe(\"rainbow\", () =>\n rainbowAdapter({ ...rainbow, ...(chains ? { chains } : {}) })),\n );\n }\n if (privy) {\n // appId is optional in the config schema but required by the adapter: an\n // operator who enables privy without one gets no privy login, not a crash.\n const { appId, clientId, methods } = privy;\n if (appId) {\n descriptors.push(\n ...describe(\"privy\", () =>\n privyAdapter({\n appId,\n clientId,\n // Methods come from JSON, so unvalidated here; the adapter's\n // resolver rejects anything it can't drive.\n methods: methods as PrivyLoginMethod[] | undefined,\n chain: chains?.[0],\n })),\n );\n }\n }\n if (mock) {\n descriptors.push(\n ...describe(\"mock\", () =>\n mockAdapter({\n ...mock,\n methods: mock.methods as MockLoginMethod[] | undefined,\n })),\n );\n }\n return descriptors;\n}\n","import { RenownWalletProvider, useTheme } from \"@powerhousedao/reactor-browser\";\nimport type { WalletTheme } from \"@renown/sdk/wallet\";\nimport { useMemo, type ReactNode } from \"react\";\nimport { getRuntimeConfig } from \"../runtime-config.js\";\nimport {\n configToDescriptors,\n type ConnectRenownAdapters,\n} from \"./renown-adapter-descriptors.js\";\n\n// Resolve a CSS color expression (a theme token) to a concrete color via a\n// hidden probe, so adapters receive Connect's palette without reading the DOM.\nfunction resolveColor(expr: string, fallback: string): string {\n if (typeof document === \"undefined\") return fallback;\n const probe = document.createElement(\"span\");\n probe.style.color = fallback;\n probe.style.color = expr;\n probe.style.display = \"none\";\n document.body.appendChild(probe);\n const resolved = getComputedStyle(probe).color;\n probe.remove();\n return resolved || fallback;\n}\n\n// Thin Connect wrapper over the shared RenownWalletProvider primitive: supplies\n// the configured adapters and Connect's runtime theme (mode + accent colors).\nexport function RenownWalletProviders({ children }: { children: ReactNode }) {\n const config = getRuntimeConfig().connect.renown?.adapters as\n | ConnectRenownAdapters\n | undefined;\n const chainId = getRuntimeConfig().connect.renown?.chainId;\n const { theme } = useTheme();\n // Descriptors carry only eager metadata; no wallet library loads here.\n const adapters = useMemo(\n () => configToDescriptors(config, chainId),\n [config, chainId],\n );\n\n // Resolve colors (forced style reads) only when an adapter is configured,\n // so a wallet-less deployment does no probing work at mount.\n const walletTheme = useMemo<WalletTheme | undefined>(\n () =>\n adapters.length > 0\n ? {\n mode: theme,\n accentColor: resolveColor(\"var(--primary)\", \"#0084ff\"),\n accentColorForeground: resolveColor(\n \"var(--primary-foreground)\",\n \"#ffffff\",\n ),\n }\n : undefined,\n [theme, adapters],\n );\n\n // No adapters configured: the provider's activator/effects are inert, so skip\n // it entirely and keep the wallet controller module off the render path.\n if (adapters.length === 0) return <>{children}</>;\n\n return (\n <RenownWalletProvider adapters={adapters} theme={walletTheme}>\n {children}\n </RenownWalletProvider>\n );\n}\n","import {\n Analytics,\n OpenPanel,\n Router,\n} from \"@powerhousedao/connect/components\";\n\nimport { connectConfig } from \"@powerhousedao/connect/config\";\nimport { SentryProvider } from \"@powerhousedao/connect/context\";\nimport {\n DocumentEditorDebugTools,\n initLaunchQueueFileHandling,\n serviceWorkerManager,\n} from \"@powerhousedao/connect/utils\";\nimport { useEditorPreloader, useTheme } from \"@powerhousedao/reactor-browser\";\nimport { useEffect } from \"react\";\nimport { ToastContainer } from \"../services/toast.js\";\nimport { ConnectReactorChatFab } from \"./reactor-chat.js\";\nimport { MissingModelBanner } from \"./missing-model-banner.js\";\nimport { OpenFileUploadList } from \"./open-file-upload-list.js\";\nimport { PackageInstallPrompt } from \"./package-install-prompt.js\";\nimport { RenownWalletProviders } from \"./renown-wallet-providers.js\";\n\nexport const App = () => {\n useTheme(); // keeps the OS-preference change listener active\n useEditorPreloader(); // warms editor chunks during idle time\n\n // refresh page on vite preload error due to outdated chunks — but only when\n // the failing dynamic import is one of Connect's own chunks. External\n // dynamic imports (e.g. the package manager loading a package from the\n // configured CDN) should let the error propagate so the caller can surface\n // it; reloading here drops any open state and hides the real failure.\n useEffect(() => {\n const handlePreloadError = (event: Event) => {\n const payload = (event as Event & { payload?: unknown }).payload;\n const message =\n payload instanceof Error\n ? payload.message\n : typeof payload === \"string\"\n ? payload\n : \"\";\n const failedUrl = message.match(/https?:\\/\\/[^\\s\"']+/)?.[0];\n\n if (failedUrl && !failedUrl.startsWith(window.location.origin)) {\n console.debug(\n `[Connect] Skipping reload — vite:preloadError for off-origin URL: ${failedUrl}`,\n );\n return;\n }\n\n console.log(\"Outdated chunks detected, reloading page...\");\n window.location.reload();\n };\n\n window.addEventListener(\"vite:preloadError\", handlePreloadError);\n\n return () => {\n window.removeEventListener(\"vite:preloadError\", handlePreloadError);\n };\n }, []);\n\n useEffect(() => {\n if (import.meta.env.MODE === \"development\") {\n window.documentEditorDebugTools = new DocumentEditorDebugTools();\n } else if (connectConfig.offline) {\n serviceWorkerManager.registerServiceWorker(false);\n } else {\n // Offline disabled — drop any worker a previous offline build left running.\n void serviceWorkerManager.unregisterAll();\n }\n }, []);\n\n // Files the OS opens with the installed PWA (manifest file_handlers).\n // launchQueue buffers launches until a consumer registers, so nothing is lost\n // by wiring it on mount; a no-op where the API doesn't exist.\n useEffect(() => {\n initLaunchQueueFileHandling();\n }, []);\n\n return (\n <SentryProvider>\n <RenownWalletProviders>\n <ToastContainer position=\"bottom-right\" />\n {connectConfig.aiAssistantEnabled && <ConnectReactorChatFab />}\n <MissingModelBanner />\n <Router />\n <OpenFileUploadList />\n <PackageInstallPrompt />\n <Analytics />\n <OpenPanel />\n </RenownWalletProviders>\n </SentryProvider>\n );\n};\n","import { useEffect, useState } from \"react\";\n\nexport const DotsLoader = () => {\n const [dots, setDots] = useState(0);\n\n useEffect(() => {\n const id = setInterval(() => {\n setDots((dots) => (dots === 3 ? 0 : dots + 1));\n }, 200);\n return () => {\n clearInterval(id);\n };\n }, []);\n\n return <span>{new Array(dots).fill(\".\").join(\"\")}</span>;\n};\n","import { Icon } from \"@powerhousedao/design-system\";\nimport {\n DriveCollectionId,\n useSyncList,\n useTheme,\n} from \"@powerhousedao/reactor-browser\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport { useMemo, useState } from \"react\";\n\nexport function DriveIcon({\n drive,\n}: {\n drive: DocumentDriveDocument | undefined;\n}) {\n const remotes = useSyncList();\n const { theme } = useTheme();\n const isRemoteDrive = useMemo(() => {\n if (!drive) return false;\n\n return remotes.some((remote) =>\n remote.meta.collectionId.equals(\n DriveCollectionId.forDrive(drive.header.id),\n ),\n );\n }, [remotes, drive]);\n\n const driveIconSrc = drive?.state.global.icon;\n // A drive's icon is an arbitrary URL stored in its state, so it can rot:\n // the host goes away, the gateway starts refusing, the CID is unpinned.\n // Rendering the <img> anyway leaves a browser's broken-image glyph in the\n // sidebar forever, because the dead URL is baked into the document and no\n // later fix to whoever wrote it can reach the drives already created.\n //\n // The failure is remembered as the src that failed rather than a flag, so a\n // drive whose icon later changes retries on its own - no effect needed to\n // reset it.\n const [failedSrc, setFailedSrc] = useState<string | null>(null);\n\n if (driveIconSrc && driveIconSrc !== failedSrc) {\n // An icon is its own document once the browser renders it, so it cannot\n // see the `.dark` class the theme toggles on the host page. Propagating\n // the resolved theme as a color scheme is what lets an icon drawn against\n // `prefers-color-scheme` follow an explicit in-app choice rather than only\n // the OS preference.\n return (\n <img\n src={driveIconSrc}\n alt={drive.header.name}\n height={32}\n width={32}\n style={{ colorScheme: theme }}\n onError={() => setFailedSrc(driveIconSrc)}\n />\n );\n }\n\n if (!isRemoteDrive) {\n return <Icon name=\"Hdd\" size={32} />;\n }\n\n return <Icon name=\"Server\" size={32} />;\n}\n","import { showPHModal } from \"@powerhousedao/reactor-browser\";\nimport { useTranslation } from \"react-i18next\";\n\nexport const DocumentUpgradeToast = ({\n documentId,\n}: {\n documentId: string;\n}) => {\n const { t } = useTranslation();\n\n return (\n <div>\n <p className=\"font-medium\">\n {t(\"notifications.documentUpgradeAvailable\")}\n </p>\n <button\n onClick={() => {\n showPHModal({ type: \"confirmDocumentUpgrade\", documentId });\n }}\n className=\"underline decoration-solid underline-offset-2\"\n >\n {t(\"common.updateDocument\")}\n </button>\n </div>\n );\n};\n","import { EditorLoader } from \"@powerhousedao/connect/components\";\nimport { useUndoRedoShortcuts } from \"@powerhousedao/connect/hooks\";\nimport { dismissToast, toast } from \"@powerhousedao/connect/services\";\nimport { Icon, PowerhouseButton } from \"@powerhousedao/design-system\";\nimport { RevisionHistory } from \"@powerhousedao/design-system/connect\";\nimport {\n getRevisionFromDate,\n setRevisionHistoryVisible,\n showPHModal,\n useDocumentById,\n useDocumentModelModuleById,\n useDocumentOperations,\n useDocumentVersionStatus,\n useEditorModuleById,\n useFallbackEditorModule,\n useRevisionHistoryVisible,\n useSelectedTimelineItem,\n useVetraPackageManager,\n useVetraPackages,\n} from \"@powerhousedao/reactor-browser\";\nimport type { PHDocument } from \"@powerhousedao/shared/document-model\";\nimport { redo, undo } from \"@powerhousedao/shared/document-model\";\nimport { createElement, Suspense, useEffect, useMemo, useState } from \"react\";\nimport { CenteredErrorMessage, ErrorBoundary } from \"./error-boundary.js\";\nimport { DocumentUpgradeToast } from \"./document-upgrade-toast.js\";\n\ntype Props<TDocument extends PHDocument = PHDocument> = {\n document: TDocument;\n};\n\n// Card treatment mirrors DetailedFallback in error-boundary.tsx so editor\n// errors read the same as boundary errors, and stay legible in both themes\n// (bg-card/border-border/text-foreground tokens instead of bare text).\nfunction EditorError({\n title,\n children,\n}: {\n title: string;\n children: React.ReactNode;\n}) {\n return (\n <div className=\"flex size-full items-center justify-center p-6\">\n <div className=\"w-full max-w-lg rounded-lg border border-border bg-card p-6 text-foreground shadow-sm\">\n <div className=\"mb-3 flex items-center gap-2\">\n <Icon name=\"Error\" className=\"size-5 shrink-0 text-destructive\" />\n <h3 className=\"min-w-0 text-lg font-semibold wrap-break-word text-foreground\">\n {title}\n </h3>\n </div>\n <div className=\"wrap-break-word\">{children}</div>\n </div>\n </div>\n );\n}\n\n// Prefers \"global\" when the document carries it, otherwise falls back to\n// the first available scope.\nfunction defaultScope(scopes: string[]): string {\n return scopes.includes(\"global\") ? \"global\" : scopes[0];\n}\n\nfunction OpenPackageManagerButton() {\n return (\n <PowerhouseButton\n className=\"px-3 py-1.5 text-base font-medium\"\n onClick={() => {\n showPHModal({ type: \"settings\" });\n }}\n type=\"button\"\n >\n Open package manager\n </PowerhouseButton>\n );\n}\n\nexport const DocumentEditor: React.FC<Props> = (props) => {\n const { document: initialDocument } = props;\n const selectedTimelineItem = useSelectedTimelineItem();\n const revisionHistoryVisible = useRevisionHistoryVisible();\n const [document, dispatch] = useDocumentById(initialDocument.header.id);\n const documentId = document?.header.id ?? undefined;\n const documentName = document?.header.name ?? undefined;\n const documentType = document?.header.documentType ?? undefined;\n const preferredEditor = document?.header.meta?.preferredEditor ?? undefined;\n // The scopes a document carries operations for; every document has at\n // least \"global\".\n const scopes = useMemo(() => {\n const keys = Object.keys(document?.header.revision ?? {});\n return keys.length > 0 ? keys : [\"global\"];\n }, [document?.header.revision]);\n const [operationScope, setOperationScope] = useState(() =>\n defaultScope(scopes),\n );\n const selectedScope = scopes.includes(operationScope)\n ? operationScope\n : defaultScope(scopes);\n\n // The history panel's operations: one scope, fetched only while the panel\n // is open. The panel asks for further pages itself.\n const {\n operations: historyOperations,\n isLoading: isLoadingHistory,\n hasNextPage: historyHasNextPage,\n fetchNextPage: fetchNextHistoryPage,\n error: historyError,\n } = useDocumentOperations(documentId, selectedScope, {\n enabled: revisionHistoryVisible,\n // A page fetch costs the same for 100 or 500 rows in the in-browser\n // reactor, so fewer, bigger round trips are strictly cheaper.\n limit: 500,\n });\n\n // The timeline read-mode feature maps a selected date range to a global\n // revision, which needs the whole global history. Fetched only while a\n // timeline item is selected; shares the cache entry with the panel when\n // the panel is on \"global\".\n const {\n operations: globalOperations,\n hasNextPage: globalHasNextPage,\n isLoading: isLoadingGlobal,\n fetchNextPage: fetchNextGlobalPage,\n error: globalError,\n } = useDocumentOperations(documentId, \"global\", {\n enabled: !!selectedTimelineItem,\n // A page fetch costs the same for 100 or 500 rows in the in-browser\n // reactor, so fewer, bigger round trips are strictly cheaper.\n limit: 500,\n });\n useEffect(() => {\n // An error ends the walk; we answer from what loaded rather than\n // retrying forever.\n if (!globalHasNextPage || isLoadingGlobal || globalError) return;\n // Deferred: the cache's fetch and the render it triggers are both\n // synchronous, so calling fetchNextGlobalPage here directly would chain\n // fetch -> render -> effect -> fetch into one uninterrupted task;\n // setTimeout(0) yields between pages so the UI stays responsive.\n const handle = window.setTimeout(fetchNextGlobalPage, 0);\n return () => window.clearTimeout(handle);\n }, [globalHasNextPage, isLoadingGlobal, fetchNextGlobalPage, globalError]);\n\n const globalRevisionNumber = document?.header.revision.global ?? 0;\n const localRevisionNumber = document?.header.revision.local ?? 0;\n const documentModelModule = useDocumentModelModuleById(documentType);\n const preferredEditorModule = useEditorModuleById(preferredEditor);\n const fallbackEditorModule = useFallbackEditorModule(documentType);\n const editorModule = preferredEditorModule ?? fallbackEditorModule;\n const versionStatus = useDocumentVersionStatus(document ?? undefined);\n const versionStatusKind = versionStatus?.kind;\n const upgradeAvailable =\n versionStatus?.kind === \"upgrade-available\" && versionStatus.canUpgrade;\n useEffect(() => {\n if (upgradeAvailable && documentId) {\n toast(createElement(DocumentUpgradeToast, { documentId }), {\n type: \"connect-warning\",\n toastId: `outdated-document-${documentId}`,\n autoClose: false,\n });\n } else if (\n versionStatusKind &&\n versionStatusKind !== \"upgrade-available\" &&\n documentId\n ) {\n dismissToast(`outdated-document-${documentId}`);\n }\n }, [upgradeAvailable, versionStatusKind, documentId]);\n const vetraPackages = useVetraPackages();\n const packageManager = useVetraPackageManager();\n const owningPackageName = editorModule\n ? vetraPackages.find((pkg) => pkg.editors.includes(editorModule))?.manifest\n .name\n : undefined;\n const owningPackageVersion =\n owningPackageName && packageManager\n ? packageManager.getPackageVersion(owningPackageName)\n : undefined;\n const editorBundleKey = owningPackageName\n ? `${owningPackageName}@${owningPackageVersion ?? \"unknown\"}`\n : (editorModule?.config.id ?? \"no-editor\");\n const isLoadingDocument = !document;\n const isLoadingEditor =\n editorModule &&\n documentType &&\n !editorModule.documentTypes.includes(documentType) &&\n !editorModule.documentTypes.includes(\"*\");\n\n const canUndo = globalRevisionNumber > 0 || localRevisionNumber > 0;\n const canRedo = !!document?.clipboard.length;\n const addUndoAction = () => dispatch(undo());\n const addRedoAction = () => dispatch(redo());\n useUndoRedoShortcuts({\n undo: addUndoAction,\n redo: addRedoAction,\n canUndo,\n canRedo,\n });\n\n useEffect(() => {\n return () => {\n window.documentEditorDebugTools?.clear();\n };\n }, []);\n\n const [editorError, setEditorError] = useState<\n | {\n error: any;\n info: React.ErrorInfo;\n documentId?: string;\n // clear: () => void;\n }\n | undefined\n >(undefined);\n\n useEffect(() => {\n if (editorError && editorError.documentId !== documentId) {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setEditorError(undefined);\n }\n }, [editorError, documentId]);\n\n const handleEditorError = (error: Error, info: React.ErrorInfo) => {\n setEditorError({\n error,\n documentId,\n info,\n });\n };\n\n if (isLoadingEditor) {\n return <EditorLoader message=\"Loading editor\" />;\n }\n\n if (isLoadingDocument) {\n return <EditorLoader message=\"Loading document\" />;\n }\n\n if (!documentModelModule) {\n return (\n <EditorError title=\"Document type not supported\">\n <p className=\"mb-4 text-sm text-foreground\">\n This document can't be opened because the \"{documentType}\" document\n model isn't installed. Install the package that provides it to open\n the document.\n </p>\n <OpenPackageManagerButton />\n </EditorError>\n );\n }\n\n if (versionStatus?.kind === \"unsupported\") {\n return (\n <EditorError title=\"Document version not supported\">\n <p className=\"mb-4 text-sm text-foreground\">\n This document requires version {versionStatus.documentVersion} of the\n \"{documentType}\" document model, but only version\n {versionStatus.availableVersions.length > 1 ? \"s\" : \"\"}{\" \"}\n {versionStatus.availableVersions.join(\", \")}{\" \"}\n {versionStatus.availableVersions.length > 1 ? \"are\" : \"is\"} installed.\n Update the package that provides \"{documentType}\" to open it.\n </p>\n <OpenPackageManagerButton />\n </EditorError>\n );\n }\n\n if (!editorModule) {\n return (\n <EditorError title=\"No editor available\">\n <p className=\"mb-4 text-sm text-foreground\">\n The \"{documentType}\" document model is installed, but no editor for it\n was found. Install a package that provides an editor for this document\n type.\n </p>\n <OpenPackageManagerButton />\n </EditorError>\n );\n }\n const EditorComponent = editorModule.Component;\n\n return (\n <div\n className=\"relative h-full\"\n id=\"document-editor-context\"\n data-editor={editorModule.config.id}\n data-document-type={documentType}\n >\n {revisionHistoryVisible ? (\n <RevisionHistory\n key={documentId}\n documentTitle={documentName ?? \"\"}\n documentId={documentId ?? \"\"}\n operations={historyOperations}\n isLoading={isLoadingHistory}\n hasNextPage={historyHasNextPage}\n onLoadNextPage={fetchNextHistoryPage}\n error={historyError}\n scopes={scopes}\n scope={selectedScope}\n onScopeChange={setOperationScope}\n onClose={() => setRevisionHistoryVisible(false)}\n documentState={document.state}\n onCopyState={() => {\n toast(\"Copied document state to clipboard\", { type: \"success\" });\n }}\n onCopyDocId={() => {\n toast(\"Copied document ID to clipboard\", { type: \"success\" });\n }}\n />\n ) : (\n <Suspense\n fallback={<EditorLoader message=\"Loading editor\" />}\n name=\"EditorLoader\"\n >\n <ErrorBoundary\n fallbackRender={CenteredErrorMessage}\n resetKeys={[documentId]}\n onError={handleEditorError}\n loggerContext={[\"Connect\", \"DocumentEditor\"]}\n >\n {!editorError?.error && (\n <EditorComponent\n key={`${editorBundleKey}:${documentId}`}\n context={{\n readMode: !!selectedTimelineItem,\n // Until the whole global history has paged in, the date lookup\n // cannot be answered; undefined leaves the editor on the latest\n // state in read mode instead of jumping to revision 0. A failed\n // page ends the walk, so we answer from what loaded rather than\n // waiting on a page that will never arrive.\n selectedTimelineRevision:\n (isLoadingGlobal || globalHasNextPage) && !globalError\n ? undefined\n : getRevisionFromDate(\n selectedTimelineItem?.startDate,\n selectedTimelineItem?.endDate,\n globalOperations,\n ),\n }}\n documentId={document.header.id}\n />\n )}\n </ErrorBoundary>\n </Suspense>\n )}\n </div>\n );\n};\n","import { setBannerShown } from \"../hooks/preferences-store.js\";\nimport { openUrl } from \"@powerhousedao/connect/utils\";\nimport { Icon } from \"@powerhousedao/design-system\";\nimport {\n Footer as DesignSystemFooter,\n FooterLink,\n} from \"@powerhousedao/design-system/connect\";\nimport { showPHModal } from \"@powerhousedao/reactor-browser\";\nimport { Trans } from \"react-i18next\";\n\nexport const Footer = () => {\n return (\n <DesignSystemFooter>\n <FooterLink onClick={() => setBannerShown(true)}>\n <Trans i18nKey=\"footer.cookiePolicy\" />\n </FooterLink>\n <FooterLink onClick={() => showPHModal({ type: \"disclaimer\" })}>\n <Trans i18nKey=\"footer.disclaimer\" />\n </FooterLink>\n <FooterLink\n id=\"ph-logo-link\"\n onClick={() => openUrl(\"https://www.powerhouse.inc/\")}\n >\n <Trans\n i18nKey=\"footer.builtWith\"\n components={{\n icon: (\n <Icon name=\"PowerhouseLogoSmall\" size={16} className=\"mx-1\" />\n ),\n }}\n />\n </FooterLink>\n </DesignSystemFooter>\n );\n};\n","import { IfPlugin, Sidebar } from \"@powerhousedao/connect/components\";\nimport { useIsEmbedded } from \"@powerhousedao/connect/hooks\";\nimport { Suspense } from \"react\";\nimport { Outlet } from \"react-router-dom\";\n\n/** The generic shell's module id; the sidebar is its most visible surface. */\nconst GENERIC_PLUGIN = \"@powerhousedao/connect/plugins/generic\";\n\nexport function Root() {\n const isEmbedded = useIsEmbedded();\n return (\n <div className=\"h-screen bg-background\">\n <div\n className={`flex h-screen items-stretch overflow-auto`}\n role=\"presentation\"\n tabIndex={0}\n >\n <Suspense name=\"Root\">\n {/* The sidebar is generic-shell chrome: hidden when embedded, and —\n the R3 gate — only rendered when the generic plugin is present in\n the composition. With no declared composition this reads active,\n so classic Connect is unchanged. */}\n {!isEmbedded && (\n <IfPlugin module={GENERIC_PLUGIN}>\n <Sidebar />\n </IfPlugin>\n )}\n <div className=\"relative flex-1 overflow-auto\">\n <Outlet />\n </div>\n </Suspense>\n </div>\n </div>\n );\n}\n","import {\n setSelectedDrive,\n useConnectionStates,\n useDrives,\n useSelectedDriveId,\n useSync,\n useUser,\n type ConnectionStateSnapshot,\n} from \"@powerhousedao/reactor-browser\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport { useCallback, useEffect, useMemo, useSyncExternalStore } from \"react\";\n\n/** Return code for the auth gate decision:\n * - `\"login\"` : anonymous user, the selected drive's channel rejected with `requiresAuth`.\n * - `\"unauthorized\"` : signed in, but the selected drive's channel was rejected — they aren't the owner.\n * - `null` : no auth barrier on the selected drive, carry on. */\nexport type AuthGate = \"login\" | \"unauthorized\" | null;\n\n/** A remote, reduced to the two fields the gate decision needs. */\nexport type AuthGateRemote = {\n readonly name: string;\n readonly driveId: string;\n};\n\nexport type AuthGateSelection = {\n readonly selectedDriveId: string | undefined;\n readonly remotes: readonly AuthGateRemote[];\n};\n\n/**\n * Decides the gate for the drive the user selected, and only that drive. A\n * refusal on any other drive must not hide the rest of Connect.\n *\n * Connection states are keyed by remote name, which is a random uuid, so the\n * caller supplies the remote -> drive mapping.\n */\nexport function computeAuthGate(\n isAuthenticated: boolean,\n connectionStates: ReadonlyMap<string, ConnectionStateSnapshot>,\n selection: AuthGateSelection,\n): AuthGate {\n const { selectedDriveId, remotes } = selection;\n if (!selectedDriveId) return null;\n\n let refused = false;\n for (const remote of remotes) {\n if (remote.driveId !== selectedDriveId) continue;\n const snapshot = connectionStates.get(remote.name);\n if (snapshot?.state === \"error\" && snapshot.requiresAuth) {\n refused = true;\n break;\n }\n }\n if (!refused) return null;\n return isAuthenticated ? \"unauthorized\" : \"login\";\n}\n\n// Drives dismissed from the auth gate. Deliberately in memory and session\n// scoped: the reactor keeps a refused drive's storage record, so a reload while\n// signed in must bring the drive back rather than fight that recovery.\nconst hiddenDriveIds = new Set<string>();\nlet hiddenDriveIdsSnapshot: readonly string[] = [];\nconst hiddenDriveListeners = new Set<() => void>();\n\nfunction publishHiddenDrives(): void {\n hiddenDriveIdsSnapshot = [...hiddenDriveIds];\n for (const listener of [...hiddenDriveListeners]) {\n listener();\n }\n}\n\nfunction subscribeHiddenDrives(listener: () => void): () => void {\n hiddenDriveListeners.add(listener);\n return () => {\n hiddenDriveListeners.delete(listener);\n };\n}\n\nfunction getHiddenDriveIds(): readonly string[] {\n return hiddenDriveIdsSnapshot;\n}\n\n/** Hides a drive from Connect's drive lists until the page reloads. */\nexport function hideDriveForSession(driveId: string): void {\n if (hiddenDriveIds.has(driveId)) return;\n hiddenDriveIds.add(driveId);\n publishHiddenDrives();\n}\n\n/** Restores every drive hidden this session. */\nexport function clearHiddenDrives(): void {\n if (hiddenDriveIds.size === 0) return;\n hiddenDriveIds.clear();\n publishHiddenDrives();\n}\n\nexport function useHiddenDriveIds(): readonly string[] {\n return useSyncExternalStore(\n subscribeHiddenDrives,\n getHiddenDriveIds,\n getHiddenDriveIds,\n );\n}\n\n/** `useDrives()` minus the drives dismissed from the auth gate this session. */\nexport function useVisibleDrives(): DocumentDriveDocument[] | undefined {\n const drives = useDrives();\n const hidden = useHiddenDriveIds();\n return useMemo(() => {\n if (!drives || hidden.length === 0) return drives;\n return drives.filter((drive) => !hidden.includes(drive.header.id));\n }, [drives, hidden]);\n}\n\n/** Live wrapper over {@link computeAuthGate}, plus the dismiss action. */\nexport function useDriveAuthGate(): { gate: AuthGate; dismiss: () => void } {\n const user = useUser();\n const connectionStates = useConnectionStates();\n const syncManager = useSync();\n const selectedDriveId = useSelectedDriveId();\n\n // Remote names are random uuids; `meta.collectionId.driveId` is the only link\n // from a connection state back to the drive it belongs to. Recomputed\n // alongside `connectionStates`, which also refreshes as remotes come and go.\n const remotes = useMemo<AuthGateRemote[]>(\n () =>\n (syncManager?.list() ?? []).map((remote) => ({\n name: remote.meta.name,\n driveId: remote.meta.collectionId.driveId,\n })),\n [syncManager, connectionStates],\n );\n\n // A change of identity changes who the drive would be fetched as, so give the\n // dismissed drives another chance instead of waiting for a reload.\n const address = user?.address;\n useEffect(() => {\n clearHiddenDrives();\n }, [address]);\n\n const dismiss = useCallback(() => {\n if (selectedDriveId) {\n hideDriveForSession(selectedDriveId);\n }\n setSelectedDrive(undefined);\n }, [selectedDriveId]);\n\n const gate = computeAuthGate(Boolean(user), connectionStates, {\n selectedDriveId,\n remotes,\n });\n return { gate, dismiss };\n}\n","import {\n AppContainer,\n DriveIcon,\n IfPlugin,\n} from \"@powerhousedao/connect/components\";\nimport {\n defaultPHAppConfig,\n defaultPHDocumentEditorConfig,\n} from \"@powerhousedao/connect/config\";\nimport {\n DriveAuthGate,\n HomeScreen,\n HomeScreenAddDriveItem,\n HomeScreenItem,\n} from \"@powerhousedao/design-system/connect\";\nimport {\n logout,\n setPHAppConfig,\n setPHDocumentEditorConfig,\n setSelectedDrive,\n useAppModuleById,\n useIsAddDriveEnabled,\n useSelectedDocumentId,\n useSelectedDriveSafe,\n useSelectedFolder,\n} from \"@powerhousedao/reactor-browser\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport { useEffect } from \"react\";\nimport { getRuntimeConfig } from \"../runtime-config.js\";\nimport {\n useDriveAuthGate,\n useVisibleDrives,\n} from \"../components/use-drive-auth-gate.js\";\nimport { useOpenRenownLogin } from \"../hooks/use-renown-login.js\";\n\nexport function Content() {\n const { gate, dismiss } = useDriveAuthGate();\n const openLogin = useOpenRenownLogin();\n const [selectedDrive] = useSelectedDriveSafe();\n const selectedFolder = useSelectedFolder();\n const selectedDocumentId = useSelectedDocumentId();\n\n useEffect(() => {\n if (!selectedDocumentId) {\n setPHDocumentEditorConfig(defaultPHDocumentEditorConfig);\n }\n }, [selectedDocumentId]);\n\n useEffect(() => {\n if (!selectedDrive) {\n setPHAppConfig(defaultPHAppConfig);\n }\n }, [selectedDrive]);\n\n const showHomeScreen =\n !selectedDocumentId && !selectedDrive && !selectedFolder;\n return (\n <ContentContainer>\n {gate ? (\n <div className=\"flex h-full items-center justify-center p-4\">\n <DriveAuthGate\n mode={gate}\n onLogin={openLogin}\n onLogout={() => void logout()}\n onClose={dismiss}\n />\n </div>\n ) : showHomeScreen ? (\n // The home screen is generic-shell chrome (the drive-list landing +\n // add-drive). R3 gate: only when the generic plugin is composed in.\n // Absent → no generic landing (a headless/custom shell renders its own\n // or routes straight to a drive). Classic (no composition) = active.\n <IfPlugin module=\"@powerhousedao/connect/plugins/generic\">\n <HomeScreenContainer />\n </IfPlugin>\n ) : (\n <AppContainer />\n )}\n </ContentContainer>\n );\n}\n\nfunction ContentContainer({ children }: { children: React.ReactNode }) {\n return (\n <div className=\"flex h-full flex-col overflow-auto\" id=\"content-view\">\n {children}\n </div>\n );\n}\n\nfunction DriveItem({ drive }: { drive: DocumentDriveDocument }) {\n const editorModule = useAppModuleById(drive.header.meta?.preferredEditor);\n const description = editorModule?.config.name || \"Drive Explorer App\";\n return (\n <HomeScreenItem\n key={drive.header.id}\n title={drive.state.global.name || drive.header.name}\n description={description}\n icon={<DriveIcon drive={drive} />}\n onClick={() => setSelectedDrive(drive)}\n />\n );\n}\n\nfunction HomeScreenContainer() {\n const drives = useVisibleDrives();\n const isAddDriveEnabled = useIsAddDriveEnabled();\n const runtimeConfig = getRuntimeConfig();\n const homeBackground = runtimeConfig.connect?.branding?.homeBackground;\n return (\n <HomeScreen homeBackground={homeBackground}>\n {drives?.map((drive) => {\n return <DriveItem key={drive.header.id} drive={drive} />;\n })}\n {isAddDriveEnabled && <HomeScreenAddDriveItem />}\n </HomeScreen>\n );\n}\n","import { Root } from \"@powerhousedao/connect/components\";\nimport { connectConfig } from \"@powerhousedao/connect/config\";\nimport { Content } from \"@powerhousedao/connect/pages\";\nimport { Suspense } from \"react\";\nimport type { RouteObject } from \"react-router-dom\";\nimport { RouterProvider, createBrowserRouter } from \"react-router-dom\";\n\nfunction createRouter(routes: RouteObject[]) {\n const routerBasename = connectConfig.routerBasename;\n\n return createBrowserRouter(routes, {\n basename: routerBasename,\n future: {\n v7_fetcherPersist: true,\n v7_relativeSplatPath: true,\n },\n });\n}\n\nfunction createRoutes() {\n const routes: RouteObject[] = [\n {\n index: true,\n path: \"d?/:driveId?/*?\",\n element: (\n <Suspense name=\"Drive\">\n <Content />\n </Suspense>\n ),\n },\n ];\n\n return [\n {\n element: (\n <Suspense name=\"RouteRoot\">\n <Root />\n </Suspense>\n ),\n children: routes,\n },\n ];\n}\n\nconst routes = createRoutes();\nconst router = createRouter(routes);\n\nexport const Router = () => {\n return <RouterProvider router={router} />;\n};\n","import { Icon } from \"@powerhousedao/design-system\";\nimport type { ConnectSearchBarProps } from \"@powerhousedao/design-system/connect\";\nimport { ConnectSearchBar } from \"@powerhousedao/design-system/connect\";\nimport { useTranslation } from \"react-i18next\";\n\nconst defaultFilterItems: ConnectSearchBarProps[\"filterItems\"] = [\n {\n id: \"project\",\n label: \".project\",\n icon: <Icon name=\"Project\" color=\"#FF6A55\" size={16} />,\n },\n {\n id: \"budget\",\n label: \".budget\",\n icon: <Icon name=\"BarChart\" color=\"#8E55EA\" size={16} />,\n },\n {\n id: \"profile\",\n label: \".profile\",\n icon: <Icon name=\"Person\" color=\"#3E90F0\" size={16} />,\n },\n {\n id: \"legal\",\n label: \".legal\",\n icon: <Icon name=\"Briefcase\" color=\"#4BAB71\" size={16} />,\n },\n {\n id: \"atlas\",\n label: \".Atlas\",\n icon: <Icon name=\"Globe\" color=\"#FF8A00\" size={16} />,\n },\n];\n\nexport const SearchBar = () => {\n const { t } = useTranslation();\n\n return (\n <ConnectSearchBar\n className=\"m-4 shrink-0 bg-muted\"\n placeholder={t(\"searchbar.placeholder\")}\n filterLabel={t(\"searchbar.filterLabel\")}\n filterItems={defaultFilterItems}\n />\n );\n};\n","import { DriveIcon } from \"@powerhousedao/connect/components\";\nimport {\n ConnectSidebar,\n ConnectTooltipProvider,\n SidebarAddDriveItem,\n SidebarItem,\n useEns,\n} from \"@powerhousedao/design-system/connect\";\n\nimport {\n logout,\n setSelectedDrive,\n showPHModal,\n useIsAddDriveEnabled,\n useSelectedDriveSafe,\n useUser,\n} from \"@powerhousedao/reactor-browser\";\nimport { useOpenRenownLogin } from \"../hooks/use-renown-login.js\";\nimport { useVisibleDrives } from \"./use-drive-auth-gate.js\";\nimport { ErrorBoundary } from \"./error-boundary.js\";\n\nexport function Sidebar() {\n const user = useUser();\n const openLogin = useOpenRenownLogin();\n const drives = useVisibleDrives();\n const isAddDriveEnabled = useIsAddDriveEnabled();\n const [selectedDrive] = useSelectedDriveSafe();\n const connectDebug = localStorage.getItem(\"CONNECT_DEBUG\") === \"true\";\n\n const ensName = user?.ens?.name || user?.profile?.username || undefined;\n const avatarUrl =\n user?.ens?.avatarUrl || user?.profile?.userImage || undefined;\n\n const ensInfo = useEns(!avatarUrl ? user?.address : undefined);\n\n const onClickSettings = () => {\n showPHModal({ type: \"settings\" });\n };\n\n const onAddDriveClick = () => {\n showPHModal({ type: \"addDrive\" });\n };\n\n const etherscanUrl = user?.address\n ? `https://etherscan.io/address/${user.address}`\n : \"\";\n\n return (\n <ConnectTooltipProvider>\n <ConnectSidebar\n id=\"sidebar\"\n onClick={() => setSelectedDrive(undefined)}\n onClickSettings={onClickSettings}\n address={user?.address}\n onLogin={openLogin}\n onDisconnect={() => {\n void logout();\n }}\n ensName={ensName || ensInfo.data?.ens}\n avatarUrl={\n avatarUrl ||\n ensInfo.data?.avatar_small ||\n ensInfo.data?.avatar_url ||\n undefined\n }\n etherscanUrl={etherscanUrl}\n showDebug={connectDebug}\n onDebugClick={() => showPHModal({ type: \"debugSettings\" })}\n >\n <ErrorBoundary\n variant=\"text\"\n fallbackMessage=\"There was an error loading drives\"\n loggerContext={[\"Connect\", \"Sidebar\"]}\n >\n {drives?.map((drive) => (\n <SidebarItem\n key={drive.header.id}\n title={drive.header.name}\n onClick={() => setSelectedDrive(drive)}\n active={selectedDrive?.header.id === drive.header.id}\n icon={<DriveIcon drive={drive} />}\n />\n ))}\n {isAddDriveEnabled && (\n <SidebarAddDriveItem onClick={onAddDriveClick} />\n )}\n </ErrorBoundary>\n </ConnectSidebar>\n </ConnectTooltipProvider>\n );\n}\n","import { showPHModal } from \"@powerhousedao/reactor-browser\";\nimport { useSyncExternalStore } from \"react\";\nimport {\n getWorkerConnectionStatus,\n subscribeWorkerConnection,\n type WorkerConnectionStatus,\n} from \"../connection-state.js\";\n\nconst CONNECTED: WorkerConnectionStatus = \"connected\";\n\nconst BANNER_TEXT: Record<\n Exclude<WorkerConnectionStatus, \"connected\">,\n { title: string; detail: string }\n> = {\n failed: {\n title: \"Reactor worker failed to load\",\n detail:\n \"The background worker script could not be loaded. Reload to retry.\",\n },\n lost: {\n title: \"Lost connection to the reactor\",\n detail: \"The background worker stopped responding. Reload to reconnect.\",\n },\n \"storage-held\": {\n title: \"Waiting for another Connect tab\",\n detail:\n \"Another Connect tab still holds local storage. Close or reload the other Connect tabs to continue.\",\n },\n \"version-conflict\": {\n title: \"Connect tabs are on different builds\",\n detail:\n \"Open tabs keep restarting the reactor. Close the other Connect tabs, then reload.\",\n },\n \"storage-unusable\": {\n title: \"Local storage is unusable\",\n detail:\n \"The local database stopped responding. Clear storage to start over, or reload to retry.\",\n },\n};\n\nexport const ConnectionBanner: React.FC = () => {\n const status = useSyncExternalStore(\n subscribeWorkerConnection,\n getWorkerConnectionStatus,\n () => CONNECTED,\n );\n\n if (status === \"connected\") {\n return null;\n }\n\n const { title, detail } = BANNER_TEXT[status];\n\n return (\n <div className=\"absolute inset-x-0 top-0 z-30 flex justify-center p-3\">\n <div className=\"flex max-w-3xl items-center gap-3 rounded-lg border border-destructive bg-warning px-4 py-3 text-sm text-warning-foreground shadow-lg\">\n <div className=\"flex-1\">\n <div className=\"font-semibold\">{title}</div>\n <div className=\"text-foreground\">{detail}</div>\n </div>\n {status === \"storage-unusable\" && (\n <button\n type=\"button\"\n onClick={() => showPHModal({ type: \"clearStorage\" })}\n className=\"rounded-sm bg-primary px-3 py-1 text-sm font-medium text-primary-foreground hover:hover-effect\"\n >\n Clear storage\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => window.location.reload()}\n className=\"rounded-sm bg-primary px-3 py-1 text-sm font-medium text-primary-foreground hover:hover-effect\"\n >\n Reload\n </button>\n </div>\n </div>\n );\n};\n","import {\n CURRENT_PG_MAJOR,\n getCachedMigrationMajor,\n migrateAllIfNeeded,\n subscribeMigrationMajor,\n} from \"@powerhousedao/connect/utils\";\nimport { useReactorClientModule } from \"@powerhousedao/reactor-browser\";\nimport type { IWorkerAdminClient } from \"@powerhousedao/reactor-browser/rpc\";\nimport { useState, useSyncExternalStore } from \"react\";\n\nfunction BannerShell({\n title,\n body,\n error,\n children,\n}: {\n title: string;\n body: string;\n error?: string | null;\n children?: React.ReactNode;\n}) {\n return (\n <div className=\"absolute inset-x-0 top-0 z-30 flex justify-center p-3\">\n <div className=\"flex max-w-3xl items-center gap-3 rounded-lg border border-warning bg-warning px-4 py-3 text-sm text-warning-foreground shadow-lg\">\n <div className=\"flex-1\">\n <div className=\"font-semibold\">{title}</div>\n <div className=\"text-foreground\">{body}</div>\n {error && (\n <div className=\"mt-2 font-medium text-destructive\">\n Migration failed: {error}\n </div>\n )}\n </div>\n {children}\n </div>\n </div>\n );\n}\n\nconst actionButton =\n \"rounded-sm bg-primary px-3 py-1 text-sm font-medium text-primary-foreground hover:hover-effect disabled:disabled-effect\";\nconst dismissButton =\n \"rounded-sm border border-foreground bg-transparent px-3 py-1 text-sm font-medium text-foreground hover:hover-effect disabled:disabled-effect\";\n\nlet browserDismissed = false;\nconst browserListeners = new Set<() => void>();\n\nfunction WorkerMigrationBanner({\n adminClient,\n}: {\n adminClient: IWorkerAdminClient;\n}) {\n const state = useSyncExternalStore(\n (cb) => adminClient.subscribeMigration(cb),\n () => adminClient.getMigrationState(),\n );\n const [dismissed, setDismissed] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n if (state.status === \"idle\") return null;\n if (state.status === \"needed\" && dismissed) return null;\n\n const migrating = state.status === \"migrating\";\n const handleMigrate = () => {\n setError(null);\n adminClient.migrate().catch((err: unknown) => {\n setError(err instanceof Error ? err.message : String(err));\n });\n };\n\n return (\n <BannerShell\n title={\n migrating\n ? `Migrating to Postgres ${CURRENT_PG_MAJOR}…`\n : `Your local database uses Postgres ${state.legacyMajor ?? \"?\"}.`\n }\n body={\n migrating\n ? `Working (${state.phase ?? \"starting\"}). Your data is backed up first.`\n : `Migrate to Postgres ${CURRENT_PG_MAJOR} to pick up the latest features. Your data will be backed up first.`\n }\n error={error ?? (state.status === \"failed\" ? state.error : null)}\n >\n {!migrating && (\n <button type=\"button\" onClick={handleMigrate} className={actionButton}>\n {state.status === \"failed\" ? \"Retry\" : \"Migrate now\"}\n </button>\n )}\n {state.status === \"needed\" && (\n <button\n type=\"button\"\n onClick={() => setDismissed(true)}\n className={dismissButton}\n >\n Dismiss\n </button>\n )}\n </BannerShell>\n );\n}\n\nfunction BrowserMigrationBanner() {\n const isDismissed = useSyncExternalStore(\n (cb) => {\n browserListeners.add(cb);\n return () => browserListeners.delete(cb);\n },\n () => browserDismissed,\n () => false,\n );\n const major = useSyncExternalStore(\n subscribeMigrationMajor,\n getCachedMigrationMajor,\n () => undefined,\n );\n const [migrating, setMigrating] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n if (major === undefined || major === null || major === CURRENT_PG_MAJOR) {\n return null;\n }\n if (isDismissed) return null;\n\n const handleMigrate = () => {\n setError(null);\n setMigrating(true);\n migrateAllIfNeeded()\n .then(() => window.location.reload())\n .catch((err: unknown) => {\n setError(err instanceof Error ? err.message : String(err));\n setMigrating(false);\n });\n };\n\n return (\n <BannerShell\n title={`Your local database uses Postgres ${major}.`}\n body={`Migrate to Postgres ${CURRENT_PG_MAJOR} to pick up the latest features. Your data will be backed up first.`}\n error={error}\n >\n <button\n type=\"button\"\n disabled={migrating}\n onClick={handleMigrate}\n className={actionButton}\n >\n {migrating ? \"Migrating…\" : \"Migrate now\"}\n </button>\n <button\n type=\"button\"\n disabled={migrating}\n onClick={() => {\n browserDismissed = true;\n for (const l of browserListeners) l();\n }}\n className={dismissButton}\n >\n Dismiss\n </button>\n </BannerShell>\n );\n}\n\nexport const MigrationBanner: React.FC = () => {\n const module = useReactorClientModule();\n if (module?.kind === \"worker\") {\n return <WorkerMigrationBanner adminClient={module.adminClient} />;\n }\n return <BrowserMigrationBanner />;\n};\n","import { usePHModal } from \"@powerhousedao/reactor-browser\";\nimport { lazy, Suspense } from \"react\";\nimport { ErrorBoundary } from \"../error-boundary.js\";\n\nconst AddDriveModal = lazy(() =>\n import(\"./modals/AddDriveModal.js\").then((m) => ({\n default: m.AddDriveModal,\n })),\n);\nconst ClearStorageModal = lazy(() =>\n import(\"./modals/ClearStorageModal.js\").then((m) => ({\n default: m.ClearStorageModal,\n })),\n);\nconst CookiesPolicyModal = lazy(() =>\n import(\"./modals/CookiesPolicyModal.js\").then((m) => ({\n default: m.CookiesPolicyModal,\n })),\n);\nconst CreateDocumentModal = lazy(() =>\n import(\"./modals/CreateDocumentModal.js\").then((m) => ({\n default: m.CreateDocumentModal,\n })),\n);\nconst DebugSettingsModal = lazy(() =>\n import(\"./modals/DebugSettingsModal.js\").then((m) => ({\n default: m.DebugSettingsModal,\n })),\n);\nconst DeleteDriveModal = lazy(() =>\n import(\"./modals/DeleteDriveModal.js\").then((m) => ({\n default: m.DeleteDriveModal,\n })),\n);\nconst DeleteItemModal = lazy(() =>\n import(\"./modals/DeleteItemModal.js\").then((m) => ({\n default: m.DeleteItemModal,\n })),\n);\nconst DisclaimerModal = lazy(() =>\n import(\"./modals/DisclaimerModal.js\").then((m) => ({\n default: m.DisclaimerModal,\n })),\n);\nconst DriveSettingsModal = lazy(() =>\n import(\"./modals/DriveSettingsModal.js\").then((m) => ({\n default: m.DriveSettingsModal,\n })),\n);\nconst DownloadDocumentWithErrorsModal = lazy(() =>\n import(\"./modals/DownloadDocumentWithErrorsModal.js\").then((m) => ({\n default: m.DownloadDocumentWithErrorsModal,\n })),\n);\nconst DocumentVersionUnsupportedModal = lazy(() =>\n import(\"./modals/DocumentVersionUnsupportedModal.js\").then((m) => ({\n default: m.DocumentVersionUnsupportedModal,\n })),\n);\nconst ConfirmDocumentUpgradeModal = lazy(() =>\n import(\"./modals/ConfirmDocumentUpgradeModal.js\").then((m) => ({\n default: m.ConfirmDocumentUpgradeModal,\n })),\n);\nconst SettingsModal = lazy(() =>\n import(\"./modals/SettingsModal.js\").then((m) => ({\n default: m.SettingsModal,\n })),\n);\nconst UpgradeDriveModal = lazy(() =>\n import(\"./modals/UpgradeDriveModal.js\").then((m) => ({\n default: m.UpgradeDriveModal,\n })),\n);\nconst InspectorModal = lazy(() =>\n import(\"./modals/InspectorModal/index.js\").then((m) => ({\n default: m.InspectorModal,\n })),\n);\nconst MissingPackageModal = lazy(() =>\n import(\"./modals/MissingPackageModal.js\").then((m) => ({\n default: m.ConnectMissingPackageModal,\n })),\n);\nconst DriveAuthRequiredModal = lazy(() =>\n import(\"./modals/DriveAuthRequiredModal.js\").then((m) => ({\n default: m.DriveAuthRequiredModal,\n })),\n);\nconst OpenFileDocumentsModal = lazy(() =>\n import(\"./modals/OpenFileDocumentsModal.js\").then((m) => ({\n default: m.OpenFileDocumentsModal,\n })),\n);\nconst LoginModal = lazy(() =>\n import(\"./modals/LoginModal.js\").then((m) => ({\n default: m.LoginModal,\n })),\n);\nconst modalComponents = {\n addDrive: AddDriveModal,\n clearStorage: ClearStorageModal,\n cookiesPolicy: CookiesPolicyModal,\n createDocument: CreateDocumentModal,\n debugSettings: DebugSettingsModal,\n deleteDrive: DeleteDriveModal,\n deleteItem: DeleteItemModal,\n disclaimer: DisclaimerModal,\n driveSettings: DriveSettingsModal,\n downloadDocumentWithErrors: DownloadDocumentWithErrorsModal,\n documentVersionUnsupported: DocumentVersionUnsupportedModal,\n confirmDocumentUpgrade: ConfirmDocumentUpgradeModal,\n inspector: InspectorModal,\n settings: SettingsModal,\n upgradeDrive: UpgradeDriveModal,\n missingPackage: MissingPackageModal,\n driveAuthRequired: DriveAuthRequiredModal,\n openFileDocuments: OpenFileDocumentsModal,\n login: LoginModal,\n} as const;\n\nexport const ModalsContainer = lazy(() => {\n return Promise.resolve({\n default: () => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const phModal = usePHModal();\n\n if (!phModal?.type) return null;\n\n const ModalComponent = modalComponents[phModal.type];\n\n return ModalComponent ? (\n <ErrorBoundary variant=\"silent\" loggerContext={[\"Connect\", \"Modals\"]}>\n <Suspense fallback={null}>\n <ModalComponent />\n </Suspense>\n </ErrorBoundary>\n ) : null;\n },\n });\n});\n","import {\n getServiceWorkerUpdateAvailable,\n serviceWorkerManager,\n subscribeServiceWorkerUpdate,\n} from \"@powerhousedao/connect/utils\";\nimport { useSyncExternalStore } from \"react\";\n\n// Prompts the user to load a waiting service-worker update, so a new version\n// never reloads over in-progress work.\nexport const ServiceWorkerUpdatePrompt: React.FC = () => {\n const updateAvailable = useSyncExternalStore(\n subscribeServiceWorkerUpdate,\n getServiceWorkerUpdateAvailable,\n () => false,\n );\n\n if (!updateAvailable) return null;\n\n return (\n <div className=\"absolute inset-x-0 bottom-0 z-30 flex justify-center p-3\">\n <div className=\"flex max-w-3xl items-center gap-3 rounded-lg border border-foreground bg-primary px-4 py-3 text-sm text-primary-foreground shadow-lg\">\n <div className=\"flex-1 font-medium\">\n A new version of Connect is available.\n </div>\n <button\n type=\"button\"\n onClick={() => serviceWorkerManager.applyUpdate()}\n className=\"rounded-sm bg-primary-foreground px-3 py-1 text-sm font-medium text-primary hover:hover-effect\"\n >\n Refresh\n </button>\n </div>\n </div>\n );\n};\n","import { Icon, PowerhouseButton } from \"@powerhousedao/design-system\";\n\n/** Boot screen for a reactor that refused this browser's stored documents. */\nexport function StoredDocumentsRefusedFallback({ error }: { error: Error }) {\n return (\n <div className=\"z-10 mx-auto flex max-w-[80%] flex-1 items-center justify-center p-6\">\n <div\n role=\"alert\"\n className=\"w-full max-w-lg rounded-lg border border-border bg-card p-6 text-foreground shadow-sm\"\n >\n <div className=\"mb-3 flex items-center gap-2\">\n <Icon name=\"Error\" className=\"size-5 shrink-0 text-destructive\" />\n <h1 className=\"text-lg font-semibold text-foreground\">\n Connect cannot open this browser&apos;s documents\n </h1>\n </div>\n <p className=\"mb-4 text-sm wrap-break-word text-foreground\">\n {error.message}\n </p>\n <PowerhouseButton\n type=\"button\"\n onClick={() => {\n window.location.reload();\n }}\n className=\"px-3 py-1.5 text-base font-medium\"\n >\n Reload\n </PowerhouseButton>\n </div>\n </div>\n );\n}\n","import \"@powerhousedao/connect/i18n\";\nimport type { DocumentModelLib } from \"document-model\";\nimport { lazy, StrictMode, Suspense } from \"react\";\nimport AppSkeleton from \"./app-skeleton.js\";\nimport { DetailedFallback, ErrorBoundary } from \"./error-boundary.js\";\nimport { App } from \"./index.js\";\nimport { ConnectionBanner } from \"./connection-banner.js\";\nimport { MigrationBanner } from \"./migration-banner.js\";\nimport { ModalsContainer } from \"./modal/modals-container.js\";\nimport { ServiceWorkerUpdatePrompt } from \"./service-worker-update-prompt.js\";\nimport { StoredDocumentsRefusedFallback } from \"./stored-documents-refused.js\";\nimport { isStoredDocumentsRefused } from \"../utils/stored-documents-refused.js\";\n\nconst CookieBanner = lazy(() =>\n import(\"./cookie-banner.js\").then((m) => ({ default: m.CookieBanner })),\n);\n\nexport const AppLoader = (props: { localPackage?: DocumentModelLib }) => {\n const Load = lazy(() =>\n import(\"./load.js\").then((m) => m.loadComponent(props.localPackage)),\n );\n return (\n <StrictMode>\n <ErrorBoundary\n fallbackRender={(props) => (\n <AppSkeleton\n children={\n isStoredDocumentsRefused(props.error) ? (\n <StoredDocumentsRefusedFallback error={props.error} />\n ) : (\n <DetailedFallback {...props} />\n )\n }\n />\n )}\n resetKeys={[props.localPackage]}\n loggerContext={[\"Connect\"]}\n >\n <Suspense fallback={<AppSkeleton />} name=\"AppLoader\">\n {/* eslint-disable-next-line react-hooks-extra/static-components */}\n <Load {...props}>\n <App />\n </Load>\n </Suspense>\n {/* The cookie banner is an optional, ad-blocker-vulnerable chunk:\n if its module (or its dependencies) is blocked, the silent\n boundary renders nothing and the app continues with the\n flags at their rejected defaults (analytics off). */}\n <ErrorBoundary\n variant=\"silent\"\n loggerContext={[\"Connect\", \"CookieBanner\"]}\n >\n <Suspense fallback={null} name=\"CookieBanner\">\n <CookieBanner />\n </Suspense>\n </ErrorBoundary>\n <Suspense name=\"ModalsContainer\">\n <ModalsContainer />\n </Suspense>\n <MigrationBanner />\n <ServiceWorkerUpdatePrompt />\n <ConnectionBanner />\n </ErrorBoundary>\n </StrictMode>\n );\n};\n"],"names":["logger","ErrorBoundary","ReactErrorBoundary","rawEvents","ErrorBoundary","emptyArray","logger","ErrorBoundary","Footer","DesignSystemFooter","ErrorBoundary","AddDriveModal","CreateDocumentModal","DriveSettingsModal","SettingsModal","ErrorBoundary","CookieBanner","ErrorBoundary"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAMA,WAAS,YAAY,CAAC,SAAS,CAAC;AAmDtC,SAAS,kBACP,OAC2C;CAC3C,OAAO,oBAAoB;AAC7B;AAEA,SAAS,iBAAiB;CACxB,OAAO;AACT;;;;;AAMA,SAAS,aAAa,EACpB,UAAU,0BAGT;CACD,OACE,oBAAC,OAAD;EAAK,WAAU;EAA+C,UAAA;CAAa,CAAA;AAE/E;;;;;;AAOA,SAAS,iBAAiB,EAAE,OAAO,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ppLoader } from "./app-loader-CNCzLxgV.js";
2
- export { AppLoader };
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="54101bdc-21e8-5fd7-aa68-9e9a68ad39ef")}catch(e){}}();
4
- //# debugId=54101bdc-21e8-5fd7-aa68-9e9a68ad39ef
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-skeleton--Me5zlSz.js","sources":["../src/utils/browser.ts","../src/components/migration-status.ts","../src/components/app-skeleton.tsx"],"sourcesContent":["export function getBasePath() {\n if (typeof document === \"undefined\") {\n return \"/\";\n }\n\n const baseEl = document.querySelector(\"base\");\n const href = baseEl?.getAttribute(\"href\");\n return href || \"/\";\n}\n","export type MigrationPhase = \"clone\" | \"dump\" | \"restore\";\n\nexport type MigrationStatus = {\n idbName: string;\n phase: MigrationPhase;\n};\n\nlet current: MigrationStatus | null = null;\nconst listeners = new Set<() => void>();\n\nexport function setMigrationStatus(status: MigrationStatus | null): void {\n current = status;\n for (const l of listeners) l();\n}\n\nexport function getMigrationStatus(): MigrationStatus | null {\n return current;\n}\n\nexport function subscribeMigrationStatus(cb: () => void): () => void {\n listeners.add(cb);\n return () => {\n listeners.delete(cb);\n };\n}\n","// Leaf imports, not the `@powerhousedao/connect/{utils,hooks}` barrels: this\n// is the first contentful paint and main.tsx loads it BEFORE the runtime\n// config is fetched. The barrels re-export modules that read the config at\n// module-evaluation (which throws if the config cache isn't warm), so they\n// must stay out of this graph.\nimport { getBasePath } from \"../utils/browser.js\";\nimport { getIsEmbedded } from \"../hooks/useIsEmbedded.js\";\nimport {\n ConnectSidebar,\n HomeScreen,\n LogoAnimation,\n} from \"@powerhousedao/design-system/connect\";\nimport { initTheme } from \"@powerhousedao/reactor-browser\";\nimport {\n useEffect,\n useState,\n useSyncExternalStore,\n type PropsWithChildren,\n} from \"react\";\nimport {\n getMigrationStatus,\n subscribeMigrationStatus,\n type MigrationPhase,\n} from \"./migration-status.js\";\nconst LOADER_DELAY = 250;\n\nconst PHASE_LABEL: Record<MigrationPhase, string> = {\n clone: \"Backing up local database…\",\n dump: \"Exporting data from previous version…\",\n restore: \"Restoring data into the new database…\",\n};\n\nconst MigrationOverlay = () => {\n const status = useSyncExternalStore(\n subscribeMigrationStatus,\n getMigrationStatus,\n () => null,\n );\n if (!status) return null;\n return (\n <div className=\"absolute inset-0 z-20 flex items-center justify-center\">\n <div className=\"rounded-lg bg-card/90 px-6 py-4 text-sm text-foreground shadow-lg\">\n <div className=\"font-medium\">Upgrading local database…</div>\n <div className=\"text-foreground\">{PHASE_LABEL[status.phase]}</div>\n </div>\n </div>\n );\n};\n\nconst Loader = ({ delay = LOADER_DELAY }: { delay?: number }) => {\n const isSSR = typeof window === \"undefined\";\n const showInitialLoader =\n typeof document !== \"undefined\" &&\n document.body.getAttribute(\"data-show-loader\") === \"true\";\n if (!isSSR) {\n initTheme();\n }\n\n const [showLoading, setShowLoading] = useState(!delay || showInitialLoader);\n\n useEffect(() => {\n const id = setTimeout(() => {\n setShowLoading(true);\n // Latch it on the body — the same flag the SSR branch below sets, and\n // the one `showInitialLoader` reads on mount. The bootstrap renders this\n // skeleton, then swaps in the config-dependent app whose Suspense\n // fallback is this same component, which remounts it. Without the latch\n // the delay re-arms and the logo blinks out for another `delay` ms at\n // exactly the moment the app is loading.\n document.body.setAttribute(\"data-show-loader\", \"true\");\n }, delay);\n\n return () => clearTimeout(id);\n }, []);\n\n return (\n <div\n className={`skeleton-loader absolute inset-0 z-10 flex items-center justify-center ${showLoading ? \"\" : \"hidden\"}`}\n >\n <div className=\"animate-pulse overflow-hidden rounded-full shadow-lg\">\n <LogoAnimation />\n </div>\n {isSSR ? (\n <script\n dangerouslySetInnerHTML={{\n __html: `setTimeout(() => {\n document.querySelector('.skeleton-loader')?.classList.remove('hidden');\n document.body.setAttribute('data-show-loader', 'true');\n }, ${delay})`,\n }}\n />\n ) : null}\n </div>\n );\n};\n\nexport const AppSkeleton: React.FC<PropsWithChildren> = (props) => {\n const isSSR = typeof window === \"undefined\";\n const isHomeScreen = !isSSR && window.location.pathname === getBasePath();\n /* Match Root's behavior: when Connect is rendered inside an embed (e.g. the\n * vetra-studio BUILD iframe), suppress the sidebar during the Suspense\n * fallback so the loading state matches the loaded state. */\n const isEmbedded = !isSSR && getIsEmbedded();\n return (\n <div className=\"flex h-screen overflow-hidden bg-background\">\n {!isEmbedded && (\n <ConnectSidebar\n className=\"animate-pulse\"\n onLogin={undefined}\n onDisconnect={undefined}\n onClickSettings={undefined}\n address={undefined}\n />\n )}\n <HomeScreen\n containerClassName={\n isSSR || !isHomeScreen ? \"home-screen hidden\" : undefined\n }\n children={props.children ?? null}\n />\n {isSSR ? (\n <script\n dangerouslySetInnerHTML={{\n __html: `\n const baseEl = document.querySelector('base');\n const href = baseEl?.getAttribute('href');\n const basePath = href || '/';\n if (window.location.pathname === basePath) {\n document.querySelector('.home-screen')?.classList.remove('hidden')\n }`,\n }}\n />\n ) : null}\n {!props.children ? <Loader /> : null}\n <MigrationOverlay />\n </div>\n );\n};\n\nexport default AppSkeleton;\n"],"names":[],"mappings":";;;;;;;;AAAA,SAAgB,cAAc;CAC5B,IAAI,OAAO,aAAa,aACtB,OAAO;CAKT,OAFe,SAAS,cAAc,MACpB,CAAC,EAAE,aAAa,MAAM,KACzB;AACjB;;;ACDA,IAAI,UAAkC;AACtC,MAAM,4BAAY,IAAI,IAAgB;AAEtC,SAAgB,mBAAmB,QAAsC;CACvE,UAAU;CACV,KAAK,MAAM,KAAK,WAAW,EAAE;AAC/B;AAEA,SAAgB,qBAA6C;CAC3D,OAAO;AACT;AAEA,SAAgB,yBAAyB,IAA4B;CACnE,UAAU,IAAI,EAAE;CAChB,aAAa;EACX,UAAU,OAAO,EAAE;CACrB;AACF;;;ACAA,MAAM,eAAe;AAErB,MAAM,cAA8C;CAClD,OAAO;CACP,MAAM;CACN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AAA;IACT,cAAc,KAAA;IACd,iBAAiB,KAAA;IACjB,SAAS,KAAA;GACV,CAAA;GAEH,oBAAC,YAAD;IACE,oBACE,SAAS,CAAC,eAAe,uBAAuB,KAAA;IAElD,UAAU,MAAM,YAAY;GAC7B,CAAA;GACA,QACC,oBAAC,UAAD,EACE,yBAAyB,EACvB,QAAQ;;;;;;uBAOV,EACD,CAAA,IACC;GACH,CAAC,MAAM,WAAW,oBAAC,QAAD,CAAS,CAAA,IAAI;GAChC,oBAAC,kBAAD,CAAmB,CAAA;EAChB;;AAET","debug_id":"bc14a2f8-c87b-59c0-ba90-8e0cce16c883"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"boot-CNW7ypcB.js","sources":["../src/utils/performance-observer.ts","../src/boot.tsx"],"sourcesContent":["import { track } from \"../services/openpanel/buffer.js\";\nimport type { PHGlobal } from \"@powerhousedao/reactor-browser\";\n\n/**\n * Startup performance measurement.\n *\n * Captures First Contentful Paint (FCP) and Largest Contentful Paint (LCP) via\n * the Performance API and reports each to the OpenPanel analytics buffer (a\n * consent-gated, never-throwing queue). Call {@link initPerformanceObserver}\n * at the very top of the entry module, before the runtime config is fetched,\n * so FCP is caught even if the browser has already painted — a\n * `PerformanceObserver` with `buffered: true` replays entries that fired\n * before `observe()` was called.\n *\n * This module is intentionally dependency-light (only the OpenPanel event\n * buffer, which has no runtime imports of its own) so it is safe to load\n * before the runtime config is fetched. Every API access is guarded: nothing\n * here may throw into the application.\n */\n\nfunction navigationType(): string | undefined {\n try {\n const entry = performance.getEntriesByType(\"navigation\")[0] as\n | PerformanceNavigationTiming\n | undefined;\n return entry?.type; // \"navigate\" | \"reload\" | \"back_forward\" | \"prerender\"\n } catch {\n return undefined;\n }\n}\n\n// window.ph is the app's global bag (PHGlobal). This module owns a\n// `performance` sub-object it writes into; `PhWithPerformance` is a named\n// stand-in for that write so it type-checks without touching the shared\n// PHGlobal definition.\ntype PhWithPerformance = PHGlobal & { performance?: Record<string, number> };\n\n/**\n * Mirror the metric on `window.ph.performance` for devtools inspection. Only\n * writes to an already-existing `window.ph` (owned by the entry module) —\n * never creates or replaces it, so it can't clobber the app's global state.\n */\nfunction storeOnWindow(name: string, value: number): void {\n try {\n const ph = window.ph as PhWithPerformance | undefined;\n if (!ph) return;\n ph.performance = ph.performance ?? {};\n ph.performance[name] = value;\n } catch {\n // devtools mirror is best-effort only\n }\n}\n\nfunction report(name: string, ms: number): void {\n const value = Math.round(ms);\n const props: Record<string, unknown> = { ms: value };\n const navType = navigationType();\n if (navType) props.navigation = navType;\n\n storeOnWindow(name, value);\n\n // The console summary is a developer aid. In a production build it is noise\n // in every user's console and in every support screenshot, so it is gated\n // out of the bundle there.\n if (!import.meta.env.PROD) {\n try {\n console.info(`[connect:performance] ${name}: ${value}ms`, props);\n } catch {\n // console is best-effort only\n }\n }\n\n try {\n track(`performance.${name}`, props);\n } catch {\n // analytics must never throw into the app\n }\n}\n\n/**\n * Starts the observers. Returns a disposer that detaches all of them. The app\n * never needs it — the observers live as long as the page does — but it keeps\n * the module testable and leaves no listener behind.\n */\nexport function initPerformanceObserver(): () => void {\n if (\n typeof window === \"undefined\" ||\n typeof PerformanceObserver === \"undefined\"\n ) {\n return () => undefined;\n }\n\n const teardown: Array<() => void> = [];\n\n /** Registers a listener and queues its removal on dispose. */\n const listen = (\n target: EventTarget,\n type: string,\n handler: () => void,\n once = true,\n ): void => {\n target.addEventListener(type, handler, { once });\n teardown.push(() => target.removeEventListener(type, handler));\n };\n\n // FCP — from the \"paint\" buffer. It fires once, so stop observing after it.\n try {\n const fcpObserver = new PerformanceObserver((list) => {\n for (const entry of list.getEntries()) {\n if (entry.name === \"first-contentful-paint\") {\n fcpObserver.disconnect();\n report(\"first_contentful_paint\", entry.startTime);\n }\n }\n });\n fcpObserver.observe({ type: \"paint\", buffered: true });\n teardown.push(() => fcpObserver.disconnect());\n } catch (err) {\n console.warn(\"[connect:performance] FCP observer failed:\", err);\n }\n\n // LCP — the final value only settles on an interaction or page hide, so latch\n // the latest candidate and report on the first terminal signal.\n let lcpMs = 0;\n let lcpReported = false;\n let lcpObserver: PerformanceObserver | undefined;\n\n /** Latches the newest candidate of a batch. The last entry is the newest. */\n const latch = (entries: ArrayLike<{ startTime: number }>): void => {\n if (entries.length > 0) {\n lcpMs = entries[entries.length - 1].startTime;\n }\n };\n\n const reportLcp = (): void => {\n // Several terminal signals can fire in one session (a click, then the page\n // hiding, then pagehide). The metric is sent for the first one only: every\n // repeat would be a double-count downstream.\n if (lcpReported) return;\n lcpReported = true;\n\n // A PerformanceObserver delivers entries in a task of its own, so a\n // terminal signal early in the page's life arrives while the newest\n // candidate is still buffered. Drain it before disconnecting — otherwise\n // an early click costs the session its LCP entirely.\n try {\n latch(lcpObserver?.takeRecords() ?? []);\n } catch {\n // draining is best-effort; report whatever was already delivered\n }\n\n lcpObserver?.disconnect();\n if (lcpMs > 0) report(\"largest_contentful_paint\", lcpMs);\n };\n\n try {\n lcpObserver = new PerformanceObserver((list) => {\n latch(list.getEntries());\n });\n lcpObserver.observe({ type: \"largest-contentful-paint\", buffered: true });\n teardown.push(() => lcpObserver?.disconnect());\n\n listen(window, \"pagehide\", reportLcp);\n listen(window, \"pointerdown\", reportLcp);\n listen(window, \"keydown\", reportLcp);\n // Not `once`: a page that loads in a background tab, or that the user tabs\n // away from and back, fires visibilitychange more than once, and only the\n // transition to \"hidden\" is terminal. A one-shot listener would be spent\n // on an earlier \"visible\" event and never see the hide.\n listen(\n document,\n \"visibilitychange\",\n () => {\n if (document.visibilityState === \"hidden\") reportLcp();\n },\n false,\n );\n } catch (err) {\n console.warn(\"[connect:performance] LCP observer failed:\", err);\n }\n\n return () => {\n for (const detach of teardown) {\n try {\n detach();\n } catch {\n // teardown is best-effort only\n }\n }\n teardown.length = 0;\n };\n}\n","import type { ComponentType, PropsWithChildren, ReactNode } from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport { loadRuntimeConfig } from \"./runtime-config.js\";\nimport { initPerformanceObserver } from \"./utils/performance-observer.js\";\n\n/**\n * The two-phase startup shared by both entry points.\n *\n * Phase 1 paints the config-independent skeleton, so first contentful paint\n * does not wait on the `powerhouse.config.json` round-trip. Phase 2 awaits the\n * config and hands the caller back the root to render the config-dependent app\n * into — every module that reads the runtime config at module-evaluation\n * throws if the cache isn't warm, so the app graph may only be imported after\n * this resolves.\n *\n * Kept dependency-light on purpose: it loads before the config is fetched, so\n * nothing in its import graph may read the config.\n */\n\n/** All the bootstrap needs of a React root — and all a test has to stand in for. */\ntype RenderTarget = { render: (node: ReactNode) => void };\n\nexport type BootDeps = {\n loadConfig: () => Promise<unknown>;\n importSkeleton: () => Promise<{ default: ComponentType<PropsWithChildren> }>;\n createRoot: () => RenderTarget;\n initObserver: () => () => void;\n};\n\nconst defaultDeps: BootDeps = {\n loadConfig: () => loadRuntimeConfig(),\n importSkeleton: () => import(\"./components/app-skeleton.js\"),\n createRoot: () => createRoot(document.getElementById(\"root\")!),\n initObserver: initPerformanceObserver,\n};\n\n/**\n * Shown when startup cannot proceed. Deliberately built from plain elements:\n * this renders precisely when the runtime config is unavailable, so it must\n * not depend on anything that reads it.\n */\nfunction BootError({ error }: { error: unknown }): ReactNode {\n const message = error instanceof Error ? error.message : String(error);\n return (\n <div\n role=\"alert\"\n className=\"flex h-screen flex-col items-center justify-center gap-3 bg-background p-6 text-center\"\n >\n <h1 className=\"text-lg font-semibold text-foreground\">\n Connect could not start\n </h1>\n <p className=\"max-w-prose text-sm text-foreground\">\n Its runtime configuration could not be loaded. This is usually temporary\n — reloading often resolves it.\n </p>\n <pre className=\"max-w-prose overflow-x-auto rounded-sm bg-card px-3 py-2 text-left text-xs text-foreground\">\n {message}\n </pre>\n <button\n type=\"button\"\n className=\"rounded-sm bg-card px-4 py-2 text-sm font-medium text-foreground shadow-sm\"\n onClick={() => {\n window.location.reload();\n }}\n >\n Reload\n </button>\n </div>\n );\n}\n\n/**\n * Paints the skeleton, then waits for the runtime config.\n *\n * Returns the root to render the app into, or `null` when startup failed — in\n * which case the error state is already painted and the caller must not import\n * the config-dependent app. It resolves rather than rejecting on failure: both\n * entry points await this at their module's top level, where a rejection would\n * surface only as an unhandled rejection behind a skeleton that never goes\n * away.\n */\nexport async function bootConnect(\n overrides: Partial<BootDeps> = {},\n): Promise<RenderTarget | null> {\n const {\n loadConfig,\n importSkeleton,\n createRoot: makeRoot,\n initObserver,\n } = { ...defaultDeps, ...overrides };\n\n if (!window.ph) {\n window.ph = {};\n }\n\n // Before anything else: the observers use `buffered: true`, so they catch\n // the browser's paint even when setup runs a tick after it fired.\n initObserver();\n\n // Started here and awaited at the bottom. The config fetch and the skeleton\n // chunk are independent round-trips, so they overlap; awaiting the chunk\n // first would put the config fetch — and with it everything the app needs —\n // behind it, which measured ~180ms of extra time-to-usable on a 150ms-RTT\n // connection. Mapping the rejection to a value here also means a config\n // failure is handled from the start, never an unhandled rejection.\n const config = loadConfig().then(\n () => ({ ok: true }) as const,\n (error: unknown) => ({ ok: false, error }) as const,\n );\n\n const root = makeRoot();\n\n try {\n const { default: AppSkeleton } = await importSkeleton();\n root.render(<AppSkeleton />);\n } catch (error) {\n console.error(\"[connect:boot] the app skeleton failed to load:\", error);\n root.render(<BootError error={error} />);\n return null;\n }\n\n const result = await config;\n if (!result.ok) {\n console.error(\n \"[connect:boot] the runtime config failed to load:\",\n result.error,\n );\n root.render(<BootError error={result.error} />);\n return null;\n }\n\n return root;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,iBAAqC;CAC5C,IAAI;EAIF,OAHc,YAAY,iBAAiB,YAAY,CAAC,CAAC,EAG7C,EAAE;CAChB,QAAQ;EACN;CACF;AACF;;;;;;AAaA,SAAS,cAAc,MAAc,OAAqB;CACxD,IAAI;EACF,MAAM,KAAK,OAAO;EAClB,IAAI,CAAC,IAAI;EACT,GAAG,cAAc,GAAG,eAAe,CAAC;EACpC,GAAG,YAAY,QAAQ;CACzB,QAAQ,CAER;AACF;AAEA,SAAS,OAAO,MAAc,I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ACZ,iBACE;EAAE,GAAG;EAAa,GAAG;CAAU;CAEnC,IAAI,CAAC,OAAO,IACV,OAAO,KAAK,CAAC;CAKf,aAAa;CAQb,MAAM,SAAS,WAAW,CAAC,CAAC,YACnB,EAAE,IAAI,KAAK,KACjB,WAAoB;EAAE,IAAI;EAAO;CAAM,EAC1C;CAEA,MAAM,OAAO,SAAS;CAEtB,IAAI;EACF,MAAM,EAAE,SAAS,gBAAgB,MAAM,eAAe;EACtD,KAAK,OAAO,oBAAC,aAAD,CAAc,CAAA,CAAC;CAC7B,SAAS,OAAO;EACd,QAAQ,MAAM,mDAAmD,KAAK;EACtE,KAAK,OAAO,oBAAC,WAAD,EAAkB,MAAQ,CAAA,CAAC;EACvC,OAAO;CACT;CAEA,MAAM,SAAS,MAAM;CACrB,IAAI,CAAC,OAAO,IAAI;EACd,QAAQ,MACN,qDACA,OAAO,KACT;EACA,KAAK,OAAO,oBAAC,WAAD,EAAW,OAAO,OAAO,MAAQ,CAAA,CAAC;EAC9C,OAAO;CACT;CAEA,OAAO;AACT","debug_id":"00db7b70-4175-5d68-afee-a04fa39b6aff"}
@@ -1,5 +0,0 @@
1
- import { t as AppSkeleton } from "./app-skeleton--Me5zlSz.js";
2
- import { _ as EditorLoader, a as Root, b as IfPlugin, c as DriveIcon, g as AppContainer, i as Router, l as DotsLoader, n as Sidebar, o as Footer, r as SearchBar, s as DocumentEditor, t as AppLoader, u as App, v as DocumentEditorContainer, x as Analytics, y as OpenPanel } from "./app-loader-CNCzLxgV.js";
3
- export { Analytics, App, AppContainer, AppLoader, AppSkeleton, DocumentEditor, DocumentEditorContainer, DotsLoader, DriveIcon, EditorLoader, Footer, IfPlugin, OpenPanel, Root, Router, SearchBar, Sidebar };
4
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e13904c8-6db3-501f-bb49-f448dfc3e6c3")}catch(e){}}();
5
- //# debugId=e13904c8-6db3-501f-bb49-f448dfc3e6c3
@@ -1 +0,0 @@
1
- {"version":3,"file":"load-BxQ82Cxc.js","sources":["../src/hooks/useCheckLatestVersion.ts","../src/hooks/utils.ts","../src/store/user.ts","../src/components/load.tsx"],"sourcesContent":["import { connectConfig } from \"@powerhousedao/connect/config\";\nimport { getBuildHashStatus } from \"@powerhousedao/connect/hooks\";\nimport { logger } from \"document-model\";\nimport { useEffect } from \"react\";\n\n// Session-scoped guard: records the deployed hash this tab already reloaded\n// for, so a broken or rolling deploy (server hash keeps changing under us)\n// cannot turn the tab into a reload loop. Cleared implicitly with the tab.\nconst RELOADED_FOR_KEY = \"ph-reloaded-for-build-hash\";\n\n/**\n * Drop the service worker's stale caches (precache + the NetworkFirst shell\n * cache) before reloading onto a new deploy, so the post-reload navigation\n * is answered from the network / fresh build instead of leftovers of the\n * build we are leaving. Best-effort: if the Caches API is unavailable or a\n * delete fails, the reload still picks up the new shell (the navigation\n * route is NetworkFirst).\n */\nasync function clearStaleCaches(): Promise<void> {\n try {\n if (!(\"caches\" in window)) return;\n const keys = await window.caches.keys();\n await Promise.all(\n keys\n .filter((key) => key.includes(\"precache\") || key.includes(\"ph-shell\"))\n .map((key) => window.caches.delete(key)),\n );\n } catch (error) {\n logger.warn(\n \"Failed to clear stale caches before update reload @error\",\n error,\n );\n }\n}\n\n/**\n * Detects that the server is serving a different build than the one this\n * page was loaded from (a new deploy) and reloads onto it — once per session\n * per deployed hash. Checked on mount and whenever the tab returns to the\n * foreground, so a deploy that lands while the tab sits open is picked up on\n * the next focus without a manual reload. The in-tab \"new version available\"\n * service-worker prompt (ServiceWorkerUpdatePrompt) remains the opt-in path\n * for workers that are waiting but not yet controlling.\n */\nexport const useCheckLatestVersion = () => {\n useEffect(() => {\n if (\n import.meta.env.MODE === \"development\" ||\n connectConfig.studioMode ||\n !connectConfig.warnOutdatedApp\n ) {\n return;\n }\n\n const checkBuildHash = async () => {\n const status = await getBuildHashStatus();\n if (!status || status.isCurrent) return;\n\n const reloadedFor = window.sessionStorage.getItem(RELOADED_FOR_KEY);\n if (reloadedFor === status.deployedHash) return;\n window.sessionStorage.setItem(RELOADED_FOR_KEY, status.deployedHash);\n\n logger.info(\n \"New deploy detected — reloading from build @currentHash to @deployedHash\",\n status.currentHash,\n status.deployedHash,\n );\n await clearStaleCaches();\n window.location.reload();\n };\n\n void checkBuildHash();\n const onVisibilityChange = () => {\n if (document.visibilityState === \"visible\") void checkBuildHash();\n };\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n return () => {\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n };\n }, []);\n};\n","import { getBuildHash } from \"../utils/build-info.js\";\n\nexport const isMac = window.navigator.appVersion.includes(\"Mac\");\n\nexport interface BuildHashStatus {\n /** Hash baked into the running build. */\n currentHash: string;\n /** Hash the server is currently serving. */\n deployedHash: string;\n /** true when the running build matches what the server serves. */\n isCurrent: boolean;\n}\n\n/**\n * Same-origin build-identity probe. The build bakes a hash of the inputs that\n * determine the deployed content into the bundle (define\n * `PH_CONNECT_BUILD_HASH`, see builder-tools' connectBuildHashPlugin) and\n * emits `build-hash.json` next to the app (served no-cache). Comparing the\n * two tells us whether the server is serving a different build than the one\n * this page was loaded from — the reliable \"a new deploy went out\" signal.\n * Unlike the old GitHub-raw version check it works on localhost (it compares\n * against what the origin actually serves, not a remote branch head) and\n * needs no network beyond the app's own origin.\n *\n * Returns null when there is nothing to compare: dev/studio builds (no hash\n * baked), a server predating `build-hash.json`, an offline fetch, or a\n * malformed body.\n */\nexport const getBuildHashStatus = async (): Promise<BuildHashStatus | null> => {\n const currentHash = getBuildHash();\n if (!currentHash || currentHash === \"unknown\") return null;\n try {\n const result = await fetch(`${import.meta.env.BASE_URL}build-hash.json`, {\n cache: \"no-cache\",\n });\n if (!result.ok) return null;\n const data = (await result.json()) as { hash?: unknown };\n if (typeof data.hash !== \"string\" || !data.hash) return null;\n return {\n currentHash,\n deployedHash: data.hash,\n isCurrent: data.hash === currentHash,\n };\n } catch {\n return null;\n }\n};\n","import { useUser } from \"@powerhousedao/reactor-browser\";\nimport type { User as SentryUser } from \"@sentry/react\";\nimport { useEffect } from \"react\";\nimport { setUser as setSentryUser } from \"../services/sentry.js\";\n\nexport function useSetSentryUser() {\n const user = useUser();\n useEffect(() => {\n let sentryUser: SentryUser | null = null;\n if (user) {\n // saves the user info except the credential\n const { credential: _credential, ...rest } = user;\n sentryUser = { id: rest.did, username: rest.ens?.name, ...rest };\n }\n setSentryUser(sentryUser);\n }, [user]);\n}\n","import { useCheckLatestVersion } from \"@powerhousedao/connect/hooks\";\nimport \"@powerhousedao/connect/i18n\";\nimport { createReactor, useSetSentryUser } from \"@powerhousedao/connect/store\";\nimport {\n detectMigrationMajor,\n detectReactorPgMajor,\n seedPendingPgVersion,\n} from \"@powerhousedao/connect/utils\";\nimport { initTheme } from \"@powerhousedao/reactor-browser\";\nimport type { DocumentModelLib } from \"document-model\";\nimport { type ReactNode } from \"react\";\nimport { applyConnectBranding, loadRuntimeConfig } from \"../runtime-config.js\";\n\nexport async function loadComponent(localPackage?: DocumentModelLib) {\n await seedPendingPgVersion();\n await Promise.all([detectReactorPgMajor(), detectMigrationMajor()]);\n const runtimeConfig = await loadRuntimeConfig();\n applyConnectBranding(runtimeConfig);\n await createReactor(localPackage);\n return {\n default: ({ children }: { children?: ReactNode }) => {\n initTheme();\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useSetSentryUser();\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useCheckLatestVersion();\n return children;\n },\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAQA,MAAM,mBAAmB;;;;;;;;;AAUzB,eAAe,mBAAkC;CAC/C,IAAI;EACF,IAAI,EAAE,YAAY,SAAS;EAC3B,MAAM,OAAO,MAAM,OAAO,OAAO,KAAK;EACtC,MAAM,QAAQ,IACZ,KACG,QAAQ,QAAQ,IAAI,SAAS,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AACF;;;ACzCA,SAAgB,mBAAmB;CACjC,MAAM,OAAO,QAAQ;CACrB,gBAAgB;EACd,IAAI,aAAgC;EACpC,IAAI,MAAM;GAER,MAAM,EAAE,YAAY,aAAa,GAAG,SAAS;GAC7C,aAAa;IAAE,IAAI,KAAK;IAAK,UAAU,KAAK,KAAK;IAAM,GAAG;GAAK;EACjE;EACA,QAAc,UAAU;CAC1B,GAAG,CAAC,IAAI,CAAC;AACX;;;ACHA,eAAsB,cAAc,cAAiC;CACnE,MAAM,qBAAqB;CAC3B,MAAM,QAAQ,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC,CAAC;CAClE,MAAM,gBAAgB,MAAM,kBAAkB;CAC9C,qBAAqB,aAAa;CAClC,MAAM,cAAc,YAAY;CAChC,OAAO,EACL,UAAU,EAAE,eAAyC;EACnD,UAAU;EAEV,iBAAiB;EAEjB,sBAAsB;EACtB,OAAO;CACT,EACF;AACF","debug_id":"d2f57276-04c5-5749-b94c-da11d286fd19"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"multi-reactor-BG-DqUcm.js","sources":["../src/store/graphql-routable-backend.ts","../src/store/multi-reactor.ts"],"sourcesContent":["import {\n JOB_NOT_FOUND_ERROR_NAME,\n JobStatus,\n type PagedResults,\n type ReactorInfo,\n type ViewFilter,\n} from \"@powerhousedao/reactor\";\nimport {\n DRIVE_DOCUMENT_TYPES,\n findIsServableOverGraphQL,\n GraphQLReactorClient,\n type DriveIdCall,\n type GraphQLReactorClientOptions,\n} from \"@powerhousedao/reactor-browser\";\nimport type { IRoutableBackend } from \"@powerhousedao/reactor-router\";\nimport type { Action, PHDocument } from \"@powerhousedao/shared/document-model\";\n\nconst REMOTE_INFO_QUERY = /* GraphQL */ `\n query RemoteReactorInfo {\n inspection {\n info {\n storage {\n engine\n persistence\n durable\n selfHeal\n }\n workflows\n syncChannels\n }\n }\n }\n`;\n\ntype RemoteReactorInfo = {\n inspection: { info: Omit<ReactorInfo, \"access\"> };\n};\n\n/** Ids and slugs of documents this backend answered as drives, by drive id. */\nclass KnownDrives {\n private readonly ids = new Map<string, string>();\n\n learn<T extends PHDocument>(document: T): T {\n const { id, slug, documentType } = document.header;\n if ((DRIVE_DOCUMENT_TYPES as readonly string[]).includes(documentType)) {\n this.ids.set(id, id);\n if (slug) {\n this.ids.set(slug, id);\n }\n }\n return document;\n }\n\n learnPage<T extends PHDocument>(page: PagedResults<T>): PagedResults<T> {\n for (const document of page.results) {\n this.learn(document);\n }\n return page;\n }\n\n driveOf(identifier: string | undefined): string | undefined {\n return identifier === undefined ? undefined : this.ids.get(identifier);\n }\n\n /** Names a drive only when this backend proved it is one. */\n driveIdFor = (call: DriveIdCall): string | undefined => {\n switch (call.method) {\n case \"create\":\n case \"find\":\n return this.driveOf(call.parentId);\n case \"execute\":\n case \"deleteDocument\":\n return this.driveOf(call.documentId);\n case \"executeBatch\":\n for (const job of call.jobs ?? []) {\n const drive = this.driveOf(job.documentId);\n if (drive !== undefined) {\n return drive;\n }\n }\n return undefined;\n }\n };\n}\n\nexport type GraphQLRoutableBackendOptions = Omit<\n GraphQLReactorClientOptions,\n \"driveIdFor\"\n>;\n\nexport type GraphQLRoutableBackend = {\n readonly backend: IRoutableBackend;\n /** The Switchboard's own facts, from its inspection subgraph. */\n info(): Promise<ReactorInfo>;\n /** Reopens the realtime socket on the new credentials. */\n notifyCredentialsChanged(): void;\n};\n\n/** A Switchboard as a router backend; members GraphQL cannot serve are absent. */\nexport function createGraphQLRoutableBackend(\n options: GraphQLRoutableBackendOptions,\n): GraphQLRoutableBackend {\n const drives = new KnownDrives();\n const gql = new GraphQLReactorClient({\n ...options,\n driveIdFor: drives.driveIdFor,\n });\n const backend: IRoutableBackend = {\n supports: { find: findIsServableOverGraphQL, pointInTimeViews: false },\n get: async <TDocument extends PHDocument>(\n identifier: string,\n view?: ViewFilter,\n signal?: AbortSignal,\n ) => drives.learn(await gql.get<TDocument>(identifier, view, signal)),\n getOperations: (identifier, view, filter, paging, signal) =>\n gql.getOperations(identifier, view, filter, paging, signal),\n find: async (search, view, paging, signal) =>\n drives.learnPage(await gql.find(search, view, paging, signal)),\n isServed: (identifier, view, signal) =>\n gql.isServed(identifier, view, signal),\n getOutgoingRelationships: (source, type, view, paging, signal) =>\n gql.getOutgoingRelationships(source, type, view, paging, signal),\n getIncomingRelationships: (target, type, view, paging, signal) =>\n gql.getIncomingRelationships(target, type, view, paging, signal),\n getOutgoingRelationshipEdges: (source, type, view, paging, signal) =>\n gql.getOutgoingRelationshipEdges(source, type, view, paging, signal),\n getIncomingRelationshipEdges: (target, type, view, paging, signal) =>\n gql.getIncomingRelationshipEdges(target, type, view, paging, signal),\n subscribe: (search, callback, view) =>\n gql.subscribe(search, callback, view),\n getCreateSignaturePolicy: () => gql.getCreateSignaturePolicy(),\n getCreateProtocolVersions: (parent, signal) =>\n gql.getCreateProtocolVersions(parent, signal),\n create: async <TDocument extends PHDocument = PHDocument>(\n document: PHDocument,\n parent?: string,\n signal?: AbortSignal,\n ) => drives.learn(await gql.create<TDocument>(document, parent, signal)),\n execute: async <TDocument extends PHDocument>(\n identifier: string,\n branch: string,\n actions: Action[],\n signal?: AbortSignal,\n ) =>\n drives.learn(\n await gql.execute<TDocument>(identifier, branch, actions, signal),\n ),\n executeBatch: (request, signal) => gql.executeBatch(request, signal),\n deleteDocument: (identifier, propagate, signal) =>\n gql.deleteDocument(identifier, propagate, signal),\n setPreferredEditor: (identifier, editor, branch, signal) =>\n gql.setPreferredEditor(identifier, editor, branch, signal),\n getJob: async (jobId, signal) => {\n const job = await gql.getJob(jobId, signal);\n return job?.status === JobStatus.FAILED &&\n job.error?.name === JOB_NOT_FOUND_ERROR_NAME\n ? undefined\n : job;\n },\n waitForJob: (job, signal) => gql.waitForJob(job, signal),\n };\n return {\n backend,\n info: async () => {\n const result = await gql.request<RemoteReactorInfo>(REMOTE_INFO_QUERY);\n return {\n ...result.inspection.info,\n access: { admin: false, sql: false },\n };\n },\n notifyCredentialsChanged: () => gql.notifyCredentialsChanged(),\n };\n}\n","import {\n createReactorInspector,\n type ReactorInfo,\n} from \"@powerhousedao/reactor\";\nimport type {\n BrowserReactorClientModule,\n WorkerReactorClientModule,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n FanInPartialFailureError,\n fromReactorClient,\n RoutingReactorClient,\n type CollectionRequirementsInput,\n type ReactorReach,\n type RoutableBackendConfig,\n type RouterDiagnostic,\n type RoutingClientOptions,\n} from \"@powerhousedao/reactor-router\";\nimport type {\n DocumentModelModule,\n ISigner,\n} from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"document-model\";\nimport {\n createGraphQLRoutableBackend,\n type GraphQLRoutableBackend,\n} from \"./graphql-routable-backend.js\";\n\nexport const LOCAL_BACKEND_NAME = \"connect-local\";\nexport const REMOTE_BACKEND_NAME = \"switchboard-remote\";\n\nexport type LocalReactorModule =\n | BrowserReactorClientModule\n | WorkerReactorClientModule;\n\nconst REMOTE_REACH: ReactorReach = Object.freeze({\n hosting: \"remote\",\n inspection: \"none\",\n});\n\n/** Only the tab's reactor is inspectable here, so new collections land on it. */\nexport const PLACE_ON_LOCAL: CollectionRequirementsInput = Object.freeze({\n inspectable: true,\n});\n\nexport function localReach(kind: LocalReactorModule[\"kind\"]): ReactorReach {\n return kind === \"worker\"\n ? { hosting: \"worker\", inspection: \"rpc\" }\n : { hosting: \"in-process\", inspection: \"direct\" };\n}\n\n/** Read at every refresh, never kept: a rebuilt reactor reports its own. */\nexport function localFacts(\n module: LocalReactorModule,\n): () => Promise<ReactorInfo> {\n if (module.kind === \"worker\") {\n return () => module.inspector.info();\n }\n return async () => {\n const reactorModule = module.reactorModule;\n if (!reactorModule) {\n throw new Error(\"The in-tab reactor exposes no module to inspect\");\n }\n return createReactorInspector(reactorModule).info();\n };\n}\n\n/** `<origin>[/<prefix>]/d/<slug>` -> `<origin>[/<prefix>]/graphql`. */\nexport function deriveSwitchboardGraphqlUrl(\n remoteDriveUrl: string,\n): string | undefined {\n let parsed: URL;\n try {\n parsed = new URL(remoteDriveUrl);\n } catch {\n return undefined;\n }\n const prefix = /^(.*)\\/d\\/[^/]+\\/?$/.exec(parsed.pathname)?.[1];\n return prefix === undefined ? undefined : `${parsed.origin}${prefix}/graphql`;\n}\n\nexport type MultiReactorParams = {\n /** The local module, built and ready. Undefined builds a REMOTE-ONLY router\n * (no local backend → no local reactor, no PGlite): the `remote` client. */\n module: LocalReactorModule | undefined;\n remoteGraphqlUrl: string;\n signer: ISigner;\n /** Signing models when the local module exposes no registry; the router asks the local reactor (or, remote-only, the statically-loaded set). */\n documentModelModules: readonly DocumentModelModule[];\n onDiagnostic?: RouterDiagnostic;\n};\n\n/** Remote-only placement: the Switchboard serves every collection. (It offers\n * no inspection surface over GraphQL, so PLACE_ON_LOCAL's `inspectable`\n * requirement must NOT apply, or no backend would be eligible.) */\nexport const PLACE_ON_REMOTE: CollectionRequirementsInput = Object.freeze({});\n\n/** The router Connect installs, with Connect's handling of credentials and id checks. */\nexport class ConnectRoutingClient extends RoutingReactorClient {\n private readonly remote: GraphQLRoutableBackend;\n private readonly hasLocal: boolean;\n\n constructor(\n backends: readonly RoutableBackendConfig[],\n options: RoutingClientOptions,\n remote: GraphQLRoutableBackend,\n hasLocal: boolean,\n ) {\n super(backends, options);\n this.remote = remote;\n this.hasLocal = hasLocal;\n }\n\n /** Renown's sign-in and sign-out call this on whatever client is installed. */\n notifyCredentialsChanged(): void {\n this.remote.notifyCredentialsChanged();\n }\n\n /** The local answer stands when only the Switchboard could not answer — but\n * only when there IS a local backend. Remote-only has nothing to fall back\n * to, so its errors surface. */\n override async isDocumentIdTaken(\n documentId: string,\n signal?: AbortSignal,\n ): Promise<boolean> {\n try {\n return await super.isDocumentIdTaken(documentId, signal);\n } catch (error) {\n if (!this.hasLocal || !failedOnlyOnRemote(error)) {\n throw error;\n }\n logger.warn(\n \"The Switchboard could not say whether @id is taken; using the local reactor's answer: @error\",\n documentId,\n error,\n );\n return false;\n }\n }\n}\n\nfunction failedOnlyOnRemote(error: unknown): boolean {\n return (\n error instanceof FanInPartialFailureError &&\n error.failures.every((failure) => failure.backend === REMOTE_BACKEND_NAME)\n );\n}\n\n/**\n * Build the Connect routing client. With a local `module` it is the router\n * over the tab's reactor (primary) and the Switchboard; WITHOUT one it is the\n * `remote` client — a remote-only router whose single backend is the\n * Switchboard, so no local reactor (and no PGlite) is built. Either way the\n * result is a full IReactorClient the app graph consumes unchanged.\n */\nexport async function buildMultiReactorClient(\n params: MultiReactorParams,\n): Promise<ConnectRoutingClient> {\n const module = params.module;\n const registry = module?.reactorModule?.documentModelRegistry;\n const remote = createGraphQLRoutableBackend({\n url: params.remoteGraphqlUrl,\n documentModels: () =>\n registry?.getAllModules() ?? params.documentModelModules,\n });\n const remoteBackend: RoutableBackendConfig = {\n name: REMOTE_BACKEND_NAME,\n backend: remote.backend,\n facts: () => remote.info(),\n reach: REMOTE_REACH,\n refusesMisroutes: false,\n };\n const backends: RoutableBackendConfig[] = module\n ? [\n {\n name: LOCAL_BACKEND_NAME,\n backend: fromReactorClient(module.client),\n facts: localFacts(module),\n reach: localReach(module.kind),\n refusesMisroutes: false,\n },\n remoteBackend,\n ]\n : [remoteBackend];\n const router = new ConnectRoutingClient(\n backends,\n {\n // Remote-only: the Switchboard is primary and serves every collection;\n // with a local reactor, new collections land on it (inspectable).\n primaryBackend: module ? LOCAL_BACKEND_NAME : REMOTE_BACKEND_NAME,\n defaultRequirements: module ? PLACE_ON_LOCAL : PLACE_ON_REMOTE,\n signer: params.signer,\n onDiagnostic: params.onDiagnostic,\n },\n remote,\n Boolean(module),\n );\n await router.refreshFacts();\n return router;\n}\n"],"names":[],"mappings":";;;;;;;AAiBA,MAAM,oBAAkC;;;;;;;;;;;;;;;;;AAsBxC,IAAM,cAAN,MAAkB;CAChB,sBAAuB,IAAI,IAAoB;CAE/C,MAA4B,UAAgB;EAC1C,MAAM,EAAE,IAAI,MAAM,iBAAiB,SAAS;EAC5C,IAAK,qBAA2C,SAAS,YAAY,GAAG;GACtE,KAAK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