@powerhousedao/connect 6.2.3-dev.60 → 6.2.3-dev.62

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-DE2TKUfn.js → ClearStorageModal-CXWhHez-.js} +9 -11
  5. package/dist/ClearStorageModal-CXWhHez-.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-BYrr41NU.js → DebugSettingsModal-C0j4mtkx.js} +8 -8
  13. package/dist/{DebugSettingsModal-BYrr41NU.js.map → DebugSettingsModal-C0j4mtkx.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-CpqAS_PY.js → InspectorModal-CKuKR5g7.js} +9 -9
  31. package/dist/{InspectorModal-CpqAS_PY.js.map → InspectorModal-CKuKR5g7.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-C9vyTb6I.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-DqNf3gc0.js +1291 -0
  43. package/dist/app-loader-DqNf3gc0.js.map +1 -0
  44. package/dist/app-loader-gMCokq-Y.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-CRwnXFRI.js → build-info-BL03di3M.js} +5 -5
  51. package/dist/{build-info-CRwnXFRI.js.map → build-info-BL03di3M.js.map} +1 -1
  52. package/dist/components-D4yHqff7.js +120 -0
  53. package/dist/components-D4yHqff7.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-BO0qVu72.js → load-CEuzCNRz.js} +48 -48
  74. package/dist/load-CEuzCNRz.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-B8Sh7Et8.js → reactor-DmBtssmg.js} +50 -46
  91. package/dist/reactor-DmBtssmg.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-B4Z1LV9b.js +4 -0
  105. package/dist/router-BlxJIE3W.js +604 -0
  106. package/dist/router-BlxJIE3W.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/{SettingsModal-_hk8S-ey.js → settings-2Id1UgNY.js} +126 -83
  114. package/dist/settings-2Id1UgNY.js.map +1 -0
  115. package/dist/settings-CjvK8OKA.js +91 -0
  116. package/dist/settings-CjvK8OKA.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-DE2TKUfn.js.map +0 -1
  164. package/dist/DocumentVersionUnsupportedModal-C4fy7fZ6.js.map +0 -1
  165. package/dist/OpenFileDocumentsModal-C9vyTb6I.js.map +0 -1
  166. package/dist/SettingsModal-_hk8S-ey.js.map +0 -1
  167. package/dist/app-loader-C_y2O5-k.js +0 -2379
  168. package/dist/app-loader-C_y2O5-k.js.map +0 -1
  169. package/dist/app-loader-DthM3kLU.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-DVQlpeR0.js +0 -5
  173. package/dist/load-BO0qVu72.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-B8Sh7Et8.js.map +0 -1
  178. package/dist/runtime-config-DI5OfIC6.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components-D4yHqff7.js","sources":["../src/utils/openUrl.ts","../src/components/dots-loader.tsx","../src/components/footer.tsx","../src/components/search-bar.tsx"],"sourcesContent":["const openBrowserUrl = (url: string) => window.open(url, \"_blank\");\n\nexport const openUrl = openBrowserUrl;\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 { 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 { 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"],"names":["DesignSystemFooter"],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EACJ,OAAO;EACP,MAAM,oBAAC,MAAD;GAAM,MAAK;GAAS,OAAM;GAAU,MAAM;EAAK,CAAA;CACvD;CACA;EACE,IAAI;EACJ,OAAO;EACP,MAAM,oBAAC,MAAD;GAAM,MAAK;GAAY,OAAM;GAAU,MAAM;EAAK,CAAA;CAC1D;CACA;EACE,IAAI;EACJ,OAAO;EACP,MAAM,oBAAC,MAAD;GAAM,MAAK;GAAQ,OAAM;GAAU,MAAM;EAAK,CAAA;CACtD;AACF;AAEA,MAAa,kBAAkB;CAC7B,MAAM,EAAE,MAAM,eAAe;CAE7B,OACE,oBAAC,kBAAD;EACE,WAAU;EACV,aAAa,EAAE,uBAAuB;EACtC,aAAa,EAAE,uBAAuB;EACtC,aAAa;CACd,CAAA;AAEL","debug_id":"dc1da679-a66f-5cc6-86a3-76e39abbbeae"}
