@coffre/ui 0.0.0 → 0.1.1

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 (168) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -3
  3. package/dist/client/.assetsignore +2 -0
  4. package/dist/client/_coffre/assets/account-C3Zo1l5A.js +1 -0
  5. package/dist/client/_coffre/assets/account-C4bNbeO7.js +2 -0
  6. package/dist/client/_coffre/assets/affordances-DiuJIiR2.js +1 -0
  7. package/dist/client/_coffre/assets/audit-1xLyuxGz.js +2 -0
  8. package/dist/client/_coffre/assets/audit-Dab2GuRj.js +1 -0
  9. package/dist/client/_coffre/assets/auth.device-BfCfeBWe.js +2 -0
  10. package/dist/client/_coffre/assets/auth.device-D2pCLF-X.js +1 -0
  11. package/dist/client/_coffre/assets/coffre-C7qL3HGR.js +1 -0
  12. package/dist/client/_coffre/assets/directory-C2Ou4SQv.js +1 -0
  13. package/dist/client/_coffre/assets/globals-Dgq4Jy0x.css +1 -0
  14. package/dist/client/_coffre/assets/grants-fqTtJ-aW.js +1 -0
  15. package/dist/client/_coffre/assets/index-BpGwbjmM.js +12 -0
  16. package/dist/client/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
  17. package/dist/client/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
  18. package/dist/client/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
  19. package/dist/client/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
  20. package/dist/client/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
  21. package/dist/client/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
  22. package/dist/client/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
  23. package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  24. package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  25. package/dist/client/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  26. package/dist/client/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  27. package/dist/client/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  28. package/dist/client/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  29. package/dist/client/_coffre/assets/login-CR9CBXlw.js +2 -0
  30. package/dist/client/_coffre/assets/login-DZizFxa4.js +1 -0
  31. package/dist/client/_coffre/assets/offboarding-DOLJQcXU.js +1 -0
  32. package/dist/client/_coffre/assets/page-BxW2MwaX.js +1 -0
  33. package/dist/client/_coffre/assets/preload-helper-BHuP8_FL.js +46 -0
  34. package/dist/client/_coffre/assets/principal-page-xnBZVURr.js +1 -0
  35. package/dist/client/_coffre/assets/project-environments-CfIH5kFM.js +1 -0
  36. package/dist/client/_coffre/assets/projects._project._environment-CrWjQmIA.js +2 -0
  37. package/dist/client/_coffre/assets/projects._project._environment-CwRVG9Ne.js +3 -0
  38. package/dist/client/_coffre/assets/projects._project.index-CCDEuE-z.js +2 -0
  39. package/dist/client/_coffre/assets/projects._project.index-DCJsmnD7.js +1 -0
  40. package/dist/client/_coffre/assets/projects.index-B8eV8JIn.js +1 -0
  41. package/dist/client/_coffre/assets/projects.index-BNEC7Oz8.js +2 -0
  42. package/dist/client/_coffre/assets/settings-2BPsenNM.js +2 -0
  43. package/dist/client/_coffre/assets/settings-BrS0-wEt.js +1 -0
  44. package/dist/client/_coffre/assets/signin-errors-CroZWZgm.js +1 -0
  45. package/dist/client/_coffre/assets/tokens._token-B3-YwuKp.js +2 -0
  46. package/dist/client/_coffre/assets/tokens._token-D_hsbHx6.js +1 -0
  47. package/dist/client/_coffre/assets/tokens.index-BdKE2Jv8.js +2 -0
  48. package/dist/client/_coffre/assets/tokens.index-XvA4XRxh.js +1 -0
  49. package/dist/client/_coffre/assets/unregistered-CTRMtBIy.js +1 -0
  50. package/dist/client/_coffre/assets/use-action-DgAf-tiX.js +1 -0
  51. package/dist/client/_coffre/assets/users._user-BFPXcJ4y.js +2 -0
  52. package/dist/client/_coffre/assets/users._user-DEtMeSoh.js +1 -0
  53. package/dist/client/_coffre/assets/users.index-B03beUHq.js +1 -0
  54. package/dist/client/_coffre/assets/users.index-D8hwzM6P.js +2 -0
  55. package/dist/client/_coffre/assets/validation-9Cl_XS-l.js +1 -0
  56. package/dist/index.d.ts +19 -0
  57. package/dist/server/.vite/manifest.json +572 -0
  58. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-B6CZDfrB.js +133 -0
  59. package/dist/server/_coffre/assets/account-B71_b5xc.js +296 -0
  60. package/dist/server/_coffre/assets/account-BoO6ZqMc.js +176 -0
  61. package/dist/server/_coffre/assets/affordances-BNaXjMOb.js +46 -0
  62. package/dist/server/_coffre/assets/async-local-storage-C0cwgkEr.js +3107 -0
  63. package/dist/server/_coffre/assets/audit-CwRFnSAY.js +74 -0
  64. package/dist/server/_coffre/assets/audit-t1sYjtrf.js +964 -0
  65. package/dist/server/_coffre/assets/auth.device-1IcJ475s.js +208 -0
  66. package/dist/server/_coffre/assets/auth.device-CJwZYYtn.js +29 -0
  67. package/dist/server/_coffre/assets/coffre-1hxT2E_U.js +278 -0
  68. package/dist/server/_coffre/assets/directory-wm_JQUfk.js +396 -0
  69. package/dist/server/_coffre/assets/empty-plugin-adapters-Cq4--YW-.js +5 -0
  70. package/dist/server/_coffre/assets/globals-Dgq4Jy0x.css +1 -0
  71. package/dist/server/_coffre/assets/grants-BmhEY1vz.js +243 -0
  72. package/dist/server/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
  73. package/dist/server/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
  74. package/dist/server/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
  75. package/dist/server/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
  76. package/dist/server/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
  77. package/dist/server/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
  78. package/dist/server/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
  79. package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  80. package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  81. package/dist/server/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  82. package/dist/server/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  83. package/dist/server/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  84. package/dist/server/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  85. package/dist/server/_coffre/assets/login-B5O5LPXV.js +100 -0
  86. package/dist/server/_coffre/assets/login-Bvc4gp0X.js +22 -0
  87. package/dist/server/_coffre/assets/offboarding-CvSilnSm.js +330 -0
  88. package/dist/server/_coffre/assets/page-BjXk0Ehu.js +2003 -0
  89. package/dist/server/_coffre/assets/principal-page-DkwNGzM2.js +617 -0
  90. package/dist/server/_coffre/assets/project-environments-lEzFHUt4.js +9 -0
  91. package/dist/server/_coffre/assets/projects._project._environment-7grhqlgq.js +2227 -0
  92. package/dist/server/_coffre/assets/projects._project._environment-ByEf6pmz.js +55 -0
  93. package/dist/server/_coffre/assets/projects._project.index-B1bjowP-.js +932 -0
  94. package/dist/server/_coffre/assets/projects._project.index-DU8wtoHD.js +22 -0
  95. package/dist/server/_coffre/assets/projects.index-B0DoHbCz.js +280 -0
  96. package/dist/server/_coffre/assets/projects.index-kMDA6pMy.js +54 -0
  97. package/dist/server/_coffre/assets/react-dom-qCTiwGGR.js +1352 -0
  98. package/dist/server/_coffre/assets/router-ChU_CwCX.js +2028 -0
  99. package/dist/server/_coffre/assets/settings-CM9-h7in.js +18 -0
  100. package/dist/server/_coffre/assets/settings-Cg5qOGij.js +60 -0
  101. package/dist/server/_coffre/assets/signin-errors-BEFlVDbQ.js +28 -0
  102. package/dist/server/_coffre/assets/start-DR3rN0St.js +4 -0
  103. package/dist/server/_coffre/assets/tokens._token-CCpaPMAk.js +268 -0
  104. package/dist/server/_coffre/assets/tokens._token-Di4OZdAA.js +18 -0
  105. package/dist/server/_coffre/assets/tokens.index-Do3OHR31.js +34 -0
  106. package/dist/server/_coffre/assets/tokens.index-tDKq4AFh.js +10 -0
  107. package/dist/server/_coffre/assets/ui-BNzhIAQP.js +15710 -0
  108. package/dist/server/_coffre/assets/unregistered-BqaWYFJK.js +51 -0
  109. package/dist/server/_coffre/assets/use-action-BkJXC5JM.js +953 -0
  110. package/dist/server/_coffre/assets/useStore-DWGPqzXR.js +892 -0
  111. package/dist/server/_coffre/assets/users._user-BenYva93.js +15 -0
  112. package/dist/server/_coffre/assets/users._user-Cp039Va-.js +10 -0
  113. package/dist/server/_coffre/assets/users.index-BrzG1Ecq.js +10 -0
  114. package/dist/server/_coffre/assets/users.index-DQ_45DQl.js +34 -0
  115. package/dist/server/_coffre/assets/validation-BQtqPe2V.js +27 -0
  116. package/dist/server/index.js +13910 -0
  117. package/package.json +58 -5
  118. package/src/components/affordances.ts +80 -0
  119. package/src/components/agentation.tsx +34 -0
  120. package/src/components/command-palette.tsx +271 -0
  121. package/src/components/directory.tsx +448 -0
  122. package/src/components/grants.tsx +204 -0
  123. package/src/components/icons.tsx +283 -0
  124. package/src/components/offboarding.tsx +286 -0
  125. package/src/components/page.tsx +128 -0
  126. package/src/components/principal-page.tsx +549 -0
  127. package/src/components/principal-picker.tsx +168 -0
  128. package/src/components/principal.tsx +53 -0
  129. package/src/components/route-states.tsx +60 -0
  130. package/src/components/service-tokens.tsx +212 -0
  131. package/src/components/shell.tsx +641 -0
  132. package/src/components/syncs.tsx +581 -0
  133. package/src/components/theme.tsx +141 -0
  134. package/src/components/tile.tsx +22 -0
  135. package/src/components/ui.tsx +440 -0
  136. package/src/entry.ts +19 -0
  137. package/src/lib/access-plan.ts +201 -0
  138. package/src/lib/audit-sentences.ts +468 -0
  139. package/src/lib/capabilities.ts +45 -0
  140. package/src/lib/coffre.ts +57 -0
  141. package/src/lib/project-access.ts +95 -0
  142. package/src/lib/project-environments.ts +23 -0
  143. package/src/lib/reveal.ts +21 -0
  144. package/src/lib/secret-edit-batch.ts +181 -0
  145. package/src/lib/signin-errors.ts +33 -0
  146. package/src/lib/use-action.ts +50 -0
  147. package/src/lib/validation.ts +27 -0
  148. package/src/routeTree.gen.ts +367 -0
  149. package/src/router.tsx +84 -0
  150. package/src/routes/__root.tsx +192 -0
  151. package/src/routes/access.tsx +11 -0
  152. package/src/routes/account.tsx +359 -0
  153. package/src/routes/audit.tsx +545 -0
  154. package/src/routes/auth.device.tsx +200 -0
  155. package/src/routes/index.tsx +15 -0
  156. package/src/routes/login.tsx +129 -0
  157. package/src/routes/projects.$project.$environment.tsx +1659 -0
  158. package/src/routes/projects.$project.index.tsx +917 -0
  159. package/src/routes/projects.index.tsx +353 -0
  160. package/src/routes/settings.tsx +72 -0
  161. package/src/routes/tokens.$token.tsx +35 -0
  162. package/src/routes/tokens.index.tsx +37 -0
  163. package/src/routes/unregistered.tsx +59 -0
  164. package/src/routes/users.$user.tsx +13 -0
  165. package/src/routes/users.index.tsx +37 -0
  166. package/src/shared/models.ts +55 -0
  167. package/src/styles/globals.css +4118 -0
  168. package/src/types.ts +21 -0
