@coffre/ui 0.1.18 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/README.md +23 -3
  2. package/dist/{server/_coffre/assets/affordances-CKANXDTG.js → chunks/affordances-DAvsVz7u.js} +12 -7
  3. package/dist/chunks/affordances-DAvsVz7u.js.map +1 -0
  4. package/dist/chunks/directory-CSjWWUQ1.js +370 -0
  5. package/dist/chunks/directory-CSjWWUQ1.js.map +1 -0
  6. package/dist/{server/_coffre/assets/grants-DdKT11Ny.js → chunks/grants-saMQagmG.js} +41 -39
  7. package/dist/chunks/grants-saMQagmG.js.map +1 -0
  8. package/dist/chunks/icons-D-PfAfnH.js +203 -0
  9. package/dist/chunks/icons-D-PfAfnH.js.map +1 -0
  10. package/dist/chunks/mounted-jJmqqV_n.js +17 -0
  11. package/dist/chunks/mounted-jJmqqV_n.js.map +1 -0
  12. package/dist/{server/_coffre/assets/offboarding-CRz-K82H.js → chunks/offboarding-C6l30DZR.js} +70 -69
  13. package/dist/chunks/offboarding-C6l30DZR.js.map +1 -0
  14. package/dist/chunks/page-C5HcNqf2.js +190 -0
  15. package/dist/chunks/page-C5HcNqf2.js.map +1 -0
  16. package/dist/chunks/page-route-Drfw7lmn.js +20 -0
  17. package/dist/chunks/page-route-Drfw7lmn.js.map +1 -0
  18. package/dist/{server/_coffre/assets/principal-page-C-EFwJQw.js → chunks/principal-page-D_91OA0l.js} +105 -103
  19. package/dist/chunks/principal-page-D_91OA0l.js.map +1 -0
  20. package/dist/{server/_coffre/assets → chunks}/project-environments-lEzFHUt4.js +2 -0
  21. package/dist/chunks/project-environments-lEzFHUt4.js.map +1 -0
  22. package/dist/chunks/queries-CQ81o4so.js +376 -0
  23. package/dist/chunks/queries-CQ81o4so.js.map +1 -0
  24. package/dist/{server/_coffre/assets/row-state-C2P57xT1.js → chunks/row-state-0PsrEzOL.js} +22 -21
  25. package/dist/chunks/row-state-0PsrEzOL.js.map +1 -0
  26. package/dist/{server/_coffre/assets → chunks}/signin-errors-BEFlVDbQ.js +2 -0
  27. package/dist/chunks/signin-errors-BEFlVDbQ.js.map +1 -0
  28. package/dist/chunks/theme-B2vQolVR.js +86 -0
  29. package/dist/chunks/theme-B2vQolVR.js.map +1 -0
  30. package/dist/chunks/ui-DixXLQvQ.js +405 -0
  31. package/dist/chunks/ui-DixXLQvQ.js.map +1 -0
  32. package/dist/{server/_coffre/assets/use-action-B-xpvVRO.js → chunks/use-action-CWsg_YWU.js} +8 -6
  33. package/dist/chunks/use-action-CWsg_YWU.js.map +1 -0
  34. package/dist/{server/_coffre/assets/use-change-C8BCf3oU.js → chunks/use-change-c6CeLRin.js} +10 -474
  35. package/dist/chunks/use-change-c6CeLRin.js.map +1 -0
  36. package/dist/chunks/use-shell-jxd7Tzd-.js +26 -0
  37. package/dist/chunks/use-shell-jxd7Tzd-.js.map +1 -0
  38. package/dist/{server/_coffre/assets → chunks}/validation-BQtqPe2V.js +2 -0
  39. package/dist/chunks/validation-BQtqPe2V.js.map +1 -0
  40. package/dist/index.d.ts +386 -18
  41. package/dist/index.js +1147 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/pages/account.d.ts +9 -0
  44. package/dist/pages/account.js +334 -0
  45. package/dist/pages/account.js.map +1 -0
  46. package/dist/pages/audit.d.ts +3 -0
  47. package/dist/{server/_coffre/assets/audit-qB9G2AQJ.js → pages/audit.js} +102 -100
  48. package/dist/pages/audit.js.map +1 -0
  49. package/dist/pages/device-login.d.ts +9 -0
  50. package/dist/pages/device-login.js +211 -0
  51. package/dist/pages/device-login.js.map +1 -0
  52. package/dist/pages/environment.d.ts +3 -0
  53. package/dist/{server/_coffre/assets/projects._project._environment-C6uybzeU.js → pages/environment.js} +323 -469
  54. package/dist/pages/environment.js.map +1 -0
  55. package/dist/pages/login.d.ts +10 -0
  56. package/dist/pages/login.js +104 -0
  57. package/dist/pages/login.js.map +1 -0
  58. package/dist/pages/project.d.ts +2 -0
  59. package/dist/{server/_coffre/assets/projects._project.index-3CXwkyTh.js → pages/project.js} +223 -225
  60. package/dist/pages/project.js.map +1 -0
  61. package/dist/pages/projects.d.ts +3 -0
  62. package/dist/{server/_coffre/assets/projects.index-iSoBpRFz.js → pages/projects.js} +83 -81
  63. package/dist/pages/projects.js.map +1 -0
  64. package/dist/pages/settings.d.ts +3 -0
  65. package/dist/{server/_coffre/assets/settings-BDQTF5XW.js → pages/settings.js} +20 -18
  66. package/dist/pages/settings.js.map +1 -0
  67. package/dist/pages/token.d.ts +3 -0
  68. package/dist/{server/_coffre/assets/tokens._token-CrBMpcbN.js → pages/token.js} +198 -267
  69. package/dist/pages/token.js.map +1 -0
  70. package/dist/pages/tokens.d.ts +3 -0
  71. package/dist/pages/tokens.js +39 -0
  72. package/dist/pages/tokens.js.map +1 -0
  73. package/dist/pages/unregistered.d.ts +8 -0
  74. package/dist/pages/unregistered.js +54 -0
  75. package/dist/pages/unregistered.js.map +1 -0
  76. package/dist/pages/user.d.ts +3 -0
  77. package/dist/pages/user.js +16 -0
  78. package/dist/pages/user.js.map +1 -0
  79. package/dist/pages/users.d.ts +3 -0
  80. package/dist/pages/users.js +39 -0
  81. package/dist/pages/users.js.map +1 -0
  82. package/dist/project-BqIy8gYR.d.ts +5 -0
  83. package/dist/vite.d.ts +16 -0
  84. package/dist/vite.js +52 -0
  85. package/package.json +36 -21
  86. package/src/assets/icon.svg +1 -0
  87. package/src/components/affordances.ts +10 -4
  88. package/src/components/command-palette.tsx +229 -203
  89. package/src/components/directory.tsx +34 -38
  90. package/src/components/principal.tsx +7 -3
  91. package/src/components/service-tokens.tsx +3 -2
  92. package/src/components/shell.tsx +89 -127
  93. package/src/components/theme.tsx +14 -81
  94. package/src/components/ui.tsx +97 -68
  95. package/src/index.ts +29 -0
  96. package/src/layout.tsx +113 -0
  97. package/src/lib/coffre.ts +8 -4
  98. package/src/lib/mounted.ts +13 -0
  99. package/src/lib/page-context.ts +31 -0
  100. package/src/lib/page-route.ts +22 -0
  101. package/src/lib/preferences.tsx +46 -0
  102. package/src/options.ts +240 -0
  103. package/src/{routes → pages}/account.tsx +7 -24
  104. package/src/{routes → pages}/audit.tsx +5 -16
  105. package/src/{routes/auth.device.tsx → pages/device-login.tsx} +8 -21
  106. package/src/{routes/projects.$project.$environment.tsx → pages/environment.tsx} +43 -52
  107. package/src/{routes → pages}/login.tsx +5 -16
  108. package/src/{routes/projects.$project.index.tsx → pages/project.tsx} +38 -50
  109. package/src/{routes/projects.index.tsx → pages/projects.tsx} +2 -7
  110. package/src/{routes → pages}/settings.tsx +3 -10
  111. package/src/{routes/tokens.$token.tsx → pages/token.tsx} +6 -7
  112. package/src/{routes/tokens.index.tsx → pages/tokens.tsx} +3 -8
  113. package/src/{routes → pages}/unregistered.tsx +1 -6
  114. package/src/pages/user.tsx +10 -0
  115. package/src/{routes/users.index.tsx → pages/users.tsx} +3 -8
  116. package/src/register.ts +55 -0
  117. package/src/router.tsx +31 -62
  118. package/src/styles/globals.css +104 -46
  119. package/src/vite.ts +78 -0
  120. package/dist/client/.assetsignore +0 -2
  121. package/dist/client/_coffre/assets/account-BoLGAxbD.js +0 -2
  122. package/dist/client/_coffre/assets/account-CnnuRTDB.js +0 -1
  123. package/dist/client/_coffre/assets/affordances-CEafRJcN.js +0 -1
  124. package/dist/client/_coffre/assets/audit-CHSvKLWX.js +0 -1
  125. package/dist/client/_coffre/assets/audit-Cn4hmS4u.js +0 -2
  126. package/dist/client/_coffre/assets/auth.device-Co5vrpaA.js +0 -2
  127. package/dist/client/_coffre/assets/auth.device-DAlqWacc.js +0 -1
  128. package/dist/client/_coffre/assets/directory-H8Eh3MnS.js +0 -1
  129. package/dist/client/_coffre/assets/dist-Braunv_x.js +0 -1
  130. package/dist/client/_coffre/assets/globals-CpMrgkV6.css +0 -1
  131. package/dist/client/_coffre/assets/grants-DPDxJXU1.js +0 -1
  132. package/dist/client/_coffre/assets/icons-Dc_-t0lp.js +0 -1
  133. package/dist/client/_coffre/assets/index-sUCIXRgJ.js +0 -12
  134. package/dist/client/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
  135. package/dist/client/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
  136. package/dist/client/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
  137. package/dist/client/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
  138. package/dist/client/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
  139. package/dist/client/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
  140. package/dist/client/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
  141. package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  142. package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  143. package/dist/client/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  144. package/dist/client/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  145. package/dist/client/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  146. package/dist/client/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  147. package/dist/client/_coffre/assets/link-DBINMwm6.js +0 -1
  148. package/dist/client/_coffre/assets/login-BZFYfL1Y.js +0 -1
  149. package/dist/client/_coffre/assets/login-CYCKWTOD.js +0 -2
  150. package/dist/client/_coffre/assets/offboarding-Bwpftp3g.js +0 -1
  151. package/dist/client/_coffre/assets/page-C_hnzdaR.js +0 -1
  152. package/dist/client/_coffre/assets/preload-helper-CLkO85Nq.js +0 -1
  153. package/dist/client/_coffre/assets/principal-page-DLho8TSJ.js +0 -1
  154. package/dist/client/_coffre/assets/project-environments-CfIH5kFM.js +0 -1
  155. package/dist/client/_coffre/assets/projects._project._environment-DHRRvQw0.js +0 -3
  156. package/dist/client/_coffre/assets/projects._project._environment-TLI-RjBZ.js +0 -2
  157. package/dist/client/_coffre/assets/projects._project.index-BO-8FZIY.js +0 -2
  158. package/dist/client/_coffre/assets/projects._project.index-DGl921dP.js +0 -1
  159. package/dist/client/_coffre/assets/projects.index-BDn7Bhoo.js +0 -1
  160. package/dist/client/_coffre/assets/row-state-DJ-KLamZ.js +0 -1
  161. package/dist/client/_coffre/assets/settings-q9G1QvR_.js +0 -1
  162. package/dist/client/_coffre/assets/signin-errors-CroZWZgm.js +0 -1
  163. package/dist/client/_coffre/assets/suspense-O8sP0mEC.js +0 -1
  164. package/dist/client/_coffre/assets/tokens._token-B_qczpT9.js +0 -2
  165. package/dist/client/_coffre/assets/tokens._token-T-sqwMbz.js +0 -2
  166. package/dist/client/_coffre/assets/tokens.index-CcXSZnAG.js +0 -1
  167. package/dist/client/_coffre/assets/ui-BXP2IqrW.js +0 -46
  168. package/dist/client/_coffre/assets/unregistered-D2JXJ90x.js +0 -1
  169. package/dist/client/_coffre/assets/use-action-BpzKWhgg.js +0 -1
  170. package/dist/client/_coffre/assets/use-change-CKj3Inq9.js +0 -1
  171. package/dist/client/_coffre/assets/use-shell-W0SusPkz.js +0 -1
  172. package/dist/client/_coffre/assets/useQuery-B-lxFSES.js +0 -1
  173. package/dist/client/_coffre/assets/useSuspenseQuery-BZ-nzHST.js +0 -1
  174. package/dist/client/_coffre/assets/users._user-Bb3BGYHl.js +0 -1
  175. package/dist/client/_coffre/assets/users._user-DXmvKrzE.js +0 -2
  176. package/dist/client/_coffre/assets/users.index-BvzP3qwW.js +0 -1
  177. package/dist/client/_coffre/assets/validation-9Cl_XS-l.js +0 -1
  178. package/dist/server/.vite/manifest.json +0 -668
  179. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-GsKnGGRy.js +0 -162
  180. package/dist/server/_coffre/assets/account-CV-a2IU2.js +0 -329
  181. package/dist/server/_coffre/assets/account-hk6wcIXU.js +0 -162
  182. package/dist/server/_coffre/assets/async-local-storage-C10uQtMM.js +0 -3108
  183. package/dist/server/_coffre/assets/audit-C1_Ej6YB.js +0 -31
  184. package/dist/server/_coffre/assets/auth.device-6JRrWbSV.js +0 -210
  185. package/dist/server/_coffre/assets/auth.device-CLoAxC2T.js +0 -29
  186. package/dist/server/_coffre/assets/directory-B-_rqsPx.js +0 -371
  187. package/dist/server/_coffre/assets/dist-CnnV3t2g.js +0 -908
  188. package/dist/server/_coffre/assets/empty-plugin-adapters-Cq4--YW-.js +0 -5
  189. package/dist/server/_coffre/assets/globals-CpMrgkV6.css +0 -1
  190. package/dist/server/_coffre/assets/icons-DOFT-eWB.js +0 -1704
  191. package/dist/server/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
  192. package/dist/server/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
  193. package/dist/server/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
  194. package/dist/server/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
  195. package/dist/server/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
  196. package/dist/server/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
  197. package/dist/server/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
  198. package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  199. package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  200. package/dist/server/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  201. package/dist/server/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  202. package/dist/server/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  203. package/dist/server/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  204. package/dist/server/_coffre/assets/lazyRouteComponent-CqBNCGuZ.js +0 -480
  205. package/dist/server/_coffre/assets/link-42ZWdjzZ.js +0 -422
  206. package/dist/server/_coffre/assets/login-DRKUKkaW.js +0 -22
  207. package/dist/server/_coffre/assets/login-DnwxVl4Y.js +0 -102
  208. package/dist/server/_coffre/assets/matchContext-qLfYbC6_.js +0 -56
  209. package/dist/server/_coffre/assets/page-D6n45dcK.js +0 -3561
  210. package/dist/server/_coffre/assets/projects._project._environment-CS8DdSMY.js +0 -48
  211. package/dist/server/_coffre/assets/projects._project.index-BGfcNpj0.js +0 -23
  212. package/dist/server/_coffre/assets/react-dom-bBoJXlK2.js +0 -1718
  213. package/dist/server/_coffre/assets/router-9BTgJhWG.js +0 -2322
  214. package/dist/server/_coffre/assets/start-DR3rN0St.js +0 -4
  215. package/dist/server/_coffre/assets/suspense-C-2QfDd2.js +0 -602
  216. package/dist/server/_coffre/assets/tokens._token-rY86Cjgp.js +0 -10
  217. package/dist/server/_coffre/assets/tokens.index-Bq5qDW9q.js +0 -37
  218. package/dist/server/_coffre/assets/ui-Cc0CGMtr.js +0 -14881
  219. package/dist/server/_coffre/assets/unregistered-D9ZKLOPJ.js +0 -53
  220. package/dist/server/_coffre/assets/use-shell-DwOzEi87.js +0 -462
  221. package/dist/server/_coffre/assets/useQuery-CTe86qFq.js +0 -8
  222. package/dist/server/_coffre/assets/useRouter-CaUSUNsw.js +0 -473
  223. package/dist/server/_coffre/assets/useSuspenseQuery-CSoHzrMb.js +0 -117
  224. package/dist/server/_coffre/assets/users._user-BmLKYeo_.js +0 -10
  225. package/dist/server/_coffre/assets/users._user-BmiHwQx3.js +0 -14
  226. package/dist/server/_coffre/assets/users.index-BiEax90r.js +0 -37
  227. package/dist/server/index.js +0 -13911
  228. package/src/assets/favicon-32.png +0 -0
  229. package/src/components/agentation.tsx +0 -34
  230. package/src/entry.ts +0 -19
  231. package/src/routeTree.gen.ts +0 -367
  232. package/src/routes/__root.tsx +0 -169
  233. package/src/routes/access.tsx +0 -11
  234. package/src/routes/index.tsx +0 -15
  235. package/src/routes/users.$user.tsx +0 -13
  236. package/src/types.ts +0 -21