@@ -0,0 +1,434 @@
1
+
2
+ !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]="b9208c68-ea05-53c0-890f-053cb2f6c5d4")}catch(e){}}();
3
+ import { t as captureException } from "./sentry-CJb7--mu.js";
4
+ import { g as stringifyConnectSearch, h as parseConnectSearch, i as DriveNotFoundView, m as definedSearch, o as NotFoundView, v as isDriveNotFound } from "./route-components-BkztQruF.js";
5
+ import { n as keepOpenedFrom, r as settingsTabs, u as driveTitle } from "./settings-CjvK8OKA.js";
6
+ import { createElement, useMemo } from "react";
7
+ import { OPENED_FROM_STATE_KEY, applySearchUpdate, findDriveBySlugOrId, getPHStoreSubscribe, isSettingsTarget, makeDriveSlug, openedFromIndex, resolveSearchUpdate } from "@powerhousedao/reactor-browser";
8
+ import { createRouter, useRouterState } from "@tanstack/react-router";
9
+ import { routeTree } from "@powerhousedao/connect/route-tree";
10
+ /** The measures each navigation writes, as the bench reads them. */
11
+ const ROUTER_MEASURES = {
12
+ /** `navigation.open` to the router starting the navigation. */
13
+ click: "nav click",
14
+ /** Route loaders, until the router commits the matches. */
15
+ loader: "nav loader",
16
+ /** The commit until React has rendered it. */
17
+ commit: "nav commit",
18
+ /** The click (or the navigation's start) to the next frame after render. */
19
+ total: "nav total"
20
+ };
21
+ const DETAIL = { devtools: {
22
+ dataType: "track-entry",
23
+ track: "Router",
24
+ trackGroup: "Connect"
25
+ } };
26
+ let marking = 0;
27
+ let clickedAt;
28
+ /** On in dev builds; elsewhere only with the runtime flag. */
29
+ function routerPerfEnabled(dev = import.meta.env.DEV) {
30
+ if (dev) return true;
31
+ try {
32
+ return new URLSearchParams(location.search).get("perf") === "1" || localStorage.getItem("ph:perf") === "1";
33
+ } catch {
34
+ return false;
35
+ }
36
+ }
37
+ /** Marks a navigation's click; a no-op unless a router is being marked. */
38
+ function markNavigationClick() {
39
+ if (!marking) return;
40
+ clickedAt = performance.now();
41
+ performance.mark("nav:click", { detail: DETAIL });
42
+ }
43
+ function measure(name, start, end) {
44
+ if (start === void 0) return;
45
+ performance.measure(name, {
46
+ start,
47
+ end,
48
+ detail: DETAIL
49
+ });
50
+ }
51
+ /** Writes each navigation's phases as performance measures; returns the unsubscribe. */
52
+ function markRouterNavigations(router, enabled = routerPerfEnabled()) {
53
+ if (!enabled) return () => {};
54
+ marking++;
55
+ let generation = 0;
56
+ let clicked;
57
+ let navigated;
58
+ let loading;
59
+ let loaded;
60
+ const unsubscribes = [
61
+ router.subscribe("onBeforeNavigate", () => {
62
+ generation++;
63
+ navigated = performance.now();
64
+ clicked = clickedAt;
65
+ clickedAt = void 0;
66
+ measure(ROUTER_MEASURES.click, clicked, navigated);
67
+ loading = loaded = void 0;
68
+ }),
69
+ router.subscribe("onBeforeLoad", () => {
70
+ loading = performance.now();
71
+ }),
72
+ router.subscribe("onLoad", () => {
73
+ loaded = performance.now();
74
+ measure(ROUTER_MEASURES.loader, loading, loaded);
75
+ }),
76
+ router.subscribe("onRendered", () => {
77
+ measure(ROUTER_MEASURES.commit, loaded, performance.now());
78
+ const current = generation;
79
+ const start = clicked ?? navigated;
80
+ requestAnimationFrame(() => setTimeout(() => {
81
+ if (current === generation) measure(ROUTER_MEASURES.total, start, performance.now());
82
+ }));
83
+ })
84
+ ];
85
+ return () => {
86
+ marking--;
87
+ for (const unsubscribe of unsubscribes) unsubscribe();
88
+ };
89
+ }
90
+ //#endregion
91
+ //#region src/router/scroll.ts
92
+ const TRAVERSALS = /* @__PURE__ */ new Set([
93
+ "BACK",
94
+ "FORWARD",
95
+ "GO"
96
+ ]);
97
+ const traversals = /* @__PURE__ */ new WeakMap();
98
+ /** The router's `scrollRestoration`: on for back/forward only; other
99
+ * navigations reset the content view in `bindConnectScroll`. */
100
+ function connectScrollRestoration() {
101
+ const state = { traversal: true };
102
+ const restore = ({ location }) => state.traversal || !!location.hash;
103
+ traversals.set(restore, state);
104
+ return restore;
105
+ }
106
+ /** Tracks history actions, and resets a scrolled content view on new views. */
107
+ function bindConnectScroll(router, contentViewId) {
108
+ const state = traversals.get(router.options.scrollRestoration);
109
+ if (!state) return () => {};
110
+ const unsubscribeHistory = router.history.subscribe(({ action }) => {
111
+ state.traversal = TRAVERSALS.has(action.type);
112
+ });
113
+ if (typeof document === "undefined") return unsubscribeHistory;
114
+ let scrolledView;
115
+ let windowScrolled = false;
116
+ const onScroll = (event) => {
117
+ const target = event.target;
118
+ if (target === document) windowScrolled = window.scrollY > 0 || window.scrollX > 0;
119
+ else if (target instanceof Element && target.id === contentViewId) scrolledView = target.scrollTop > 0 ? target : void 0;
120
+ };
121
+ document.addEventListener("scroll", onScroll, {
122
+ capture: true,
123
+ passive: true
124
+ });
125
+ let resetScroll = true;
126
+ const unsubscribes = [
127
+ unsubscribeHistory,
128
+ router.subscribe("onBeforeRouteMount", () => {
129
+ resetScroll = router._scroll.n;
130
+ }),
131
+ router.subscribe("onRendered", ({ toLocation }) => {
132
+ if (state.traversal || toLocation.hash || !resetScroll) return;
133
+ if (scrolledView?.isConnected) scrolledView.scrollTo(0, 0);
134
+ if (windowScrolled) window.scrollTo(0, 0);
135
+ scrolledView = void 0;
136
+ windowScrolled = false;
137
+ })
138
+ ];
139
+ return () => {
140
+ document.removeEventListener("scroll", onScroll, { capture: true });
141
+ for (const unsubscribe of unsubscribes) unsubscribe();
142
+ };
143
+ }
144
+ //#endregion
145
+ //#region src/router/navigation.ts
146
+ const PRELOAD_DELAY_MS = 50;
147
+ /** The PH navigation backed by `router`; its hooks take the router directly,
148
+ * so they work outside the RouterProvider. */
149
+ function createConnectNavigation(connectRouter) {
150
+ const { router, homeRoute, driveRoute, settingsRoute } = connectRouter;
151
+ const anyRouter = router;
152
+ const driveParams = (target) => {
153
+ const drive = findDriveBySlugOrId(router.options.context.store, target.driveSlug);
154
+ return {
155
+ driveSlug: drive ? makeDriveSlug(drive) : target.driveSlug,
156
+ nodeSlug: target.nodeSlug || void 0
157
+ };
158
+ };
159
+ const settingsPath = ({ settings }) => {
160
+ const tab = settings === true ? settingsTabs(anyRouter).at(0)?.id : settings;
161
+ return tab ? `${settingsRoute.fullPath}/${tab}` : settingsRoute.fullPath;
162
+ };
163
+ const setSearch = (update, options) => {
164
+ router.navigate({
165
+ to: ".",
166
+ search: (prev) => applySearchUpdate({}, update(definedSearch(prev))),
167
+ state: true,
168
+ replace: options?.replace,
169
+ resetScroll: false
170
+ });
171
+ };
172
+ const showsSettings = () => router.state.matches.some((match) => match.routeId === settingsRoute.id);
173
+ const openedFromState = (replace, target) => {
174
+ const { state } = router.history.location;
175
+ const next = replace || isSettingsTarget(target) && showsSettings() ? keepOpenedFrom(state) : { [OPENED_FROM_STATE_KEY]: state.__TSR_index };
176
+ return () => next;
177
+ };
178
+ const targetKey = (target) => {
179
+ if (!target) return homeRoute.id;
180
+ if (isSettingsTarget(target)) return settingsPath(target);
181
+ const { driveSlug, nodeSlug } = driveParams(target);
182
+ return JSON.stringify([driveSlug, nodeSlug ?? ""]);
183
+ };
184
+ let keyedMatches;
185
+ let matchesKey;
186
+ const currentKey = (matches) => {
187
+ if (matches === keyedMatches) return matchesKey;
188
+ keyedMatches = matches;
189
+ const drive = matches.find((match) => match.routeId === driveRoute.id);
190
+ const settings = matches.some((match) => match.routeId === settingsRoute.id);
191
+ if (drive) matchesKey = targetKey(drive.params);
192
+ else if (settings) matchesKey = matches.at(-1)?.fullPath.replace(/\/$/, "");
193
+ else matchesKey = matches.find((match) => match.routeId === homeRoute.id)?.routeId;
194
+ return matchesKey;
195
+ };
196
+ const hrefs = /* @__PURE__ */ new Map();
197
+ let hrefsSearch;
198
+ const setSearchParams = (update, options) => setSearch((prev) => resolveSearchUpdate(prev, update), options);
199
+ let preloadTimer;
200
+ return {
201
+ location: () => router.history.location,
202
+ open: (target, options) => {
203
+ markNavigationClick();
204
+ const search = applySearchUpdate({}, options?.search ?? {});
205
+ const replace = options?.replace;
206
+ const state = openedFromState(replace, target);
207
+ if (!target) {
208
+ router.navigate({
209
+ to: homeRoute.fullPath,
210
+ search,
211
+ replace,
212
+ state
213
+ });
214
+ return;
215
+ }
216
+ if (isSettingsTarget(target)) {
217
+ anyRouter.navigate({
218
+ to: settingsPath(target),
219
+ search,
220
+ replace,
221
+ state
222
+ });
223
+ return;
224
+ }
225
+ router.navigate({
226
+ to: driveRoute.fullPath,
227
+ params: driveParams(target),
228
+ search,
229
+ replace,
230
+ state
231
+ });
232
+ },
233
+ hrefFor: (target) => {
234
+ const { searchStr } = router.latestLocation;
235
+ if (searchStr !== hrefsSearch) {
236
+ hrefs.clear();
237
+ hrefsSearch = searchStr;
238
+ }
239
+ const key = targetKey(target);
240
+ let href = hrefs.get(key);
241
+ if (href === void 0) {
242
+ href = (!target ? router.buildLocation({
243
+ to: homeRoute.fullPath,
244
+ search: {}
245
+ }) : isSettingsTarget(target) ? anyRouter.buildLocation({
246
+ to: settingsPath(target),
247
+ search: {}
248
+ }) : router.buildLocation({
249
+ to: driveRoute.fullPath,
250
+ params: driveParams(target),
251
+ search: {}
252
+ })).publicHref;
253
+ hrefs.set(key, href);
254
+ }
255
+ return href;
256
+ },
257
+ useIsCurrent: (target) => {
258
+ const anyTab = isSettingsTarget(target) && target.settings === true;
259
+ const key = anyTab ? `${settingsRoute.fullPath}/` : targetKey(target);
260
+ return useRouterState({
261
+ router,
262
+ select: (state) => {
263
+ const current = currentKey(state.matches);
264
+ return anyTab ? !!current?.startsWith(key) : current === key;
265
+ }
266
+ });
267
+ },
268
+ preload: (target) => {
269
+ clearTimeout(preloadTimer);
270
+ if (!target) return;
271
+ preloadTimer = setTimeout(() => {
272
+ (isSettingsTarget(target) ? anyRouter.preloadRoute({ to: settingsPath(target) }) : router.preloadRoute({
273
+ to: driveRoute.fullPath,
274
+ params: driveParams(target)
275
+ })).catch(() => void 0);
276
+ }, PRELOAD_DELAY_MS);
277
+ },
278
+ setSearch,
279
+ useSearchParams() {
280
+ const search = useRouterState({
281
+ router,
282
+ select: (state) => state.matches.at(-1)?.search ?? state.location.search
283
+ });
284
+ return useMemo(() => definedSearch(search), [search]);
285
+ },
286
+ useSetSearchParams: () => setSearchParams,
287
+ closeOpened: () => {
288
+ const { state } = router.history.location;
289
+ const from = openedFromIndex(state, state.__TSR_index);
290
+ if (from === void 0) return false;
291
+ router.history.go(from - state.__TSR_index);
292
+ return true;
293
+ },
294
+ dispose: () => clearTimeout(preloadTimer)
295
+ };
296
+ }
297
+ //#endregion
298
+ //#region src/router/route-tree.ts
299
+ /** The home route's id; a tree change that moves it is a type error here. */
300
+ const HOME_ROUTE_ID = "/_app/_content/";
301
+ /** The sidebar layout's id; a project's _app/ routes nest in it. */
302
+ const APP_ROUTE_ID = "/_app";
303
+ const DRIVE_PATH = "/d/$driveSlug/{-$nodeSlug}";
304
+ function findChild(parent, idOrPath) {
305
+ const child = (parent.children ?? []).find((route) => {
306
+ const options = route.options;
307
+ return options.id === idOrPath || options.path === idOrPath;
308
+ });
309
+ if (!child) throw new Error(`Connect's route tree lacks ${idOrPath}`);
310
+ return child;
311
+ }
312
+ /** Connect's routes in the generated tree; deployment routes attach to these. */
313
+ function connectRoutes() {
314
+ const appRoute = findChild(routeTree, APP_ROUTE_ID);
315
+ const contentRoute = findChild(appRoute, "/_content");
316
+ return {
317
+ routeTree,
318
+ rootRoute: routeTree,
319
+ appRoute,
320
+ contentRoute,
321
+ homeRoute: findChild(contentRoute, "/"),
322
+ driveRoute: findChild(contentRoute, DRIVE_PATH),
323
+ settingsRoute: findChild(appRoute, "/settings")
324
+ };
325
+ }
326
+ /** Code routes, e.g. `createRoute({ getParentRoute: () => rootRoute })`, join
327
+ * their parent's file routes; an embedding app without the router plugin adds routes so. */
328
+ function addConnectRoutes(routes) {
329
+ for (const route of routes) {
330
+ const parent = route.options.getParentRoute();
331
+ if (!parent) throw new Error("A Connect route needs getParentRoute");
332
+ const children = parent.children ?? [];
333
+ if (!children.includes(route)) parent.addChildren([...children, route]);
334
+ }
335
+ }
336
+ /** The route tree; components reach its routes through router context. */
337
+ function createConnectRouteTree(_components) {
338
+ const { homeRoute, driveRoute } = connectRoutes();
339
+ return {
340
+ routeTree,
341
+ homeRoute,
342
+ driveRoute
343
+ };
344
+ }
345
+ //#endregion
346
+ //#region src/router/connect-router.ts
347
+ /** The scroll container of the content view. */
348
+ const CONTENT_VIEW_ID = "content-view";
349
+ function reportRouteError(error, info) {
350
+ captureException(error, info?.componentStack ? { data: { componentStack: info.componentStack } } : void 0);
351
+ }
352
+ function createConnectRouter(options) {
353
+ if (options.routes) addConnectRoutes(options.routes);
354
+ const { routeTree, homeRoute, driveRoute, settingsRoute } = connectRoutes();
355
+ return {
356
+ router: createRouter({
357
+ routeTree,
358
+ basepath: options.basepath,
359
+ history: options.history,
360
+ context: {
361
+ store: options.store,
362
+ arrivals: options.arrivals,
363
+ components: options.components,
364
+ appName: options.appName
365
+ },
366
+ parseSearch: parseConnectSearch,
367
+ stringifySearch: stringifyConnectSearch,
368
+ scrollRestoration: connectScrollRestoration(),
369
+ scrollToTopSelectors: [`#${CONTENT_VIEW_ID}`],
370
+ InnerWrap: options.InnerWrap,
371
+ defaultErrorComponent: options.components.error,
372
+ defaultNotFoundComponent: ({ data }) => isDriveNotFound(data) ? createElement(DriveNotFoundView, { driveSlug: data.driveSlug }) : createElement(NotFoundView),
373
+ defaultOnCatch: options.onCatch ?? reportRouteError
374
+ }),
375
+ homeRoute,
376
+ driveRoute,
377
+ settingsRoute
378
+ };
379
+ }
380
+ function writeSelection(store, data) {
381
+ if (store.selectedNodeId !== data?.nodeId) store.revisionHistoryVisible = false;
382
+ store.selectedDriveId = data?.driveId;
383
+ store.selectedNodeId = data?.nodeId;
384
+ }
385
+ /** Makes `router` the store's navigation and writes the selection it commits. */
386
+ function bindConnectRouter(connectRouter, store) {
387
+ const { router, driveRoute } = connectRouter;
388
+ const commitSelection = () => {
389
+ const matches = router.state.matches;
390
+ const drive = matches.find((match) => match.routeId === driveRoute.id);
391
+ if (drive) {
392
+ if (drive.status === "success" && drive.loaderData) writeSelection(store, drive.loaderData);
393
+ else if (matches.some((match) => match.status === "notFound")) writeSelection(store, void 0);
394
+ return;
395
+ }
396
+ const shown = matches.at(-1)?.status;
397
+ if (shown === "success" || shown === "notFound") writeSelection(store, void 0);
398
+ };
399
+ const navigation = createConnectNavigation(connectRouter);
400
+ store.navigation = navigation;
401
+ const shownTitle = () => {
402
+ const drive = router.state.matches.find((m) => m.routeId === driveRoute.id);
403
+ return driveTitle(store, drive?.loaderData, router.options.context.appName);
404
+ };
405
+ let title = shownTitle();
406
+ const retitle = () => {
407
+ const next = shownTitle();
408
+ if (next === title) return;
409
+ title = next;
410
+ router.invalidate({ filter: (m) => m.routeId === driveRoute.id });
411
+ };
412
+ const unsubscribes = [
413
+ router.subscribe("onBeforeRouteMount", commitSelection),
414
+ router.subscribe("onResolved", commitSelection),
415
+ router.subscribe("onResolved", () => {
416
+ title = shownTitle();
417
+ }),
418
+ getPHStoreSubscribe(store, "drives")(retitle),
419
+ markRouterNavigations(router)
420
+ ];
421
+ const unbindScroll = bindConnectScroll(router, CONTENT_VIEW_ID);
422
+ commitSelection();
423
+ return () => {
424
+ navigation.dispose();
425
+ unbindScroll();
426
+ for (const unsubscribe of unsubscribes) unsubscribe();
427
+ if (store.navigation === navigation) store.navigation = void 0;
428
+ };
429
+ }
430
+ //#endregion
431
+ export { HOME_ROUTE_ID as a, createConnectRouteTree as c, APP_ROUTE_ID as i, createConnectNavigation as l, bindConnectRouter as n, addConnectRoutes as o, createConnectRouter as r, connectRoutes as s, CONTENT_VIEW_ID as t };
432
+
433
+ //# sourceMappingURL=connect-router-KmNBGS0G.js.map
434
+ //# debugId=b9208c68-ea05-53c0-890f-053cb2f6c5d4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-router-KmNBGS0G.js","sources":["../src/router/perf-marks.ts","../src/router/scroll.ts","../src/router/navigation.ts","../src/router/route-tree.ts","../src/router/connect-router.ts"],"sourcesContent":["import type { AnyRouter } from \"@tanstack/react-router\";\n\n/** `localStorage[PERF_STORAGE_KEY] = \"1\"` or `?perf=1` turns the marks on in production. */\nexport const PERF_STORAGE_KEY = \"ph:perf\";\n\n/** The measures each navigation writes, as the bench reads them. */\nexport const ROUTER_MEASURES = {\n /** `navigation.open` to the router starting the navigation. */\n click: \"nav click\",\n /** Route loaders, until the router commits the matches. */\n loader: \"nav loader\",\n /** The commit until React has rendered it. */\n commit: \"nav commit\",\n /** The click (or the navigation's start) to the next frame after render. */\n total: \"nav total\",\n} as const;\n\n// Chrome's Performance panel shows these as \"Connect › Router\".\nconst DETAIL = {\n devtools: { dataType: \"track-entry\", track: \"Router\", trackGroup: \"Connect\" },\n} as const;\n\nlet marking = 0;\nlet clickedAt: number | undefined;\n\n/** On in dev builds; elsewhere only with the runtime flag. */\nexport function routerPerfEnabled(dev: boolean = import.meta.env.DEV) {\n if (dev) return true;\n try {\n return (\n new URLSearchParams(location.search).get(\"perf\") === \"1\" ||\n localStorage.getItem(PERF_STORAGE_KEY) === \"1\"\n );\n } catch {\n return false;\n }\n}\n\n/** Marks a navigation's click; a no-op unless a router is being marked. */\nexport function markNavigationClick() {\n if (!marking) return;\n clickedAt = performance.now();\n performance.mark(\"nav:click\", { detail: DETAIL });\n}\n\nfunction measure(name: string, start: number | undefined, end: number) {\n if (start === undefined) return;\n performance.measure(name, { start, end, detail: DETAIL });\n}\n\n/** Writes each navigation's phases as performance measures; returns the unsubscribe. */\nexport function markRouterNavigations(\n router: Pick<AnyRouter, \"subscribe\">,\n enabled = routerPerfEnabled(),\n) {\n if (!enabled) return () => {};\n marking++;\n let generation = 0;\n let clicked: number | undefined;\n let navigated: number | undefined;\n let loading: number | undefined;\n let loaded: number | undefined;\n const unsubscribes = [\n router.subscribe(\"onBeforeNavigate\", () => {\n generation++;\n navigated = performance.now();\n clicked = clickedAt;\n clickedAt = undefined;\n measure(ROUTER_MEASURES.click, clicked, navigated);\n loading = loaded = undefined;\n }),\n router.subscribe(\"onBeforeLoad\", () => {\n loading = performance.now();\n }),\n router.subscribe(\"onLoad\", () => {\n loaded = performance.now();\n measure(ROUTER_MEASURES.loader, loading, loaded);\n }),\n router.subscribe(\"onRendered\", () => {\n measure(ROUTER_MEASURES.commit, loaded, performance.now());\n const current = generation;\n const start = clicked ?? navigated;\n // The frame after render, as close to paint as a script sees.\n requestAnimationFrame(() =>\n setTimeout(() => {\n if (current === generation) {\n measure(ROUTER_MEASURES.total, start, performance.now());\n }\n }),\n );\n }),\n ];\n return () => {\n marking--;\n for (const unsubscribe of unsubscribes) unsubscribe();\n };\n}\n","import type {\n AnyRouter,\n ParsedLocation,\n RouterHistory,\n} from \"@tanstack/react-router\";\n\ntype ScrollRouter = Pick<AnyRouter, \"subscribe\" | \"_scroll\" | \"options\"> & {\n history: RouterHistory;\n};\n\nconst TRAVERSALS = new Set([\"BACK\", \"FORWARD\", \"GO\"]);\nconst traversals = new WeakMap<object, { traversal: boolean }>();\n\n/** The router's `scrollRestoration`: on for back/forward only; other\n * navigations reset the content view in `bindConnectScroll`. */\nexport function connectScrollRestoration() {\n // The first load restores a reloaded page's scroll.\n const state = { traversal: true };\n const restore = ({ location }: { location: ParsedLocation }) =>\n state.traversal || !!location.hash;\n traversals.set(restore, state);\n return restore;\n}\n\n/** Tracks history actions, and resets a scrolled content view on new views. */\nexport function bindConnectScroll(router: ScrollRouter, contentViewId: string) {\n const state = traversals.get(router.options.scrollRestoration as object);\n if (!state) return () => {};\n const unsubscribeHistory = router.history.subscribe(({ action }) => {\n state.traversal = TRAVERSALS.has(action.type);\n });\n if (typeof document === \"undefined\") return unsubscribeHistory;\n\n // Read in the scroll event, where layout is clean, not at navigation.\n let scrolledView: Element | undefined;\n let windowScrolled = false;\n const onScroll = (event: Event) => {\n const target = event.target;\n if (target === document) {\n windowScrolled = window.scrollY > 0 || window.scrollX > 0;\n } else if (target instanceof Element && target.id === contentViewId) {\n scrolledView = target.scrollTop > 0 ? target : undefined;\n }\n };\n document.addEventListener(\"scroll\", onScroll, {\n capture: true,\n passive: true,\n });\n\n let resetScroll = true;\n const unsubscribes = [\n unsubscribeHistory,\n // The navigation's `resetScroll`, before the router clears it on render.\n router.subscribe(\"onBeforeRouteMount\", () => {\n resetScroll = router._scroll.n;\n }),\n router.subscribe(\"onRendered\", ({ toLocation }) => {\n if (state.traversal || toLocation.hash || !resetScroll) return;\n if (scrolledView?.isConnected) scrolledView.scrollTo(0, 0);\n if (windowScrolled) window.scrollTo(0, 0);\n scrolledView = undefined;\n windowScrolled = false;\n }),\n ];\n return () => {\n document.removeEventListener(\"scroll\", onScroll, { capture: true });\n for (const unsubscribe of unsubscribes) unsubscribe();\n };\n}\n","import type {\n PHDriveTarget,\n PHNavigation,\n PHNavigationTarget,\n PHSettingsTarget,\n SetSearchParams,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n applySearchUpdate,\n findDriveBySlugOrId,\n isSettingsTarget,\n makeDriveSlug,\n OPENED_FROM_STATE_KEY,\n openedFromIndex,\n resolveSearchUpdate,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n AnyRouter,\n HistoryState,\n MakeRouteMatchUnion,\n} from \"@tanstack/react-router\";\nimport { useRouterState } from \"@tanstack/react-router\";\nimport { useMemo } from \"react\";\nimport type { ConnectRouterBundle } from \"./connect-router.js\";\nimport { markNavigationClick } from \"./perf-marks.js\";\nimport { definedSearch } from \"./search.js\";\nimport { keepOpenedFrom, settingsTabs } from \"./settings.js\";\n\n// Hover intent: a pointer passing over cards doesn't preload each of them.\nconst PRELOAD_DELAY_MS = 50;\n\n/** The PH navigation backed by `router`; its hooks take the router directly,\n * so they work outside the RouterProvider. */\nexport function createConnectNavigation(\n connectRouter: ConnectRouterBundle,\n): PHNavigation & { dispose(): void } {\n const { router, homeRoute, driveRoute, settingsRoute } = connectRouter;\n // Settings tabs can come from a project's routes, unknown to Connect's types.\n const anyRouter = router as unknown as AnyRouter;\n\n // A listed drive is addressed by its canonical slug, whatever form came in.\n const driveParams = (target: PHDriveTarget) => {\n const drive = findDriveBySlugOrId(\n router.options.context.store,\n target.driveSlug,\n );\n return {\n driveSlug: drive ? makeDriveSlug(drive) : target.driveSlug,\n nodeSlug: target.nodeSlug || undefined,\n };\n };\n\n // `true` is the first tab, so the URL names a tab without a redirect.\n const settingsPath = ({ settings }: PHSettingsTarget) => {\n const tab =\n settings === true ? settingsTabs(anyRouter).at(0)?.id : settings;\n return tab ? `${settingsRoute.fullPath}/${tab}` : settingsRoute.fullPath;\n };\n\n // In-document writes keep the entry's state, so its opened-from index too.\n const setSearch: PHNavigation[\"setSearch\"] = (update, options) => {\n void router.navigate({\n to: \".\",\n search: (prev) => applySearchUpdate({}, update(definedSearch(prev))),\n state: true,\n replace: options?.replace,\n resetScroll: false,\n });\n };\n\n const showsSettings = () =>\n router.state.matches.some((match) => match.routeId === settingsRoute.id);\n\n // A push remembers the entry it leaves; a replace keeps what that one had,\n // as does a move between settings tabs.\n const openedFromState = (\n replace: boolean | undefined,\n target: PHNavigationTarget | undefined,\n ) => {\n const { state } = router.history.location;\n const next =\n replace || (isSettingsTarget(target) && showsSettings())\n ? keepOpenedFrom(state)\n : ({\n [OPENED_FROM_STATE_KEY]: state.__TSR_index,\n } as unknown as HistoryState);\n return () => next;\n };\n\n const targetKey = (target: PHNavigationTarget | undefined) => {\n if (!target) return homeRoute.id;\n if (isSettingsTarget(target)) return settingsPath(target);\n const { driveSlug, nodeSlug } = driveParams(target);\n return JSON.stringify([driveSlug, nodeSlug ?? \"\"]);\n };\n let keyedMatches: readonly MakeRouteMatchUnion[] | undefined;\n let matchesKey: string | undefined;\n const currentKey = (matches: readonly MakeRouteMatchUnion[]) => {\n if (matches === keyedMatches) return matchesKey;\n keyedMatches = matches;\n const drive = matches.find((match) => match.routeId === driveRoute.id);\n const settings = matches.some(\n (match) => match.routeId === settingsRoute.id,\n );\n if (drive) {\n matchesKey = targetKey(drive.params as PHDriveTarget);\n } else if (settings) {\n // A tab's key is its path, as settingsPath builds it.\n matchesKey = matches.at(-1)?.fullPath.replace(/\\/$/, \"\");\n } else {\n matchesKey = matches.find(\n (match) => match.routeId === homeRoute.id,\n )?.routeId;\n }\n return matchesKey;\n };\n\n // Hrefs depend only on the target and the global params of the current search.\n const hrefs = new Map<string, string>();\n let hrefsSearch: string | undefined;\n\n const setSearchParams: SetSearchParams = (update, options) =>\n setSearch((prev) => resolveSearchUpdate(prev, update), options);\n\n let preloadTimer: ReturnType<typeof setTimeout> | undefined;\n return {\n location: () => router.history.location,\n // The root route's middlewares add the global params to `search`.\n open: (target, options) => {\n markNavigationClick();\n const search = applySearchUpdate({}, options?.search ?? {});\n const replace = options?.replace;\n const state = openedFromState(replace, target);\n if (!target) {\n void router.navigate({\n to: homeRoute.fullPath,\n search,\n replace,\n state,\n });\n return;\n }\n if (isSettingsTarget(target)) {\n void anyRouter.navigate({\n to: settingsPath(target),\n search,\n replace,\n state,\n });\n return;\n }\n void router.navigate({\n to: driveRoute.fullPath,\n params: driveParams(target),\n search,\n replace,\n state,\n });\n },\n // The public href, base path included; global params as `open` keeps them.\n hrefFor: (target) => {\n const { searchStr } = router.latestLocation;\n if (searchStr !== hrefsSearch) {\n hrefs.clear();\n hrefsSearch = searchStr;\n }\n const key = targetKey(target);\n let href = hrefs.get(key);\n if (href === undefined) {\n const location = !target\n ? router.buildLocation({ to: homeRoute.fullPath, search: {} })\n : isSettingsTarget(target)\n ? anyRouter.buildLocation({ to: settingsPath(target), search: {} })\n : router.buildLocation({\n to: driveRoute.fullPath,\n params: driveParams(target),\n search: {},\n });\n href = location.publicHref;\n hrefs.set(key, href);\n }\n return href;\n },\n // One key per shown matches, so each link's selector is a string compare.\n useIsCurrent: (target) => {\n // The settings page itself is current on any of its tabs.\n const anyTab = isSettingsTarget(target) && target.settings === true;\n const key = anyTab ? `${settingsRoute.fullPath}/` : targetKey(target);\n return useRouterState({\n router,\n select: (state) => {\n const current = currentKey(state.matches);\n return anyTab ? !!current?.startsWith(key) : current === key;\n },\n });\n },\n preload: (target) => {\n clearTimeout(preloadTimer);\n if (!target) return;\n preloadTimer = setTimeout(() => {\n const preloading = isSettingsTarget(target)\n ? anyRouter.preloadRoute({ to: settingsPath(target) })\n : router.preloadRoute({\n to: driveRoute.fullPath,\n params: driveParams(target),\n });\n preloading.catch(() => undefined);\n }, PRELOAD_DELAY_MS);\n },\n setSearch,\n // The presented matches' params, else the location's.\n useSearchParams() {\n const search = useRouterState({\n router,\n select: (state) =>\n state.matches.at(-1)?.search ?? state.location.search,\n });\n return useMemo(() => definedSearch(search), [search]);\n },\n useSetSearchParams: () => setSearchParams,\n closeOpened: () => {\n const { state } = router.history.location;\n const from = openedFromIndex(state, state.__TSR_index);\n if (from === undefined) return false;\n router.history.go(from - state.__TSR_index);\n return true;\n },\n dispose: () => clearTimeout(preloadTimer),\n };\n}\n","// Connect's route tree: file routes under src/routes, generated by the router plugin.\nimport type { AnyRoute } from \"@tanstack/react-router\";\n// A project build with its own routes aliases this to its generated tree.\nimport type { FileRoutesById } from \"@powerhousedao/connect/route-tree\";\nimport { routeTree } from \"@powerhousedao/connect/route-tree\";\nimport type { ConnectRouteComponents } from \"./route-components.js\";\n\nexport { DRIVE_PENDING_MS } from \"./route-components.js\";\nexport type { ConnectRouteComponents } from \"./route-components.js\";\n\n/** The home route's id; a tree change that moves it is a type error here. */\nexport const HOME_ROUTE_ID = \"/_app/_content/\" satisfies keyof FileRoutesById;\n/** The sidebar layout's id; a project's _app/ routes nest in it. */\nexport const APP_ROUTE_ID = \"/_app\";\nconst CONTENT_ROUTE_ID = \"/_app/_content\";\nconst DRIVE_PATH = \"/d/$driveSlug/{-$nodeSlug}\";\nconst SETTINGS_ROUTE_ID = \"/_app/settings\";\n\ntype RouteOptions = { id?: string; path?: string };\n\n// Generated routes carry their full id only once a router initialises them.\nfunction findChild(parent: AnyRoute, idOrPath: string) {\n const children = (parent.children ?? []) as AnyRoute[];\n const child = children.find((route) => {\n const options = route.options as RouteOptions;\n return options.id === idOrPath || options.path === idOrPath;\n });\n if (!child) throw new Error(`Connect's route tree lacks ${idOrPath}`);\n return child;\n}\n\n// Named, so declarations reach the tree through the specifier a project aliases;\n// inferred types would point at Connect's own generated file.\nexport type ConnectRootRoute = typeof routeTree;\nexport type ConnectRoutes = {\n routeTree: ConnectRootRoute;\n rootRoute: ConnectRootRoute;\n appRoute: FileRoutesById[typeof APP_ROUTE_ID];\n contentRoute: FileRoutesById[typeof CONTENT_ROUTE_ID];\n homeRoute: FileRoutesById[typeof HOME_ROUTE_ID];\n driveRoute: FileRoutesById[`${typeof CONTENT_ROUTE_ID}${typeof DRIVE_PATH}`];\n settingsRoute: FileRoutesById[typeof SETTINGS_ROUTE_ID];\n};\n\n/** Connect's routes in the generated tree; deployment routes attach to these. */\nexport function connectRoutes(): ConnectRoutes {\n const appRoute = findChild(routeTree, APP_ROUTE_ID);\n const contentRoute = findChild(appRoute, \"/_content\");\n return {\n routeTree,\n rootRoute: routeTree,\n appRoute: appRoute as ConnectRoutes[\"appRoute\"],\n contentRoute: contentRoute as ConnectRoutes[\"contentRoute\"],\n homeRoute: findChild(contentRoute, \"/\") as ConnectRoutes[\"homeRoute\"],\n driveRoute: findChild(\n contentRoute,\n DRIVE_PATH,\n ) as ConnectRoutes[\"driveRoute\"],\n settingsRoute: findChild(\n appRoute,\n \"/settings\",\n ) as ConnectRoutes[\"settingsRoute\"],\n };\n}\n\n/** Code routes, e.g. `createRoute({ getParentRoute: () => rootRoute })`, join\n * their parent's file routes; an embedding app without the router plugin adds routes so. */\nexport function addConnectRoutes(routes: readonly AnyRoute[]) {\n for (const route of routes) {\n const parent = route.options.getParentRoute() as AnyRoute | undefined;\n if (!parent) throw new Error(\"A Connect route needs getParentRoute\");\n const children = (parent.children ?? []) as AnyRoute[];\n if (!children.includes(route)) parent.addChildren([...children, route]);\n }\n}\n\n/** The route tree; components reach its routes through router context. */\nexport function createConnectRouteTree(\n _components?: ConnectRouteComponents,\n): ConnectRouteTree {\n const { homeRoute, driveRoute } = connectRoutes();\n return { routeTree, homeRoute, driveRoute };\n}\n\nexport type ConnectRouteTree = Pick<\n ConnectRoutes,\n \"routeTree\" | \"homeRoute\" | \"driveRoute\"\n>;\n","import type { DriveArrivals, PHStore } from \"@powerhousedao/reactor-browser\";\nimport { getPHStoreSubscribe } from \"@powerhousedao/reactor-browser\";\nimport type { AnyRoute, Router, RouterHistory } from \"@tanstack/react-router\";\nimport { createRouter } from \"@tanstack/react-router\";\nimport type { ErrorInfo, PropsWithChildren, ReactElement } from \"react\";\nimport { createElement } from \"react\";\nimport { captureException } from \"../services/sentry.js\";\nimport { markRouterNavigations } from \"./perf-marks.js\";\nimport { bindConnectScroll, connectScrollRestoration } from \"./scroll.js\";\nimport type { DriveRouteData } from \"./drive-route-loader.js\";\nimport { isDriveNotFound } from \"./drive-route-loader.js\";\nimport type {\n ConnectRootRoute,\n ConnectRouteComponents,\n ConnectRoutes,\n} from \"./route-tree.js\";\nimport { createConnectNavigation } from \"./navigation.js\";\nimport { DriveNotFoundView, NotFoundView } from \"./route-components.js\";\nimport { addConnectRoutes, connectRoutes } from \"./route-tree.js\";\nimport { parseConnectSearch, stringifyConnectSearch } from \"./search.js\";\nimport { driveTitle } from \"./titles.js\";\n\n/** The scroll container of the content view. */\nexport const CONTENT_VIEW_ID = \"content-view\";\n\nexport type ConnectRouterOptions = {\n store: PHStore;\n arrivals?: DriveArrivals;\n components: ConnectRouteComponents;\n basepath?: string;\n history?: RouterHistory;\n InnerWrap?: (props: PropsWithChildren) => ReactElement;\n /** Code routes added to Connect's file routes; see `addConnectRoutes`. */\n routes?: readonly AnyRoute[];\n /** Reports a route's loader or render error; Sentry by default. */\n onCatch?: (error: unknown, info?: ErrorInfo) => void;\n /** Ends every document title; \"Connect\" without one. */\n appName?: string;\n};\n\nfunction reportRouteError(error: unknown, info?: ErrorInfo) {\n captureException(\n error,\n info?.componentStack\n ? { data: { componentStack: info.componentStack } }\n : undefined,\n );\n}\n\n/** The router over `TRouteTree`; a project's generated tree registers its own. */\nexport type ConnectRouterFor<TRouteTree extends AnyRoute> = Router<\n TRouteTree,\n \"never\",\n false,\n RouterHistory,\n Record<string, any>\n>;\n// Written out, not inferred; see ConnectRootRoute.\nexport type ConnectRouter = ConnectRouterFor<ConnectRootRoute>;\nexport type ConnectRouterBundle = Pick<\n ConnectRoutes,\n \"homeRoute\" | \"driveRoute\" | \"settingsRoute\"\n> & { router: ConnectRouter };\n\nexport function createConnectRouter(\n options: ConnectRouterOptions,\n): ConnectRouterBundle {\n if (options.routes) addConnectRoutes(options.routes);\n const { routeTree, homeRoute, driveRoute, settingsRoute } = connectRoutes();\n const router = createRouter({\n routeTree,\n basepath: options.basepath,\n history: options.history,\n context: {\n store: options.store,\n arrivals: options.arrivals,\n components: options.components,\n appName: options.appName,\n },\n parseSearch: parseConnectSearch,\n stringifySearch: stringifyConnectSearch,\n scrollRestoration: connectScrollRestoration(),\n scrollToTopSelectors: [`#${CONTENT_VIEW_ID}`],\n InnerWrap: options.InnerWrap,\n defaultErrorComponent: options.components.error,\n // Not per route: a route's notFoundComponent mounts a boundary that\n // re-renders on every navigation.\n defaultNotFoundComponent: ({ data }) =>\n isDriveNotFound(data)\n ? createElement(DriveNotFoundView, { driveSlug: data.driveSlug })\n : createElement(NotFoundView),\n defaultOnCatch: options.onCatch ?? reportRouteError,\n });\n return { router, homeRoute, driveRoute, settingsRoute };\n}\n\nfunction writeSelection(store: PHStore, data: DriveRouteData | undefined) {\n // Revision history belongs to the document it was opened for.\n if (store.selectedNodeId !== data?.nodeId) {\n store.revisionHistoryVisible = false;\n }\n // Drive first: a new drive resets the node.\n store.selectedDriveId = data?.driveId;\n store.selectedNodeId = data?.nodeId;\n}\n\n/** Makes `router` the store's navigation and writes the selection it commits. */\nexport function bindConnectRouter(\n connectRouter: ConnectRouterBundle,\n store: PHStore,\n) {\n const { router, driveRoute } = connectRouter;\n\n // Only committed matches select; pending ones keep the open view.\n const commitSelection = () => {\n const matches = router.state.matches;\n const drive = matches.find((match) => match.routeId === driveRoute.id);\n if (drive) {\n if (drive.status === \"success\" && drive.loaderData) {\n writeSelection(store, drive.loaderData);\n } else if (matches.some((match) => match.status === \"notFound\")) {\n // The drive's 404 page shows no drive.\n writeSelection(store, undefined);\n }\n return;\n }\n // Any other page (home, settings, a project's, a 404) shows no drive.\n const shown = matches.at(-1)?.status;\n if (shown === \"success\" || shown === \"notFound\") {\n writeSelection(store, undefined);\n }\n };\n\n // Set once, before the first render; selection setters navigate from the start.\n const navigation = createConnectNavigation(connectRouter);\n store.navigation = navigation;\n\n // The drive route's head reads names from the store; a rename re-runs it.\n const shownTitle = () => {\n const drive = router.state.matches.find((m) => m.routeId === driveRoute.id);\n return driveTitle(store, drive?.loaderData, router.options.context.appName);\n };\n let title = shownTitle();\n const retitle = () => {\n const next = shownTitle();\n if (next === title) return;\n title = next;\n void router.invalidate({ filter: (m) => m.routeId === driveRoute.id });\n };\n\n // Before mount, so the view and scroll restoration see the new selection.\n const unsubscribes = [\n router.subscribe(\"onBeforeRouteMount\", commitSelection),\n router.subscribe(\"onResolved\", commitSelection),\n router.subscribe(\"onResolved\", () => {\n title = shownTitle();\n }),\n getPHStoreSubscribe(store, \"drives\")(retitle),\n markRouterNavigations(router),\n ];\n const unbindScroll = bindConnectScroll(router, CONTENT_VIEW_ID);\n commitSelection();\n\n return () => {\n navigation.dispose();\n unbindScroll();\n for (const unsubscribe of unsubscribes) unsubscribe();\n if (store.navigation === navigation) store.navigation = undefined;\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;AAMA,MAAa,kBAAkB;;CAE7B,OAAO;;CAEP,QAAQ;;CAER,QAAQ;;CAER,OAAO;AACT;AAGA,MAAM,SAAS,EACb,UAAU;CAAE,UAAU;CAAe,OAAO;CAAU,YAAY;AAAU,EAC9E;AAEA,IAAI,UAAU;AACd,IAAI;;AAGJ,SAAgB,kBAAkB,MAAe,YAAY,IAAI,KAAK;CACpE,IAAI,KAAK,OAAO;CAChB,IAAI;EACF,OACE,IAAI,gBAAgB,SAAS,MAAM,CAAC,CAAC,IAAI,MAAM,MAAM,OACrD,aAAa,QAAA,SAAwB,MAAM;CAE/C,QAAQ;EACN,OAAO;CACT;AACF;;AAGA,SAAgB,sBAAsB;CACpC,IAAI,CAAC,SAAS;CACd,YAAY,YAAY,IAAI;CAC5B,YAAY,KAAK,aAAa,EAAE,QAAQ,OAAO,CAAC;AAClD;AAEA,SAAS,QAAQ,MAAc,OAA2B,KAAa;CACrE,IAAI,UAAU,KAAA,GAAW;CACzB,YAAY,QAAQ,MAAM;EAAE;EAAO;EAAK,QAAQ;CAAO,CAAC;AAC1D;;AAGA,SAAgB,sBACd,QACA,UAAU,kBAAkB,GAC5B;CACA,IAAI,CAAC,SAAS,aAAa,CAAC;CAC5B;CACA,IAAI,aAAa;CACjB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM,eAAe;EACnB,OAAO,UAAU,0BAA0B;GACzC;GACA,YAAY,YAAY,IAAI;GAC5B,UAAU;GACV,YAAY,KAAA;GACZ,QAAQ,gBAAgB,OAAO,SAAS,SAAS;GACjD,UAAU,SAAS,KAAA;EACrB,CAAC;EACD,OAAO,UAAU,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ACF","debug_id":"b9208c68-ea05-53c0-890f-053cb2f6c5d4"}
@@ -1,9 +1,9 @@
1
1
 