@@ -0,0 +1,2028 @@
1
+ import { C as require_react, E as __toESM, f as deepEqual, i as useRouter, m as escapeHtml, o as require_jsx_runtime, t as useStore } from "./useStore-DWGPqzXR.js";
2
+ import { o as redirect, r as useHydrated } from "./react-dom-qCTiwGGR.js";
3
+ import { C as createNonReactiveReadonlyStore, S as createNonReactiveMutableStore, d as appendUniqueUserTags, h as getScriptPreloadAttrs, i as Outlet, m as getAssetCrossOrigin, o as ScriptOnce, t as getStartContext, v as resolveManifestCssLink, y as RouterCore } from "./async-local-storage-C0cwgkEr.js";
4
+ import { C as lazyRouteComponent, D as useNavigate, E as Link, S as composeRefs, T as createRootRouteWithContext, _ as DialogContent, b as useId, f as TooltipProvider, g as Dialog, h as dropdown_menu_exports, m as dialog_exports, u as Tip, v as DialogOverlay, w as createFileRoute, x as Primitive, y as DialogPortal } from "./ui-BNzhIAQP.js";
5
+ import { $ as Users, A as Menu, C as Key, G as SlashCircle, H as Settings, K as Sun, M as Moon, O as MARK_SVG, P as PanelLeft, Q as UserCog, R as Plus, T as Ledger, V as Search, W as SignOut, a as Tile, c as AlertTriangle, et as X$1, j as Monitor, k as Mark, n as ClosedDoor, p as ChevronsUpDown, rt as useStructuralSharing, u as Check, v as Folder, w as Layers, y as GitHub } from "./page-BjXk0Ehu.js";
6
+ import { c as CoffreError, u as createClient } from "./coffre-1hxT2E_U.js";
7
+ import { n as Toaster, r as toast } from "./use-action-BkJXC5JM.js";
8
+ import { a as hasAdministrationItems, s as deriveUiCapabilities, t as AdministrationItems } from "./affordances-BNaXjMOb.js";
9
+ import { n as isActiveAccessibleEnvironment } from "./project-environments-lEzFHUt4.js";
10
+ import { a as setTheme, i as ThemeToggle, o as themeBootScript, r as ThemeMenuItems, t as Route$4 } from "./account-BoO6ZqMc.js";
11
+ import { t as Route$5 } from "./audit-CwRFnSAY.js";
12
+ import { t as Route$6 } from "./login-Bvc4gp0X.js";
13
+ import { t as Route$7 } from "./settings-CM9-h7in.js";
14
+ import { t as Route$8 } from "./auth.device-CJwZYYtn.js";
15
+ import { t as Route$9 } from "./projects.index-kMDA6pMy.js";
16
+ import { t as Route$10 } from "./tokens.index-tDKq4AFh.js";
17
+ import { t as Route$11 } from "./tokens._token-Di4OZdAA.js";
18
+ import { t as Route$12 } from "./users.index-BrzG1Ecq.js";
19
+ import { t as Route$13 } from "./users._user-Cp039Va-.js";
20
+ import { t as Route$14 } from "./projects._project.index-DU8wtoHD.js";
21
+ import { t as Route$15 } from "./projects._project._environment-ByEf6pmz.js";
22
+ //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/routerStores.js
23
+ var getStoreFactory = (opts) => {
24
+ return {
25
+ createMutableStore: createNonReactiveMutableStore,
26
+ createReadonlyStore: createNonReactiveReadonlyStore,
27
+ batch: (fn) => fn()
28
+ };
29
+ };
30
+ //#endregion
31
+ //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/router.js
32
+ /**
33
+ * Creates a new Router instance for React.
34
+ *
35
+ * Pass the returned router to `RouterProvider` to enable routing.
36
+ * Notable options: `routeTree` (your route definitions) and `context`
37
+ * (required if the root route was created with `createRootRouteWithContext`).
38
+ *
39
+ * @param options Router options used to configure the router.
40
+ * @returns A Router instance to be provided to `RouterProvider`.
41
+ * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction
42
+ */
43
+ var createRouter = (options) => {
44
+ return new Router(options);
45
+ };
46
+ var Router = class extends RouterCore {
47
+ constructor(options) {
48
+ super(options, getStoreFactory);
49
+ }
50
+ };
51
+ //#endregion
52
+ //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/useRouterState.js
53
+ /**
54
+ * Subscribe to the router's state store with optional selection and
55
+ * structural sharing for render optimization.
56
+ *
57
+ * Options:
58
+ * - `select`: Project the full router state to a derived slice
59
+ * - `structuralSharing`: Replace-equal semantics for stable references
60
+ * - `router`: Read state from a specific router instance instead of context
61
+ *
62
+ * @returns The selected router state (or the full state by default).
63
+ * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterStateHook
64
+ */
65
+ function useRouterState(opts) {
66
+ const contextRouter = useRouter({ warn: opts?.router === void 0 });
67
+ const router = opts?.router || contextRouter;
68
+ {
69
+ const state = router.stores.__store.get();
70
+ return opts?.select ? opts.select(state) : state;
71
+ }
72
+ return useStore(router.stores.__store, useStructuralSharing(opts, router));
73
+ }
74
+ //#endregion
75
+ //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/Asset.js
76
+ var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
77
+ var import_jsx_runtime = require_jsx_runtime();
78
+ var noopScriptHandler = () => {};
79
+ function setScriptAttrs(script, attrs) {
80
+ if (!attrs) return;
81
+ for (const [key, value] of Object.entries(attrs)) if (key !== "suppressHydrationWarning" && value !== void 0 && value !== false) script.setAttribute(key, typeof value === "boolean" ? "" : String(value));
82
+ }
83
+ function Asset(asset) {
84
+ const { attrs, children, nonce, preventScriptHoist } = asset;
85
+ switch (asset.tag) {
86
+ case "title": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("title", {
87
+ ...attrs,
88
+ suppressHydrationWarning: true,
89
+ children
90
+ });
91
+ case "meta": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("meta", {
92
+ ...attrs,
93
+ suppressHydrationWarning: true
94
+ });
95
+ case "link": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("link", {
96
+ ...attrs,
97
+ precedence: attrs?.precedence ?? (attrs?.rel === "stylesheet" ? "default" : void 0),
98
+ nonce,
99
+ suppressHydrationWarning: true
100
+ });
101
+ case "style":
102
+ if (asset.inlineCss && false);
103
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", {
104
+ ...attrs,
105
+ dangerouslySetInnerHTML: { __html: children },
106
+ nonce
107
+ });
108
+ case "script": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Script, {
109
+ attrs,
110
+ preventScriptHoist,
111
+ children
112
+ });
113
+ default: return null;
114
+ }
115
+ }
116
+ function Script({ attrs, children, preventScriptHoist }) {
117
+ useRouter();
118
+ useHydrated();
119
+ const dataScript = typeof attrs?.type === "string" && attrs.type !== "" && attrs.type !== "text/javascript" && attrs.type !== "module";
120
+ import_react.useEffect(() => {
121
+ if (dataScript) return;
122
+ if (attrs?.src) {
123
+ const normSrc = (() => {
124
+ try {
125
+ const base = document.baseURI || window.location.href;
126
+ return new URL(attrs.src, base).href;
127
+ } catch {
128
+ return attrs.src;
129
+ }
130
+ })();
131
+ for (const el of document.querySelectorAll("script[src]")) if (el.src === normSrc) return;
132
+ const script = document.createElement("script");
133
+ setScriptAttrs(script, attrs);
134
+ document.head.appendChild(script);
135
+ return () => script.remove();
136
+ }
137
+ if (typeof children === "string") {
138
+ const typeAttr = typeof attrs?.type === "string" ? attrs.type : "text/javascript";
139
+ const nonceAttr = typeof attrs?.nonce === "string" ? attrs.nonce : void 0;
140
+ for (const el of document.querySelectorAll("script:not([src])")) {
141
+ if (!(el instanceof HTMLScriptElement)) continue;
142
+ const sType = el.getAttribute("type") ?? "text/javascript";
143
+ const sNonce = el.getAttribute("nonce") ?? void 0;
144
+ if (el.textContent === children && sType === typeAttr && sNonce === nonceAttr) return;
145
+ }
146
+ const script = document.createElement("script");
147
+ script.textContent = children;
148
+ setScriptAttrs(script, attrs);
149
+ document.head.appendChild(script);
150
+ return () => script.remove();
151
+ }
152
+ }, [
153
+ attrs,
154
+ children,
155
+ dataScript
156
+ ]);
157
+ if (attrs?.src) {
158
+ if (!preventScriptHoist) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
159
+ ...attrs,
160
+ suppressHydrationWarning: true
161
+ });
162
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
163
+ ...attrs,
164
+ onLoad: noopScriptHandler,
165
+ suppressHydrationWarning: true
166
+ });
167
+ }
168
+ if (typeof children === "string") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
169
+ ...attrs,
170
+ dangerouslySetInnerHTML: { __html: children },
171
+ suppressHydrationWarning: true
172
+ });
173
+ return null;
174
+ }
175
+ //#endregion
176
+ //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/headContentUtils.js
177
+ function buildTagsFromMatches(router, nonce, matches, assetCrossOrigin) {
178
+ const routeMeta = matches.map((match) => match.meta).filter((meta) => meta !== void 0);
179
+ const resultMeta = [];
180
+ const metaByAttribute = {};
181
+ let title;
182
+ for (let i = routeMeta.length - 1; i >= 0; i--) {
183
+ const metas = routeMeta[i];
184
+ for (let j = metas.length - 1; j >= 0; j--) {
185
+ const m = metas[j];
186
+ if (!m) continue;
187
+ if (m.title) {
188
+ if (!title) title = {
189
+ tag: "title",
190
+ children: m.title
191
+ };
192
+ } else if ("script:ld+json" in m) try {
193
+ const json = JSON.stringify(m["script:ld+json"]);
194
+ resultMeta.push({
195
+ tag: "script",
196
+ attrs: { type: "application/ld+json" },
197
+ children: escapeHtml(json)
198
+ });
199
+ } catch {}
200
+ else {
201
+ const attribute = m.name ?? m.property;
202
+ if (attribute) if (metaByAttribute[attribute]) continue;
203
+ else metaByAttribute[attribute] = true;
204
+ resultMeta.push({
205
+ tag: "meta",
206
+ attrs: {
207
+ ...m,
208
+ nonce
209
+ }
210
+ });
211
+ }
212
+ }
213
+ }
214
+ if (title) resultMeta.push(title);
215
+ if (nonce) resultMeta.push({
216
+ tag: "meta",
217
+ attrs: {
218
+ property: "csp-nonce",
219
+ content: nonce
220
+ }
221
+ });
222
+ resultMeta.reverse();
223
+ const constructedLinks = matches.flatMap((match) => match.links ?? []).filter((link) => link !== void 0).map((link) => ({
224
+ tag: "link",
225
+ attrs: {
226
+ ...link,
227
+ nonce
228
+ }
229
+ }));
230
+ const manifest = router.ssr?.manifest;
231
+ const manifestCssTags = [];
232
+ if (manifest) {
233
+ matches.forEach((match) => {
234
+ (manifest.routes[match.routeId]?.css)?.forEach((link) => {
235
+ const resolvedLink = resolveManifestCssLink(link);
236
+ manifestCssTags.push({
237
+ tag: "link",
238
+ attrs: {
239
+ rel: "stylesheet",
240
+ ...resolvedLink,
241
+ crossOrigin: getAssetCrossOrigin(assetCrossOrigin, "stylesheet") ?? resolvedLink.crossOrigin,
242
+ suppressHydrationWarning: true,
243
+ nonce
244
+ }
245
+ });
246
+ });
247
+ });
248
+ if (manifest.inlineStyle) manifestCssTags.push({
249
+ tag: "style",
250
+ attrs: {
251
+ ...manifest.inlineStyle.attrs,
252
+ nonce
253
+ },
254
+ children: manifest.inlineStyle.children,
255
+ inlineCss: true
256
+ });
257
+ }
258
+ const preloadLinks = [];
259
+ if (manifest) matches.forEach((match) => {
260
+ manifest.routes[match.routeId]?.preloads?.forEach((preload) => {
261
+ preloadLinks.push({
262
+ tag: "link",
263
+ attrs: {
264
+ ...getScriptPreloadAttrs(manifest, preload, assetCrossOrigin),
265
+ nonce
266
+ }
267
+ });
268
+ });
269
+ });
270
+ const styles = matches.flatMap((match) => match.styles ?? []).filter((style) => style !== void 0).map(({ children, ...attrs }) => ({
271
+ tag: "style",
272
+ attrs: {
273
+ ...attrs,
274
+ nonce
275
+ },
276
+ children
277
+ }));
278
+ const headScripts = matches.flatMap((match) => match.headScripts ?? []).filter((script) => script !== void 0).map(({ children, ...script }) => ({
279
+ tag: "script",
280
+ attrs: {
281
+ ...script,
282
+ nonce
283
+ },
284
+ children
285
+ }));
286
+ const tags = [];
287
+ appendUniqueUserTags(tags, resultMeta);
288
+ tags.push(...preloadLinks);
289
+ appendUniqueUserTags(tags, constructedLinks);
290
+ tags.push(...manifestCssTags);
291
+ appendUniqueUserTags(tags, styles);
292
+ appendUniqueUserTags(tags, headScripts);
293
+ return tags;
294
+ }
295
+ /**
296
+ * Build the list of head/link/meta/script tags to render for active matches.
297
+ * Used internally by `HeadContent`.
298
+ */
299
+ var useTags = (assetCrossOrigin) => {
300
+ const router = useRouter();
301
+ const nonce = router.options.ssr?.nonce;
302
+ return buildTagsFromMatches(router, nonce, router.stores.matches.get(), assetCrossOrigin);
303
+ };
304
+ //#endregion
305
+ //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/HeadContent.js
306
+ /**
307
+ * Render route-managed head tags (title, meta, links, styles, head scripts).
308
+ * Place inside the document head of your app shell.
309
+ * @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management
310
+ */
311
+ function HeadContent(props) {
312
+ const tags = useTags(props.assetCrossOrigin);
313
+ const nonce = useRouter().options.ssr?.nonce;
314
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: tags.map((tag) => /* @__PURE__ */ (0, import_react.createElement)(Asset, {
315
+ ...tag,
316
+ key: `tsr-meta-${JSON.stringify(tag)}`,
317
+ nonce
318
+ })) });
319
+ }
320
+ //#endregion
321
+ //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/Scripts.js
322
+ /**
323
+ * Render body script tags collected from route matches and SSR manifests.
324
+ * Should be placed near the end of the document body.
325
+ */
326
+ var Scripts = () => {
327
+ const router = useRouter();
328
+ const nonce = router.options.ssr?.nonce;
329
+ const getAssetScripts = (matches) => {
330
+ const assetScripts = [];
331
+ const manifest = router.ssr?.manifest;
332
+ if (!manifest) return [];
333
+ for (const match of matches) {
334
+ const scripts = manifest.routes[match.routeId]?.scripts;
335
+ if (!scripts) continue;
336
+ for (const asset of scripts) assetScripts.push({
337
+ tag: "script",
338
+ attrs: {
339
+ ...asset.attrs,
340
+ nonce
341
+ },
342
+ children: asset.children,
343
+ ...typeof asset.attrs?.src === "string" ? { preventScriptHoist: true } : {}
344
+ });
345
+ }
346
+ return assetScripts;
347
+ };
348
+ const getScripts = (matches) => matches.map((match) => match.scripts).flat(1).filter(Boolean).map(({ children, ...script }) => ({
349
+ tag: "script",
350
+ attrs: {
351
+ ...script,
352
+ suppressHydrationWarning: true,
353
+ nonce
354
+ },
355
+ children
356
+ }));
357
+ {
358
+ const activeMatches = router.stores.matches.get();
359
+ const assetScripts = getAssetScripts(activeMatches);
360
+ return renderScripts(router, getScripts(activeMatches), assetScripts);
361
+ }
362
+ const assetScripts = useStore(router.stores.matches, getAssetScripts, deepEqual);
363
+ return renderScripts(router, useStore(router.stores.matches, getScripts, deepEqual), assetScripts);
364
+ };
365
+ function renderScripts(router, scripts, assetScripts) {
366
+ const allScripts = [...scripts, ...assetScripts];
367
+ if (router.serverSsr) {
368
+ const serverBufferedScript = router.serverSsr.takeBufferedScripts();
369
+ if (serverBufferedScript) allScripts.unshift(serverBufferedScript);
370
+ }
371
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: allScripts.map((asset, i) => /* @__PURE__ */ (0, import_react.createElement)(Asset, {
372
+ ...asset,
373
+ key: `tsr-scripts-${asset.tag}-${i}`
374
+ })) });
375
+ }
376
+ //#endregion
377
+ //#region ../../node_modules/.pnpm/@tanstack+start-client-core@1.170.14/node_modules/@tanstack/start-client-core/dist/esm/getGlobalStartContext.js
378
+ var getGlobalStartContext = () => {
379
+ const context = getStartContext().contextAfterGlobalMiddlewares;
380
+ if (!context) throw new Error(`Global context not set yet, you are calling getGlobalStartContext() before the global middlewares are applied.`);
381
+ return context;
382
+ };
383
+ //#endregion
384
+ //#region src/styles/globals.css?url
385
+ var globals_default = "/_coffre/assets/globals-Dgq4Jy0x.css";
386
+ //#endregion
387
+ //#region ../../node_modules/.pnpm/cmdk@1.1.1_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/cmdk/dist/chunk-NZJY6EH4.mjs
388
+ var U = 1;
389
+ var Y$1 = .9;
390
+ var H = .8;
391
+ var J = .17;
392
+ var p = .1;
393
+ var u = .999;
394
+ var $ = .9999;
395
+ var k$1 = .99;
396
+ var m = /[\\\/_+.#"@\[\(\{&]/;
397
+ var B$1 = /[\\\/_+.#"@\[\(\{&]/g;
398
+ var K$1 = /[\s-]/;
399
+ var X = /[\s-]/g;
400
+ function G(_, C, h, P, A, f, O) {
401
+ if (f === C.length) return A === _.length ? U : k$1;
402
+ var T = `${A},${f}`;
403
+ if (O[T] !== void 0) return O[T];
404
+ for (var L = P.charAt(f), c = h.indexOf(L, A), S = 0, E, N, R, M; c >= 0;) E = G(_, C, h, P, c + 1, f + 1, O), E > S && (c === A ? E *= U : m.test(_.charAt(c - 1)) ? (E *= H, R = _.slice(A, c - 1).match(B$1), R && A > 0 && (E *= Math.pow(u, R.length))) : K$1.test(_.charAt(c - 1)) ? (E *= Y$1, M = _.slice(A, c - 1).match(X), M && A > 0 && (E *= Math.pow(u, M.length))) : (E *= J, A > 0 && (E *= Math.pow(u, c - A))), _.charAt(c) !== C.charAt(f) && (E *= $)), (E < p && h.charAt(c - 1) === P.charAt(f + 1) || P.charAt(f + 1) === P.charAt(f) && h.charAt(c - 1) !== P.charAt(f)) && (N = G(_, C, h, P, c + 1, f + 2, O), N * p > E && (E = N * p)), E > S && (S = E), c = h.indexOf(L, c + 1);
405
+ return O[T] = S, S;
406
+ }
407
+ function D(_) {
408
+ return _.toLowerCase().replace(X, " ");
409
+ }
410
+ function W(_, C, h) {
411
+ return _ = h && h.length > 0 ? `${_ + " " + h.join(" ")}` : _, G(_, C, D(_), D(C), 0, 0, {});
412
+ }
413
+ //#endregion
414
+ //#region ../../node_modules/.pnpm/cmdk@1.1.1_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/cmdk/dist/index.mjs
415
+ var N = "[cmdk-group=\"\"]";
416
+ var Y = "[cmdk-group-items=\"\"]";
417
+ var be = "[cmdk-group-heading=\"\"]";
418
+ var le = "[cmdk-item=\"\"]";
419
+ var ce = `${le}:not([aria-disabled="true"])`;
420
+ var Z = "cmdk-item-select";
421
+ var T = "data-value";
422
+ var Re = (r, o, n) => W(r, o, n);
423
+ var ue = import_react.createContext(void 0);
424
+ var K = () => import_react.useContext(ue);
425
+ var de = import_react.createContext(void 0);
426
+ var ee = () => import_react.useContext(de);
427
+ var fe = import_react.createContext(void 0);
428
+ var me = import_react.forwardRef((r, o) => {
429
+ let n = L(() => {
430
+ var e, a;
431
+ return {
432
+ search: "",
433
+ value: (a = (e = r.value) != null ? e : r.defaultValue) != null ? a : "",
434
+ selectedItemId: void 0,
435
+ filtered: {
436
+ count: 0,
437
+ items: /* @__PURE__ */ new Map(),
438
+ groups: /* @__PURE__ */ new Set()
439
+ }
440
+ };
441
+ }), u = L(() => /* @__PURE__ */ new Set()), c = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), p = pe(r), { label: b, children: m, value: R, onValueChange: x, filter: C, shouldFilter: S, loop: A, disablePointerSelection: ge = !1, vimBindings: j = !0, ...O } = r, $ = useId(), q = useId(), _ = useId(), I = import_react.useRef(null), v = ke();
442
+ k(() => {
443
+ if (R !== void 0) {
444
+ let e = R.trim();
445
+ n.current.value = e, E.emit();
446
+ }
447
+ }, [R]), k(() => {
448
+ v(6, ne);
449
+ }, []);
450
+ let E = import_react.useMemo(() => ({
451
+ subscribe: (e) => (f.current.add(e), () => f.current.delete(e)),
452
+ snapshot: () => n.current,
453
+ setState: (e, a, s) => {
454
+ var i, l, g, y;
455
+ if (!Object.is(n.current[e], a)) {
456
+ if (n.current[e] = a, e === "search") J(), z(), v(1, W);
457
+ else if (e === "value") {
458
+ if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
459
+ let h = document.getElementById(_);
460
+ h ? h.focus() : (i = document.getElementById($)) == null || i.focus();
461
+ }
462
+ if (v(7, () => {
463
+ var h;
464
+ n.current.selectedItemId = (h = M()) == null ? void 0 : h.id, E.emit();
465
+ }), s || v(5, ne), ((l = p.current) == null ? void 0 : l.value) !== void 0) {
466
+ let h = a != null ? a : "";
467
+ (y = (g = p.current).onValueChange) == null || y.call(g, h);
468
+ return;
469
+ }
470
+ }
471
+ E.emit();
472
+ }
473
+ },
474
+ emit: () => {
475
+ f.current.forEach((e) => e());
476
+ }
477
+ }), []), U = import_react.useMemo(() => ({
478
+ value: (e, a, s) => {
479
+ var i;
480
+ a !== ((i = d.current.get(e)) == null ? void 0 : i.value) && (d.current.set(e, {
481
+ value: a,
482
+ keywords: s
483
+ }), n.current.filtered.items.set(e, te(a, s)), v(2, () => {
484
+ z(), E.emit();
485
+ }));
486
+ },
487
+ item: (e, a) => (u.current.add(e), a && (c.current.has(a) ? c.current.get(a).add(e) : c.current.set(a, /* @__PURE__ */ new Set([e]))), v(3, () => {
488
+ J(), z(), n.current.value || W(), E.emit();
489
+ }), () => {
490
+ d.current.delete(e), u.current.delete(e), n.current.filtered.items.delete(e);
491
+ let s = M();
492
+ v(4, () => {
493
+ J(), (s == null ? void 0 : s.getAttribute("id")) === e && W(), E.emit();
494
+ });
495
+ }),
496
+ group: (e) => (c.current.has(e) || c.current.set(e, /* @__PURE__ */ new Set()), () => {
497
+ d.current.delete(e), c.current.delete(e);
498
+ }),
499
+ filter: () => p.current.shouldFilter,
500
+ label: b || r["aria-label"],
501
+ getDisablePointerSelection: () => p.current.disablePointerSelection,
502
+ listId: $,
503
+ inputId: _,
504
+ labelId: q,
505
+ listInnerRef: I
506
+ }), []);
507
+ function te(e, a) {
508
+ var i, l;
509
+ let s = (l = (i = p.current) == null ? void 0 : i.filter) != null ? l : Re;
510
+ return e ? s(e, n.current.search, a) : 0;
511
+ }
512
+ function z() {
513
+ if (!n.current.search || p.current.shouldFilter === !1) return;
514
+ let e = n.current.filtered.items, a = [];
515
+ n.current.filtered.groups.forEach((i) => {
516
+ let l = c.current.get(i), g = 0;
517
+ l.forEach((y) => {
518
+ let h = e.get(y);
519
+ g = Math.max(h, g);
520
+ }), a.push([i, g]);
521
+ });
522
+ let s = I.current;
523
+ V().sort((i, l) => {
524
+ var h, F;
525
+ let g = i.getAttribute("id"), y = l.getAttribute("id");
526
+ return ((h = e.get(y)) != null ? h : 0) - ((F = e.get(g)) != null ? F : 0);
527
+ }).forEach((i) => {
528
+ let l = i.closest(Y);
529
+ l ? l.appendChild(i.parentElement === l ? i : i.closest(`${Y} > *`)) : s.appendChild(i.parentElement === s ? i : i.closest(`${Y} > *`));
530
+ }), a.sort((i, l) => l[1] - i[1]).forEach((i) => {
531
+ var g;
532
+ let l = (g = I.current) == null ? void 0 : g.querySelector(`${N}[${T}="${encodeURIComponent(i[0])}"]`);
533
+ l?.parentElement.appendChild(l);
534
+ });
535
+ }
536
+ function W() {
537
+ let e = V().find((s) => s.getAttribute("aria-disabled") !== "true"), a = e == null ? void 0 : e.getAttribute(T);
538
+ E.setState("value", a || void 0);
539
+ }
540
+ function J() {
541
+ var a, s, i, l;
542
+ if (!n.current.search || p.current.shouldFilter === !1) {
543
+ n.current.filtered.count = u.current.size;
544
+ return;
545
+ }
546
+ n.current.filtered.groups = /* @__PURE__ */ new Set();
547
+ let e = 0;
548
+ for (let g of u.current) {
549
+ let F = te((s = (a = d.current.get(g)) == null ? void 0 : a.value) != null ? s : "", (l = (i = d.current.get(g)) == null ? void 0 : i.keywords) != null ? l : []);
550
+ n.current.filtered.items.set(g, F), F > 0 && e++;
551
+ }
552
+ for (let [g, y] of c.current) for (let h of y) if (n.current.filtered.items.get(h) > 0) {
553
+ n.current.filtered.groups.add(g);
554
+ break;
555
+ }
556
+ n.current.filtered.count = e;
557
+ }
558
+ function ne() {
559
+ var a, s, i;
560
+ let e = M();
561
+ e && (((a = e.parentElement) == null ? void 0 : a.firstChild) === e && ((i = (s = e.closest(N)) == null ? void 0 : s.querySelector(be)) == null || i.scrollIntoView({ block: "nearest" })), e.scrollIntoView({ block: "nearest" }));
562
+ }
563
+ function M() {
564
+ var e;
565
+ return (e = I.current) == null ? void 0 : e.querySelector(`${le}[aria-selected="true"]`);
566
+ }
567
+ function V() {
568
+ var e;
569
+ return Array.from(((e = I.current) == null ? void 0 : e.querySelectorAll(ce)) || []);
570
+ }
571
+ function X(e) {
572
+ let s = V()[e];
573
+ s && E.setState("value", s.getAttribute(T));
574
+ }
575
+ function Q(e) {
576
+ var g;
577
+ let a = M(), s = V(), i = s.findIndex((y) => y === a), l = s[i + e];
578
+ (g = p.current) != null && g.loop && (l = i + e < 0 ? s[s.length - 1] : i + e === s.length ? s[0] : s[i + e]), l && E.setState("value", l.getAttribute(T));
579
+ }
580
+ function re(e) {
581
+ let a = M(), s = a == null ? void 0 : a.closest(N), i;
582
+ for (; s && !i;) s = e > 0 ? we(s, N) : De(s, N), i = s == null ? void 0 : s.querySelector(ce);
583
+ i ? E.setState("value", i.getAttribute(T)) : Q(e);
584
+ }
585
+ let oe = () => X(V().length - 1), ie = (e) => {
586
+ e.preventDefault(), e.metaKey ? oe() : e.altKey ? re(1) : Q(1);
587
+ }, se = (e) => {
588
+ e.preventDefault(), e.metaKey ? X(0) : e.altKey ? re(-1) : Q(-1);
589
+ };
590
+ return import_react.createElement(Primitive.div, {
591
+ ref: o,
592
+ tabIndex: -1,
593
+ ...O,
594
+ "cmdk-root": "",
595
+ onKeyDown: (e) => {
596
+ var s;
597
+ (s = O.onKeyDown) == null || s.call(O, e);
598
+ let a = e.nativeEvent.isComposing || e.keyCode === 229;
599
+ if (!(e.defaultPrevented || a)) switch (e.key) {
600
+ case "n":
601
+ case "j":
602
+ j && e.ctrlKey && ie(e);
603
+ break;
604
+ case "ArrowDown":
605
+ ie(e);
606
+ break;
607
+ case "p":
608
+ case "k":
609
+ j && e.ctrlKey && se(e);
610
+ break;
611
+ case "ArrowUp":
612
+ se(e);
613
+ break;
614
+ case "Home":
615
+ e.preventDefault(), X(0);
616
+ break;
617
+ case "End":
618
+ e.preventDefault(), oe();
619
+ break;
620
+ case "Enter": {
621
+ e.preventDefault();
622
+ let i = M();
623
+ if (i) {
624
+ let l = new Event(Z);
625
+ i.dispatchEvent(l);
626
+ }
627
+ }
628
+ }
629
+ }
630
+ }, import_react.createElement("label", {
631
+ "cmdk-label": "",
632
+ htmlFor: U.inputId,
633
+ id: U.labelId,
634
+ style: Te
635
+ }, b), B(r, (e) => import_react.createElement(de.Provider, { value: E }, import_react.createElement(ue.Provider, { value: U }, e))));
636
+ });
637
+ var he = import_react.forwardRef((r, o) => {
638
+ var _, I;
639
+ let n = useId(), u = import_react.useRef(null), c = import_react.useContext(fe), d = K(), f = pe(r), p = (I = (_ = f.current) == null ? void 0 : _.forceMount) != null ? I : c == null ? void 0 : c.forceMount;
640
+ k(() => {
641
+ if (!p) return d.item(n, c == null ? void 0 : c.id);
642
+ }, [p]);
643
+ let b = ve(n, u, [
644
+ r.value,
645
+ r.children,
646
+ u
647
+ ], r.keywords), m = ee(), R = P((v) => v.value && v.value === b.current), x = P((v) => p || d.filter() === !1 ? !0 : v.search ? v.filtered.items.get(n) > 0 : !0);
648
+ import_react.useEffect(() => {
649
+ let v = u.current;
650
+ if (!(!v || r.disabled)) return v.addEventListener(Z, C), () => v.removeEventListener(Z, C);
651
+ }, [
652
+ x,
653
+ r.onSelect,
654
+ r.disabled
655
+ ]);
656
+ function C() {
657
+ var v, E;
658
+ S(), (E = (v = f.current).onSelect) == null || E.call(v, b.current);
659
+ }
660
+ function S() {
661
+ m.setState("value", b.current, !0);
662
+ }
663
+ if (!x) return null;
664
+ let { disabled: A, value: ge, onSelect: j, forceMount: O, keywords: $, ...q } = r;
665
+ return import_react.createElement(Primitive.div, {
666
+ ref: composeRefs(u, o),
667
+ ...q,
668
+ id: n,
669
+ "cmdk-item": "",
670
+ role: "option",
671
+ "aria-disabled": !!A,
672
+ "aria-selected": !!R,
673
+ "data-disabled": !!A,
674
+ "data-selected": !!R,
675
+ onPointerMove: A || d.getDisablePointerSelection() ? void 0 : S,
676
+ onClick: A ? void 0 : C
677
+ }, r.children);
678
+ });
679
+ var Ee = import_react.forwardRef((r, o) => {
680
+ let { heading: n, children: u, forceMount: c, ...d } = r, f = useId(), p = import_react.useRef(null), b = import_react.useRef(null), m = useId(), R = K(), x = P((S) => c || R.filter() === !1 ? !0 : S.search ? S.filtered.groups.has(f) : !0);
681
+ k(() => R.group(f), []), ve(f, p, [
682
+ r.value,
683
+ r.heading,
684
+ b
685
+ ]);
686
+ let C = import_react.useMemo(() => ({
687
+ id: f,
688
+ forceMount: c
689
+ }), [c]);
690
+ return import_react.createElement(Primitive.div, {
691
+ ref: composeRefs(p, o),
692
+ ...d,
693
+ "cmdk-group": "",
694
+ role: "presentation",
695
+ hidden: x ? void 0 : !0
696
+ }, n && import_react.createElement("div", {
697
+ ref: b,
698
+ "cmdk-group-heading": "",
699
+ "aria-hidden": !0,
700
+ id: m
701
+ }, n), B(r, (S) => import_react.createElement("div", {
702
+ "cmdk-group-items": "",
703
+ role: "group",
704
+ "aria-labelledby": n ? m : void 0
705
+ }, import_react.createElement(fe.Provider, { value: C }, S))));
706
+ });
707
+ var ye = import_react.forwardRef((r, o) => {
708
+ let { alwaysRender: n, ...u } = r, c = import_react.useRef(null), d = P((f) => !f.search);
709
+ return !n && !d ? null : import_react.createElement(Primitive.div, {
710
+ ref: composeRefs(c, o),
711
+ ...u,
712
+ "cmdk-separator": "",
713
+ role: "separator"
714
+ });
715
+ });
716
+ var Se = import_react.forwardRef((r, o) => {
717
+ let { onValueChange: n, ...u } = r, c = r.value != null, d = ee(), f = P((m) => m.search), p = P((m) => m.selectedItemId), b = K();
718
+ return import_react.useEffect(() => {
719
+ r.value != null && d.setState("search", r.value);
720
+ }, [r.value]), import_react.createElement(Primitive.input, {
721
+ ref: o,
722
+ ...u,
723
+ "cmdk-input": "",
724
+ autoComplete: "off",
725
+ autoCorrect: "off",
726
+ spellCheck: !1,
727
+ "aria-autocomplete": "list",
728
+ role: "combobox",
729
+ "aria-expanded": !0,
730
+ "aria-controls": b.listId,
731
+ "aria-labelledby": b.labelId,
732
+ "aria-activedescendant": p,
733
+ id: b.inputId,
734
+ type: "text",
735
+ value: c ? r.value : f,
736
+ onChange: (m) => {
737
+ c || d.setState("search", m.target.value), n?.(m.target.value);
738
+ }
739
+ });
740
+ });
741
+ var Ce = import_react.forwardRef((r, o) => {
742
+ let { children: n, label: u = "Suggestions", ...c } = r, d = import_react.useRef(null), f = import_react.useRef(null), p = P((m) => m.selectedItemId), b = K();
743
+ return import_react.useEffect(() => {
744
+ if (f.current && d.current) {
745
+ let m = f.current, R = d.current, x, C = new ResizeObserver(() => {
746
+ x = requestAnimationFrame(() => {
747
+ let S = m.offsetHeight;
748
+ R.style.setProperty("--cmdk-list-height", S.toFixed(1) + "px");
749
+ });
750
+ });
751
+ return C.observe(m), () => {
752
+ cancelAnimationFrame(x), C.unobserve(m);
753
+ };
754
+ }
755
+ }, []), import_react.createElement(Primitive.div, {
756
+ ref: composeRefs(d, o),
757
+ ...c,
758
+ "cmdk-list": "",
759
+ role: "listbox",
760
+ tabIndex: -1,
761
+ "aria-activedescendant": p,
762
+ "aria-label": u,
763
+ id: b.listId
764
+ }, B(r, (m) => import_react.createElement("div", {
765
+ ref: composeRefs(f, b.listInnerRef),
766
+ "cmdk-list-sizer": ""
767
+ }, m)));
768
+ });
769
+ var xe = import_react.forwardRef((r, o) => {
770
+ let { open: n, onOpenChange: u, overlayClassName: c, contentClassName: d, container: f, ...p } = r;
771
+ return import_react.createElement(Dialog, {
772
+ open: n,
773
+ onOpenChange: u
774
+ }, import_react.createElement(DialogPortal, { container: f }, import_react.createElement(DialogOverlay, {
775
+ "cmdk-overlay": "",
776
+ className: c
777
+ }), import_react.createElement(DialogContent, {
778
+ "aria-label": r.label,
779
+ "cmdk-dialog": "",
780
+ className: d
781
+ }, import_react.createElement(me, {
782
+ ref: o,
783
+ ...p
784
+ }))));
785
+ });
786
+ var Ie = import_react.forwardRef((r, o) => P((u) => u.filtered.count === 0) ? import_react.createElement(Primitive.div, {
787
+ ref: o,
788
+ ...r,
789
+ "cmdk-empty": "",
790
+ role: "presentation"
791
+ }) : null);
792
+ var Pe = import_react.forwardRef((r, o) => {
793
+ let { progress: n, children: u, label: c = "Loading...", ...d } = r;
794
+ return import_react.createElement(Primitive.div, {
795
+ ref: o,
796
+ ...d,
797
+ "cmdk-loading": "",
798
+ role: "progressbar",
799
+ "aria-valuenow": n,
800
+ "aria-valuemin": 0,
801
+ "aria-valuemax": 100,
802
+ "aria-label": c
803
+ }, B(r, (f) => import_react.createElement("div", { "aria-hidden": !0 }, f)));
804
+ });
805
+ var _e = Object.assign(me, {
806
+ List: Ce,
807
+ Item: he,
808
+ Input: Se,
809
+ Group: Ee,
810
+ Separator: ye,
811
+ Dialog: xe,
812
+ Empty: Ie,
813
+ Loading: Pe
814
+ });
815
+ function we(r, o) {
816
+ let n = r.nextElementSibling;
817
+ for (; n;) {
818
+ if (n.matches(o)) return n;
819
+ n = n.nextElementSibling;
820
+ }
821
+ }
822
+ function De(r, o) {
823
+ let n = r.previousElementSibling;
824
+ for (; n;) {
825
+ if (n.matches(o)) return n;
826
+ n = n.previousElementSibling;
827
+ }
828
+ }
829
+ function pe(r) {
830
+ let o = import_react.useRef(r);
831
+ return k(() => {
832
+ o.current = r;
833
+ }), o;
834
+ }
835
+ var k = typeof window == "undefined" ? import_react.useEffect : import_react.useLayoutEffect;
836
+ function L(r) {
837
+ let o = import_react.useRef();
838
+ return o.current === void 0 && (o.current = r()), o;
839
+ }
840
+ function P(r) {
841
+ let o = ee(), n = () => r(o.snapshot());
842
+ return import_react.useSyncExternalStore(o.subscribe, n, n);
843
+ }
844
+ function ve(r, o, n, u = []) {
845
+ let c = import_react.useRef(), d = K();
846
+ return k(() => {
847
+ var b;
848
+ let f = (() => {
849
+ var m;
850
+ for (let R of n) {
851
+ if (typeof R == "string") return R.trim();
852
+ if (typeof R == "object" && "current" in R) return R.current ? (m = R.current.textContent) == null ? void 0 : m.trim() : c.current;
853
+ }
854
+ })(), p = u.map((m) => m.trim());
855
+ d.value(r, f, p), (b = o.current) == null || b.setAttribute(T, f), c.current = f;
856
+ }), c;
857
+ }
858
+ var ke = () => {
859
+ let [r, o] = import_react.useState(), n = L(() => /* @__PURE__ */ new Map());
860
+ return k(() => {
861
+ n.current.forEach((u) => u()), n.current = /* @__PURE__ */ new Map();
862
+ }, [r]), (u, c) => {
863
+ n.current.set(u, c), o({});
864
+ };
865
+ };
866
+ function Me(r) {
867
+ let o = r.type;
868
+ return typeof o == "function" ? o(r.props) : "render" in o ? o.render(r.props) : r;
869
+ }
870
+ function B({ asChild: r, children: o }, n) {
871
+ return r && import_react.isValidElement(o) ? import_react.cloneElement(Me(o), { ref: o.ref }, n(o.props.children)) : n(o);
872
+ }
873
+ var Te = {
874
+ position: "absolute",
875
+ width: "1px",
876
+ height: "1px",
877
+ padding: "0",
878
+ margin: "-1px",
879
+ overflow: "hidden",
880
+ clip: "rect(0, 0, 0, 0)",
881
+ whiteSpace: "nowrap",
882
+ borderWidth: "0"
883
+ };
884
+ //#endregion
885
+ //#region src/components/command-palette.tsx
886
+ /**
887
+ * Command palette.
888
+ *
889
+ * The fast path, never the only path: everything reachable here is also
890
+ * reachable by clicking.
891
+ *
892
+ * Selecting an item uses router navigation so the destination loader finishes
893
+ * before the new screen replaces the current one.
894
+ */
895
+ function CommandPalette({ projects, capabilities }) {
896
+ const navigate = useNavigate();
897
+ const [open, setOpen] = (0, import_react.useState)(false);
898
+ (0, import_react.useEffect)(() => {
899
+ function onKeyDown(event) {
900
+ if (event.key === "k" && (event.metaKey || event.ctrlKey)) {
901
+ event.preventDefault();
902
+ setOpen((value) => !value);
903
+ }
904
+ }
905
+ document.addEventListener("keydown", onKeyDown);
906
+ return () => document.removeEventListener("keydown", onKeyDown);
907
+ }, []);
908
+ const active = projects.filter((project) => project.archivedAt === null);
909
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
910
+ type: "button",
911
+ className: "search-trigger",
912
+ onClick: () => setOpen(true),
913
+ "aria-label": "Search projects and environments",
914
+ "aria-keyshortcuts": "Meta+K Control+K",
915
+ children: [
916
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Search, { size: 14 }),
917
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
918
+ className: "search-label",
919
+ children: "Search…"
920
+ }),
921
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", {
922
+ "aria-hidden": true,
923
+ children: "⌘K"
924
+ })
925
+ ]
926
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Dialog, {
927
+ open,
928
+ onOpenChange: setOpen,
929
+ label: "Jump to a project, environment or page",
930
+ overlayClassName: "overlay",
931
+ contentClassName: "palette",
932
+ loop: true,
933
+ children: [
934
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_e.Input, { placeholder: "Search projects, environments and pages…" }),
935
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.List, { children: [
936
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_e.Empty, { children: "Nothing by that name." }),
937
+ active.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_e.Group, {
938
+ heading: "Environments",
939
+ children: active.flatMap((project) => project.environments.filter(isActiveAccessibleEnvironment).map((environment) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
940
+ value: `${project.slug}/${environment.slug} ${environment.name}`,
941
+ onSelect: () => {
942
+ setOpen(false);
943
+ navigate({
944
+ to: "/projects/$project/$environment",
945
+ params: {
946
+ project: project.slug,
947
+ environment: environment.slug
948
+ }
949
+ });
950
+ },
951
+ children: [
952
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Layers, { size: 15 }),
953
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
954
+ className: "mono",
955
+ children: [
956
+ project.slug,
957
+ "/",
958
+ environment.slug
959
+ ]
960
+ }),
961
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
962
+ className: "palette-hint",
963
+ children: [
964
+ environment.details.secretCount,
965
+ " secret",
966
+ environment.details.secretCount === 1 ? "" : "s"
967
+ ]
968
+ })
969
+ ]
970
+ }, `${project.slug}/${environment.slug}`)))
971
+ }),
972
+ active.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_e.Group, {
973
+ heading: "Projects",
974
+ children: active.map((project) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
975
+ value: `${project.slug} ${project.name}`,
976
+ onSelect: () => {
977
+ setOpen(false);
978
+ navigate({
979
+ to: "/projects/$project",
980
+ params: { project: project.slug }
981
+ });
982
+ },
983
+ children: [
984
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Folder, { size: 15 }),
985
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
986
+ className: "mono",
987
+ children: project.slug
988
+ }),
989
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
990
+ className: "palette-hint",
991
+ children: project.name
992
+ })
993
+ ]
994
+ }, project.slug))
995
+ }),
996
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Group, {
997
+ heading: "Pages",
998
+ children: [
999
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1000
+ value: "projects all",
1001
+ onSelect: () => {
1002
+ setOpen(false);
1003
+ navigate({ to: "/projects" });
1004
+ },
1005
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Folder, { size: 15 }), "Projects"]
1006
+ }),
1007
+ hasAdministrationItems(capabilities) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdministrationItems, {
1008
+ capabilities,
1009
+ audit: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1010
+ value: "audit log history reads",
1011
+ onSelect: () => {
1012
+ setOpen(false);
1013
+ navigate({
1014
+ to: "/audit",
1015
+ search: {}
1016
+ });
1017
+ },
1018
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ledger, { size: 15 }), "Audit"]
1019
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1020
+ value: "audit denials denied refused",
1021
+ onSelect: () => {
1022
+ setOpen(false);
1023
+ navigate({
1024
+ to: "/audit",
1025
+ search: { decision: "deny" }
1026
+ });
1027
+ },
1028
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlashCircle, { size: 15 }), "Audit, denials only"]
1029
+ })] }),
1030
+ users: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1031
+ value: "users people members directory",
1032
+ onSelect: () => {
1033
+ setOpen(false);
1034
+ navigate({ to: "/users" });
1035
+ },
1036
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Users, { size: 15 }), "Users"]
1037
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1038
+ value: "tokens service accounts machines ci directory",
1039
+ onSelect: () => {
1040
+ setOpen(false);
1041
+ navigate({ to: "/tokens" });
1042
+ },
1043
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Key, { size: 15 }), "Tokens"]
1044
+ })] })
1045
+ }),
1046
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1047
+ value: "settings workspace instance sign-in",
1048
+ onSelect: () => {
1049
+ setOpen(false);
1050
+ navigate({ to: "/settings" });
1051
+ },
1052
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Settings, { size: 15 }), "Settings"]
1053
+ }),
1054
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1055
+ value: "account preferences appearance identity profile me",
1056
+ onSelect: () => {
1057
+ setOpen(false);
1058
+ navigate({ to: "/account" });
1059
+ },
1060
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserCog, { size: 15 }), "Account"]
1061
+ })
1062
+ ]
1063
+ }),
1064
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Group, {
1065
+ heading: "Appearance",
1066
+ children: [
1067
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1068
+ value: "theme system automatic",
1069
+ onSelect: () => {
1070
+ setTheme("system");
1071
+ setOpen(false);
1072
+ },
1073
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Monitor, { size: 15 }), "Match system colours"]
1074
+ }),
1075
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1076
+ value: "theme light paper",
1077
+ onSelect: () => {
1078
+ setTheme("light");
1079
+ setOpen(false);
1080
+ },
1081
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sun, { size: 15 }), "Light"]
1082
+ }),
1083
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1084
+ value: "theme dark night",
1085
+ onSelect: () => {
1086
+ setTheme("dark");
1087
+ setOpen(false);
1088
+ },
1089
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Moon, { size: 15 }), "Dark"]
1090
+ })
1091
+ ]
1092
+ })
1093
+ ] }),
1094
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1095
+ className: "palette-foot",
1096
+ "aria-hidden": true,
1097
+ children: [
1098
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
1099
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", { children: "↑" }),
1100
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", { children: "↓" }),
1101
+ " move"
1102
+ ] }),
1103
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", { children: "↵" }), " open"] }),
1104
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", { children: "esc" }), " close"] })
1105
+ ]
1106
+ })
1107
+ ]
1108
+ })] });
1109
+ }
1110
+ //#endregion
1111
+ //#region src/components/shell.tsx
1112
+ var REPOSITORY = "https://github.com/erwinkn/coffre";
1113
+ /**
1114
+ * The workspace this deployment serves. The server has no such notion yet --
1115
+ * one deployment is one workspace -- so the name lives here until it does.
1116
+ */
1117
+ var WORKSPACE = "Acme";
1118
+ var SIDEBAR_KEY = "coffre-sidebar";
1119
+ /** Wide enough for the sidebar to sit beside the page; narrower, it is a drawer. */
1120
+ var WIDE = "(width > 60rem)";
1121
+ /**
1122
+ * Collapses the sidebar before first paint, inlined in <head> like the
1123
+ * theme's script: drawn wide and then snapped narrow, the whole page would
1124
+ * lurch sideways on every load.
1125
+ */
1126
+ var sidebarBootScript = `(function(){try{if(localStorage.getItem(${JSON.stringify(SIDEBAR_KEY)})==="collapsed"){document.documentElement.setAttribute("data-sidebar","collapsed")}}catch(e){}})()`;
1127
+ /**
1128
+ * Whether the sidebar is folded down to its icons, and the switch.
1129
+ *
1130
+ * The attribute on <html> is the truth and the stylesheet reads it, so the
1131
+ * boot script has already drawn the right width. Server-rendered markup
1132
+ * cannot know it, so this state starts expanded and catches up on mount.
1133
+ */
1134
+ function useSidebarCollapsed() {
1135
+ const [collapsed, setCollapsed] = (0, import_react.useState)(false);
1136
+ (0, import_react.useEffect)(() => setCollapsed(document.documentElement.dataset.sidebar === "collapsed"), []);
1137
+ return [collapsed, (0, import_react.useCallback)(() => {
1138
+ const root = document.documentElement;
1139
+ const next = root.dataset.sidebar !== "collapsed";
1140
+ if (next) root.dataset.sidebar = "collapsed";
1141
+ else delete root.dataset.sidebar;
1142
+ try {
1143
+ if (next) localStorage.setItem(SIDEBAR_KEY, "collapsed");
1144
+ else localStorage.removeItem(SIDEBAR_KEY);
1145
+ } catch {}
1146
+ setCollapsed(next);
1147
+ }, [])];
1148
+ }
1149
+ /** Marks the current route without each link having to compare paths itself. */
1150
+ var CURRENT = { "aria-current": "page" };
1151
+ function roleLabel(principal, instanceRole) {
1152
+ if (principal?.type === "service") return "Token";
1153
+ if (instanceRole === "root-admin") return "Root admin";
1154
+ if (instanceRole === "owner") return "Owner";
1155
+ return "Member";
1156
+ }
1157
+ /** The product's mark and name, for the pages you see before signing in. */
1158
+ function Brand() {
1159
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1160
+ className: "brand",
1161
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1162
+ className: "brand-mark",
1163
+ "aria-hidden": true,
1164
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Mark, { size: 16 })
1165
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1166
+ className: "brand-name",
1167
+ children: "coffre"
1168
+ })]
1169
+ });
1170
+ }
1171
+ /**
1172
+ * The application frame: a sidebar of sections, headed by the workspace and
1173
+ * footed by your account, and a bar across the content with search on the
1174
+ * right. The sidebar folds down to its icons (⌘B, or the button at the left
1175
+ * of the bar) and stays folded across visits.
1176
+ *
1177
+ * Inside a project, the left of that bar is the path to where you are, and
1178
+ * each step of it switches: that is the only place project and environment
1179
+ * navigation lives outside the pages themselves. Everywhere else the page's
1180
+ * own title says where you are, so the bar leaves it out rather than repeat it.
1181
+ */
1182
+ function Shell({ projects, principal, instanceRole, capabilities, children }) {
1183
+ const pathname = useRouterState({ select: (state) => state.location.pathname });
1184
+ const [drawerOpen, setDrawerOpen] = (0, import_react.useState)(false);
1185
+ const [collapsed, toggleSidebar] = useSidebarCollapsed();
1186
+ (0, import_react.useEffect)(() => setDrawerOpen(false), [pathname]);
1187
+ (0, import_react.useEffect)(() => {
1188
+ function onKeyDown(event) {
1189
+ if (event.key === "b" && (event.metaKey || event.ctrlKey) && matchMedia(WIDE).matches) {
1190
+ event.preventDefault();
1191
+ toggleSidebar();
1192
+ }
1193
+ }
1194
+ document.addEventListener("keydown", onKeyDown);
1195
+ return () => document.removeEventListener("keydown", onKeyDown);
1196
+ }, [toggleSidebar]);
1197
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1198
+ className: "shell",
1199
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("aside", {
1200
+ className: "sidebar",
1201
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sidebar, {
1202
+ principal,
1203
+ instanceRole,
1204
+ capabilities,
1205
+ collapsed
1206
+ })
1207
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1208
+ className: "main",
1209
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", {
1210
+ className: "header",
1211
+ children: [
1212
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tip, {
1213
+ label: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [collapsed ? "Expand sidebar" : "Collapse sidebar", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", { children: "⌘B" })] }),
1214
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1215
+ type: "button",
1216
+ className: "btn btn-quiet btn-icon header-sidebar",
1217
+ "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
1218
+ "aria-keyshortcuts": "Meta+B Control+B",
1219
+ onClick: toggleSidebar,
1220
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelLeft, { size: 16 })
1221
+ })
1222
+ }),
1223
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dialog_exports.Root, {
1224
+ open: drawerOpen,
1225
+ onOpenChange: setDrawerOpen,
1226
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialog_exports.Trigger, {
1227
+ asChild: true,
1228
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1229
+ type: "button",
1230
+ className: "btn btn-quiet btn-icon header-menu",
1231
+ "aria-label": "Open navigation",
1232
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Menu, { size: 18 })
1233
+ })
1234
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dialog_exports.Portal, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialog_exports.Overlay, { className: "overlay" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dialog_exports.Content, {
1235
+ className: "drawer",
1236
+ "aria-describedby": void 0,
1237
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialog_exports.Title, {
1238
+ className: "visually-hidden",
1239
+ children: "Navigation"
1240
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sidebar, {
1241
+ principal,
1242
+ instanceRole,
1243
+ capabilities,
1244
+ close: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialog_exports.Close, {
1245
+ asChild: true,
1246
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1247
+ type: "button",
1248
+ className: "btn btn-quiet btn-sm btn-icon",
1249
+ "aria-label": "Close navigation",
1250
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X$1, { size: 16 })
1251
+ })
1252
+ })
1253
+ })]
1254
+ })] })]
1255
+ }),
1256
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Breadcrumbs, {
1257
+ pathname,
1258
+ projects,
1259
+ canListPrincipals: capabilities.canManageGrants
1260
+ }),
1261
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1262
+ className: "header-end",
1263
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CommandPalette, {
1264
+ projects,
1265
+ capabilities
1266
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tip, {
1267
+ label: "coffre on GitHub",
1268
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
1269
+ className: "btn btn-quiet btn-icon",
1270
+ href: REPOSITORY,
1271
+ target: "_blank",
1272
+ rel: "noreferrer",
1273
+ "aria-label": "coffre on GitHub",
1274
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GitHub, { size: 16 })
1275
+ })
1276
+ })]
1277
+ })
1278
+ ]
1279
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("main", {
1280
+ className: "content",
1281
+ id: "content",
1282
+ children
1283
+ })]
1284
+ })]
1285
+ });
1286
+ }
1287
+ /** The sidebar's contents, shared by the wide layout and the narrow drawer. */
1288
+ function Sidebar({ principal, instanceRole, capabilities, collapsed = false, close }) {
1289
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1290
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1291
+ className: "sidebar-head",
1292
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(WorkspaceMenu, { collapsed }), close]
1293
+ }),
1294
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", {
1295
+ className: "sidebar-nav",
1296
+ "aria-label": "Sections",
1297
+ children: [
1298
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavLink, {
1299
+ to: "/projects",
1300
+ label: "Projects",
1301
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Folder, { size: 16 }),
1302
+ collapsed
1303
+ }),
1304
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdministrationItems, {
1305
+ capabilities,
1306
+ users: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavLink, {
1307
+ to: "/users",
1308
+ label: "Users",
1309
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Users, { size: 16 }),
1310
+ collapsed
1311
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavLink, {
1312
+ to: "/tokens",
1313
+ label: "Tokens",
1314
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Key, { size: 16 }),
1315
+ collapsed
1316
+ })] }),
1317
+ audit: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavLink, {
1318
+ to: "/audit",
1319
+ label: "Audit",
1320
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ledger, { size: 16 }),
1321
+ collapsed
1322
+ })
1323
+ }),
1324
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavLink, {
1325
+ to: "/settings",
1326
+ label: "Settings",
1327
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Settings, { size: 16 }),
1328
+ collapsed
1329
+ })
1330
+ ]
1331
+ }),
1332
+ principal !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1333
+ className: "sidebar-foot",
1334
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccountMenu, {
1335
+ principal,
1336
+ instanceRole,
1337
+ collapsed
1338
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tip, {
1339
+ label: "Account settings",
1340
+ side: collapsed ? "right" : void 0,
1341
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
1342
+ className: "btn btn-quiet btn-icon sidebar-foot-settings",
1343
+ to: "/account",
1344
+ "aria-label": "Account settings",
1345
+ activeProps: CURRENT,
1346
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserCog, { size: 16 })
1347
+ })
1348
+ })]
1349
+ })
1350
+ ] });
1351
+ }
1352
+ /** A folded sidebar's stand-in for the labels it hides. */
1353
+ function CollapsedTip({ collapsed, label, children }) {
1354
+ return collapsed ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tip, {
1355
+ label,
1356
+ side: "right",
1357
+ children
1358
+ }) : children;
1359
+ }
1360
+ function NavLink({ to, label, icon, collapsed }) {
1361
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsedTip, {
1362
+ collapsed,
1363
+ label,
1364
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
1365
+ className: "nav-link",
1366
+ to,
1367
+ activeProps: CURRENT,
1368
+ children: [icon, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1369
+ className: "nav-label",
1370
+ children: label
1371
+ })]
1372
+ })
1373
+ });
1374
+ }
1375
+ /**
1376
+ * The workspace you are in, and where the others would be.
1377
+ *
1378
+ * For now this lists the one there is, and creating another says why it
1379
+ * cannot yet rather than opening a form that goes nowhere.
1380
+ */
1381
+ function WorkspaceMenu({ collapsed }) {
1382
+ const navigate = useNavigate();
1383
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Root, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsedTip, {
1384
+ collapsed,
1385
+ label: WORKSPACE,
1386
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Trigger, {
1387
+ asChild: true,
1388
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
1389
+ type: "button",
1390
+ className: "workspace",
1391
+ children: [
1392
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tile, { name: WORKSPACE }),
1393
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1394
+ className: "workspace-name",
1395
+ children: WORKSPACE
1396
+ }),
1397
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronsUpDown, {
1398
+ size: 14,
1399
+ className: "workspace-chevron"
1400
+ })
1401
+ ]
1402
+ })
1403
+ })
1404
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Content, {
1405
+ className: "menu menu-workspace",
1406
+ align: "start",
1407
+ sideOffset: 6,
1408
+ children: [
1409
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Label, {
1410
+ className: "menu-label",
1411
+ children: "Workspaces"
1412
+ }),
1413
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Item, {
1414
+ className: "menu-item",
1415
+ onSelect: () => navigate({ to: "/projects" }),
1416
+ children: [
1417
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tile, { name: WORKSPACE }),
1418
+ WORKSPACE,
1419
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, {
1420
+ size: 14,
1421
+ className: "menu-check"
1422
+ })
1423
+ ]
1424
+ }),
1425
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Separator, { className: "menu-sep" }),
1426
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Item, {
1427
+ className: "menu-item",
1428
+ onSelect: () => toast("One workspace per deployment, for now", { description: `Creating another needs server support coffre does not have yet. This deployment is ${WORKSPACE}.` }),
1429
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Plus, { size: 14 }), "Create workspace"]
1430
+ })
1431
+ ]
1432
+ }) })] });
1433
+ }
1434
+ /**
1435
+ * Sign out with a real form post, built on the spot: the menu item unmounts
1436
+ * as the menu closes, so it cannot hold the form itself, and the response is
1437
+ * a redirect the browser should follow (to Access's logout, in Cloudflare
1438
+ * mode).
1439
+ */
1440
+ function signOut() {
1441
+ const form = document.createElement("form");
1442
+ form.method = "post";
1443
+ form.action = "/auth/signout";
1444
+ document.body.appendChild(form);
1445
+ form.submit();
1446
+ }
1447
+ function AccountMenu({ principal, instanceRole, collapsed }) {
1448
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Root, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsedTip, {
1449
+ collapsed,
1450
+ label: principal.id,
1451
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Trigger, {
1452
+ asChild: true,
1453
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
1454
+ type: "button",
1455
+ className: "account",
1456
+ title: collapsed ? void 0 : principal.id,
1457
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1458
+ className: "avatar",
1459
+ "aria-hidden": true,
1460
+ children: principal.id.slice(0, 1)
1461
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1462
+ className: "account-text",
1463
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1464
+ className: "account-name",
1465
+ children: principal.id
1466
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1467
+ className: "account-role",
1468
+ children: roleLabel(principal, instanceRole)
1469
+ })]
1470
+ })]
1471
+ })
1472
+ })
1473
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Content, {
1474
+ className: "menu menu-account",
1475
+ side: "top",
1476
+ align: "start",
1477
+ sideOffset: 6,
1478
+ children: [
1479
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Label, {
1480
+ className: "menu-label",
1481
+ children: "Theme"
1482
+ }),
1483
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeMenuItems, {}),
1484
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Separator, { className: "menu-sep" }),
1485
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Item, {
1486
+ className: "menu-item",
1487
+ onSelect: signOut,
1488
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SignOut, { size: 14 }), "Sign out"]
1489
+ })
1490
+ ]
1491
+ }) })] });
1492
+ }
1493
+ /**
1494
+ * The path to the project or environment you are in, where each step also
1495
+ * switches: one click on `prod` lists its siblings. Absent everywhere else.
1496
+ */
1497
+ function Breadcrumbs({ pathname, projects, canListPrincipals }) {
1498
+ const [section, projectSlug, environmentSlug] = pathname.split("/").filter((segment) => segment !== "").map(decodeURIComponent);
1499
+ if ((section === "users" || section === "tokens") && projectSlug !== void 0) {
1500
+ const label = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: section === "users" ? "Users" : "Tokens" });
1501
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", {
1502
+ className: "crumbs",
1503
+ "aria-label": "Breadcrumb",
1504
+ children: [
1505
+ canListPrincipals ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
1506
+ className: "crumb-link crumb-root",
1507
+ to: section === "users" ? "/users" : "/tokens",
1508
+ children: label
1509
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1510
+ className: "crumb-link crumb-root",
1511
+ children: label
1512
+ }),
1513
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1514
+ className: "crumb-sep",
1515
+ "aria-hidden": true,
1516
+ children: "/"
1517
+ }),
1518
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1519
+ className: "crumb",
1520
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1521
+ className: "crumb-link",
1522
+ "aria-current": "page",
1523
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: projectSlug })
1524
+ })
1525
+ })
1526
+ ]
1527
+ });
1528
+ }
1529
+ if (section !== "projects" || projectSlug === void 0) return null;
1530
+ const active = projects.filter((project) => project.archivedAt === null);
1531
+ const project = projects.find((entry) => entry.slug === projectSlug);
1532
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", {
1533
+ className: "crumbs",
1534
+ "aria-label": "Breadcrumb",
1535
+ children: [
1536
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
1537
+ className: "crumb-link crumb-root",
1538
+ to: "/projects",
1539
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Projects" })
1540
+ }),
1541
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1542
+ className: "crumb-sep",
1543
+ "aria-hidden": true,
1544
+ children: "/"
1545
+ }),
1546
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProjectCrumb, {
1547
+ slug: projectSlug,
1548
+ current: environmentSlug === void 0,
1549
+ projects: active
1550
+ }),
1551
+ environmentSlug !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1552
+ className: "crumb-sep",
1553
+ "aria-hidden": true,
1554
+ children: "/"
1555
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EnvironmentCrumb, {
1556
+ projectSlug,
1557
+ slug: environmentSlug,
1558
+ environments: project?.environments.filter(isActiveAccessibleEnvironment) ?? []
1559
+ })] })
1560
+ ]
1561
+ });
1562
+ }
1563
+ function ProjectCrumb({ slug, current, projects }) {
1564
+ const navigate = useNavigate();
1565
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1566
+ className: "crumb",
1567
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
1568
+ className: "crumb-link",
1569
+ to: "/projects/$project",
1570
+ params: { project: slug },
1571
+ "aria-current": current ? "page" : void 0,
1572
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tile, { name: slug }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1573
+ className: "crumb-project-name",
1574
+ children: slug
1575
+ })]
1576
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Root, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Trigger, {
1577
+ asChild: true,
1578
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1579
+ type: "button",
1580
+ className: "crumb-switch",
1581
+ "aria-label": "Switch project",
1582
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronsUpDown, { size: 14 })
1583
+ })
1584
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Content, {
1585
+ className: "menu",
1586
+ sideOffset: 6,
1587
+ align: "start",
1588
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Label, {
1589
+ className: "menu-label",
1590
+ children: "Projects"
1591
+ }), projects.map((project) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Item, {
1592
+ className: "menu-item",
1593
+ onSelect: () => navigate({
1594
+ to: "/projects/$project",
1595
+ params: { project: project.slug }
1596
+ }),
1597
+ children: [
1598
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tile, { name: project.slug }),
1599
+ project.slug,
1600
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1601
+ className: "menu-hint",
1602
+ children: project.name
1603
+ }),
1604
+ project.slug === slug && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, {
1605
+ size: 14,
1606
+ className: "menu-check"
1607
+ })
1608
+ ]
1609
+ }, project.slug))]
1610
+ }) })] })]
1611
+ });
1612
+ }
1613
+ function EnvironmentCrumb({ projectSlug, slug, environments }) {
1614
+ const navigate = useNavigate();
1615
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1616
+ className: "crumb",
1617
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1618
+ className: "crumb-link",
1619
+ "aria-current": "page",
1620
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: slug })
1621
+ }), environments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Root, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Trigger, {
1622
+ asChild: true,
1623
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1624
+ type: "button",
1625
+ className: "crumb-switch",
1626
+ "aria-label": "Switch environment",
1627
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronsUpDown, { size: 14 })
1628
+ })
1629
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Content, {
1630
+ className: "menu",
1631
+ sideOffset: 6,
1632
+ align: "start",
1633
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Label, {
1634
+ className: "menu-label",
1635
+ children: ["Environments in ", projectSlug]
1636
+ }), environments.map((environment) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Item, {
1637
+ className: "menu-item",
1638
+ onSelect: () => navigate({
1639
+ to: "/projects/$project/$environment",
1640
+ params: {
1641
+ project: projectSlug,
1642
+ environment: environment.slug
1643
+ }
1644
+ }),
1645
+ children: [
1646
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1647
+ className: "mono",
1648
+ children: environment.slug
1649
+ }),
1650
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1651
+ className: "menu-hint",
1652
+ children: [
1653
+ environment.details?.secretCount ?? 0,
1654
+ " secret",
1655
+ environment.details?.secretCount === 1 ? "" : "s"
1656
+ ]
1657
+ }),
1658
+ environment.slug === slug && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, {
1659
+ size: 14,
1660
+ className: "menu-check"
1661
+ })
1662
+ ]
1663
+ }, environment.slug))]
1664
+ }) })] })]
1665
+ });
1666
+ }
1667
+ //#endregion
1668
+ //#region src/components/agentation.tsx
1669
+ function Agentation() {
1670
+ return null;
1671
+ }
1672
+ /** Reads the page's origin, so it renders only inside ClientOnly, never on the server. */
1673
+ //#endregion
1674
+ //#region src/routes/__root.tsx
1675
+ var Route$3 = createRootRouteWithContext()({
1676
+ head: () => ({
1677
+ meta: [
1678
+ { charSet: "utf-8" },
1679
+ {
1680
+ name: "viewport",
1681
+ content: "width=device-width, initial-scale=1"
1682
+ },
1683
+ { title: "coffre" },
1684
+ {
1685
+ name: "description",
1686
+ content: "Secrets, with an audit log"
1687
+ }
1688
+ ],
1689
+ links: [{
1690
+ rel: "stylesheet",
1691
+ href: globals_default
1692
+ }, {
1693
+ rel: "icon",
1694
+ type: "image/svg+xml",
1695
+ href: `data:image/svg+xml,${encodeURIComponent(MARK_SVG)}`
1696
+ }]
1697
+ }),
1698
+ loader: async ({ context: { client }, location }) => {
1699
+ const shell = await loadShell(client);
1700
+ if (shell.registrationRequired && location.pathname !== "/unregistered") throw redirect({ to: "/unregistered" });
1701
+ if (shell.principal === null && location.pathname !== "/login") throw redirect({
1702
+ to: "/login",
1703
+ search: { next: location.href }
1704
+ });
1705
+ if (shell.principal !== null && location.pathname === "/login") throw redirect({ to: "/projects" });
1706
+ if (shell.principal !== null && !shell.registrationRequired && location.pathname === "/unregistered") throw redirect({ to: "/projects" });
1707
+ return shell;
1708
+ },
1709
+ shellComponent: RootDocument,
1710
+ component: RootComponent
1711
+ });
1712
+ /**
1713
+ * Who is looking, how this instance signs people in, and the projects they
1714
+ * can see. Three calls at once: for someone signed out or not yet a member,
1715
+ * the project list is refused, and they get the sign-in or closed-door page.
1716
+ */
1717
+ async function loadShell(client) {
1718
+ const [auth, me, projects] = await Promise.all([
1719
+ client.auth(),
1720
+ client.me().catch((error) => {
1721
+ if (error instanceof CoffreError && error.status === 401) return null;
1722
+ throw error;
1723
+ }),
1724
+ client.projects.list().then(({ projects }) => projects, () => [])
1725
+ ]);
1726
+ const member = me?.registered === true ? me : null;
1727
+ return {
1728
+ auth,
1729
+ principal: me === null ? null : me.principal,
1730
+ instanceRole: member?.instanceRole ?? null,
1731
+ projects,
1732
+ capabilities: deriveUiCapabilities(member, projects),
1733
+ registrationRequired: me !== null && !me.registered,
1734
+ /** A member the vault refuses: their record failed its integrity check. */
1735
+ accessTampered: me?.tampered === true
1736
+ };
1737
+ }
1738
+ function RootDocument({ children }) {
1739
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("html", {
1740
+ lang: "en",
1741
+ suppressHydrationWarning: true,
1742
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("head", { children: [
1743
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HeadContent, {}),
1744
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScriptOnce, { children: themeBootScript }),
1745
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScriptOnce, { children: sidebarBootScript })
1746
+ ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("body", { children: [children, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Scripts, {})] })]
1747
+ });
1748
+ }
1749
+ function Toasts() {
1750
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toaster, {
1751
+ position: "bottom-right",
1752
+ gap: 10,
1753
+ offset: 20,
1754
+ toastOptions: {
1755
+ duration: 4200,
1756
+ unstyled: true,
1757
+ classNames: {
1758
+ toast: "toast",
1759
+ title: "toast-title",
1760
+ description: "toast-description",
1761
+ actionButton: "toast-action",
1762
+ success: "toast-success",
1763
+ error: "toast-error"
1764
+ }
1765
+ }
1766
+ });
1767
+ }
1768
+ function RootComponent() {
1769
+ const { principal, instanceRole, projects, capabilities } = Route$3.useLoaderData();
1770
+ const pathname = useRouterState({ select: (state) => state.location.pathname });
1771
+ if (pathname === "/login" || pathname === "/unregistered" || pathname === "/auth/device") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TooltipProvider, { children: [
1772
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1773
+ className: "solo",
1774
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1775
+ className: "solo-top",
1776
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Brand, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeToggle, {})]
1777
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("main", {
1778
+ className: "solo-main",
1779
+ id: "content",
1780
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {})
1781
+ })]
1782
+ }),
1783
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toasts, {}),
1784
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Agentation, {})
1785
+ ] });
1786
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TooltipProvider, { children: [
1787
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
1788
+ className: "skip-link",
1789
+ href: "#content",
1790
+ children: "Skip to content"
1791
+ }),
1792
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Shell, {
1793
+ projects,
1794
+ principal,
1795
+ instanceRole,
1796
+ capabilities,
1797
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {})
1798
+ }),
1799
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toasts, {}),
1800
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Agentation, {})
1801
+ ] });
1802
+ }
1803
+ //#endregion
1804
+ //#region src/routes/index.tsx
1805
+ /**
1806
+ * The root is the project list, one level up.
1807
+ *
1808
+ * Projects live under `/projects/:slug` rather than at `/:slug` so that a
1809
+ * project may be called `audit` or `login` without shadowing the page of that
1810
+ * name. Nothing renders here; `/` only exists so the obvious URL still lands
1811
+ * somewhere.
1812
+ */
1813
+ var Route$2 = createFileRoute("/")({ beforeLoad: () => {
1814
+ throw redirect({ to: "/projects" });
1815
+ } });
1816
+ //#endregion
1817
+ //#region src/routes/access.tsx
1818
+ /**
1819
+ * The directory used to be one page here. It is now Users and Tokens; the
1820
+ * old address still lands somewhere sensible for bookmarks and links.
1821
+ */
1822
+ var Route$1 = createFileRoute("/access")({ beforeLoad: () => {
1823
+ throw redirect({ to: "/users" });
1824
+ } });
1825
+ //#endregion
1826
+ //#region src/routes/unregistered.tsx
1827
+ var $$splitComponentImporter = () => import("./unregistered-BqaWYFJK.js");
1828
+ var Route = createFileRoute("/unregistered")({ component: lazyRouteComponent($$splitComponentImporter, "component") });
1829
+ /**
1830
+ * Cloudflare Access has authenticated this person, but Coffre has not
1831
+ * registered them as a member. Keep this deliberately actionless: registration is
1832
+ * an owner decision, not a self-service privilege escalation path.
1833
+ */
1834
+ //#endregion
1835
+ //#region src/routeTree.gen.ts
1836
+ var IndexRoute = Route$2.update({
1837
+ id: "/",
1838
+ path: "/",
1839
+ getParentRoute: () => Route$3
1840
+ });
1841
+ var AccessRoute = Route$1.update({
1842
+ id: "/access",
1843
+ path: "/access",
1844
+ getParentRoute: () => Route$3
1845
+ });
1846
+ var AccountRoute = Route$4.update({
1847
+ id: "/account",
1848
+ path: "/account",
1849
+ getParentRoute: () => Route$3
1850
+ });
1851
+ var AuditRoute = Route$5.update({
1852
+ id: "/audit",
1853
+ path: "/audit",
1854
+ getParentRoute: () => Route$3
1855
+ });
1856
+ var LoginRoute = Route$6.update({
1857
+ id: "/login",
1858
+ path: "/login",
1859
+ getParentRoute: () => Route$3
1860
+ });
1861
+ var SettingsRoute = Route$7.update({
1862
+ id: "/settings",
1863
+ path: "/settings",
1864
+ getParentRoute: () => Route$3
1865
+ });
1866
+ var UnregisteredRoute = Route.update({
1867
+ id: "/unregistered",
1868
+ path: "/unregistered",
1869
+ getParentRoute: () => Route$3
1870
+ });
1871
+ var AuthDeviceRoute = Route$8.update({
1872
+ id: "/auth/device",
1873
+ path: "/auth/device",
1874
+ getParentRoute: () => Route$3
1875
+ });
1876
+ var ProjectsIndexRoute = Route$9.update({
1877
+ id: "/projects/",
1878
+ path: "/projects/",
1879
+ getParentRoute: () => Route$3
1880
+ });
1881
+ var TokensIndexRoute = Route$10.update({
1882
+ id: "/tokens/",
1883
+ path: "/tokens/",
1884
+ getParentRoute: () => Route$3
1885
+ });
1886
+ var TokensTokenRoute = Route$11.update({
1887
+ id: "/tokens/$token",
1888
+ path: "/tokens/$token",
1889
+ getParentRoute: () => Route$3
1890
+ });
1891
+ var UsersIndexRoute = Route$12.update({
1892
+ id: "/users/",
1893
+ path: "/users/",
1894
+ getParentRoute: () => Route$3
1895
+ });
1896
+ var UsersUserRoute = Route$13.update({
1897
+ id: "/users/$user",
1898
+ path: "/users/$user",
1899
+ getParentRoute: () => Route$3
1900
+ });
1901
+ var ProjectsProjectIndexRoute = Route$14.update({
1902
+ id: "/projects/$project/",
1903
+ path: "/projects/$project/",
1904
+ getParentRoute: () => Route$3
1905
+ });
1906
+ var rootRouteChildren = {
1907
+ IndexRoute,
1908
+ AccessRoute,
1909
+ AccountRoute,
1910
+ AuditRoute,
1911
+ LoginRoute,
1912
+ SettingsRoute,
1913
+ UnregisteredRoute,
1914
+ AuthDeviceRoute,
1915
+ TokensTokenRoute,
1916
+ UsersUserRoute,
1917
+ ProjectsIndexRoute,
1918
+ TokensIndexRoute,
1919
+ UsersIndexRoute,
1920
+ ProjectsProjectEnvironmentRoute: Route$15.update({
1921
+ id: "/projects/$project/$environment",
1922
+ path: "/projects/$project/$environment",
1923
+ getParentRoute: () => Route$3
1924
+ }),
1925
+ ProjectsProjectIndexRoute
1926
+ };
1927
+ var routeTree = Route$3._addFileChildren(rootRouteChildren)._addFileTypes();
1928
+ //#endregion
1929
+ //#region src/components/route-states.tsx
1930
+ /** A path that matches no page. */
1931
+ function NotFound() {
1932
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClosedDoor, {
1933
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Search, { size: 18 }),
1934
+ label: "404",
1935
+ title: "Nothing at this address",
1936
+ actions: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
1937
+ className: "btn",
1938
+ to: "/projects",
1939
+ children: "All projects"
1940
+ }),
1941
+ children: "There is no page at this address. If you followed a link to a project or environment, it may have been renamed or archived since."
1942
+ });
1943
+ }
1944
+ /**
1945
+ * A loader or render failure the page itself did not anticipate.
1946
+ *
1947
+ * Deliberately says nothing about the error's contents: they can include
1948
+ * server detail that has no business on screen. Retrying re-runs the loaders.
1949
+ */
1950
+ function RouteError({ reset }) {
1951
+ const router = useRouter();
1952
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClosedDoor, {
1953
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTriangle, { size: 18 }),
1954
+ label: "Something went wrong",
1955
+ title: "This page could not be shown",
1956
+ actions: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1957
+ type: "button",
1958
+ className: "btn btn-primary",
1959
+ onClick: () => {
1960
+ reset();
1961
+ router.invalidate();
1962
+ },
1963
+ children: "Try again"
1964
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
1965
+ className: "btn",
1966
+ to: "/projects",
1967
+ children: "All projects"
1968
+ })] }),
1969
+ children: "coffre could not load what this page needs, and nothing was read or written. If you typed this address, check it; if it keeps happening, the service or its database may be unavailable."
1970
+ });
1971
+ }
1972
+ //#endregion
1973
+ //#region src/router.tsx
1974
+ /**
1975
+ * The router factory. TanStack Start calls this once per request on the server
1976
+ * and once on the client.
1977
+ *
1978
+ * Note what is deliberately absent: any caching of loader data. Every screen in
1979
+ * this app reports authorisation state that another person can change from
1980
+ * another tab, so a stale project list or grant table is not a cosmetic
1981
+ * problem. `staleTime: 0` means a navigation back to a screen refetches it,
1982
+ * which is the behaviour the Next.js version got from `force-dynamic`.
1983
+ */
1984
+ function getRouter() {
1985
+ return createRouter({
1986
+ routeTree,
1987
+ defaultPreload: "intent",
1988
+ defaultStaleTime: 0,
1989
+ scrollRestoration: true,
1990
+ defaultNotFoundComponent: NotFound,
1991
+ defaultErrorComponent: RouteError,
1992
+ ssr: { nonce: cspNonce() },
1993
+ context: { client: requestClient() }
1994
+ });
1995
+ }
1996
+ /**
1997
+ * The API as this visitor, which every loader reads through:
1998
+ * `context.client.secrets.list('market/dev')`. On the server `@coffre/server`
1999
+ * builds it per request, calling the API in process with the visitor's
2000
+ * credential (`server/fetch-api.ts`); the UI only uses it. In the browser it
2001
+ * is plain `fetch` to `/api`, which sends the session cookie itself.
2002
+ */
2003
+ function requestClient() {
2004
+ if (typeof window !== "undefined") return createClient({ url: window.location.origin });
2005
+ try {
2006
+ const client = getGlobalStartContext()?.client;
2007
+ if (client !== void 0) return client;
2008
+ } catch {}
2009
+ return createClient({
2010
+ url: "http://coffre.invalid",
2011
+ transport: () => Promise.reject(/* @__PURE__ */ new Error("no request to call the API for"))
2012
+ });
2013
+ }
2014
+ /**
2015
+ * The nonce the server minted for this response's Content-Security-Policy,
2016
+ * which the router puts on every script it renders. The client has none to
2017
+ * give: hydration reads it back from the page. A router built only to
2018
+ * resolve a redirect runs outside the request's context and renders nothing.
2019
+ */
2020
+ function cspNonce() {
2021
+ try {
2022
+ return getGlobalStartContext()?.cspNonce;
2023
+ } catch {
2024
+ return;
2025
+ }
2026
+ }
2027
+ //#endregion
2028
+ export { getRouter };