@@ -19,7 +19,11 @@
19
19
  /* Tokens */
20
20
  /* ========================================================================== */
21
21
 
22
- :root {
22
+ /* All of coffre's look is scoped to its element, which <CoffreProvider>
23
+ renders, with the visitor's theme and sidebar as attributes: the
24
+ deployment's own document keeps its own, and its own color-scheme. No
25
+ theme is "system", which these follow by color-scheme alone. */
26
+ .coffre {
23
27
  color-scheme: light dark;
24
28
 
25
29
  --font-sans: 'Inter Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;
@@ -68,11 +72,11 @@
68
72
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
69
73
  }
70
74
 
71
- :root[data-theme='light'] {
75
+ .coffre[data-theme='light'] {
72
76
  color-scheme: light;
73
77
  }
74
78
 
75
- :root[data-theme='dark'] {
79
+ .coffre[data-theme='dark'] {
76
80
  color-scheme: dark;
77
81
  --shadow-xs: 0 1px 2px oklch(0 0 0 / 0.3);
78
82
  --shadow-md: 0 1px 2px oklch(0 0 0 / 0.4), 0 8px 24px -8px oklch(0 0 0 / 0.6);
@@ -80,7 +84,7 @@
80
84
  }
81
85
 
82
86
  @media (prefers-color-scheme: dark) {
83
- :root:not([data-theme='light']) {
87
+ .coffre:not([data-theme='light']) {
84
88
  --shadow-xs: 0 1px 2px oklch(0 0 0 / 0.3);
85
89
  --shadow-md: 0 1px 2px oklch(0 0 0 / 0.4), 0 8px 24px -8px oklch(0 0 0 / 0.6);
86
90
  --shadow-lg: 0 1px 3px oklch(0 0 0 / 0.5), 0 24px 56px -16px oklch(0 0 0 / 0.8);
@@ -100,12 +104,15 @@
100
104
  html {
101
105
  -webkit-text-size-adjust: 100%;
102
106
  text-size-adjust: 100%;
103
- scrollbar-color: var(--border) transparent;
104
107
  }
105
108
 
106
109
  body {
107
110
  margin: 0;
111
+ }
112
+
113
+ .coffre {
108
114
  min-height: 100vh;
115
+ scrollbar-color: var(--border) transparent;
109
116
  background: var(--canvas);
110
117
  color: var(--ink);
111
118
  font-family: var(--font-sans);
@@ -315,7 +322,7 @@ kbd {
315
322
  }
316
323
 
317
324
  .menu-account {
318
- width: var(--radix-dropdown-menu-trigger-width);
325
+ width: var(--anchor-width);
319
326
  min-width: 14rem;
320
327
  }
321
328
 
@@ -553,7 +560,7 @@ a.crumb-link:hover {
553
560
  }
554
561
 
555
562
  .crumb-switch:hover,
556
- .crumb-switch[data-state='open'] {
563
+ .crumb-switch[data-popup-open] {
557
564
  background: var(--nav-hover);
558
565
  color: var(--ink);
559
566
  }
@@ -600,28 +607,29 @@ a.crumb-link:hover {
600
607
  border-right: 1px solid var(--border);
601
608
  background: var(--canvas);
602
609
  box-shadow: var(--shadow-lg);
603
- animation: drawer-in 200ms var(--ease-out);
610
+ transition:
611
+ opacity 200ms var(--ease-out),
612
+ transform 200ms var(--ease-out);
604
613
 
605
614
  --nav-hover: color-mix(in oklab, var(--ink) 5%, transparent);
606
615
  --nav-current: color-mix(in oklab, var(--ink) 8%, transparent);
607
616
  }
608
617
 
609
- @keyframes drawer-in {
610
- from {
611
- opacity: 0;
612
- transform: translateX(-16px);
613
- }
618
+ .drawer[data-starting-style],
619
+ .drawer[data-ending-style] {
620
+ opacity: 0;
621
+ transform: translateX(-16px);
614
622
  }
615
623
 
616
624
  /* Folded, the sidebar keeps only its icons. The mark, the section icons and
617
625
  the avatar share one centre line, the same folded or not, so folding moves
618
626
  the page and nothing in the sidebar. */
619
627
  @media (width > 60rem) {
620
- :root[data-sidebar='collapsed'] .shell {
628
+ .coffre[data-sidebar='collapsed'] .shell {
621
629
  grid-template-columns: 3.5rem minmax(0, 1fr);
622
630
  }
623
631
 
624
- :root[data-sidebar='collapsed']
632
+ .coffre[data-sidebar='collapsed']
625
633
  .shell
626
634
  > .sidebar
627
635
  :is(.brand-name, .nav-label, .account-text) {
@@ -634,21 +642,21 @@ a.crumb-link:hover {
634
642
  }
635
643
 
636
644
  /* Folded, the mark is the size of the icons below it. */
637
- :root[data-sidebar='collapsed'] .shell > .sidebar .sidebar-brand {
645
+ .coffre[data-sidebar='collapsed'] .shell > .sidebar .sidebar-brand {
638
646
  justify-content: center;
639
647
  padding-inline: 0;
640
648
  }
641
649
 
642
- :root[data-sidebar='collapsed'] .shell > .sidebar .sidebar-brand svg {
650
+ .coffre[data-sidebar='collapsed'] .shell > .sidebar .sidebar-brand svg {
643
651
  width: 1.25rem;
644
652
  height: 1.25rem;
645
653
  }
646
654
 
647
- :root[data-sidebar='collapsed'] .shell > .sidebar .sidebar-foot {
655
+ .coffre[data-sidebar='collapsed'] .shell > .sidebar .sidebar-foot {
648
656
  flex-direction: column-reverse;
649
657
  }
650
658
 
651
- :root[data-sidebar='collapsed'] .shell > .sidebar .sidebar-foot-settings {
659
+ .coffre[data-sidebar='collapsed'] .shell > .sidebar .sidebar-foot-settings {
652
660
  width: 100%;
653
661
  height: 2rem;
654
662
  }
@@ -3211,12 +3219,27 @@ a.env-card-name:hover {
3211
3219
  /* Overlays: dialogs, menus, popovers, tooltips, palette, toasts */
3212
3220
  /* ========================================================================== */
3213
3221
 
3222
+ /*
3223
+ * Each overlay transitions in from its `[data-starting-style]` and out to its
3224
+ * `[data-ending-style]`, which Base UI sets for a frame on mount and for the
3225
+ * length of the transition before unmounting. Leaving is quicker than
3226
+ * arriving: the eye has already moved on.
3227
+ */
3228
+ :is(.overlay, .dialog, .drawer, .palette, .menu, .tooltip)[data-ending-style] {
3229
+ transition-duration: 100ms;
3230
+ }
3231
+
3214
3232
  .overlay {
3215
3233
  position: fixed;
3216
3234
  inset: 0;
3217
3235
  z-index: 50;
3218
3236
  background: var(--scrim);
3219
- animation: fade-in 160ms ease-out;
3237
+ transition: opacity 160ms ease-out;
3238
+ }
3239
+
3240
+ .overlay[data-starting-style],
3241
+ .overlay[data-ending-style] {
3242
+ opacity: 0;
3220
3243
  }
3221
3244
 
3222
3245
  .dialog {
@@ -3233,7 +3256,17 @@ a.env-card-name:hover {
3233
3256
  border-radius: var(--radius-xl);
3234
3257
  background: var(--panel);
3235
3258
  box-shadow: var(--shadow-lg);
3236
- animation: dialog-in 180ms var(--ease-out);
3259
+ transition:
3260
+ opacity 180ms var(--ease-out),
3261
+ transform 180ms var(--ease-out);
3262
+ }
3263
+
3264
+ .dialog[data-starting-style],
3265
+ .dialog[data-ending-style],
3266
+ .palette[data-starting-style],
3267
+ .palette[data-ending-style] {
3268
+ opacity: 0;
3269
+ transform: translate(-50%, 6px) scale(0.99);
3237
3270
  }
3238
3271
 
3239
3272
  .dialog-wide {
@@ -3290,30 +3323,30 @@ a.env-card-name:hover {
3290
3323
  margin-bottom: 0.5rem;
3291
3324
  }
3292
3325
 
3293
- @keyframes fade-in {
3294
- from {
3295
- opacity: 0;
3296
- }
3297
- }
3298
-
3299
- @keyframes dialog-in {
3300
- from {
3301
- opacity: 0;
3302
- transform: translate(-50%, 6px) scale(0.99);
3303
- }
3326
+ .menu-positioner {
3327
+ z-index: 70;
3304
3328
  }
3305
3329
 
3306
3330
  .menu {
3307
- z-index: 70;
3308
3331
  min-width: 12rem;
3309
- max-height: min(24rem, var(--radix-dropdown-menu-content-available-height, 24rem));
3332
+ max-height: min(24rem, var(--available-height, 24rem));
3310
3333
  overflow-y: auto;
3311
3334
  padding: 0.25rem;
3312
3335
  border: 1px solid var(--border);
3313
3336
  border-radius: var(--radius-lg);
3314
3337
  background: var(--panel);
3315
3338
  box-shadow: var(--shadow-md);
3316
- animation: fade-in 120ms ease-out;
3339
+ outline: none;
3340
+ transform-origin: var(--transform-origin);
3341
+ transition:
3342
+ opacity 120ms ease-out,
3343
+ transform 120ms ease-out;
3344
+ }
3345
+
3346
+ .menu[data-starting-style],
3347
+ .menu[data-ending-style] {
3348
+ opacity: 0;
3349
+ transform: scale(0.98);
3317
3350
  }
3318
3351
 
3319
3352
  .menu-item {
@@ -3396,8 +3429,11 @@ a.env-card-name:hover {
3396
3429
  font-size: 0.75rem;
3397
3430
  }
3398
3431
 
3399
- .tooltip {
3432
+ .tooltip-positioner {
3400
3433
  z-index: 80;
3434
+ }
3435
+
3436
+ .tooltip {
3401
3437
  max-width: 18rem;
3402
3438
  padding: 0.375rem 0.5rem;
3403
3439
  border-radius: var(--radius-sm);
@@ -3405,7 +3441,18 @@ a.env-card-name:hover {
3405
3441
  color: var(--panel);
3406
3442
  font-size: 0.75rem;
3407
3443
  line-height: 1.45;
3408
- animation: fade-in 100ms ease-out;
3444
+ outline: none;
3445
+ transition: opacity 100ms ease-out;
3446
+ }
3447
+
3448
+ .tooltip[data-starting-style],
3449
+ .tooltip[data-ending-style] {
3450
+ opacity: 0;
3451
+ }
3452
+
3453
+ /* Moving along a row of tips, or opening one from the keyboard: no fade. */
3454
+ .tooltip[data-instant] {
3455
+ transition: none;
3409
3456
  }
3410
3457
 
3411
3458
  /* A shortcut in a tooltip, in the bubble's own colours. */
@@ -3435,10 +3482,16 @@ a.env-card-name:hover {
3435
3482
  border-radius: var(--radius-xl);
3436
3483
  background: var(--panel);
3437
3484
  box-shadow: var(--shadow-lg);
3438
- animation: dialog-in 160ms var(--ease-out);
3485
+ transition:
3486
+ opacity 160ms var(--ease-out),
3487
+ transform 160ms var(--ease-out);
3439
3488
  }
3440
3489
 
3441
- .palette [cmdk-input] {
3490
+ .palette:focus {
3491
+ outline: none;
3492
+ }
3493
+
3494
+ .palette-input {
3442
3495
  width: 100%;
3443
3496
  height: 3rem;
3444
3497
  padding: 0 1rem;
@@ -3450,24 +3503,24 @@ a.env-card-name:hover {
3450
3503
  outline: none;
3451
3504
  }
3452
3505
 
3453
- .palette [cmdk-input]::placeholder {
3506
+ .palette-input::placeholder {
3454
3507
  color: var(--ink-3);
3455
3508
  }
3456
3509
 
3457
- .palette [cmdk-list] {
3510
+ .palette-list {
3458
3511
  max-height: min(24rem, 60vh);
3459
3512
  overflow-y: auto;
3460
3513
  padding: 0.375rem;
3461
3514
  }
3462
3515
 
3463
- .palette [cmdk-group-heading] {
3516
+ .palette-group-label {
3464
3517
  padding: 0.5rem 0.5rem 0.25rem;
3465
3518
  color: var(--ink-3);
3466
3519
  font-size: 0.75rem;
3467
3520
  font-weight: 550;
3468
3521
  }
3469
3522
 
3470
- .palette [cmdk-item] {
3523
+ .palette-item {
3471
3524
  display: flex;
3472
3525
  align-items: center;
3473
3526
  gap: 0.625rem;
@@ -3479,21 +3532,26 @@ a.env-card-name:hover {
3479
3532
  cursor: default;
3480
3533
  }
3481
3534
 
3482
- .palette [cmdk-item] svg {
3535
+ .palette-item svg {
3483
3536
  flex: none;
3484
3537
  color: var(--ink-3);
3485
3538
  }
3486
3539
 
3487
- .palette [cmdk-item][data-selected='true'] {
3540
+ .palette-item[data-highlighted] {
3488
3541
  background: var(--subtle);
3489
3542
  }
3490
3543
 
3491
- .palette [cmdk-empty] {
3544
+ .palette-empty {
3492
3545
  padding: 1.25rem 0.75rem;
3493
3546
  color: var(--ink-3);
3494
3547
  font-size: 0.8125rem;
3495
3548
  }
3496
3549
 
3550
+ /* Always there, as the live region that announces "Nothing by that name". */
3551
+ .palette-empty:empty {
3552
+ padding: 0;
3553
+ }
3554
+
3497
3555
  .palette-hint {
3498
3556
  margin-left: auto;
3499
3557
  overflow: hidden;
package/src/vite.ts ADDED
@@ -0,0 +1,78 @@
1
+ // `@coffre/ui/vite`: what a deployment's Vite build needs to carry coffre's
2
+ // pages, beside TanStack Start's and React's own plugins:
3
+ //
4
+ // plugins: [cloudflare(…), tanstackStart(), viteReact(), coffre()]
5
+ //
6
+ // It runs in Node, in the deployment's build; nothing here reaches a page.
7
+ import { readFileSync } from 'node:fs';
8
+ import { createRequire } from 'node:module';
9
+ import { join, resolve } from 'node:path';
10
+ import { fileURLToPath } from 'node:url';
11
+
12
+ import { searchForWorkspaceRoot, type Plugin } from 'vite';
13
+
14
+ /**
15
+ * The packages this one shares with the deployment, at the versions it was
16
+ * built against, and those the deployment has. Two copies of React, or of
17
+ * the router, render nothing that hydrates; another version of one is a
18
+ * build no one tested.
19
+ */
20
+ export function versionDrift(root: string): string[] {
21
+ const own = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')) as {
22
+ version: string;
23
+ peerDependencies: Record<string, string>;
24
+ };
25
+ const from = createRequire(join(root, 'package.json'));
26
+ return Object.entries(own.peerDependencies).flatMap(([name, wanted]) => {
27
+ let installed: string;
28
+ try {
29
+ installed = (JSON.parse(readFileSync(from.resolve(`${name}/package.json`), 'utf8')) as { version: string }).version;
30
+ } catch {
31
+ return [`${name} ${wanted} is not installed`];
32
+ }
33
+ return installed === wanted ? [] : [`${name} is ${installed}, and @coffre/ui ${own.version} is built for ${wanted}`];
34
+ });
35
+ }
36
+
37
+
38
+ /**
39
+ * coffre's pages in a deployment's build: its static files under
40
+ * `/_coffre/`, as the server expects them; a server build that holds what
41
+ * it runs; and the versions it shares, as built.
42
+ */
43
+ export function coffre(): Plugin {
44
+ return {
45
+ name: 'coffre',
46
+ config(config) {
47
+ return {
48
+ // `vite dev` serves coffre's files from this package, wherever it
49
+ // is: under node_modules, inside the project, as installed; or
50
+ // linked from elsewhere. Naming it keeps the project's own root.
51
+ server: { fs: { allow: [searchForWorkspaceRoot(resolve(config.root ?? '')), fileURLToPath(new URL('..', import.meta.url))] } },
52
+ // The server's build holds all it runs, as a Worker's does: run by
53
+ // Node, it then resolves nothing from node_modules, where pnpm lets
54
+ // a deployment reach only its own dependencies.
55
+ ssr: { noExternal: true },
56
+ build: {
57
+ // A deployment serves these from its own origin, beside `/api` and
58
+ // `/auth`; the prefix keeps the two apart.
59
+ assetsDir: '_coffre/assets',
60
+ // Vite inlines files under 4 KiB as data: URLs, which would catch a
61
+ // small font subset: the Content-Security-Policy takes fonts from
62
+ // coffre's own origin alone.
63
+ assetsInlineLimit: (file: string) => (/\.woff2?$/.test(file) ? false : undefined),
64
+ },
65
+ };
66
+ },
67
+ configResolved(config) {
68
+ if (config.command !== 'build') return;
69
+ const drift = versionDrift(config.root);
70
+ if (drift.length > 0) {
71
+ throw new Error(
72
+ `coffre's pages need the versions they were built with: ${drift.join('; ')}. ` +
73
+ '`coffre update` pins them all, or set them by hand, exactly, in package.json',
74
+ );
75
+ }
76
+ },
77
+ };
78
+ }
@@ -1,2 +0,0 @@
1
- wrangler.json
2
- .dev.vars
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/account-CnnuRTDB.js","_coffre/assets/page-C_hnzdaR.js","_coffre/assets/use-change-CKj3Inq9.js","_coffre/assets/suspense-O8sP0mEC.js","_coffre/assets/row-state-DJ-KLamZ.js","_coffre/assets/ui-BXP2IqrW.js","_coffre/assets/link-DBINMwm6.js","_coffre/assets/icons-Dc_-t0lp.js","_coffre/assets/use-shell-W0SusPkz.js","_coffre/assets/directory-H8Eh3MnS.js","_coffre/assets/signin-errors-CroZWZgm.js"])))=>i.map(i=>d[i]);
2
- import{U as e,X as t,f as n,h as r,q as i}from"./page-C_hnzdaR.js";import{n as a,r as o,t as s}from"./preload-helper-CLkO85Nq.js";import{h as c}from"./ui-BXP2IqrW.js";import{D as l,E as u,a as d,z as f}from"./icons-Dc_-t0lp.js";var p=t(i(),1),m=e(),h=`coffre-theme`,g=`coffre-theme-change`,_=`(function(){try{var t=localStorage.getItem(${JSON.stringify(h)});if(t==="light"||t==="dark"){document.documentElement.setAttribute("data-theme",t)}}catch(e){}})()`;function v(){try{let e=localStorage.getItem(h);return e===`light`||e===`dark`?e:`system`}catch{return`system`}}function y(e){let t=document.documentElement;try{e===`system`?localStorage.removeItem(h):localStorage.setItem(h,e)}catch{}e===`system`?t.removeAttribute(`data-theme`):t.setAttribute(`data-theme`,e),window.dispatchEvent(new CustomEvent(g))}var b=[{value:`system`,label:`Match system`,Icon:u},{value:`light`,label:`Light`,Icon:f},{value:`dark`,label:`Dark`,Icon:l}];function x(){let[e,t]=(0,p.useState)(`system`);return(0,p.useEffect)(()=>{let e=()=>t(v());return e(),window.addEventListener(g,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(g,e),window.removeEventListener(`storage`,e)}},[]),e}function S(){let e=x();return(0,m.jsx)(c.RadioGroup,{value:e,onValueChange:e=>y(e),children:b.map(({value:e,label:t,Icon:n})=>(0,m.jsxs)(c.RadioItem,{value:e,className:`menu-item`,children:[(0,m.jsx)(n,{size:15}),t,(0,m.jsx)(c.ItemIndicator,{className:`menu-check`,children:(0,m.jsx)(d,{size:14})})]},e))})}function C(){let e=x();return(0,m.jsx)(`div`,{className:`theme-choice`,role:`group`,"aria-label":`Colour scheme`,children:b.map(({value:t,label:n,Icon:r})=>(0,m.jsx)(`button`,{type:`button`,"aria-pressed":e===t,"aria-label":n,title:n,onClick:()=>y(t),children:(0,m.jsx)(r,{size:14})},t))})}function w(e){y(e)}function T(){let e=x();return(0,m.jsx)(`div`,{className:`choice-grid`,role:`group`,"aria-label":`Colour scheme`,children:b.map(({value:t,label:n,Icon:r})=>(0,m.jsxs)(`button`,{type:`button`,className:`choice`,"aria-pressed":e===t,onClick:()=>y(t),children:[(0,m.jsx)(r,{size:16}),n]},t))})}var E=o(`/account`)({validateSearch:e=>{let t={};for(let n of[`linked`,`error`]){let r=e[n];typeof r==`string`&&/^[a-z0-9_-]{1,40}$/.test(r)&&(t[n]=r)}return t},loader:async({context:{client:e,queryClient:t}})=>{let i=await n(t,e);i.auth.signin===null||i.principal?.type!==`user`||await Promise.all([t.fetchQuery(r.identities(e)),t.fetchQuery(r.sessions(e))])},component:a(()=>s(()=>import(`./account-CnnuRTDB.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),`component`)});export{w as a,C as i,T as n,_ as o,S as r,E as t};
@@ -1 +0,0 @@
1
- import{C as e,U as t,X as n,h as r,i,q as a,r as o,t as s}from"./page-C_hnzdaR.js";import{C as c,n as l,t as u,u as d}from"./use-change-CKj3Inq9.js";import{n as f,t as p}from"./use-shell-W0SusPkz.js";import{a as m,i as h,l as g,s as _,t as v}from"./ui-BXP2IqrW.js";import{B as y,E as b,G as x,L as S,M as C}from"./icons-Dc_-t0lp.js";import{n as w,t as T}from"./account-BoLGAxbD.js";import{a as E,i as D,r as O}from"./row-state-DJ-KLamZ.js";import{r as k}from"./directory-H8Eh3MnS.js";import{t as A}from"./signin-errors-CroZWZgm.js";var j=n(a()),M=t();function N(){let{principal:e,instanceRole:t,auth:n}=p();return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(i,{title:`Account`,actions:e!==null&&(0,M.jsx)(F,{})}),(0,M.jsx)(s,{labelledBy:`appearance`,title:`Appearance`,children:(0,M.jsx)(`div`,{className:`card-body`,children:(0,M.jsx)(w,{})})}),e!==null&&(0,M.jsx)(s,{labelledBy:`identity`,title:`Identity`,children:(0,M.jsxs)(`dl`,{className:`facts`,children:[(0,M.jsx)(o,{label:e.type===`user`?`Email`:`Name`,children:(0,M.jsx)(`span`,{className:`mono`,children:e.id})}),(0,M.jsx)(o,{label:`Kind`,children:e.type===`user`?`User`:`Token`}),e.type===`user`&&(0,M.jsx)(o,{label:`Instance role`,children:(0,M.jsx)(k,{principal:{principalType:`user`,principalId:e.id,instanceRole:t??`user`,isRootAdmin:t===`root-admin`}})})]})}),n.signin!==null&&e?.type===`user`&&(0,M.jsx)(P,{email:e.id,providers:n.signin.providers})]})}function P({email:t,providers:n}){let i=e(),[{data:a},{data:o}]=f({queries:[r.identities(i),r.sessions(i)]});return a.ok?o.ok?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(L,{email:t,providers:n,identities:a.identities}),(0,M.jsx)(R,{sessions:o.sessions,providers:n})]}):(0,M.jsx)(m,{error:o.error}):(0,M.jsx)(m,{error:a.error})}function F(){return(0,M.jsx)(`form`,{method:`post`,action:`/auth/signout`,children:(0,M.jsxs)(`button`,{className:`btn`,type:`submit`,children:[(0,M.jsx)(S,{size:14}),`Sign out`]})})}function I(e,t){return e.find(e=>e.id===t)?.label??t??`unknown`}function L({email:t,providers:n,identities:r}){let{linked:i,error:a}=T.useSearch(),o=A(a),d=c(e()),f=u(d),{status:p,dismiss:y}=l(d.list.queryKey);return(0,M.jsxs)(s,{labelledBy:`signin-accounts`,title:`Sign-in accounts`,description:`coffre recognises you by these accounts, never by an email address alone. A new account is linked here, while you are signed in.`,children:[(i!==void 0||o!==null)&&(0,M.jsxs)(`div`,{className:`card-body`,children:[i!==void 0&&(0,M.jsxs)(_,{tone:`good`,children:[I(n,i),` account linked.`]}),(0,M.jsx)(m,{error:o})]}),r.length===0?(0,M.jsxs)(h,{title:`No account linked`,children:[`Your next sign-in with a verified `,(0,M.jsx)(`span`,{className:`mono`,children:t}),` links that account.`]}):(0,M.jsx)(`div`,{className:`dt-wrap`,children:(0,M.jsxs)(`table`,{className:`dt`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{children:`Account`}),(0,M.jsx)(`th`,{className:`col-shrink`,children:`Linked (UTC)`}),(0,M.jsx)(`th`,{className:`col-shrink`,children:`Last sign-in`}),(0,M.jsx)(`th`,{className:`col-actions`,children:(0,M.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,M.jsx)(`tbody`,{children:r.map(e=>{let i=I(n,e.provider),a=n.find(t=>t.id===e.provider)?.brand??`oidc`,o=p(e.id);return(0,M.jsxs)(j.Fragment,{children:[(0,M.jsxs)(`tr`,{className:E(o),children:[(0,M.jsx)(`td`,{children:(0,M.jsxs)(`span`,{className:`cell-account`,children:[(0,M.jsx)(C,{brand:a}),(0,M.jsxs)(`span`,{className:`cell-stack`,children:[(0,M.jsx)(`span`,{children:i}),e.email!==null&&(0,M.jsx)(`small`,{className:`mono`,children:e.email})]})]})}),(0,M.jsx)(`td`,{className:`nowrap`,children:(0,M.jsx)(g,{iso:e.createdAt})}),(0,M.jsx)(`td`,{className:`nowrap cell-muted`,children:e.lastSignInAt===null?`Never`:(0,M.jsx)(g,{iso:e.lastSignInAt,display:`relative`})}),(0,M.jsx)(`td`,{className:`col-actions`,children:o.state===`pending`?(0,M.jsx)(D,{status:o}):(0,M.jsx)(v,{trigger:(0,M.jsxs)(`button`,{className:`act`,children:[(0,M.jsx)(x,{size:13}),`Unlink`]}),title:`Unlink this ${i} account?`,body:r.length===1?(0,M.jsxs)(M.Fragment,{children:[`It stops signing you in, and every session it opened ends now, this one included if you signed in with it. Your next sign-in with any account whose verified email is`,` `,(0,M.jsx)(`span`,{className:`mono`,children:t}),` links that account instead.`]}):(0,M.jsx)(M.Fragment,{children:`It stops signing you in, and every session it opened ends now, this one included if you signed in with it.`}),confirmLabel:`Unlink`,onConfirm:()=>f({...e,label:i})})})]}),(0,M.jsx)(O,{status:o,columns:4,onDismiss:()=>o.state===`failed`&&y(o.mutationId)})]},e.id)})})]})}),n.length>0&&(0,M.jsxs)(`div`,{className:`card-foot`,children:[(0,M.jsx)(`span`,{className:`hint`,children:`Link another account`}),(0,M.jsx)(`div`,{className:`link-providers`,children:n.map(e=>(0,M.jsxs)(`a`,{className:`btn btn-sm`,href:`/auth/signin/${encodeURIComponent(e.id)}?link=1`,children:[(0,M.jsx)(C,{brand:e.brand,size:14}),e.label]},e.id))})]})]})}function R({sessions:t,providers:n}){let r=d(e()),i=u(r),{status:a,dismiss:o}=l(r.list.queryKey);return(0,M.jsx)(s,{labelledBy:`sessions`,title:`Sessions`,description:`Browsers and command lines signed in as you. Ending one signs it out at its next request.`,children:t.length===0?(0,M.jsx)(h,{title:`No sessions`,children:`Nothing is signed in as you right now.`}):(0,M.jsx)(`div`,{className:`dt-wrap`,children:(0,M.jsxs)(`table`,{className:`dt`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{children:`Where`}),(0,M.jsx)(`th`,{className:`col-shrink`,children:`Last active`}),(0,M.jsx)(`th`,{className:`col-shrink`,children:`Expires`}),(0,M.jsx)(`th`,{className:`col-actions`,children:(0,M.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,M.jsx)(`tbody`,{children:t.map(e=>{let t=a(e.id);return(0,M.jsxs)(j.Fragment,{children:[(0,M.jsxs)(`tr`,{className:E(t),children:[(0,M.jsx)(`td`,{children:(0,M.jsxs)(`span`,{className:`cell-account`,children:[e.kind===`cli`?(0,M.jsx)(y,{size:15}):(0,M.jsx)(b,{size:15}),(0,M.jsxs)(`span`,{className:`cell-stack`,children:[(0,M.jsxs)(`span`,{children:[e.label??(e.kind===`cli`?`Command line`:`Browser`),` `,e.current&&(0,M.jsx)(`span`,{className:`tag tag-blue`,children:`this browser`})]}),(0,M.jsxs)(`small`,{children:[e.kind===`cli`?`coffre login`:`via ${I(n,e.provider)}`,e.lastUsedIp!==null&&(0,M.jsxs)(M.Fragment,{children:[` · `,(0,M.jsx)(`span`,{className:`mono`,children:e.lastUsedIp})]})]})]})]})}),(0,M.jsx)(`td`,{className:`nowrap cell-muted`,children:(0,M.jsx)(g,{iso:e.lastUsedAt??e.createdAt,display:`relative`})}),(0,M.jsx)(`td`,{className:`nowrap cell-muted`,children:(0,M.jsx)(g,{iso:e.expiresAt,display:`relative`})}),(0,M.jsx)(`td`,{className:`col-actions`,children:e.current?(0,M.jsx)(`form`,{method:`post`,action:`/auth/signout`,children:(0,M.jsxs)(`button`,{className:`act`,type:`submit`,children:[(0,M.jsx)(S,{size:13}),`Sign out`]})}):t.state===`pending`?(0,M.jsx)(D,{status:t}):(0,M.jsxs)(`button`,{className:`act`,onClick:()=>i(e),children:[(0,M.jsx)(x,{size:13}),`End`]})})]}),(0,M.jsx)(O,{status:t,columns:4,onDismiss:()=>t.state===`failed`&&o(t.mutationId)})]},e.id)})})]})})})}export{N as component};
@@ -1 +0,0 @@
1
- import{X as e,q as t}from"./page-C_hnzdaR.js";var n=e(t(),1);function r({capabilities:e,users:t,audit:r}){return(0,n.createElement)(n.Fragment,null,e.canManageGrants?t:null,e.canReadAudit?r:null)}function i(e){return e.canManageGrants||e.canReadAudit}function a({capabilities:e,children:t}){return e.canCreateProject?t:null}function o({capabilities:e,hasArchivedProjects:t}){return t?e.canCreateProject?`No active projects. Start a new one, or restore one from the archive below.`:`No active projects. Your archived projects appear below.`:e.canCreateProject?`No projects exist yet. Start the first one with New project.`:(0,n.createElement)(n.Fragment,null,`No project is visible to you. Someone holding `,(0,n.createElement)(`span`,{className:`mono`},`grant.manage`),` on a project can add you.`)}function s({canReveal:e,children:t}){return e?t:null}export{i as a,s as i,o as n,a as r,r as t};
@@ -1 +0,0 @@
1
- import{C as e,U as t,X as n,h as r,i,n as a,q as o}from"./page-C_hnzdaR.js";import{t as s}from"./link-DBINMwm6.js";import{t as c}from"./useSuspenseQuery-BZ-nzHST.js";import{t as l}from"./useQuery-B-lxFSES.js";import{c as u,d,i as f,l as p,p as m,s as h}from"./ui-BXP2IqrW.js";import{G as g,H as _,I as v,R as y,_ as b,b as ee,l as te,r as x,s as S,t as ne}from"./icons-Dc_-t0lp.js";import{t as C}from"./audit-Cn4hmS4u.js";var w=n(o()),T=e=>typeof e==`string`&&e!==``?e:null,E=e=>typeof e==`number`?e:null;function D({project:e,environment:t,key:n}){let r=[e,t,n].filter(e=>e!==null);return r.length===0?[`coffre`]:[{place:r.join(`/`)}]}function O({project:e,environment:t}){return D({project:e,environment:t,key:null})}function k(e){if(e.subject!==null)return[{member:e.subject}];let t=T(e.metadata.principalId);return t===null?[`someone`]:[{member:`${e.metadata.principalType===`service`?`token`:`user`}:${t}`}]}function A(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function j(e){return e.batch.length===1?D(e.entry):[...O(e.entry),e.refused?`, `:`: `,A(e.count,`secret`)]}function M(e){let t=T(e.metadata.destination);return t===null?``:` to ${t}`}function N(e){return T(e.metadata.destination)??`its destination`}var P={reveal:[`revealed`,`reveal`],run:[`ran`,`run`],compare:[`compared`,`compare`],sync:[`read`,`read`]};function F({entry:e}){return P[T(e.metadata.purpose)??`reveal`]??P.reveal}var I=e=>{let t=t=>[`${e} `,...e===`project`?D({...t.entry,environment:null,key:null}):O(t.entry)];return{[`${e}.create`]:{did:`created`,tried:`create`,what:t},[`${e}.update`]:{did:`changed`,tried:`change`,what:t},[`${e}.archive`]:{did:`archived`,tried:`archive`,what:t},[`${e}.restore`]:{did:`restored`,tried:`restore`,what:t}}},re={"secret.read":{did:e=>F(e)[0],tried:e=>F(e)[1],what:j},"secret.write":{did:({batch:e})=>{let t=e.filter(e=>e.version===1).length;return t===e.length?`added`:t===0?`changed`:`wrote`},tried:`change`,what:j,then:({entry:e,batch:t})=>t.length>1||e.version===null||e.version===1?[]:[`, now version ${e.version}`]},"secret.restore":{did:`restored`,tried:`restore`,what:({entry:e})=>[...D(e),...E(e.metadata.from)===null?[]:[` to version ${E(e.metadata.from)}`]],then:({entry:e})=>e.version===null?[]:[`, now ${e.version}`]},"secret.rename":{did:`renamed`,tried:`rename`,what:({entry:e})=>[...D(e),...T(e.metadata.nextKey)===null?[]:[` to ${T(e.metadata.nextKey)}`]]},"secret.archive":{did:`archived`,tried:`archive`,what:e=>D(e.entry)},"secret.unarchive":{did:`brought back`,tried:`bring back`,what:e=>D(e.entry)},...I(`project`),...I(`environment`),"access.grant":{did:`gave`,tried:`give`,what:({entry:e})=>[...k(e),` ${T(e.metadata.role)??`a role`} on `,...L(e)],then:({entry:e})=>[...T(e.metadata.previousRole)===null?[]:[`, was ${T(e.metadata.previousRole)}`],...T(e.metadata.expiresAt)===null?[]:[`, until ${T(e.metadata.expiresAt).slice(0,10)}`]]},"access.revoke":{did:`took`,tried:`take`,what:({entry:e})=>[...T(e.metadata.previousRole??e.metadata.role)===null?[`access to `]:[`${T(e.metadata.previousRole??e.metadata.role)} on `],...L(e),` from `,...k(e)]},"member.add":{did:`added`,tried:`add`,what:({entry:e})=>[...k(e),...e.metadata.rootAdmin===!0?[` as a root admin`]:e.metadata.owner===!0?[` as an owner`]:[]]},"member.remove":{did:`removed`,tried:`remove`,what:e=>k(e.entry),then:({entry:e})=>E(e.metadata.revoked)===null?[]:[`, who held ${A(E(e.metadata.revoked),`grant`)}`]},"member.restore":{did:`brought back`,tried:`bring back`,what:e=>k(e.entry)},"member.owner":{did:({entry:e})=>e.metadata.owner===!1?`took owner from`:`made`,tried:({entry:e})=>e.metadata.owner===!1?`take owner from`:`make`,what:({entry:e})=>[...k(e),...e.metadata.owner===!1?[]:[` an owner`]]},"sync.create":{did:`set up a sync of`,tried:`set up a sync of`,what:({entry:e})=>[...O(e),M(e)]},"sync.update":{did:({entry:e})=>e.metadata.paused===!0?`paused the sync of`:e.metadata.paused===!1?`resumed the sync of`:`changed the sync of`,tried:`change the sync of`,what:({entry:e})=>[...O(e),M(e)]},"sync.delete":{did:`removed the sync of`,tried:`remove the sync of`,what:({entry:e})=>[...O(e),M(e)]},"sync.push":{did:`pushed`,tried:`push`,what:e=>e.batch.length===1?[...D(e.entry),` to ${N(e.entry)}`]:[...O(e.entry),` to ${N(e.entry)}: ${A(e.count,`secret`)}`]},"sync.remove":{did:`removed`,tried:`remove`,what:e=>e.batch.length===1?[...D(e.entry),` from ${N(e.entry)}`]:[A(e.count,`secret`),` of `,...O(e.entry),` from ${N(e.entry)}`]},"token.bind":{did:`trusted CI runs to sign in as`,tried:`trust CI runs to sign in as`,what:e=>k(e.entry)},"token.unbind":{did:`stopped trusting CI runs to sign in as`,tried:`stop trusting CI runs to sign in as`,what:e=>k(e.entry)},"vault.tampered":{did:`found`,tried:`check`,what:({entry:e})=>[...e.subject===null?[`an entry`]:[...k(e),`'s record`],` tampered with: ${z[e.reason??``]??`it fails its seal`}`]},"key.rotate":{did:`rotated its key`,tried:`rotate its key`,what:()=>[]},sign_in:{did:({entry:e})=>e.metadata.kind===`cli`?`signed in to the CLI`:`signed in`,tried:`sign in`,what:({entry:e})=>T(e.metadata.provider)===null?[]:[`with ${T(e.metadata.provider)}`]},sign_out:{did:`signed out`,tried:`sign out`,what:()=>[]},"token.create":{did:`issued a token to`,tried:`issue a token to`,what:e=>k(e.entry)},"token.revoke":{did:`revoked a token of`,tried:`revoke a token of`,what:e=>k(e.entry)},"device.approve":{did:`approved a CLI sign-in`,tried:`approve a CLI sign-in`,what:()=>[]},"device.deny":{did:`turned down a CLI sign-in`,tried:`turn down a CLI sign-in`,what:()=>[]},"account.link":{did:`linked`,tried:`link`,what:({entry:e})=>[`a ${T(e.metadata.provider)??`sign-in`} account`]},"account.unlink":{did:`unlinked`,tried:`unlink`,what:({entry:e})=>[`a ${T(e.metadata.provider)??`sign-in`} account`]},"key.wrap":{did:`sealed the key of`,tried:`seal the key of`,what:e=>R(e.entry)},"key.rewrap":{did:`resealed the key of`,tried:`reseal the key of`,what:e=>R(e.entry)},"key.intent":{did:`asked KMS about`,tried:`ask KMS about`,what:e=>j(e)},"key.check":{did:`recorded the check value of`,tried:`check`,what:({entry:e})=>[[`the`,T(e.metadata.kekProvider)===`local`?null:T(e.metadata.kekProvider),`vault key`,T(e.metadata.kekId)].filter(e=>e!==null).join(` `)]},"sync.run":{did:`ran the sync of`,tried:`run the sync of`,what:({entry:e})=>[...O(e),M(e)]},"audit.heartbeat":{did:`checked in`,tried:`check in`,what:()=>[]},"audit.checkpoint":{did:`signed the log`,tried:`sign the log`,what:({entry:e})=>E(e.metadata.seq)===null?[]:[`through entry ${E(e.metadata.seq)}`]},"secret.list":{did:`listed`,tried:`list`,what:({entry:e})=>O(e)},"secret.history":{did:`read the history of`,tried:`read the history of`,what:e=>D(e.entry)},"secret.update":{did:`changed`,tried:`change`,what:e=>D(e.entry)},"sync.list":{did:`listed the syncs of`,tried:`list the syncs of`,what:({entry:e})=>O(e)}};function L(e){return D({...e,key:null})}function R(e){return[...D(e),...e.version===null?[]:[`, version ${e.version}`]]}var z={mac:`it does not carry the vault's seal`,stale:`an older copy was put back`,forged_entry:`the vault did not write it`},B={no_grant:`no grant`,bulk_limit:`bulk limit`,expired:`grant expired`,removed:`removed from coffre`,not_a_member:`not a member`,not_registered:`not invited`,tampered:`their record was tampered with`,bad_claim:`the key did not match the secret`,not_allowed:`not allowed`,root_admin:`root admins are set by the deployment`,unknown_environment:`no such environment`,unknown_secret:`no such secret`,unknown_project:`no such project`,unusable_credential:`its token is not a secret they can read`,duplicate_destination:`already synced from elsewhere`,cannot_grant_sync:`cannot grant the sync its reads`,kms_unavailable:`KMS did not answer`,wrong_kek:`the vault's key is not the one that wrapped the data`},V={secret_read:`no grant to read it`,secret_write:`no grant to write`,secret_archive:`no grant to archive`,audit_read:`no grant to read the audit log`,environment_manage:`no grant to manage environments`,grant_manage:`no grant to manage access`,project_manage:`no grant to manage the project`};function H(e){return e===null?`refused`:e.startsWith(`missing_`)?V[e.slice(8)]??`no grant`:B[e]??e.replace(/_/g,` `)}var U=[`sync.push`,`sync.remove`,`secret.write`,`secret.read`];function W(e){for(let t of U){let n=e.find(e=>e.action===t);if(n!==void 0)return n}return e[0]}function G(e){let t=W(e),n=e.filter(e=>e.action===t.action),r=n.filter(e=>e.decision===`deny`),i=r.length===n.length,a={entry:t,batch:n,count:new Set(n.map(e=>`${e.project}/${e.environment}/${e.key}`)).size,refused:i},o=re[t.action];if(o===void 0)return{parts:[t.action,` `,...D(t)],refused:i};let s=e=>typeof e==`string`?e:e(a),c=o.what(a),l=c.length===0?[]:[` `];if(i){let e=H((r[0]??t).reason);return{parts:[`tried to `,s(o.tried),...l,...c,`: ${e}`],refused:i}}let u=r.length===0?[]:[`, ${r.length} refused: ${H(r[0].reason)}`];return{parts:[s(o.did),...l,...c,...o.then?.(a)??[],...u],refused:i}}function K(e){let t=e[0];if(t.actorType===`user`)return{member:`user:${t.actorId}`};if(t.actorType===`service`)return{member:`token:${t.actorId}`};if(t.actorId.startsWith(`sync:`)){let t=e.map(e=>T(e.metadata.provider)).find(e=>e!==null),n=t===void 0?void 0:q[t]??t;return n===void 0?`a sync`:`sync to ${n}`}return J[t.actorId]??t.actorId}var q={"github-actions":`GitHub`,vercel:`Vercel`,railway:`Railway`,"cloudflare-workers":`Cloudflare`},J={scheduler:`the scheduler`,cron:`the scheduler`,vault:`the vault`,app:`coffre`};function Y(e){return[`vault`,`app`].filter(t=>e.some(e=>e.author===t)).join(`, `)}function ie(e){let t=[],n=new Map;for(let r of e){let e=r.operationId===null?void 0:n.get(r.operationId);if(e!==void 0){e.push(r);continue}let i=[r];r.operationId!==null&&n.set(r.operationId,i),t.push(i)}return t}function ae(e){if(e===null)return null;let{claims:t}=e,n=e=>typeof t[e]==`string`||typeof t[e]==`number`?String(t[e]):null,r=n(`sha`)===null?``:` at ${n(`sha`).slice(0,7)}`;return n(`repository`)!==null&&n(`run_id`)!==null?`${n(`repository`)} run ${n(`run_id`)}${r}`:n(`project_path`)!==null&&n(`pipeline_id`)!==null?`${n(`project_path`)} pipeline ${n(`pipeline_id`)}${r}`:n(`sub`)===null?`a CI run`:`CI run ${n(`sub`)}`}var X=t();function oe(){let t=C.useSearch(),n=e(),{data:o}=c(r.auditEntries(n,t)),u=l(r.auditChain(n)),d=u.data,{decision:p,actorId:m}=t,b=t.detail===`1`,x=p===`deny`;if(!o.ok)return(0,X.jsx)(a,{icon:(0,X.jsx)(ee,{size:18}),label:`Audit`,title:`The audit log is closed to you`,children:o.error});let S=d?.integrity===`broken`?d:null,w=S?.failedAtSeq??null,T=ie(o.entries),E={decision:p,actorId:m};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(i,{title:`Audit`,actions:(0,X.jsx)(`div`,{className:`chain-live`,"aria-live":`polite`,"aria-atomic":`true`,children:(0,X.jsx)(de,{chain:d,onRetry:()=>void u.refetch()})})}),S!==null&&(0,X.jsx)(`div`,{style:{marginBottom:`1.25rem`},children:(0,X.jsxs)(h,{tone:`bad`,children:[(0,X.jsx)(`strong`,{children:`Treat this as an incident.`}),` `,S.failedAtSeq===null?`The log does not verify, found by the ${S.author}'s check: ${S.reason}.`:`The log breaks at entry ${S.failedAtSeq}, found by the ${S.author}'s check: ${S.reason}.`,` `,S.through!==null&&`Every entry through ${S.through} holds. `,`Something with direct access to the database has changed what it records`,S.failedAtSeq===null?``:`, and nothing from entry ${S.failedAtSeq} on can be relied on`,` until that is explained.`,w!==null&&!o.entries.some(e=>e.seq===w)&&(0,X.jsxs)(X.Fragment,{children:[` `,`Entry `,w,` is not among the entries below`,b?(0,X.jsxs)(X.Fragment,{children:[`; `,(0,X.jsx)(`code`,{children:`coffre audit`}),` lists them all.`]}):`: it may be detail, which Show detail lists.`]})]})}),(0,X.jsxs)(`div`,{className:`toolbar`,children:[(0,X.jsxs)(`nav`,{className:`segmented`,"aria-label":`Filter by decision`,children:[(0,X.jsx)(s,{to:`/audit`,search:{...E,decision:void 0,detail:t.detail},activeOptions:{exact:!0},children:`All events`}),(0,X.jsxs)(s,{to:`/audit`,search:{...E,decision:`deny`,detail:t.detail},activeOptions:{exact:!0},children:[(0,X.jsx)(y,{size:13}),`Denials only`]})]}),m!==void 0&&(0,X.jsxs)(s,{className:`filter-chip`,to:`/audit`,search:{...E,actorId:void 0,detail:t.detail},"aria-label":`Stop filtering by ${m}`,children:[`Actor `,(0,X.jsx)(`span`,{className:`mono`,children:m}),(0,X.jsx)(g,{size:13})]}),(0,X.jsxs)(s,{className:`detail-toggle`,to:`/audit`,search:{...E,detail:b?void 0:`1`},"aria-pressed":b,children:[(0,X.jsx)(`span`,{className:`switch`,"aria-hidden":`true`}),`Show detail`]})]}),(0,X.jsx)(`section`,{className:`card`,"aria-label":`Audit entries`,children:T.length===0?(0,X.jsx)(f,{title:x?`No denials recorded`:`Nothing recorded yet`,children:x?`Every decision reaches this log, refusals included. An empty page means nobody has been turned away.`:`The log fills as people read and write secrets and change who has access.`}):(0,X.jsx)(`div`,{className:`dt-wrap`,children:(0,X.jsxs)(`table`,{className:`dt audit events stacks`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`n`,title:`Sequence number in the log`,children:`#`}),(0,X.jsx)(`th`,{className:`col-shrink`,children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(te,{size:14}),`When (UTC)`]})}),(0,X.jsx)(`th`,{className:`col-shrink`,children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(_,{size:14}),`Who`]})}),(0,X.jsx)(`th`,{children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(ne,{size:14}),`What they did`]})}),(0,X.jsx)(`th`,{className:`col-shrink`,children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(v,{size:14}),`Decided by`]})})]})}),(0,X.jsx)(`tbody`,{children:T.map(e=>(0,X.jsx)(Z,{batch:e,filters:E,detail:t.detail,breakAt:w},e[0].seq))})]})})})]})}function Z({batch:e,filters:t,detail:n,breakAt:r}){let i=r!==null&&e.some(e=>e.seq===r),[a,o]=(0,w.useState)(i),s=e[0],c=G(e),l=e.map(e=>e.seq),u=e.length>1;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{entry:s,seq:u?`${Math.min(...l)}–${Math.max(...l)}`:String(s.seq),parts:c.parts,refused:c.refused,decided:Y(e),filters:t,detail:n,breaks:i&&!u,marked:i,batch:e,toggle:u?(0,X.jsx)(`button`,{type:`button`,className:`batch-toggle`,"aria-expanded":a,"aria-label":a?`Hide each entry`:`Show each of ${e.length} entries`,onClick:()=>o(!a),children:(0,X.jsx)(S,{size:14})}):void 0}),u&&a&&e.map(e=>{let i=G([e]);return(0,X.jsx)(Q,{entry:e,seq:String(e.seq),parts:i.parts,refused:i.refused,decided:Y([e]),filters:t,detail:n,breaks:e.seq===r,marked:!1,child:!0},e.seq)})]})}function Q({entry:e,seq:t,parts:n,refused:r,decided:i,filters:a,detail:o,breaks:c,marked:l,toggle:u,child:d=!1,batch:f}){let m=K(f??[e]),h=[r&&`is-denied`,(c||l)&&`is-break`,d&&`is-child`,e.detail&&`is-detail`,e.action===`vault.tampered`&&`is-tampered`].filter(Boolean);return(0,X.jsxs)(`tr`,{className:h.length===0?void 0:h.join(` `),children:[(0,X.jsx)(`td`,{className:`n`,"data-label":`Sequence`,children:t}),(0,X.jsx)(`td`,{className:`nowrap cell-mono`,"data-label":`When (UTC)`,children:(0,X.jsx)(p,{iso:e.occurredAt,precise:!0})}),(0,X.jsxs)(`td`,{"data-label":`Who`,children:[(0,X.jsx)(`span`,{className:`actor`,children:typeof m==`string`?(0,X.jsx)(s,{to:`/audit`,search:{...a,actorId:e.actorId,detail:o},children:m}):(0,X.jsx)(s,{to:`/audit`,search:{...a,actorId:e.actorId,detail:o},children:$(m.member)})}),e.run!==null&&(0,X.jsx)(`small`,{className:`actor-run`,title:`Exchanged in entry ${e.run.exchangeSeq}`,children:ae(e.run)})]}),(0,X.jsx)(`td`,{className:`cell-sentence`,"data-label":`What they did`,children:(0,X.jsxs)(`span`,{className:`sentence`,children:[u,e.action===`vault.tampered`&&(0,X.jsx)(x,{size:13}),(0,X.jsx)(se,{parts:n}),c&&(0,X.jsx)(ue,{})]})}),(0,X.jsx)(`td`,{className:`nowrap`,"data-label":`Decided by`,children:(0,X.jsxs)(`span`,{className:r?`decided decided-refused`:`decided`,children:[r&&(0,X.jsx)(y,{size:13}),i,r&&`, refused`]})})]})}function se({parts:e}){return(0,X.jsx)(X.Fragment,{children:e.map((e,t)=>(0,X.jsx)(w.Fragment,{children:typeof e==`string`?e:`place`in e?(0,X.jsx)(ce,{path:e.place}):(0,X.jsx)(le,{member:e.member})},t))})}function ce({path:e}){let[t,n]=e.split(`/`),r=(0,X.jsx)(`span`,{className:`mono`,children:m(e)});return n===void 0?(0,X.jsx)(s,{to:`/projects/$project`,params:{project:t},children:r}):(0,X.jsx)(s,{to:`/projects/$project/$environment`,params:{project:t,environment:n},children:r})}function le({member:e}){return e.startsWith(`token:`)?(0,X.jsx)(s,{to:`/tokens/$token`,params:{token:e.slice(6)},children:e}):(0,X.jsx)(s,{to:`/users/$user`,params:{user:$(e)},children:$(e)})}function $(e){return e.startsWith(`user:`)?e.slice(5):e}function ue(){return(0,X.jsxs)(`span`,{className:`break-mark`,children:[(0,X.jsx)(x,{size:11}),`breaks here`]})}function de({chain:e,onRetry:t}){return e===void 0?(0,X.jsxs)(`span`,{className:`chain-note`,children:[(0,X.jsx)(u,{size:14}),`Verifying…`]}):e.integrity===`owners-only`?(0,X.jsx)(d,{align:`end`,label:`Owners and root admins see whether the log is intact. Checking it means recomputing every entry, and you read only your projects' part of it.`,children:(0,X.jsxs)(`button`,{type:`button`,className:`chain-note`,children:[(0,X.jsx)(b,{size:14}),`Verified by owners`]})}):e.integrity===`unknown`?(0,X.jsxs)(`div`,{className:`chain`,children:[(0,X.jsx)(d,{align:`end`,label:`coffre could not check the log: ${e.problem}. The entries below loaded, but whether they are intact is unknown until it can.`,children:(0,X.jsxs)(`button`,{type:`button`,className:`chain-flag chain-flag-warn`,children:[(0,X.jsx)(x,{size:14}),`Couldn’t verify`]})}),(0,X.jsx)(`button`,{type:`button`,className:`btn btn-sm`,onClick:t,children:`Retry`})]}):e.integrity===`broken`?(0,X.jsxs)(`span`,{className:`chain-flag chain-flag-bad`,children:[(0,X.jsx)(x,{size:14}),e.failedAtSeq===null?`Log does not verify`:`Log broken at ${e.failedAtSeq}`]}):(0,X.jsxs)(`div`,{className:`chain`,children:[e.pending>0&&(0,X.jsx)(d,{align:`end`,label:`Keys released through KMS whose outcome the vault has not logged yet. Each settles within seconds, or is logged as failed.`,children:(0,X.jsxs)(`button`,{type:`button`,className:`chain-note`,role:`status`,children:[e.pending,` key operation`,e.pending===1?``:`s`,` in flight`]})}),(0,X.jsx)(d,{align:`end`,label:`Every entry through ${e.through??0} holds, under the app's key and the vault's.`+(e.checkpoint===null?` The vault has not signed the log yet.`:` The vault last signed it through entry ${e.checkpoint.seq}, at ${e.checkpoint.signedAt}.`),children:(0,X.jsxs)(`button`,{type:`button`,className:`chain-seal`,children:[(0,X.jsx)(v,{size:14}),`Verified`]})})]})}export{oe as component};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/audit-CHSvKLWX.js","_coffre/assets/page-C_hnzdaR.js","_coffre/assets/link-DBINMwm6.js","_coffre/assets/useSuspenseQuery-BZ-nzHST.js","_coffre/assets/suspense-O8sP0mEC.js","_coffre/assets/useQuery-B-lxFSES.js","_coffre/assets/ui-BXP2IqrW.js","_coffre/assets/icons-Dc_-t0lp.js"])))=>i.map(i=>d[i]);
2
- import{h as e}from"./page-C_hnzdaR.js";import{n as t,r as n,t as r}from"./preload-helper-CLkO85Nq.js";var i=n(`/audit`)({validateSearch:e=>({decision:e.decision===`deny`?`deny`:void 0,actorId:typeof e.actorId==`string`&&e.actorId!==``?e.actorId:void 0,detail:e.detail===`1`||e.detail===1?`1`:void 0}),loaderDeps:({search:e})=>e,loader:({context:{client:t,queryClient:n},deps:r})=>n.fetchQuery(e.auditEntries(t,r)),component:t(()=>r(()=>import(`./audit-CHSvKLWX.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),`component`)});export{i as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/auth.device-DAlqWacc.js","_coffre/assets/page-C_hnzdaR.js","_coffre/assets/link-DBINMwm6.js","_coffre/assets/preload-helper-CLkO85Nq.js","_coffre/assets/ui-BXP2IqrW.js","_coffre/assets/icons-Dc_-t0lp.js"])))=>i.map(i=>d[i]);
2
- import{S as e,f as t}from"./page-C_hnzdaR.js";import{n,r,t as i}from"./preload-helper-CLkO85Nq.js";var a=r(`/auth/device`)({validateSearch:e=>{let t=e.code;return typeof t==`string`&&t.length<=16?{code:t}:{}},loaderDeps:({search:e})=>({code:e.code}),loader:async({context:{client:n,queryClient:r},deps:i})=>{if(i.code===void 0)return null;if(!(await t(r,n)).auth.signin)return{ok:!1,error:`This instance has no CLI sign-in.`};let a=i.code;return e(()=>n.deviceLogins.get(a))},component:n(()=>i(()=>import(`./auth.device-DAlqWacc.js`),__vite__mapDeps([0,1,2,3,4,5])),`component`)});export{a as t};
@@ -1 +0,0 @@
1
- import{C as e,U as t,X as n,n as r,q as i,x as a,y as o}from"./page-C_hnzdaR.js";import{t as s}from"./link-DBINMwm6.js";import{a as c}from"./preload-helper-CLkO85Nq.js";import{a as l,c as u,l as d}from"./ui-BXP2IqrW.js";import{B as f,R as p,o as m}from"./icons-Dc_-t0lp.js";import{t as h}from"./auth.device-Co5vrpaA.js";var g=n(i()),_=t();function v(){let e=h.useLoaderData(),[t,n]=(0,g.useState)(null);return t===`approved`?(0,_.jsx)(r,{icon:(0,_.jsx)(m,{size:18}),label:`coffre CLI`,title:`Your terminal is signed in`,children:(0,_.jsx)(`p`,{children:`You can close this tab and go back to the terminal.`})}):t===`denied`?(0,_.jsx)(r,{icon:(0,_.jsx)(p,{size:18}),label:`coffre CLI`,title:`Sign-in refused`,children:(0,_.jsxs)(`p`,{children:[`The terminal that asked gets nothing. If you did not run `,(0,_.jsx)(`span`,{className:`mono`,children:`coffre login`}),` yourself, someone may be trying to get you to approve theirs; the refusal is in the audit log.`]})}):e===null?(0,_.jsx)(y,{}):e.ok?e.request===null?(0,_.jsx)(y,{error:`That code is unknown, already used, or expired. Run coffre login again for a new one.`}):(0,_.jsx)(b,{request:e.request,sessionDays:e.sessionDays,onDecided:n}):(0,_.jsx)(y,{error:e.error})}function y({error:e=null}){let t=c(),[n,r]=(0,g.useState)(``);return(0,_.jsxs)(`section`,{className:`card signin`,"aria-labelledby":`device-title`,children:[(0,_.jsxs)(`div`,{className:`signin-head`,children:[(0,_.jsx)(`h1`,{className:`signin-title`,id:`device-title`,children:`Sign in the coffre CLI`}),(0,_.jsxs)(`p`,{className:`signin-lede`,children:[`Enter the code your terminal shows after `,(0,_.jsx)(`span`,{className:`mono`,children:`coffre login`}),`.`]})]}),(0,_.jsxs)(`form`,{className:`signin-form`,onSubmit:e=>{e.preventDefault(),t({to:`/auth/device`,search:{code:n.trim()}})},children:[(0,_.jsxs)(`label`,{className:`field`,children:[(0,_.jsx)(`span`,{className:`label`,children:`Code`}),(0,_.jsx)(`input`,{className:`input mono device-code-input`,name:`code`,autoComplete:`off`,autoCapitalize:`characters`,spellCheck:!1,placeholder:`XXXX-XXXX`,maxLength:16,value:n,onChange:e=>r(e.target.value)})]}),(0,_.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,style:{height:`2.125rem`},disabled:n.trim()===``,children:`Continue`})]}),e!==null&&(0,_.jsx)(`div`,{className:`signin-error`,children:(0,_.jsx)(l,{error:e})})]})}function b({request:t,sessionDays:n,onDecided:r}){let i=e(),[c,p]=(0,g.useState)(null),[m,h]=(0,g.useState)(null);async function v(e){p(e?`approve`:`deny`);try{await i.deviceLogins.decide(t.userCode,e),r(e?`approved`:`denied`)}catch(e){h(a(e)===404?`That code is unknown, already used, or expired. Run coffre login again.`:a(e)===void 0?`The decision could not be sent. Nothing was approved.`:o(e))}finally{p(null)}}return(0,_.jsxs)(`section`,{className:`card signin`,"aria-labelledby":`device-title`,children:[(0,_.jsxs)(`div`,{className:`signin-head`,children:[(0,_.jsx)(`h1`,{className:`signin-title`,id:`device-title`,children:`Approve this terminal?`}),(0,_.jsxs)(`p`,{className:`signin-lede`,children:[`Only if you just ran `,(0,_.jsx)(`span`,{className:`mono`,children:`coffre login`}),` yourself and it shows this code. It gets your access, in your name, for `,n,` days or until you end it from your account page.`]})]}),(0,_.jsx)(`p`,{className:`device-code`,"aria-label":`Code`,children:t.userCode}),(0,_.jsxs)(`dl`,{className:`facts device-facts`,children:[(0,_.jsxs)(`div`,{className:`fact`,children:[(0,_.jsx)(`dt`,{children:`Client`}),(0,_.jsx)(`dd`,{children:(0,_.jsxs)(`span`,{className:`cell-account`,children:[(0,_.jsx)(f,{size:14}),t.clientLabel??`coffre CLI`]})})]}),(0,_.jsxs)(`div`,{className:`fact`,children:[(0,_.jsx)(`dt`,{children:`Requested from`}),(0,_.jsx)(`dd`,{className:`mono`,children:t.clientIp??`an unknown address`})]}),(0,_.jsxs)(`div`,{className:`fact`,children:[(0,_.jsx)(`dt`,{children:`Requested (UTC)`}),(0,_.jsx)(`dd`,{children:(0,_.jsx)(d,{iso:t.createdAt})})]})]}),m!==null&&(0,_.jsx)(`div`,{className:`signin-error`,children:(0,_.jsx)(l,{error:m})}),(0,_.jsxs)(`div`,{className:`device-actions`,children:[(0,_.jsx)(s,{className:`btn btn-quiet`,to:`/projects`,children:`Cancel`}),(0,_.jsxs)(`button`,{className:`btn`,disabled:c!==null,onClick:()=>void v(!1),children:[c===`deny`&&(0,_.jsx)(u,{}),`Deny`]}),(0,_.jsxs)(`button`,{className:`btn btn-primary`,disabled:c!==null,onClick:()=>void v(!0),children:[c===`approve`&&(0,_.jsx)(u,{}),`Approve`]})]})]})}export{v as component};
@@ -1 +0,0 @@
1
- import{C as e,U as t,X as n,b as r,q as i}from"./page-C_hnzdaR.js";import{t as a}from"./link-DBINMwm6.js";import{_ as o,l as s,m as c,n as l,o as u,t as d}from"./use-change-CKj3Inq9.js";import{c as f,d as p,h as m,i as h,n as g,o as _}from"./ui-BXP2IqrW.js";import{A as v,C as y,G as b,H as x,I as S,O as C,j as w,v as T}from"./icons-Dc_-t0lp.js";import{a as E,i as D,r as O}from"./row-state-DJ-KLamZ.js";var k=n(i(),1),A=t();function j({type:e,id:t,size:n=`sm`}){return(0,A.jsx)(`span`,{className:`avatar${e===`service`?` avatar-token`:``}${n===`lg`?` avatar-lg`:``}`,"aria-hidden":!0,children:e===`service`?(0,A.jsx)(T,{size:n===`lg`?18:13}):t.slice(0,1)})}function M({type:e,id:t,stretch:n=!1}){let r=`cell-link${n?` stretch`:``}`;return(0,A.jsxs)(`span`,{className:`cell-principal`,children:[(0,A.jsx)(j,{type:e,id:t}),e===`user`?(0,A.jsx)(a,{className:r,to:`/users/$user`,params:{user:t},children:t}):(0,A.jsx)(a,{className:r,to:`/tokens/$token`,params:{token:t},children:t})]})}var N=e=>r(e.principalType,e.principalId),P={"root-admin":`Root admin`,owner:`Owner`,user:`Member`},F={user:`user`,service:`token`};function I({principalType:e,principals:t,hasRemoved:n=!1}){let r=e===`user`,i=r?4:3,{status:a,failedAdds:o,dismiss:c}=l(s.queryKey),u=o(t.map(N)).filter(({vars:t})=>t.principalType===e);return(0,A.jsx)(`section`,{className:`card`,"aria-label":r?`Users`:`Tokens`,children:t.length===0&&u.length===0?(0,A.jsxs)(h,{title:n?`No active ${F[e]}s`:r?`Nobody is registered`:`No tokens yet`,children:[n?`Add a ${F[e]}`:`Add the first ${F[e]}`,` to let it through the door. Project access is a separate step, granted from each project's page.`]}):(0,A.jsx)(`div`,{className:`dt-wrap`,children:(0,A.jsxs)(`table`,{className:`dt directory directory-${e} stacks`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{children:[(0,A.jsx)(`th`,{className:`n`,children:`#`}),(0,A.jsx)(`th`,{className:`col-principal`,children:(0,A.jsxs)(`span`,{className:`th`,children:[r?(0,A.jsx)(x,{size:14}):(0,A.jsx)(T,{size:14}),r?`Email`:`Name`]})}),r&&(0,A.jsx)(`th`,{className:`col-role`,children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(S,{size:14}),`Instance role`]})}),(0,A.jsx)(`th`,{className:`col-actions`,children:(0,A.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,A.jsxs)(`tbody`,{children:[t.map((e,t)=>{let n=a(N(e));return(0,A.jsxs)(k.Fragment,{children:[(0,A.jsxs)(`tr`,{className:`row-link ${E(n)}`,children:[(0,A.jsx)(`td`,{className:`n`,children:t+1}),(0,A.jsx)(`td`,{className:`col-lead`,"data-label":e.principalType===`user`?`Email`:`Name`,children:(0,A.jsx)(M,{type:e.principalType,id:e.principalId,stretch:!0})}),r&&(0,A.jsx)(`td`,{className:`col-role`,"data-label":`Instance role`,children:(0,A.jsx)(L,{principal:e})}),(0,A.jsx)(`td`,{className:`col-actions`,children:n.state===`pending`?(0,A.jsx)(D,{status:n}):(0,A.jsx)(R,{principal:e})})]}),(0,A.jsx)(O,{status:n,columns:i,onDismiss:()=>n.state===`failed`&&c(n.mutationId)})]},e.principalId)}),u.map(({mutationId:e,vars:t,status:n})=>(0,A.jsxs)(O,{status:n,columns:i,onDismiss:()=>c(e),children:[t.principalId,` was not added.`]},e))]})]})})})}function L({principal:e}){return e.tampered===!0?(0,A.jsx)(p,{label:(0,A.jsx)(A.Fragment,{children:`Their record was changed outside coffre, so the vault refuses them everything. Remove them to start them over, then add them again.`}),children:(0,A.jsxs)(`button`,{type:`button`,className:`tag tag-red tag-button`,children:[(0,A.jsx)(y,{size:11}),`Integrity check failed`]})}):e.isRootAdmin?(0,A.jsx)(p,{label:(0,A.jsxs)(A.Fragment,{children:[`Set by `,(0,A.jsx)(`code`,{children:`rootAdmins`}),` in the vault's configuration, so it cannot be changed or removed here.`]}),children:(0,A.jsxs)(`button`,{type:`button`,className:`tag tag-violet tag-button`,children:[(0,A.jsx)(y,{size:11}),`Root admin`]})}):(0,A.jsx)(`span`,{className:`tag${e.instanceRole===`user`?``:` tag-violet`}`,children:P[e.instanceRole]})}function R({principal:t,trigger:n=`act act-quiet act-menu`}){let[r,i]=(0,k.useState)(!1),[a,c]=(0,k.useState)(!1),[p,h]=(0,k.useState)(t.instanceRole===`owner`?`owner`:`user`),y=e(),x=d(u(y)),S=d(o(y)),{status:w}=l(s.queryKey),T=w(N(t)).state===`pending`,E=F[t.principalType];return t.isRootAdmin?null:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(m.Root,{children:[(0,A.jsx)(m.Trigger,{asChild:!0,children:(0,A.jsx)(`button`,{className:n,"aria-label":`Actions for ${t.principalId}`,disabled:T,children:T?(0,A.jsx)(f,{size:13}):(0,A.jsx)(C,{size:16})})}),(0,A.jsx)(m.Portal,{children:(0,A.jsxs)(m.Content,{className:`menu`,sideOffset:6,align:`end`,children:[t.principalType===`user`&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(m.Item,{className:`menu-item`,onSelect:()=>{h(t.instanceRole===`owner`?`owner`:`user`),i(!0)},children:[(0,A.jsx)(v,{size:14}),`Change role`]}),(0,A.jsx)(m.Separator,{className:`menu-sep`})]}),(0,A.jsxs)(m.Item,{className:`menu-item menu-item-danger`,onSelect:()=>c(!0),children:[(0,A.jsx)(b,{size:14}),`Remove `,E,`…`]})]})})]}),t.principalType===`user`&&(0,A.jsx)(_,{open:r,onOpenChange:i,title:(0,A.jsxs)(A.Fragment,{children:[`Role of `,(0,A.jsx)(`span`,{className:`mono`,children:t.principalId})]}),children:(0,A.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),x({principalId:t.principalId,owner:p===`owner`}),i(!1)},children:[(0,A.jsx)(B,{value:p,onChange:h}),(0,A.jsxs)(`div`,{className:`dialog-actions`,children:[(0,A.jsx)(`button`,{className:`btn`,type:`button`,onClick:()=>i(!1),children:`Cancel`}),(0,A.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,children:`Save`})]})]})}),(0,A.jsx)(g,{open:a,onOpenChange:c,title:(0,A.jsxs)(A.Fragment,{children:[`Remove `,(0,A.jsx)(`span`,{className:`mono`,children:t.principalId}),`?`]}),body:t.principalType===`user`?(0,A.jsx)(A.Fragment,{children:`They are signed out everywhere, and their CLI logins, linked sign-in accounts and project permissions are revoked at once. Their past actions stay in the audit log, and their page then lists the values they saw, to rotate.`}):(0,A.jsx)(A.Fragment,{children:`Every token issued to it stops working and its project permissions are revoked at once, including for anything running with it right now. Its past actions stay in the audit log, and its page then lists the values it read, to rotate.`}),confirmLabel:`Remove ${E}`,onConfirm:()=>S(t)})]})}function z({principalType:t}){let[n,r]=(0,k.useState)(!1),[i,a]=(0,k.useState)(``),[o,s]=(0,k.useState)(`user`),l=d(c(e())),u=F[t];function f(){r(!1),a(``),s(`user`)}return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>r(!0),children:[(0,A.jsx)(w,{size:14}),`Add `,u]}),(0,A.jsx)(_,{open:n,onOpenChange:e=>e?r(!0):f(),title:`Add a ${u}`,description:`This lets the ${u} through the door and nothing more. Grant project access from its page or from each project's.`,children:(0,A.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),l({principalType:t,principalId:i.trim(),owner:o===`owner`}),f()},children:[(0,A.jsxs)(`label`,{className:`field`,children:[(0,A.jsx)(`span`,{className:`label`,children:t===`user`?`Cloudflare Access email`:`Service token common name`}),(0,A.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,value:i,placeholder:t===`user`?`someone@acme.example`:`ci-deploy`,onChange:e=>a(e.target.value)})]}),t===`user`&&(0,A.jsx)(B,{value:o,onChange:s}),(0,A.jsxs)(`div`,{className:`dialog-actions`,children:[(0,A.jsx)(`button`,{className:`btn`,type:`button`,onClick:f,children:`Cancel`}),(0,A.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:i.trim()===``,children:[`Add `,u]})]})]})})]})}function B({value:e,onChange:t}){return(0,A.jsxs)(`label`,{className:`field`,children:[(0,A.jsx)(`span`,{className:`label`,children:`Instance role`}),(0,A.jsxs)(`select`,{className:`select`,value:e,onChange:e=>t(e.target.value),children:[(0,A.jsx)(`option`,{value:`user`,children:`Member`}),(0,A.jsx)(`option`,{value:`owner`,children:`Owner`})]}),(0,A.jsx)(`span`,{className:`hint`,children:`Owners manage users and tokens, can create projects, and read the whole audit log. Neither role reads a secret without a project grant.`})]})}export{R as a,F as i,I as n,j as o,L as r,M as s,z as t};
@@ -1 +0,0 @@
1
- import{X as e,q as t}from"./page-C_hnzdaR.js";import{z as n}from"./link-DBINMwm6.js";var r=e(t(),1),i=e(n(),1);function a(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var o=e=>{switch(e){case`success`:return l;case`info`:return d;case`warning`:return u;case`error`:return f;default:return null}},s=Array(12).fill(0),c=({visible:e,className:t})=>r.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},r.createElement(`div`,{className:`sonner-spinner`},s.map((e,t)=>r.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),l=r.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},r.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),u=r.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},r.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),d=r.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},r.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),f=r.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},r.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),p=r.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},r.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),r.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),ee=()=>{let[e,t]=r.useState(document.hidden);return r.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},m=1,h=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:m++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0||e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let i=Promise.resolve(e instanceof Function?e():e),a=n!==void 0,o,s=i.then(async e=>{if(o=[`resolve`,e],r.isValidElement(e))a=!1,this.create({id:n,type:`default`,message:e});else if(_(e)&&!e.ok){a=!1;let i=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,o=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,s=typeof i==`object`&&!r.isValidElement(i)?i:{message:i};this.create({id:n,type:`error`,description:o,...s})}else if(e instanceof Error){a=!1;let i=typeof t.error==`function`?await t.error(e):t.error,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof i==`object`&&!r.isValidElement(i)?i:{message:i};this.create({id:n,type:`error`,description:o,...s})}else if(t.success!==void 0){a=!1;let i=typeof t.success==`function`?await t.success(e):t.success,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof i==`object`&&!r.isValidElement(i)?i:{message:i};this.create({id:n,type:`success`,description:o,...s})}}).catch(async e=>{if(o=[`reject`,e],t.error!==void 0){a=!1;let i=typeof t.error==`function`?await t.error(e):t.error,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof i==`object`&&!r.isValidElement(i)?i:{message:i};this.create({id:n,type:`error`,description:o,...s})}}).finally(()=>{a&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),c=()=>new Promise((e,t)=>s.then(()=>o[0]===`reject`?t(o[1]):e(o[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(e,t)=>{let n=t?.id||m++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},g=(e,t)=>{let n=t?.id||m++;return h.addToast({title:e,...t,id:n}),n},_=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,v=Object.assign(g,{success:h.success,info:h.info,warning:h.warning,error:h.error,custom:h.custom,message:h.message,promise:h.promise,dismiss:h.dismiss,loading:h.loading},{getHistory:()=>h.toasts,getToasts:()=>h.getActiveToasts()});a(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function y(e){return e.label!==void 0}var te=3,b=`24px`,x=`16px`,S=4e3,C=356,w=14,T=45,E=200;function D(...e){return e.filter(Boolean).join(` `)}function ne(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var O=e=>{let{invert:t,toast:n,unstyled:i,interacting:a,setHeights:s,visibleToasts:l,heights:u,index:d,toasts:f,expanded:m,removeToast:h,defaultRichColors:g,closeButton:_,style:v,cancelButtonStyle:te,actionButtonStyle:b,className:x=``,descriptionClassName:C=``,duration:w,position:O,gap:k,expandByDefault:A,classNames:j,icons:M,closeButtonAriaLabel:re=`Close toast`}=e,[N,P]=r.useState(null),[F,ie]=r.useState(null),[I,L]=r.useState(!1),[R,z]=r.useState(!1),[B,V]=r.useState(!1),[ae,oe]=r.useState(!1),[se,ce]=r.useState(!1),[le,H]=r.useState(0),[ue,U]=r.useState(0),W=r.useRef(n.duration||w||S),de=r.useRef(null),G=r.useRef(null),fe=d===0,pe=d+1<=l,K=n.type,q=n.dismissible!==!1,me=n.className||``,he=n.descriptionClassName||``,J=r.useMemo(()=>u.findIndex(e=>e.toastId===n.id)||0,[u,n.id]),ge=r.useMemo(()=>n.closeButton??_,[n.closeButton,_]),_e=r.useMemo(()=>n.duration||w||S,[n.duration,w]),Y=r.useRef(0),X=r.useRef(0),ve=r.useRef(0),Z=r.useRef(null),[ye,be]=O.split(`-`),xe=r.useMemo(()=>u.reduce((e,t,n)=>n>=J?e:e+t.height,0),[u,J]),Se=ee(),Ce=n.invert||t,Q=K===`loading`;X.current=r.useMemo(()=>J*k+xe,[J,xe]),r.useEffect(()=>{W.current=_e},[_e]),r.useEffect(()=>{L(!0)},[]),r.useEffect(()=>{let e=G.current;if(e){let t=e.getBoundingClientRect().height;return U(t),s(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>s(e=>e.filter(e=>e.toastId!==n.id))}},[s,n.id]),r.useLayoutEffect(()=>{if(!I)return;let e=G.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,U(r),s(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[I,n.title,n.description,s,n.id,n.jsx,n.action,n.cancel]);let $=r.useCallback(()=>{z(!0),H(X.current),s(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{h(n)},E)},[n,h,s,X]);r.useEffect(()=>{if(n.promise&&K===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return m||a||Se?(()=>{if(ve.current<Y.current){let e=new Date().getTime()-Y.current;W.current-=e}ve.current=new Date().getTime()})():W.current!==1/0&&(Y.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),$()},W.current)),()=>clearTimeout(e)},[m,a,n,K,Se,$]),r.useEffect(()=>{n.delete&&($(),n.onDismiss==null||n.onDismiss.call(n,n))},[$,n.delete]);function we(){return M?.loading?r.createElement(`div`,{className:D(j?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":K===`loading`},M.loading):r.createElement(c,{className:D(j?.loader,n?.classNames?.loader),visible:K===`loading`})}let Te=n.icon||M?.[K]||o(K);return r.createElement(`li`,{tabIndex:0,ref:G,className:D(x,me,j?.toast,n?.classNames?.toast,j?.default,j?.[K],n?.classNames?.[K]),"data-sonner-toast":``,"data-rich-colors":n.richColors??g,"data-styled":!(n.jsx||n.unstyled||i),"data-mounted":I,"data-promise":!!n.promise,"data-swiped":se,"data-removed":R,"data-visible":pe,"data-y-position":ye,"data-x-position":be,"data-index":d,"data-front":fe,"data-swiping":B,"data-dismissible":q,"data-type":K,"data-invert":Ce,"data-swipe-out":ae,"data-swipe-direction":F,"data-expanded":!!(m||A&&I),"data-testid":n.testId,style:{"--index":d,"--toasts-before":d,"--z-index":f.length-d,"--offset":`${R?le:X.current}px`,"--initial-height":A?`auto`:`${ue}px`,...v,...n.style},onDragEnd:()=>{V(!1),P(null),Z.current=null},onPointerDown:e=>{e.button!==2&&(Q||!q||(de.current=new Date,H(X.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(V(!0),Z.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(ae||!q)return;Z.current=null;let e=Number(G.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(G.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-de.current?.getTime(),i=N===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=T||a>.11){H(X.current),n.onDismiss==null||n.onDismiss.call(n,n),ie(N===`x`?e>0?`right`:`left`:t>0?`down`:`up`),$(),oe(!0);return}else{var o,s;(o=G.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=G.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}ce(!1),V(!1),P(null)},onPointerMove:t=>{var n,r;if(!Z.current||!q||window.getSelection()?.toString().length>0)return;let i=t.clientY-Z.current.y,a=t.clientX-Z.current.x,o=e.swipeDirections??ne(O);!N&&(Math.abs(a)>1||Math.abs(i)>1)&&P(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(N===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(N===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&ce(!0),(n=G.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=G.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},ge&&!n.jsx&&K!==`loading`?r.createElement(`button`,{"aria-label":re,"data-disabled":Q,"data-close-button":!0,onClick:Q||!q?()=>{}:()=>{$(),n.onDismiss==null||n.onDismiss.call(n,n)},className:D(j?.closeButton,n?.classNames?.closeButton)},M?.close??p):null,(K||n.icon||n.promise)&&n.icon!==null&&(M?.[K]!==null||n.icon)?r.createElement(`div`,{"data-icon":``,className:D(j?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||we():null,n.type===`loading`?null:Te):null,r.createElement(`div`,{"data-content":``,className:D(j?.content,n?.classNames?.content)},r.createElement(`div`,{"data-title":``,className:D(j?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?r.createElement(`div`,{"data-description":``,className:D(C,he,j?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),r.isValidElement(n.cancel)?n.cancel:n.cancel&&y(n.cancel)?r.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||te,onClick:e=>{y(n.cancel)&&q&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),$())},className:D(j?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,r.isValidElement(n.action)?n.action:n.action&&y(n.action)?r.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||b,onClick:e=>{y(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&$())},className:D(j?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function k(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function A(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?x:b;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var j=r.forwardRef(function(e,t){let{id:n,invert:a,position:o=`bottom-right`,hotkey:s=[`altKey`,`KeyT`],expand:c,closeButton:l,className:u,offset:d,mobileOffset:f,theme:p=`light`,richColors:ee,duration:m,style:g,visibleToasts:_=te,toastOptions:v,dir:y=k(),gap:b=w,icons:x,containerAriaLabel:S=`Notifications`}=e,[T,E]=r.useState([]),D=r.useMemo(()=>n?T.filter(e=>e.toasterId===n):T.filter(e=>!e.toasterId),[T,n]),ne=r.useMemo(()=>Array.from(new Set([o].concat(D.filter(e=>e.position).map(e=>e.position)))),[D,o]),[j,M]=r.useState([]),[re,N]=r.useState(!1),[P,F]=r.useState(!1),[ie,I]=r.useState(p===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:p),L=r.useRef(null),R=s.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),z=r.useRef(null),B=r.useRef(!1),V=r.useCallback(e=>{E(t=>(t.find(t=>t.id===e.id)?.delete||h.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return r.useEffect(()=>h.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{E(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{i.flushSync(()=>{E(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[T]),r.useEffect(()=>{if(p!==`system`){I(p);return}if(p===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?I(`dark`):I(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{I(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{I(e?`dark`:`light`)}catch(e){console.error(e)}})}},[p]),r.useEffect(()=>{T.length<=1&&N(!1)},[T]),r.useEffect(()=>{let e=e=>{if(s.every(t=>e[t]||e.code===t)){var t;N(!0),(t=L.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===L.current||L.current?.contains(document.activeElement))&&N(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[s]),r.useEffect(()=>{if(L.current)return()=>{z.current&&(z.current.focus({preventScroll:!0}),z.current=null,B.current=!1)}},[L.current]),r.createElement(`section`,{ref:t,"aria-label":`${S} ${R}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},ne.map((t,n)=>{let[i,o]=t.split(`-`);return D.length?r.createElement(`ol`,{key:t,dir:y===`auto`?k():y,tabIndex:-1,ref:L,className:u,"data-sonner-toaster":!0,"data-sonner-theme":ie,"data-y-position":i,"data-x-position":o,style:{"--front-toast-height":`${j[0]?.height||0}px`,"--width":`${C}px`,"--gap":`${b}px`,...g,...A(d,f)},onBlur:e=>{B.current&&!e.currentTarget.contains(e.relatedTarget)&&(B.current=!1,z.current&&=(z.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||B.current||(B.current=!0,z.current=e.relatedTarget)},onMouseEnter:()=>N(!0),onMouseMove:()=>N(!0),onMouseLeave:()=>{P||N(!1)},onDragEnd:()=>N(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||F(!0)},onPointerUp:()=>F(!1)},D.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>r.createElement(O,{key:n.id,icons:x,index:i,toast:n,defaultRichColors:ee,duration:v?.duration??m,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:a,visibleToasts:_,closeButton:v?.closeButton??l,interacting:P,position:t,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:V,toasts:D.filter(e=>e.position==n.position),heights:j.filter(e=>e.position==n.position),setHeights:M,expandByDefault:c,gap:b,expanded:re,swipeDirections:e.swipeDirections}))):null}))});export{v as n,j as t};