2
- !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]="f8d528cc-dbf9-576e-b6d4-e9d154857c61")}catch(e){}}();
3
- import { n as getRuntimeConfig } from "./runtime-config-DI5OfIC6.js";
4
- import { loadRuntimeEnv, normalizeBasePath } from "@powerhousedao/shared/connect";
2
+ !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]="dedb51bf-40b3-5410-bc8f-5ca7b10c85ac")}catch(e){}}();
3
+ import { t as getRuntimeConfig } from "./runtime-config-DdN1Frg7.js";
4
+ import { setLogLevel } from "@powerhousedao/reactor-browser";
5
5
  import { logger } from "document-model";
6
- import { setLogLevel as setLogLevel$1 } from "@powerhousedao/reactor-browser";
6
+ import { loadRuntimeEnv, normalizeBasePath } from "@powerhousedao/shared/connect";
7
7
  //#region src/utils/openpanel-config.ts
8
8
  /**
9
9
  * Resolve Connect's OpenPanel settings. The runtime config
@@ -115,7 +115,7 @@ const defaultPHAppConfig = {
115
115
  isDragAndDropEnabled: phGlobalConfig.isDragAndDropEnabled
116
116
  };
117
117
  const RESOLVED_LOG_LEVEL = runtime.app?.logLevel;
118
- if (RESOLVED_LOG_LEVEL) setLogLevel$1(RESOLVED_LOG_LEVEL);
118
+ if (RESOLVED_LOG_LEVEL) setLogLevel(RESOLVED_LOG_LEVEL);
119
119
  logger.debug("Setting log level to @level.", RESOLVED_LOG_LEVEL);
120
120
  const PH_CONNECT_BASE_PATH = normalizeBasePath(getDeployBasePath() ?? "/");
121
121
  const PH_CONNECT_ANALYTICS_DATABASE_NAME = `${PH_CONNECT_BASE_PATH.replace(/\//g, "")}:analytics`;
@@ -190,5 +190,5 @@ const connectConfig = {
190
190
  //#endregion
191
191
  export { defaultPHDocumentEditorConfig as a, defaultPHAppConfig as i, buildPHGlobalConfig as n, phGlobalConfig as o, connectConfig as r, PH_CONNECT_BASE_PATH as t };
192
192
 
193
- //# sourceMappingURL=connect.config-CB78ZsFz.js.map
194
- //# debugId=f8d528cc-dbf9-576e-b6d4-e9d154857c61
193
+ //# sourceMappingURL=connect.config-uZF-gnvV.js.map
194
+ //# debugId=dedb51bf-40b3-5410-bc8f-5ca7b10c85ac
@@ -1 +1 @@
1
- {"version":3,"file":"connect.config-CB78ZsFz.js","sources":["../src/utils/openpanel-config.ts","../src/connect.config.ts"],"sourcesContent":["import type { PHConnectOpenPanel } from \"@powerhousedao/shared/clis\";\n\n/** The build-time (Vite env) OpenPanel settings, as parsed by loadRuntimeEnv. */\nexport type OpenPanelBuildEnv = {\n PH_CONNECT_OPENPANEL_CLIENT_ID?: string;\n PH_CONNECT_OPENPANEL_API_URL?: string;\n PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS: boolean;\n PH_CONNECT_OPENPANEL_TRACK_OPERATIONS: boolean;\n};\n\nexport type ResolvedOpenPanelConfig = {\n clientId: string;\n apiUrl: string | undefined;\n trackUiEvents: boolean;\n trackOperations: boolean;\n};\n\n/**\n * Resolve Connect's OpenPanel settings. The runtime config\n * (`connect.openPanel`, settable per deploy via PH_CONNECT_CONFIG_JSON) wins;\n * the build-time PH_CONNECT_OPENPANEL_* env is the fallback so builds that\n * bake it keep working. An empty clientId leaves OpenPanel disabled.\n */\nexport function resolveOpenPanelConfig(\n runtime: PHConnectOpenPanel | undefined,\n env: OpenPanelBuildEnv,\n): ResolvedOpenPanelConfig {\n return {\n clientId: runtime?.clientId || env.PH_CONNECT_OPENPANEL_CLIENT_ID || \"\",\n apiUrl: runtime?.apiUrl || env.PH_CONNECT_OPENPANEL_API_URL || undefined,\n trackUiEvents:\n runtime?.trackUiEvents ?? env.PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS,\n trackOperations:\n runtime?.trackOperations ?? env.PH_CONNECT_OPENPANEL_TRACK_OPERATIONS,\n };\n}\n","import {\n setLogLevel,\n type PHAppConfig,\n type PHDocumentEditorConfig,\n type PHGlobalConfig,\n} from \"@powerhousedao/reactor-browser\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport {\n loadRuntimeEnv,\n normalizeBasePath,\n} from \"@powerhousedao/shared/connect\";\nimport { logger } from \"document-model\";\nimport { getRuntimeConfig } from \"./runtime-config.js\";\nimport { resolveOpenPanelConfig } from \"./utils/openpanel-config.js\";\n\n// Env vars are reserved for version stamps and analytics processor toggles.\n// Everything in the Connect runtime schema (PHConnectRuntimeConfig) is read\n// from `runtime` below. The Sentry release tag is stamped at build time via\n// Vite's `define` so it always matches the sourcemap upload tag CI used.\nexport const env = loadRuntimeEnv({\n processEnv: import.meta.env,\n});\n\ndeclare const PH_CONNECT_SENTRY_RELEASE: string;\n\n// Runtime fields come from the JSON, not env. start-connect.tsx's top-level\n// await guarantees the loader cache is warm by the time this module\n// evaluates, so getRuntimeConfig() resolves synchronously. The cache merges\n// DEFAULT_CONNECT_CONFIG into whatever the file declared, so every leaf\n// under `runtime.*` is guaranteed defined.\nconst runtime = getRuntimeConfig().connect;\n\nfunction getRouterBasenameFromBasePath(basePath: string) {\n return basePath.endsWith(\"/\") ? basePath : basePath + \"/\";\n}\n\n// Runtime deploy base. In dynamic-base builds the plugin rewrites\n// import.meta.env.BASE_URL to (globalThis.__PH_DYNAMIC_BASE__||\"/\"), the same\n// base assets resolve against; it takes precedence so router basename and\n// path stripping match the served subpath. A baked runtime base path\n// (runtime.app.basePath) only applies to concrete-base builds, where the\n// dynamic global is unset.\nfunction getDeployBasePath() {\n if (\n typeof globalThis !== \"undefined\" &&\n (globalThis as { __PH_DYNAMIC_BASE__?: string }).__PH_DYNAMIC_BASE__\n ) {\n return import.meta.env.BASE_URL;\n }\n return runtime.app?.basePath || import.meta.env.BASE_URL;\n}\n\n// Hardcoded literal defaults for `PHGlobalConfig` fields whose env-var\n// source was removed. The fields stay on the type so wired-but-dead SW /\n// hook consumers keep typechecking; values mirror the previous Zod\n// defaults.\nfunction getBuiltInDefaults(): Omit<\n PHGlobalConfig,\n \"basePath\" | \"routerBasename\"\n> {\n const studioMode = runtime.app?.studioMode ?? false;\n // Drive containers, DocumentModel, and vetra builder-spec types are authored\n // via their own drives — never creatable from a generic drive.\n const disabledEditors = [\n \"powerhouse/document-drive\",\n \"powerhouse/reactor-drive\",\n \"powerhouse/document-model\",\n \"powerhouse/app\",\n \"powerhouse/document-editor\",\n \"powerhouse/processor\",\n \"powerhouse/subgraph\",\n \"powerhouse/package\",\n ];\n return {\n allowList: undefined,\n allowedDocumentTypes: [],\n isDragAndDropEnabled: true,\n isEditorDebugModeEnabled: false,\n isEditorReadModeEnabled: false,\n isExternalControlsEnabled: false,\n version: env.PH_CONNECT_VERSION,\n logLevel: runtime.app?.logLevel,\n requiresHardRefresh: true,\n warnOutdatedApp: true,\n studioMode,\n versionCheckInterval: 60 * 60 * 1000,\n cliVersion: env.PH_CONNECT_CLI_VERSION,\n fileUploadOperationsChunkSize: 50,\n gaTrackingId: undefined,\n defaultDrivesUrl: runtime.drives?.defaultDrives?.find(\n (drive) => \"url\" in drive,\n )?.url,\n drivesPreserveStrategy: runtime.drives?.preserveStrategy,\n enabledEditors: undefined,\n disabledEditors,\n\n /* Processors */\n isExternalProcessorsEnabled: true,\n // Analytics off by default; flip to true (or wire a runtime-config field)\n // when we want analytics enabled out of the box.\n isAnalyticsEnabled: false,\n isAnalyticsExternalProcessorsEnabled:\n env.PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED,\n analyticsDatabaseName: undefined,\n isRelationalProcessorsEnabled: true,\n isExternalRelationalProcessorsEnabled: true,\n\n renownUrl: runtime.renown?.url,\n renownNetworkId: runtime.renown?.networkId,\n renownChainId: runtime.renown?.chainId,\n switchboardUrl: runtime.renown?.switchboardUrl,\n renownAdapters: runtime.renown?.adapters,\n sentryRelease: PH_CONNECT_SENTRY_RELEASE,\n sentryDsn: runtime.sentry?.dsn ?? undefined,\n sentryEnv: runtime.sentry?.env,\n isDiffAnalyticsEnabled: env.PH_CONNECT_DIFF_ANALYTICS_ENABLED,\n isDriveAnalyticsEnabled: env.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,\n isPublicDrivesEnabled: runtime.drives?.sections?.remote?.enabled,\n isCloudDrivesEnabled: runtime.drives?.sections?.remote?.enabled ?? true,\n isLocalDrivesEnabled: runtime.drives?.sections?.local?.enabled,\n isSentryTracingEnabled: runtime.sentry?.tracing,\n isDocumentModelSelectionSettingsEnabled: false,\n isAddDriveEnabled: runtime.drives?.allowAddDrive,\n isAddPublicDrivesEnabled: runtime.drives?.sections?.remote?.allowAdd,\n isDeletePublicDrivesEnabled: runtime.drives?.sections?.remote?.allowDelete,\n isAddCloudDrivesEnabled: runtime.drives?.sections?.remote?.allowAdd ?? true,\n isDeleteCloudDrivesEnabled:\n runtime.drives?.sections?.remote?.allowDelete ?? true,\n isAddLocalDrivesEnabled: runtime.drives?.sections?.local?.allowAdd,\n isDeleteLocalDrivesEnabled: runtime.drives?.sections?.local?.allowDelete,\n isAnalyticsDatabaseWorkerEnabled: false,\n isExternalPackagesEnabled: runtime.packages?.externalEnabled,\n };\n}\n\nexport function buildPHGlobalConfig(\n basePath: string,\n routerBasename: string,\n connectFromConfig: PHConnectRuntimeConfig,\n): PHGlobalConfig {\n const defaults = getBuiltInDefaults();\n const fileOverrides: Partial<PHGlobalConfig> = {};\n\n if (connectFromConfig.drives?.allowAddDrive !== undefined) {\n fileOverrides.isAddDriveEnabled = connectFromConfig.drives.allowAddDrive;\n }\n\n return {\n basePath,\n routerBasename,\n ...defaults,\n ...fileOverrides,\n };\n}\n\nfunction getPHGlobalConfigFromRuntime(): PHGlobalConfig {\n // Deploy base wins via getDeployBasePath: the dynamic-base global when set,\n // else runtime.app.basePath (DEFAULT_CONNECT_CONFIG guarantees it defined),\n // with a \"/\" fallback as a defensive guard for typecheck.\n const basePath = getDeployBasePath() ?? \"/\";\n const routerBasename = getRouterBasenameFromBasePath(basePath);\n return buildPHGlobalConfig(basePath, routerBasename, runtime);\n}\n\nexport const phGlobalConfig = getPHGlobalConfigFromRuntime();\n\nexport const defaultPHDocumentEditorConfig: PHDocumentEditorConfig = {\n isExternalControlsEnabled: phGlobalConfig.isExternalControlsEnabled,\n};\n\nexport const defaultPHAppConfig: PHAppConfig = {\n allowedDocumentTypes: phGlobalConfig.allowedDocumentTypes,\n isDragAndDropEnabled: phGlobalConfig.isDragAndDropEnabled,\n};\n\n// Set log level from the runtime config (DEFAULT_CONNECT_CONFIG provides a\n// fallback, so this is always defined).\nconst RESOLVED_LOG_LEVEL = runtime.app?.logLevel;\nif (RESOLVED_LOG_LEVEL) {\n setLogLevel(RESOLVED_LOG_LEVEL);\n}\nlogger.debug(\"Setting log level to @level.\", RESOLVED_LOG_LEVEL);\n\n// Normalize the base path to ensure it starts and ends with a forward slash.\nexport const PH_CONNECT_BASE_PATH = normalizeBasePath(\n getDeployBasePath() ?? \"/\",\n);\n\n// Analytics database name — derived deterministically from the base path so\n// instances on different prefixes of one origin do not share an analytics DB.\n// Root resolves to \":analytics\".\nconst PH_CONNECT_ANALYTICS_DATABASE_NAME = `${PH_CONNECT_BASE_PATH.replace(\n /\\//g,\n \"\",\n)}:analytics`;\n\n// The CLOUD section was collapsed into the unified `remote` section. PUBLIC\n// keeps its existing string identifier in the legacy\n// connectConfig.drives.sections map to avoid rippling through downstream UI\n// components — both PUBLIC and the\n// soon-to-be-removed CLOUD readers point at runtime.drives.sections.remote.\nexport const connectConfig = {\n appVersion: env.PH_CONNECT_VERSION,\n studioMode: runtime.app?.studioMode ?? false,\n // Boot-time constant, so it is read straight off the runtime config rather\n // than through the PHGlobalConfig event machinery. Off unless turned on.\n workflowsEnabled: runtime.app?.workflowsEnabled ?? false,\n warnOutdatedApp: phGlobalConfig.warnOutdatedApp,\n appVersionCheckInterval: 60 * 60 * 1000,\n routerBasename: PH_CONNECT_BASE_PATH,\n offline: runtime.app?.offline ?? true,\n aiAssistantEnabled: runtime.ai?.assistantEnabled ?? false,\n externalPackagesEnabled: runtime.packages?.externalEnabled,\n processors: {\n enabled: true,\n externalProcessorsEnabled: true,\n },\n analytics: {\n enabled: true,\n databaseName: PH_CONNECT_ANALYTICS_DATABASE_NAME,\n useWorker: false,\n driveAnalyticsEnabled: env.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,\n diffProcessorEnabled: env.PH_CONNECT_DIFF_ANALYTICS_ENABLED,\n externalProcessorsEnabled: true,\n },\n relational: {\n enabled: true,\n externalProcessorsEnabled: true,\n },\n // Runtime `connect.openPanel` wins; the build-time PH_CONNECT_OPENPANEL_*\n // env is the fallback. An empty clientId (the default) keeps it disabled.\n // `trackUiEvents` is intentionally dormant — no call sites gate on it yet.\n openPanel: resolveOpenPanelConfig(runtime.openPanel, env),\n renown: {\n url: runtime.renown?.url,\n networkId: runtime.renown?.networkId,\n chainId: runtime.renown?.chainId,\n namespace: runtime.renown?.namespace,\n switchboardUrl: runtime.renown?.switchboardUrl,\n adapters: runtime.renown?.adapters,\n },\n sentry: {\n release: PH_CONNECT_SENTRY_RELEASE,\n // `dsn: null` (default) means Sentry is disabled — useInitSentry bails.\n dsn: runtime.sentry?.dsn ?? null,\n env: runtime.sentry?.env,\n tracing: runtime.sentry?.tracing ?? false,\n },\n content: {\n showSearchBar: false,\n showDocumentModelSelectionSetting: false,\n },\n drives: {\n addDriveEnabled: runtime.drives?.allowAddDrive,\n preserveStrategy: runtime.drives?.preserveStrategy,\n // The legacy `SharingType` enum still includes a \"CLOUD\" variant.\n // Connect collapsed CLOUD into the unified remote section, so both CLOUD\n // and PUBLIC map to the same `runtime.drives.sections.remote` object —\n // the alias keeps `sections[sharingType]` lookups type-safe for every\n // SharingType value.\n sections: (() => {\n const remote = {\n enabled: runtime.drives?.sections?.remote?.enabled,\n allowAdd: runtime.drives?.sections?.remote?.allowAdd,\n allowDelete: runtime.drives?.sections?.remote?.allowDelete,\n };\n return {\n LOCAL: {\n enabled: runtime.drives?.sections?.local?.enabled,\n allowAdd: runtime.drives?.sections?.local?.allowAdd,\n allowDelete: runtime.drives?.sections?.local?.allowDelete,\n },\n PUBLIC: remote,\n CLOUD: remote,\n };\n })(),\n },\n gaTrackingId: undefined,\n phCliVersion: env.PH_CONNECT_CLI_VERSION,\n} as const;\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuBA,SAAgB,uBACd,SACA,KACyB;CACzB,OAAO;EACL,UAAU,SAAS,YAAY,IAAI,kCAAkC;EACrE,QAAQ,SAAS,UAAU,IAAI,gCAAgC,KAAA;EAC/D,eACE,SAAS,iBAAiB,IAAI;EAChC,iBACE,SAAS,mBAAmB,IAAI;CACpC;AACF;;;AChBA,MAAa,MAAM,eAAe,EAChC,YAAY,YAAY,IAC1B,CAAC;AASD,MAAM,UAAU,iBAAiB,CAAC,CAAC;AAEnC,SAAS,8BAA8B,UAAkB;CACvD,OAAO,SAAS,SAAS,GAAG,IAAI,WAAW,WAAW;AACxD;AAQA,SAAS,oBAAoB;CAC3B,IACE,OAAO,eAAe,eACrB,WAAgD,qBAEjD,OAAO,YAAY,IAAI;CAEzB,OAAO,QAAQ,KAAK,YAAY,YAAY,IAAI;AAClD;AAMA,SAAS,qBAGP;CACA,MAAM,aAAa,QAAQ,KAAK,cAAc;CAa9C,OAAO;EACL,WAAW,KAAA;EACX,sBAAsB,CAAC;EACvB,sBAAsB;EACtB,0BAA0B;EAC1B,yBAAyB;EACzB,2BAA2B;EAC3B,SAAS,IAAI;EACb,UAAU,QAAQ,KAAK;EACvB,qBAAqB;EACrB,iBAAiB;EACjB;EACA,sBAAsB;EACtB,YAAY,IAAI;EAChB,+BAA+B;EAC/B,cAAc,KAAA;EACd,kBAAkB,QAAQ,QAAQ,eAAe,MAC9C,UAA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rB,SAAS,QAAQ,QAAQ,WAAW;CACtC;CACA,SAAS;EACP,eAAe;EACf,mCAAmC;CACrC;CACA,QAAQ;EACN,iBAAiB,QAAQ,QAAQ;EACjC,kBAAkB,QAAQ,QAAQ;EAMlC,iBAAiB;GACf,MAAM,SAAS;IACb,SAAS,QAAQ,QAAQ,UAAU,QAAQ;IAC3C,UAAU,QAAQ,QAAQ,UAAU,QAAQ;IAC5C,aAAa,QAAQ,QAAQ,UAAU,QAAQ;GACjD;GACA,OAAO;IACL,OAAO;KACL,SAAS,QAAQ,QAAQ,UAAU,OAAO;KAC1C,UAAU,QAAQ,QAAQ,UAAU,OAAO;KAC3C,aAAa,QAAQ,QAAQ,UAAU,OAAO;IAChD;IACA,QAAQ;IACR,OAAO;GACT;EACF,EAAA,CAAG;CACL;CACA,cAAc,KAAA;CACd,cAAc,IAAI;AACpB","debug_id":"f8d528cc-dbf9-576e-b6d4-e9d154857c61"}
1
+ {"version":3,"file":"connect.config-uZF-gnvV.js","sources":["../src/utils/openpanel-config.ts","../src/connect.config.ts"],"sourcesContent":["import type { PHConnectOpenPanel } from \"@powerhousedao/shared/clis\";\n\n/** The build-time (Vite env) OpenPanel settings, as parsed by loadRuntimeEnv. */\nexport type OpenPanelBuildEnv = {\n PH_CONNECT_OPENPANEL_CLIENT_ID?: string;\n PH_CONNECT_OPENPANEL_API_URL?: string;\n PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS: boolean;\n PH_CONNECT_OPENPANEL_TRACK_OPERATIONS: boolean;\n};\n\nexport type ResolvedOpenPanelConfig = {\n clientId: string;\n apiUrl: string | undefined;\n trackUiEvents: boolean;\n trackOperations: boolean;\n};\n\n/**\n * Resolve Connect's OpenPanel settings. The runtime config\n * (`connect.openPanel`, settable per deploy via PH_CONNECT_CONFIG_JSON) wins;\n * the build-time PH_CONNECT_OPENPANEL_* env is the fallback so builds that\n * bake it keep working. An empty clientId leaves OpenPanel disabled.\n */\nexport function resolveOpenPanelConfig(\n runtime: PHConnectOpenPanel | undefined,\n env: OpenPanelBuildEnv,\n): ResolvedOpenPanelConfig {\n return {\n clientId: runtime?.clientId || env.PH_CONNECT_OPENPANEL_CLIENT_ID || \"\",\n apiUrl: runtime?.apiUrl || env.PH_CONNECT_OPENPANEL_API_URL || undefined,\n trackUiEvents:\n runtime?.trackUiEvents ?? env.PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS,\n trackOperations:\n runtime?.trackOperations ?? env.PH_CONNECT_OPENPANEL_TRACK_OPERATIONS,\n };\n}\n","import {\n setLogLevel,\n type PHAppConfig,\n type PHDocumentEditorConfig,\n type PHGlobalConfig,\n} from \"@powerhousedao/reactor-browser\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport {\n loadRuntimeEnv,\n normalizeBasePath,\n} from \"@powerhousedao/shared/connect\";\nimport { logger } from \"document-model\";\nimport { getRuntimeConfig } from \"./runtime-config.js\";\nimport { resolveOpenPanelConfig } from \"./utils/openpanel-config.js\";\n\n// Env vars are reserved for version stamps and analytics processor toggles.\n// Everything in the Connect runtime schema (PHConnectRuntimeConfig) is read\n// from `runtime` below. The Sentry release tag is stamped at build time via\n// Vite's `define` so it always matches the sourcemap upload tag CI used.\nexport const env = loadRuntimeEnv({\n processEnv: import.meta.env,\n});\n\ndeclare const PH_CONNECT_SENTRY_RELEASE: string;\n\n// Runtime fields come from the JSON, not env. start-connect.tsx's top-level\n// await guarantees the loader cache is warm by the time this module\n// evaluates, so getRuntimeConfig() resolves synchronously. The cache merges\n// DEFAULT_CONNECT_CONFIG into whatever the file declared, so every leaf\n// under `runtime.*` is guaranteed defined.\nconst runtime = getRuntimeConfig().connect;\n\nfunction getRouterBasenameFromBasePath(basePath: string) {\n return basePath.endsWith(\"/\") ? basePath : basePath + \"/\";\n}\n\n// Runtime deploy base. In dynamic-base builds the plugin rewrites\n// import.meta.env.BASE_URL to (globalThis.__PH_DYNAMIC_BASE__||\"/\"), the same\n// base assets resolve against; it takes precedence so router basename and\n// path stripping match the served subpath. A baked runtime base path\n// (runtime.app.basePath) only applies to concrete-base builds, where the\n// dynamic global is unset.\nfunction getDeployBasePath() {\n if (\n typeof globalThis !== \"undefined\" &&\n (globalThis as { __PH_DYNAMIC_BASE__?: string }).__PH_DYNAMIC_BASE__\n ) {\n return import.meta.env.BASE_URL;\n }\n return runtime.app?.basePath || import.meta.env.BASE_URL;\n}\n\n// Hardcoded literal defaults for `PHGlobalConfig` fields whose env-var\n// source was removed. The fields stay on the type so wired-but-dead SW /\n// hook consumers keep typechecking; values mirror the previous Zod\n// defaults.\nfunction getBuiltInDefaults(): Omit<\n PHGlobalConfig,\n \"basePath\" | \"routerBasename\"\n> {\n const studioMode = runtime.app?.studioMode ?? false;\n // Drive containers, DocumentModel, and vetra builder-spec types are authored\n // via their own drives — never creatable from a generic drive.\n const disabledEditors = [\n \"powerhouse/document-drive\",\n \"powerhouse/reactor-drive\",\n \"powerhouse/document-model\",\n \"powerhouse/app\",\n \"powerhouse/document-editor\",\n \"powerhouse/processor\",\n \"powerhouse/subgraph\",\n \"powerhouse/package\",\n ];\n return {\n allowList: undefined,\n allowedDocumentTypes: [],\n isDragAndDropEnabled: true,\n isEditorDebugModeEnabled: false,\n isEditorReadModeEnabled: false,\n isExternalControlsEnabled: false,\n version: env.PH_CONNECT_VERSION,\n logLevel: runtime.app?.logLevel,\n requiresHardRefresh: true,\n warnOutdatedApp: true,\n studioMode,\n versionCheckInterval: 60 * 60 * 1000,\n cliVersion: env.PH_CONNECT_CLI_VERSION,\n fileUploadOperationsChunkSize: 50,\n gaTrackingId: undefined,\n defaultDrivesUrl: runtime.drives?.defaultDrives?.find(\n (drive) => \"url\" in drive,\n )?.url,\n drivesPreserveStrategy: runtime.drives?.preserveStrategy,\n enabledEditors: undefined,\n disabledEditors,\n\n /* Processors */\n isExternalProcessorsEnabled: true,\n // Analytics off by default; flip to true (or wire a runtime-config field)\n // when we want analytics enabled out of the box.\n isAnalyticsEnabled: false,\n isAnalyticsExternalProcessorsEnabled:\n env.PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED,\n analyticsDatabaseName: undefined,\n isRelationalProcessorsEnabled: true,\n isExternalRelationalProcessorsEnabled: true,\n\n renownUrl: runtime.renown?.url,\n renownNetworkId: runtime.renown?.networkId,\n renownChainId: runtime.renown?.chainId,\n switchboardUrl: runtime.renown?.switchboardUrl,\n renownAdapters: runtime.renown?.adapters,\n sentryRelease: PH_CONNECT_SENTRY_RELEASE,\n sentryDsn: runtime.sentry?.dsn ?? undefined,\n sentryEnv: runtime.sentry?.env,\n isDiffAnalyticsEnabled: env.PH_CONNECT_DIFF_ANALYTICS_ENABLED,\n isDriveAnalyticsEnabled: env.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,\n isPublicDrivesEnabled: runtime.drives?.sections?.remote?.enabled,\n isCloudDrivesEnabled: runtime.drives?.sections?.remote?.enabled ?? true,\n isLocalDrivesEnabled: runtime.drives?.sections?.local?.enabled,\n isSentryTracingEnabled: runtime.sentry?.tracing,\n isDocumentModelSelectionSettingsEnabled: false,\n isAddDriveEnabled: runtime.drives?.allowAddDrive,\n isAddPublicDrivesEnabled: runtime.drives?.sections?.remote?.allowAdd,\n isDeletePublicDrivesEnabled: runtime.drives?.sections?.remote?.allowDelete,\n isAddCloudDrivesEnabled: runtime.drives?.sections?.remote?.allowAdd ?? true,\n isDeleteCloudDrivesEnabled:\n runtime.drives?.sections?.remote?.allowDelete ?? true,\n isAddLocalDrivesEnabled: runtime.drives?.sections?.local?.allowAdd,\n isDeleteLocalDrivesEnabled: runtime.drives?.sections?.local?.allowDelete,\n isAnalyticsDatabaseWorkerEnabled: false,\n isExternalPackagesEnabled: runtime.packages?.externalEnabled,\n };\n}\n\nexport function buildPHGlobalConfig(\n basePath: string,\n routerBasename: string,\n connectFromConfig: PHConnectRuntimeConfig,\n): PHGlobalConfig {\n const defaults = getBuiltInDefaults();\n const fileOverrides: Partial<PHGlobalConfig> = {};\n\n if (connectFromConfig.drives?.allowAddDrive !== undefined) {\n fileOverrides.isAddDriveEnabled = connectFromConfig.drives.allowAddDrive;\n }\n\n return {\n basePath,\n routerBasename,\n ...defaults,\n ...fileOverrides,\n };\n}\n\nfunction getPHGlobalConfigFromRuntime(): PHGlobalConfig {\n // Deploy base wins via getDeployBasePath: the dynamic-base global when set,\n // else runtime.app.basePath (DEFAULT_CONNECT_CONFIG guarantees it defined),\n // with a \"/\" fallback as a defensive guard for typecheck.\n const basePath = getDeployBasePath() ?? \"/\";\n const routerBasename = getRouterBasenameFromBasePath(basePath);\n return buildPHGlobalConfig(basePath, routerBasename, runtime);\n}\n\nexport const phGlobalConfig = getPHGlobalConfigFromRuntime();\n\nexport const defaultPHDocumentEditorConfig: PHDocumentEditorConfig = {\n isExternalControlsEnabled: phGlobalConfig.isExternalControlsEnabled,\n};\n\nexport const defaultPHAppConfig: PHAppConfig = {\n allowedDocumentTypes: phGlobalConfig.allowedDocumentTypes,\n isDragAndDropEnabled: phGlobalConfig.isDragAndDropEnabled,\n};\n\n// Set log level from the runtime config (DEFAULT_CONNECT_CONFIG provides a\n// fallback, so this is always defined).\nconst RESOLVED_LOG_LEVEL = runtime.app?.logLevel;\nif (RESOLVED_LOG_LEVEL) {\n setLogLevel(RESOLVED_LOG_LEVEL);\n}\nlogger.debug(\"Setting log level to @level.\", RESOLVED_LOG_LEVEL);\n\n// Normalize the base path to ensure it starts and ends with a forward slash.\nexport const PH_CONNECT_BASE_PATH = normalizeBasePath(\n getDeployBasePath() ?? \"/\",\n);\n\n// Analytics database name — derived deterministically from the base path so\n// instances on different prefixes of one origin do not share an analytics DB.\n// Root resolves to \":analytics\".\nconst PH_CONNECT_ANALYTICS_DATABASE_NAME = `${PH_CONNECT_BASE_PATH.replace(\n /\\//g,\n \"\",\n)}:analytics`;\n\n// The CLOUD section was collapsed into the unified `remote` section. PUBLIC\n// keeps its existing string identifier in the legacy\n// connectConfig.drives.sections map to avoid rippling through downstream UI\n// components — both PUBLIC and the\n// soon-to-be-removed CLOUD readers point at runtime.drives.sections.remote.\nexport const connectConfig = {\n appVersion: env.PH_CONNECT_VERSION,\n studioMode: runtime.app?.studioMode ?? false,\n // Boot-time constant, so it is read straight off the runtime config rather\n // than through the PHGlobalConfig event machinery. Off unless turned on.\n workflowsEnabled: runtime.app?.workflowsEnabled ?? false,\n warnOutdatedApp: phGlobalConfig.warnOutdatedApp,\n appVersionCheckInterval: 60 * 60 * 1000,\n routerBasename: PH_CONNECT_BASE_PATH,\n offline: runtime.app?.offline ?? true,\n aiAssistantEnabled: runtime.ai?.assistantEnabled ?? false,\n externalPackagesEnabled: runtime.packages?.externalEnabled,\n processors: {\n enabled: true,\n externalProcessorsEnabled: true,\n },\n analytics: {\n enabled: true,\n databaseName: PH_CONNECT_ANALYTICS_DATABASE_NAME,\n useWorker: false,\n driveAnalyticsEnabled: env.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,\n diffProcessorEnabled: env.PH_CONNECT_DIFF_ANALYTICS_ENABLED,\n externalProcessorsEnabled: true,\n },\n relational: {\n enabled: true,\n externalProcessorsEnabled: true,\n },\n // Runtime `connect.openPanel` wins; the build-time PH_CONNECT_OPENPANEL_*\n // env is the fallback. An empty clientId (the default) keeps it disabled.\n // `trackUiEvents` is intentionally dormant — no call sites gate on it yet.\n openPanel: resolveOpenPanelConfig(runtime.openPanel, env),\n renown: {\n url: runtime.renown?.url,\n networkId: runtime.renown?.networkId,\n chainId: runtime.renown?.chainId,\n namespace: runtime.renown?.namespace,\n switchboardUrl: runtime.renown?.switchboardUrl,\n adapters: runtime.renown?.adapters,\n },\n sentry: {\n release: PH_CONNECT_SENTRY_RELEASE,\n // `dsn: null` (default) means Sentry is disabled — useInitSentry bails.\n dsn: runtime.sentry?.dsn ?? null,\n env: runtime.sentry?.env,\n tracing: runtime.sentry?.tracing ?? false,\n },\n content: {\n showSearchBar: false,\n showDocumentModelSelectionSetting: false,\n },\n drives: {\n addDriveEnabled: runtime.drives?.allowAddDrive,\n preserveStrategy: runtime.drives?.preserveStrategy,\n // The legacy `SharingType` enum still includes a \"CLOUD\" variant.\n // Connect collapsed CLOUD into the unified remote section, so both CLOUD\n // and PUBLIC map to the same `runtime.drives.sections.remote` object —\n // the alias keeps `sections[sharingType]` lookups type-safe for every\n // SharingType value.\n sections: (() => {\n const remote = {\n enabled: runtime.drives?.sections?.remote?.enabled,\n allowAdd: runtime.drives?.sections?.remote?.allowAdd,\n allowDelete: runtime.drives?.sections?.remote?.allowDelete,\n };\n return {\n LOCAL: {\n enabled: runtime.drives?.sections?.local?.enabled,\n allowAdd: runtime.drives?.sections?.local?.allowAdd,\n allowDelete: runtime.drives?.sections?.local?.allowDelete,\n },\n PUBLIC: remote,\n CLOUD: remote,\n };\n })(),\n },\n gaTrackingId: undefined,\n phCliVersion: env.PH_CONNECT_CLI_VERSION,\n} as const;\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuBA,SAAgB,uBACd,SACA,KACyB;CACzB,OAAO;EACL,UAAU,SAAS,YAAY,IAAI,kCAAkC;EACrE,QAAQ,SAAS,UAAU,IAAI,gCAAgC,KAAA;EAC/D,eACE,SAAS,iBAAiB,IAAI;EAChC,iBACE,SAAS,mBAAmB,IAAI;CACpC;AACF;;;AChBA,MAAa,MAAM,eAAe,EAChC,YAAY,YAAY,IAC1B,CAAC;AASD,MAAM,UAAU,iBAAiB,CAAC,CAAC;AAEnC,SAAS,8BAA8B,UAAkB;CACvD,OAAO,SAAS,SAAS,GAAG,IAAI,WAAW,WAAW;AACxD;AAQA,SAAS,oBAAoB;CAC3B,IACE,OAAO,eAAe,eACrB,WAAgD,qBAEjD,OAAO,YAAY,IAAI;CAEzB,OAAO,QAAQ,KAAK,YAAY,YAAY,IAAI;AAClD;AAMA,SAAS,qBAGP;CACA,MAAM,aAAa,QAAQ,KAAK,cAAc;CAa9C,OAAO;EACL,WAAW,KAAA;EACX,sBAAsB,CAAC;EACvB,sBAAsB;EACtB,0BAA0B;EAC1B,yBAAyB;EACzB,2BAA2B;EAC3B,SA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