@coffre/ui 0.1.10 → 0.1.11

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 (167) hide show
  1. package/dist/client/_coffre/assets/account-BJAdDvZf.js +2 -0
  2. package/dist/client/_coffre/assets/account-D0jLpk5c.js +1 -0
  3. package/dist/client/_coffre/assets/affordances-Bq2-oUB5.js +1 -0
  4. package/dist/client/_coffre/assets/audit-C-pcBgKe.js +2 -0
  5. package/dist/client/_coffre/assets/audit-CHGlDeBB.js +1 -0
  6. package/dist/client/_coffre/assets/{auth.device-BP5FY0K1.js → auth.device-BndOUjse.js} +1 -1
  7. package/dist/client/_coffre/assets/auth.device-CWHNQn9W.js +2 -0
  8. package/dist/client/_coffre/assets/directory-nDExpkAz.js +1 -0
  9. package/dist/client/_coffre/assets/dist-QVHMLatb.js +1 -0
  10. package/dist/client/_coffre/assets/globals-CKBoTlyH.css +1 -0
  11. package/dist/client/_coffre/assets/grants-CjoOnxzz.js +1 -0
  12. package/dist/client/_coffre/assets/icons-BQ27Ds9u.js +1 -0
  13. package/dist/client/_coffre/assets/index-CUGytaO3.js +12 -0
  14. package/dist/client/_coffre/assets/link-DP8SVWon.js +1 -0
  15. package/dist/client/_coffre/assets/login-CeaxDMcr.js +2 -0
  16. package/dist/client/_coffre/assets/login-DrMgvqZn.js +1 -0
  17. package/dist/client/_coffre/assets/offboarding-CNr_1tnl.js +1 -0
  18. package/dist/client/_coffre/assets/page-CGmvjSy4.js +1 -0
  19. package/dist/client/_coffre/assets/preload-helper-ClBkJ19f.js +1 -0
  20. package/dist/client/_coffre/assets/principal-page-DNLb_q_e.js +1 -0
  21. package/dist/client/_coffre/assets/projects._project._environment-CHzbboGp.js +3 -0
  22. package/dist/client/_coffre/assets/projects._project._environment-DDxu_HHD.js +2 -0
  23. package/dist/client/_coffre/assets/projects._project.index-CIAsjvg6.js +2 -0
  24. package/dist/client/_coffre/assets/projects._project.index-DZ9l6d-1.js +1 -0
  25. package/dist/client/_coffre/assets/projects.index-4eUXreE_.js +1 -0
  26. package/dist/client/_coffre/assets/row-state-ByET1OKX.js +1 -0
  27. package/dist/client/_coffre/assets/settings-D2zp1Ssu.js +1 -0
  28. package/dist/client/_coffre/assets/suspense-C7KwSnTG.js +1 -0
  29. package/dist/client/_coffre/assets/tokens._token-DWmbqzNk.js +2 -0
  30. package/dist/client/_coffre/assets/tokens._token-Dui_4KfS.js +1 -0
  31. package/dist/client/_coffre/assets/tokens.index-CSi5Wxwf.js +1 -0
  32. package/dist/client/_coffre/assets/ui-BdipqGpP.js +46 -0
  33. package/dist/client/_coffre/assets/unregistered-CA7B4C1m.js +1 -0
  34. package/dist/client/_coffre/assets/use-action-DRm9yVhV.js +1 -0
  35. package/dist/client/_coffre/assets/use-change-BRRMJocl.js +1 -0
  36. package/dist/client/_coffre/assets/use-shell-BMGlJ25Q.js +1 -0
  37. package/dist/client/_coffre/assets/useQuery-D__2KBOs.js +1 -0
  38. package/dist/client/_coffre/assets/useSuspenseQuery-CSXyDALB.js +1 -0
  39. package/dist/client/_coffre/assets/users._user-BkNrX7Qf.js +1 -0
  40. package/dist/client/_coffre/assets/users._user-jbSvtdOg.js +2 -0
  41. package/dist/client/_coffre/assets/users.index-CKnQ1G76.js +1 -0
  42. package/dist/server/.vite/manifest.json +343 -246
  43. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-Dx-c3XVk.js +162 -0
  44. package/dist/server/_coffre/assets/{account-CUQYGCYh.js → account-BocTPU1J.js} +150 -117
  45. package/dist/server/_coffre/assets/{account-DMlUoBxQ.js → account-CL8hOGhO.js} +10 -24
  46. package/dist/server/_coffre/assets/{affordances-BNaXjMOb.js → affordances-CKANXDTG.js} +2 -22
  47. package/dist/server/_coffre/assets/{async-local-storage-C0cwgkEr.js → async-local-storage-C10uQtMM.js} +3 -2
  48. package/dist/server/_coffre/assets/{audit-CCdSLmvK.js → audit-Bcka4vA6.js} +46 -16
  49. package/dist/server/_coffre/assets/audit-CSRQYIhu.js +31 -0
  50. package/dist/server/_coffre/assets/{auth.device-C05u5ROO.js → auth.device-CMcUISZY.js} +7 -5
  51. package/dist/server/_coffre/assets/{auth.device-BoFM1jcf.js → auth.device-DqO0T-rU.js} +5 -5
  52. package/dist/server/_coffre/assets/{directory-GsnYkse0.js → directory-CyYx6Jx1.js} +87 -112
  53. package/dist/server/_coffre/assets/{use-action-DwEmf58L.js → dist-CnnV3t2g.js} +3 -48
  54. package/dist/server/_coffre/assets/globals-CKBoTlyH.css +1 -0
  55. package/dist/server/_coffre/assets/grants-CRijabX0.js +158 -0
  56. package/dist/server/_coffre/assets/{page-BdnhpwvH.js → icons-Dy-5ccDF.js} +3 -196
  57. package/dist/server/_coffre/assets/lazyRouteComponent-CqBNCGuZ.js +480 -0
  58. package/dist/server/_coffre/assets/link-42ZWdjzZ.js +422 -0
  59. package/dist/server/_coffre/assets/{login-DUtCQju5.js → login-BI9tzJEy.js} +7 -5
  60. package/dist/server/_coffre/assets/{login-B2njIq_o.js → login-C-v88YwP.js} +2 -2
  61. package/dist/server/_coffre/assets/matchContext-qLfYbC6_.js +56 -0
  62. package/dist/server/_coffre/assets/{offboarding-8yMa7ViM.js → offboarding-1H0LavTd.js} +6 -4
  63. package/dist/server/_coffre/assets/page-D_mO0-sn.js +3592 -0
  64. package/dist/server/_coffre/assets/{principal-page-B8zPcS2b.js → principal-page-DQDoXute.js} +51 -42
  65. package/dist/server/_coffre/assets/{projects._project._environment-BZ5Z80V8.js → projects._project._environment-C-yVwC92.js} +168 -248
  66. package/dist/server/_coffre/assets/{projects._project._environment-DdIOc7wx.js → projects._project._environment-D_5R40of.js} +4 -11
  67. package/dist/server/_coffre/assets/{projects._project.index-CuEAUwGn.js → projects._project.index-A2BImFIT.js} +134 -96
  68. package/dist/server/_coffre/assets/{projects._project.index-DvbcU1kh.js → projects._project.index-BPPKxKrt.js} +5 -4
  69. package/dist/server/_coffre/assets/{projects.index-5HI0wOuG.js → projects.index-543IsPzY.js} +57 -55
  70. package/dist/server/_coffre/assets/{react-dom-qCTiwGGR.js → react-dom-bBoJXlK2.js} +417 -51
  71. package/dist/server/_coffre/assets/{router-CQDoql8s.js → router-CM3vK8QO.js} +376 -92
  72. package/dist/server/_coffre/assets/row-state-XBtDoIA4.js +117 -0
  73. package/dist/server/_coffre/assets/{settings-BVz78wjP.js → settings-BLVU74ym.js} +8 -6
  74. package/dist/server/_coffre/assets/suspense-CzYTwxOj.js +602 -0
  75. package/dist/server/_coffre/assets/tokens._token-B-hBgwBW.js +10 -0
  76. package/dist/server/_coffre/assets/{tokens._token-CWs3Mtki.js → tokens._token-aubAUonP.js} +97 -79
  77. package/dist/server/_coffre/assets/{tokens.index-Ck0LN7aC.js → tokens.index-4D3jwp5v.js} +9 -6
  78. package/dist/server/_coffre/assets/{ui-D_slKpSF.js → ui-BI3Bf72q.js} +7 -836
  79. package/dist/server/_coffre/assets/{unregistered-Z17da4Rc.js → unregistered-CagDxMyw.js} +5 -3
  80. package/dist/server/_coffre/assets/use-action-tzBZvjjQ.js +47 -0
  81. package/dist/server/_coffre/assets/use-change-Dggqxy5y.js +1212 -0
  82. package/dist/server/_coffre/assets/use-shell-CwStDfzX.js +462 -0
  83. package/dist/server/_coffre/assets/useQuery-C6_dBjem.js +8 -0
  84. package/dist/server/_coffre/assets/{useStore-DWGPqzXR.js → useRouter-CaUSUNsw.js} +1 -420
  85. package/dist/server/_coffre/assets/useSuspenseQuery-BuapQt_P.js +117 -0
  86. package/dist/server/_coffre/assets/{users._user-CMwj-VI9.js → users._user-137WNyxn.js} +4 -5
  87. package/dist/server/_coffre/assets/users._user-C252Iilj.js +10 -0
  88. package/dist/server/_coffre/assets/{users.index-fWHv6A30.js → users.index-DQHsfnal.js} +9 -6
  89. package/dist/server/index.js +6 -5
  90. package/package.json +5 -3
  91. package/src/components/directory.tsx +75 -104
  92. package/src/components/grants.tsx +60 -112
  93. package/src/components/principal-page.tsx +54 -67
  94. package/src/components/principal-picker.tsx +7 -16
  95. package/src/components/row-state.tsx +95 -0
  96. package/src/components/service-tokens.tsx +75 -64
  97. package/src/components/shell.tsx +1 -1
  98. package/src/components/syncs.tsx +42 -26
  99. package/src/lib/announce.ts +36 -0
  100. package/src/lib/changes.ts +498 -0
  101. package/src/lib/optimistic.ts +233 -0
  102. package/src/lib/queries.ts +393 -0
  103. package/src/lib/use-action.ts +20 -15
  104. package/src/lib/use-change.ts +42 -0
  105. package/src/lib/use-shell.ts +17 -0
  106. package/src/router.tsx +17 -9
  107. package/src/routes/__root.tsx +8 -38
  108. package/src/routes/account.tsx +163 -154
  109. package/src/routes/audit.tsx +51 -72
  110. package/src/routes/auth.device.tsx +4 -2
  111. package/src/routes/login.tsx +3 -2
  112. package/src/routes/projects.$project.$environment.tsx +226 -231
  113. package/src/routes/projects.$project.index.tsx +136 -118
  114. package/src/routes/projects.index.tsx +117 -145
  115. package/src/routes/settings.tsx +7 -7
  116. package/src/routes/tokens.$token.tsx +14 -17
  117. package/src/routes/tokens.index.tsx +8 -4
  118. package/src/routes/unregistered.tsx +3 -2
  119. package/src/routes/users.$user.tsx +4 -4
  120. package/src/routes/users.index.tsx +8 -4
  121. package/src/styles/globals.css +78 -1
  122. package/dist/client/_coffre/assets/account-B48wuSF8.js +0 -1
  123. package/dist/client/_coffre/assets/account-BkNyIDT7.js +0 -2
  124. package/dist/client/_coffre/assets/affordances-CmoY-8Xf.js +0 -1
  125. package/dist/client/_coffre/assets/audit-BvwKYb-5.js +0 -2
  126. package/dist/client/_coffre/assets/audit-D02H-zxS.js +0 -1
  127. package/dist/client/_coffre/assets/auth.device-DYOONgFF.js +0 -2
  128. package/dist/client/_coffre/assets/coffre-BBp7cKVa.js +0 -1
  129. package/dist/client/_coffre/assets/directory-Bu0EIxqI.js +0 -1
  130. package/dist/client/_coffre/assets/globals-Bh2x1gBM.css +0 -1
  131. package/dist/client/_coffre/assets/grants-DavcwofW.js +0 -1
  132. package/dist/client/_coffre/assets/index-CDPlq5rM.js +0 -12
  133. package/dist/client/_coffre/assets/login-C-wTm_t1.js +0 -2
  134. package/dist/client/_coffre/assets/login-CLLv1om9.js +0 -1
  135. package/dist/client/_coffre/assets/offboarding-DWsE2FSa.js +0 -1
  136. package/dist/client/_coffre/assets/page-DbSS7pYH.js +0 -1
  137. package/dist/client/_coffre/assets/preload-helper-DduCCcmc.js +0 -46
  138. package/dist/client/_coffre/assets/principal-page-Bp_iwuSd.js +0 -1
  139. package/dist/client/_coffre/assets/projects._project._environment-BMeX_B8l.js +0 -2
  140. package/dist/client/_coffre/assets/projects._project._environment-CT0A-hIU.js +0 -3
  141. package/dist/client/_coffre/assets/projects._project.index-C_xYOGLT.js +0 -2
  142. package/dist/client/_coffre/assets/projects._project.index-Chcf-cUd.js +0 -1
  143. package/dist/client/_coffre/assets/projects.index-CfOtb1X5.js +0 -2
  144. package/dist/client/_coffre/assets/projects.index-DSjOhLDh.js +0 -1
  145. package/dist/client/_coffre/assets/settings-BC9cUJNK.js +0 -1
  146. package/dist/client/_coffre/assets/settings-Bkj_E21y.js +0 -2
  147. package/dist/client/_coffre/assets/tokens._token-BA0KqvaW.js +0 -1
  148. package/dist/client/_coffre/assets/tokens._token-Dh9jLOkm.js +0 -2
  149. package/dist/client/_coffre/assets/tokens.index-BgAMWkHT.js +0 -2
  150. package/dist/client/_coffre/assets/tokens.index-CHueIAv1.js +0 -1
  151. package/dist/client/_coffre/assets/unregistered-D5go1AfR.js +0 -1
  152. package/dist/client/_coffre/assets/use-action-l__xZDYY.js +0 -1
  153. package/dist/client/_coffre/assets/users._user-Dwqa0gv5.js +0 -1
  154. package/dist/client/_coffre/assets/users._user-xJAb3T6Y.js +0 -2
  155. package/dist/client/_coffre/assets/users.index-BJoF-L37.js +0 -2
  156. package/dist/client/_coffre/assets/users.index-YUjtbTGy.js +0 -1
  157. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-BKg2AlPu.js +0 -133
  158. package/dist/server/_coffre/assets/audit-CThXn2v7.js +0 -74
  159. package/dist/server/_coffre/assets/coffre-C2ANsTAz.js +0 -281
  160. package/dist/server/_coffre/assets/globals-Bh2x1gBM.css +0 -1
  161. package/dist/server/_coffre/assets/grants-B6k4Fu9z.js +0 -243
  162. package/dist/server/_coffre/assets/projects.index-uiomWX_l.js +0 -54
  163. package/dist/server/_coffre/assets/settings-4oRyDizv.js +0 -18
  164. package/dist/server/_coffre/assets/tokens._token-CF_deAwq.js +0 -18
  165. package/dist/server/_coffre/assets/tokens.index-DF_07KEe.js +0 -10
  166. package/dist/server/_coffre/assets/users._user-DUzwkSKT.js +0 -10
  167. package/dist/server/_coffre/assets/users.index-BbuweTwH.js +0 -10
@@ -0,0 +1 @@
1
+ import{Q as e,U as t,V as n,Z as r,et as i}from"./page-CGmvjSy4.js";var a=e((e=>{var t=r();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(n(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return s(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.7`})),o=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=a()}));function s(e){return e[e.length-1]}function c(e){return typeof e==`function`}function l(e,t){return c(e)?e(t):e}var u=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable;function f(e){for(let t in e)if(u.call(e,t))return!0;return!1}var p=()=>Object.create(null),m=(e,t)=>h(e,t,p);function h(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=y(e)&&y(i);if(!a&&!(_(e)&&_(i)))return i;let o=a?e:g(e);if(!o)return i;let s=a?i:g(i);if(!s)return i;let c=o.length,l=s.length,d=a?Array(l):n(),f=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],p=i[o];if(l===p){d[o]=l,(a?t<c:u.call(e,o))&&f++;continue}if(l===null||p===null||typeof l!=`object`||typeof p!=`object`){d[o]=p;continue}let m=h(l,p,n,r+1);d[o]=m,m===l&&f++}return c===l&&f===c?e:d}function g(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!d.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!d.call(e,t))return!1;r.push(t)}return r}function _(e){if(!v(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!v(n)||!n.hasOwnProperty(`isPrototypeOf`))}function v(e){return Object.prototype.toString.call(e)===`[object Object]`}function y(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function b(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!b(e[r],t[r],n))return!1;return!0}if(_(e)&&_(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!b(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!b(e[o],t[o],n)))return!1;return i===a}return!1}function x(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function S(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}function C(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}var w=/[\x00-\x1f\x7f"<>`{}]/g;function T(e){return e.replace(w,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function E(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return T(t)}var D=[`http:`,`https:`,`mailto:`,`tel:`];function ee(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}var O={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},k=/[&><\u2028\u2029]/g;function te(e){return e.replace(k,e=>O[e])}function ne(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=E(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=E(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function re(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function ie(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function ae(){throw Error(`Invariant failed`)}function A(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var j=4,oe=5;function se(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function ce(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=se(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function M(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=ce(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=F(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=F(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=I(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=I(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=I(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=F(n.fullPath??n.from);e.kind=oe,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=F(n.fullPath??n.from);e.kind=j,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)M(e,t,r,s,i,a,o)}function N(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function P(e){if(e.pathless)for(let t of e.pathless)P(t);if(e.static)for(let t of e.static.values())P(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())P(t);if(e.dynamic?.length){e.dynamic.sort(N);for(let t of e.dynamic)P(t)}if(e.optional?.length){e.optional.sort(N);for(let t of e.optional)P(t)}if(e.wildcard?.length){e.wildcard.sort(N);for(let t of e.wildcard)P(t)}}function F(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function I(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function le(e,t){let n=F(`/`),r=new Uint16Array(6);for(let t of e)M(!1,r,t,1,n,0);P(n),t.masksTree=n,t.flatCache=A(1e3)}function ue(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=V(e,t.masksTree);return t.flatCache.set(e,r),r}function L(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=F(`/`),M(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),V(r,o,n)}function R(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=V(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=U(a.route)),t.matchCache.set(r,a),a}function z(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function B(e,t=!1,n){let r=F(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return M(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&ae(),a[e.id]=e,s!==0&&e.path){let t=z(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),P(r),{processedTree:{segmentTree:r,singleCache:A(1e3),matchCache:A(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function V(e,t,n=!1){let r=e.split(`/`),i=fe(e,r,t,n);if(!i)return null;let[a]=H(e,r,i);return{route:i.node.route,rawParams:a}}function H(e,t,n){let r=de(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===j)break;if(u.kind===oe){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function U(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function de(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function fe(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!s(t),a=i&&e!==`/`,o=t.length-+!!i,c=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],l=null,u=null;for(;c.length;){let n=c.pop(),{node:i,index:s,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!q(u,n))continue;if(i.parse){if(!K(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==j&&q(l,n)&&(l=n);let v=s===o;if(v&&(i.route&&(!a||i.kind===j||i.kind===2)&&q(u,n)&&(u=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[s],b;if(v&&i.index){let n={node:i.index,index:s,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(K(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&G(p,o))return n;q(u,n)&&(u=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(s).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}c.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];c.push({node:r,index:s,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}c.push({node:n,index:s+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+W(o,s),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}c.push({node:t,index:s+1,skipped:d,depth:f+1,statics:p,dynamics:m+W(o,s),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&c.push({node:e,index:s+1,skipped:d,depth:f+1,statics:p+W(o,s),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&c.push({node:e,index:s+1,skipped:d,depth:f+1,statics:p+W(o,s),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];c.push({node:n,index:s,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(u)return u;if(r&&l){let n=l.index;for(let e=0;e<l.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return l.rawParams??=Object.create(null),l.rawParams[`**`]=decodeURIComponent(r),l}return null}function W(e,t){return 2**(e-t-1)}function G(e,t){return e===2**(t-1)-1}function K(e,t,n){let r,i;try{[r,i]=H(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function q(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===j)>(e.node.kind===j)||t.node.kind===j==(e.node.kind===j)&&t.depth>e.depth)))}function pe(e){return J(e.filter(e=>e!==void 0).join(`/`))}function J(e){return e.replace(/\/{2,}/g,`/`)}function me(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function Y(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function he(e){return Y(me(e))}function X(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function ge(e,t,n){return X(e,n)===X(t,n)}function _e({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let c;if(a)c=e.split(`/`);else if(i)c=t.split(`/`);else{for(c=e.split(`/`);c.length>1&&s(c)===``;)c.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&c.push(r):c=[r]:r===`..`?c.pop():r===`.`||c.push(r)}}c.length>1&&(s(c)===``?n===`never`&&c.pop():n===`always`&&c.push(``));let l=J(c.join(`/`))||`/`;return o&&r&&r.set(o,l),l}function ve(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function ye(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>xe(e,n)).join(`/`):xe(r,n):r}function be({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=ce(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=ye(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=ye(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=ye(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function xe(e,t){let n=encodeURIComponent(e);return t?.(n)??n}var Se=`Error preloading route! ☝️`,Z=i(r(),1),Ce=Z.use,we=typeof window<`u`?Z.useLayoutEffect:Z.useEffect;function Te(e){let t=Z.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function Ee(e,t,n={},r={}){Z.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function De(e){let t=Z.useRef(null);return Z.useImperativeHandle(e,()=>t.current,[]),t}var Oe=t();function ke({children:e,fallback:t=null}){return Ae()?(0,Oe.jsx)(Z.Fragment,{children:e}):(0,Oe.jsx)(Z.Fragment,{children:t})}function Ae(){return Z.useSyncExternalStore(je,()=>!0,()=>!1)}function je(){return()=>{}}var Me=e((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Ne=e(((e,t)=>{t.exports=Me()})),Pe=e((e=>{var t=r(),n=Ne();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),Fe=e(((e,t)=>{t.exports=Pe()}))();function Ie(e,t){return e===t}function Le(e,t,n=Ie){let r=(0,Z.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,Z.useCallback)(()=>e?.get(),[e]);return(0,Fe.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Re=i(o(),1);function ze(e,t){let r=n(),i=De(t),{activeProps:a,inactiveProps:o,activeOptions:s,to:c,preload:u,preloadDelay:d,preloadIntentProximity:f,hashScrollIntoView:p,replace:m,startTransition:h,resetScroll:g,viewTransition:_,children:v,target:y,disabled:x,style:S,className:C,onClick:w,onBlur:T,onFocus:E,onMouseEnter:D,onMouseLeave:O,onTouchStart:k,ignoreBlocker:te,params:ne,search:re,hash:ie,state:ae,mask:A,reloadDocument:j,unsafeRelative:oe,from:se,_fromLocation:ce,...M}=e,N=Ae(),P=Z.useMemo(()=>e,[r,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),F=Le(r.stores.location,e=>e,(e,t)=>e.href===t.href),I=Z.useMemo(()=>{let e={_fromLocation:F,...P};return r.buildLocation(e)},[r,F,P]),le=I.maskedLocation?I.maskedLocation.publicHref:I.publicHref,ue=I.maskedLocation?I.maskedLocation.external:I.external,L=Z.useMemo(()=>Ke(le,ue,r.history,x),[x,ue,le,r.history]),R=Z.useMemo(()=>{if(L?.external)return ee(L.href,r.protocolAllowlist)?void 0:L.href;if(!qe(c)&&!(typeof c!=`string`||c.indexOf(`:`)===-1))try{return new URL(c),ee(c,r.protocolAllowlist)?void 0:c}catch{}},[c,L,r.protocolAllowlist]),z=Z.useMemo(()=>{if(R)return!1;if(s?.exact){if(!ge(F.pathname,I.pathname,r.basepath))return!1}else{let e=X(F.pathname,r.basepath),t=X(I.pathname,r.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(s?.includeSearch??!0)&&!b(F.search,I.search,{partial:!s?.exact,ignoreUndefined:!s?.explicitUndefined})?!1:!s?.includeHash||N&&F.hash===I.hash},[s?.exact,s?.explicitUndefined,s?.includeHash,s?.includeSearch,F,R,N,I.hash,I.pathname,I.search,r.basepath]),B=z?l(a,{})??Ve:Be,V=z?Be:l(o,{})??Be,H=[C,B.className,V.className].filter(Boolean).join(` `),U=(S||B.style||V.style)&&{...S,...B.style,...V.style},[de,fe]=Z.useState(!1),W=Z.useRef(!1),G=e.reloadDocument||R?!1:u??r.options.defaultPreload,K=d??r.options.defaultPreloadDelay??0,q=Z.useCallback(()=>{r.preloadRoute({...P,_builtLocation:I}).catch(e=>{console.warn(e),console.warn(Se)})},[r,P,I]);Ee(i,Z.useCallback(e=>{e?.isIntersecting&&q()},[q]),Ge,{disabled:!!x||G!==`viewport`}),Z.useEffect(()=>{W.current||!x&&G===`render`&&(q(),W.current=!0)},[x,q,G]);let pe=e=>{let t=e.currentTarget.getAttribute(`target`),n=y===void 0?t:y;if(!x&&!Ye(e)&&!e.defaultPrevented&&(!n||n===`_self`)&&e.button===0){e.preventDefault(),(0,Re.flushSync)(()=>{fe(!0)});let t=r.subscribe(`onResolved`,()=>{t(),fe(!1)});r.navigate({...P,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:te})}};if(R)return{...M,ref:i,href:R,...v&&{children:v},...y&&{target:y},...x&&{disabled:x},...S&&{style:S},...C&&{className:C},...w&&{onClick:w},...T&&{onBlur:T},...E&&{onFocus:E},...D&&{onMouseEnter:D},...O&&{onMouseLeave:O},...k&&{onTouchStart:k}};let J=e=>{if(x||G!==`intent`)return;if(!K){q();return}let t=e.currentTarget;if(Q.has(t))return;let n=setTimeout(()=>{Q.delete(t),q()},K);Q.set(t,n)},me=e=>{x||G!==`intent`||q()},Y=e=>{if(x||!G||!K)return;let t=e.currentTarget,n=Q.get(t);n&&(clearTimeout(n),Q.delete(t))};return{...M,...B,...V,href:L?.href,ref:i,onClick:$([w,pe]),onBlur:$([T,Y]),onFocus:$([E,J]),onMouseEnter:$([D,J]),onMouseLeave:$([O,Y]),onTouchStart:$([k,me]),disabled:!!x,target:y,...U&&{style:U},...H&&{className:H},...x&&He,...z&&Ue,...N&&de&&We}}var Be={},Ve={className:`active`},He={role:`link`,"aria-disabled":!0},Ue={"data-status":`active`,"aria-current":`page`},We={"data-transitioning":`transitioning`},Q=new WeakMap,Ge={rootMargin:`100px`},$=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Ke(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function qe(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Je=Z.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=ze(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return Z.createElement(`a`,t,o)}return Z.createElement(n,a,o)});function Ye(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}export{te as A,ae as C,ne as D,x as E,C as F,s as I,m as L,f as M,ee as N,b as O,S as P,h as R,A as S,ie as T,ue as _,Ce as a,le as b,J as c,pe as d,_e as f,U as g,Y as h,Ae as i,l as j,re as k,ve as l,me as m,Le as n,we as o,he as p,ke as r,Te as s,Je as t,be as u,R as v,D as w,B as x,L as y,o as z};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/login-DrMgvqZn.js","_coffre/assets/page-CGmvjSy4.js","_coffre/assets/use-shell-BMGlJ25Q.js","_coffre/assets/suspense-C7KwSnTG.js","_coffre/assets/ui-BdipqGpP.js","_coffre/assets/link-DP8SVWon.js","_coffre/assets/icons-BQ27Ds9u.js","_coffre/assets/signin-errors-CroZWZgm.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t,t as n}from"./preload-helper-ClBkJ19f.js";var r=t(`/login`)({validateSearch:e=>{let t={},{next:n,error:r}=e;return typeof n==`string`&&n.startsWith(`/`)&&!n.startsWith(`//`)&&(t.next=n),typeof r==`string`&&/^[a-z_]{1,40}$/.test(r)&&(t.error=r),t},component:e(()=>n(()=>import(`./login-DrMgvqZn.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),`component`)});export{r as t};
@@ -0,0 +1 @@
1
+ import{U as e,Z as t,et as n,n as r}from"./page-CGmvjSy4.js";import{t as i}from"./use-shell-BMGlJ25Q.js";import{a,c as o}from"./ui-BdipqGpP.js";import{L as s,N as c,S as l}from"./icons-BQ27Ds9u.js";import{t as u}from"./login-CeaxDMcr.js";import{t as d}from"./signin-errors-CroZWZgm.js";var f=n(t()),p=e();function m(){let{signin:e,access:t}=i().auth;return e===null?t?.assertion?(0,p.jsx)(g,{}):(0,p.jsx)(h,{}):(0,p.jsx)(_,{...e})}function h(){return(0,p.jsxs)(r,{icon:(0,p.jsx)(l,{size:18}),label:`Cloudflare Access`,title:`Open coffre through Access`,children:[(0,p.jsx)(`p`,{children:`This instance has no sign-in of its own. Cloudflare Access authenticates you before a request ever reaches coffre, and this request arrived without an Access assertion.`}),(0,p.jsx)(`p`,{children:`Use the Access-protected hostname. A request straight to the origin is refused by design.`})]})}function g(){return(0,p.jsxs)(r,{icon:(0,p.jsx)(s,{size:18}),label:`Cloudflare Access`,title:`Your identity could not be confirmed`,children:[(0,p.jsx)(`p`,{children:`Cloudflare Access forwarded an identity assertion, but coffre could not verify it. The Access session may have expired, or the identity verifier may be unavailable.`}),(0,p.jsx)(`p`,{children:`Reopen coffre through its Access-protected hostname. If this keeps happening, tell whoever operates coffre.`})]})}function _({title:e,note:t,providers:n}){let{next:r,error:i}=u.useSearch(),s=d(i),[l,m]=(0,f.useState)(null),h=r===void 0?``:`?next=${encodeURIComponent(r)}`;return(0,p.jsxs)(`section`,{className:`card signin`,"aria-labelledby":`signin-title`,children:[(0,p.jsxs)(`div`,{className:`signin-head`,children:[(0,p.jsx)(`h1`,{className:`signin-title`,id:`signin-title`,children:e}),(0,p.jsx)(`p`,{className:`signin-lede`,children:t??`Sign in with your organization’s account. Only people an owner has invited can get in.`})]}),s!==null&&(0,p.jsx)(`div`,{className:`signin-error`,children:(0,p.jsx)(a,{error:s})}),n.length===0?(0,p.jsxs)(`p`,{className:`signin-empty`,children:[`No sign-in provider is configured. Whoever runs coffre lists them in`,` `,(0,p.jsxs)(`span`,{className:`mono`,children:[`signin(`,`{`,` providers `,`}`,`)`]}),`.`]}):(0,p.jsx)(`ul`,{className:`providers`,children:n.map(e=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(`a`,{className:`btn provider`,href:`/auth/signin/${encodeURIComponent(e.id)}${h}`,"aria-busy":l===e.id,onClick:()=>m(e.id),children:[(0,p.jsx)(`span`,{className:`provider-mark`,"aria-hidden":!0,children:l===e.id?(0,p.jsx)(o,{}):(0,p.jsx)(c,{brand:e.brand})}),`Continue with `,e.label]})},e.id))})]})}export{m as component};
@@ -0,0 +1 @@
1
+ import{U as e,t}from"./page-CGmvjSy4.js";import{t as n}from"./link-DP8SVWon.js";import{i as r,l as i,s as a}from"./ui-BdipqGpP.js";import{G as o,H as s,s as c,v as l}from"./icons-BQ27Ds9u.js";import{s as u}from"./directory-nDExpkAz.js";var d=e();function f({report:e}){let t=e.status===`removed`,n=e.principalType===`user`;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h,{report:e,removed:t,person:n}),e.syncs.length>0&&(0,d.jsx)(g,{report:e,person:n}),e.issuedTokens.length>0&&(0,d.jsx)(_,{report:e})]})}function p({report:e}){let t=e.principalType===`user`;return(0,d.jsx)(`div`,{className:`report-notice`,children:(0,d.jsxs)(a,{children:[`Removed`,e.removedBy!==null&&(0,d.jsxs)(d.Fragment,{children:[` `,`by `,(0,d.jsx)(`span`,{className:`mono`,children:e.removedBy})]}),e.removedAt!==null&&(0,d.jsxs)(d.Fragment,{children:[` `,`on `,(0,d.jsx)(i,{iso:e.removedAt})]}),`.`,` `,t?`Their project access, sessions, CLI logins and linked sign-in accounts were revoked at the same time, so adding them again starts from nothing.`:`Its project access and every token issued to it were revoked at the same time, so adding it again starts from nothing.`]})})}function m({principalType:e,removed:t}){let n=e===`user`,r=t.filter(t=>t.principalType===e);return r.length===0?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`h2`,{className:`section-title`,children:`Removed`}),(0,d.jsx)(`section`,{className:`card`,"aria-label":n?`Removed users`:`Removed tokens`,children:(0,d.jsx)(`div`,{className:`dt-wrap`,children:(0,d.jsxs)(`table`,{className:`dt directory stacks`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{className:`n`,children:`#`}),(0,d.jsx)(`th`,{className:`col-principal`,children:(0,d.jsxs)(`span`,{className:`th`,children:[n?(0,d.jsx)(o,{size:14}):(0,d.jsx)(l,{size:14}),n?`Email`:`Name`]})}),(0,d.jsx)(`th`,{className:`col-role`,children:`Still to rotate`}),(0,d.jsx)(`th`,{className:`col-actions`,children:(0,d.jsx)(`span`,{className:`visually-hidden`,children:`Report`})})]})}),(0,d.jsx)(`tbody`,{children:r.map((e,t)=>(0,d.jsxs)(`tr`,{className:`row-link`,children:[(0,d.jsx)(`td`,{className:`n`,children:t+1}),(0,d.jsx)(`td`,{className:`col-lead`,"data-label":n?`Email`:`Name`,children:(0,d.jsx)(u,{type:e.principalType,id:e.principalId,stretch:!0})}),(0,d.jsx)(`td`,{className:`col-role`,"data-label":`Still to rotate`,children:e.toRotate===0?(0,d.jsx)(`span`,{className:`cell-muted`,children:`Nothing`}):`${e.toRotate} ${e.toRotate===1?`value`:`values`}`}),(0,d.jsx)(`td`,{className:`col-actions col-open cell-muted`,"aria-hidden":`true`,children:(0,d.jsx)(c,{size:16})})]},e.principalId))})]})})}),(0,d.jsxs)(`p`,{className:`hint section-foot`,children:[n?`They`:`These`,` can no longer sign in. Each page lists the values`,` `,n?`they`:`it`,` saw that nobody has changed since.`]})]})}function h({report:e,removed:a,person:o}){let s=o?`they`:`it`,c=a?`Values ${s} read or wrote that nobody has changed since, so ${s} may still hold them. Rotate each where it comes from, such as a new API key or database password, then save the new value here and it leaves this list.`:`Current values ${s} ${o?`have`:`has`} read or written: the ones to rotate if ${s} ${o?`leave`:`is retired`}. Saving a new version takes a value off.`;return(0,d.jsx)(t,{labelledBy:`seen-values`,title:a?`Still to rotate`:`Values seen`,description:c,actions:e.rotated>0&&(0,d.jsxs)(`span`,{className:`card-aside`,children:[e.rotated,` already rotated`]}),children:e.exposed.length===0?(0,d.jsx)(r,{title:a?`Nothing left to rotate`:`No current values seen`,children:e.rotated>0?`Every value ${s} saw has had a new version since.`:`${o?`They have`:`It has`} not read or written a value that is still current.`}):(0,d.jsx)(`div`,{className:`dt-wrap`,children:(0,d.jsxs)(`table`,{className:`dt report-values`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{children:`Secret`}),(0,d.jsx)(`th`,{className:`col-shrink`,children:`Version`}),(0,d.jsx)(`th`,{className:`col-shrink`,children:`Last seen`})]})}),(0,d.jsx)(`tbody`,{children:e.exposed.map(e=>(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`td`,{children:(0,d.jsxs)(n,{className:`cell-link mono`,to:`/projects/$project/$environment`,params:{project:e.project,environment:e.environment},search:{filter:e.key},children:[(0,d.jsxs)(`span`,{className:`report-path`,children:[e.project,`/`,e.environment,`/`]}),e.key]})}),(0,d.jsxs)(`td`,{className:`col-shrink cell-mono cell-muted`,children:[`v`,e.version]}),(0,d.jsxs)(`td`,{className:`col-shrink nowrap`,children:[e.how===`wrote`?`Wrote`:`Read`,` `,(0,d.jsx)(i,{iso:e.at,display:`relative`})]})]},`${e.project}/${e.environment}/${e.key}`))})]})})})}function g({report:e,person:r}){return(0,d.jsx)(t,{labelledBy:`created-syncs`,title:r?`Syncs they set up`:`Syncs it set up`,description:`A sync keeps pushing every change to the destination it names, whoever set it up. Check each one still points somewhere you control.`,children:(0,d.jsx)(`div`,{className:`dt-wrap`,children:(0,d.jsxs)(`table`,{className:`dt syncs`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{children:`Destination`}),(0,d.jsx)(`th`,{className:`col-shrink`,children:`From`}),(0,d.jsx)(`th`,{className:`col-shrink col-hide-narrow`,children:`Token`})]})}),(0,d.jsx)(`tbody`,{children:e.syncs.map(e=>(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`td`,{children:(0,d.jsxs)(`span`,{className:`cell-account`,children:[(0,d.jsx)(s,{brand:e.brand,size:15}),(0,d.jsxs)(`span`,{className:`cell-stack`,children:[(0,d.jsxs)(`span`,{children:[e.providerLabel,e.paused&&(0,d.jsx)(`span`,{className:`tag`,children:`Paused`})]}),(0,d.jsx)(`small`,{className:`mono`,children:e.destination})]})]})}),(0,d.jsx)(`td`,{className:`col-shrink`,children:(0,d.jsxs)(n,{className:`cell-link mono`,to:`/projects/$project/$environment`,params:{project:e.project,environment:e.environment},children:[e.project,`/`,e.environment]})}),(0,d.jsx)(`td`,{className:`col-shrink col-hide-narrow cell-mono cell-muted`,children:e.credential})]},e.id))})]})})})}function _({report:e}){return(0,d.jsx)(t,{labelledBy:`issued-tokens`,title:`Tokens they issued`,description:`Service tokens they created that still work. Each was shown to them once, when it was made; revoke any they may have kept a copy of.`,children:(0,d.jsx)(`div`,{className:`dt-wrap`,children:(0,d.jsxs)(`table`,{className:`dt report-tokens`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{children:`Token`}),(0,d.jsx)(`th`,{className:`col-shrink`,children:`Expires`}),(0,d.jsx)(`th`,{className:`col-shrink col-hide-narrow`,children:`Last used`})]})}),(0,d.jsx)(`tbody`,{children:e.issuedTokens.map(e=>(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`td`,{children:(0,d.jsxs)(`span`,{className:`cell-stack`,children:[(0,d.jsx)(n,{className:`cell-link mono`,to:`/tokens/$token`,params:{token:e.service},children:e.service}),(0,d.jsxs)(`small`,{children:[e.label??`No label`,` · `,(0,d.jsx)(`span`,{className:`mono`,children:e.hint})]})]})}),(0,d.jsx)(`td`,{className:`col-shrink nowrap`,children:(0,d.jsx)(i,{iso:e.expiresAt,display:`relative`})}),(0,d.jsx)(`td`,{className:`col-shrink col-hide-narrow nowrap`,children:e.lastUsedAt===null?(0,d.jsx)(`span`,{className:`cell-muted`,children:`Never`}):(0,d.jsx)(i,{iso:e.lastUsedAt,display:`relative`})})]},e.id))})]})})})}export{m as n,p as r,f as t};
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function te(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,j(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(k,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+A(a,u),c+=j(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+A(a,u++),c+=j(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return j(te(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function N(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},F={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=F,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:N}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,P)}catch(e){P(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),d=o(((e,t)=>{t.exports=u()})),f=l(d(),1);function p(e){return Object.fromEntries(e.fields.map(e=>[e.name,e.type===`text`?``:e.initial]))}function m(e,t){if(e.type===`options`||e.when===void 0)return!0;let n=t[e.when.field],r=Array.isArray(n)?n:[];return r.length===e.when.is.length&&e.when.is.every(e=>r.includes(e))}function h(e,t){for(let n of e.fields){if(!m(n,t))continue;let e=t[n.name];if((typeof e==`string`?e.trim()===``:(e??[]).length===0)&&(n.type===`options`||n.optional!==!0))return n.label}return null}function g(e,t){let n={};for(let r of e.fields){if(!m(r,t))continue;let e=t[r.name];if(r.type===`options`){let t=Array.isArray(e)?e:[];n[r.name]=r.multiple?t:t[0]}else{let t=typeof e==`string`?e.trim():``;t!==``&&(n[r.name]=t)}}return n}var _=Symbol.for(`@coffre/client:CoffreError`),v=class extends Error{static[Symbol.hasInstance](e){return typeof e==`object`&&!!e&&_ in e}[_]=!0;status;code;reason;constructor(e,t,n,r){super(n),this.name=`CoffreError`,this.status=e,this.code=t,this.reason=r}};function y(e){let[t=``,n=``,r=``]=e.replace(/^\/+|\/+$/g,``).split(`/`);return{project:t,environment:n,key:r}}function b(e){let t=e.url.replace(/\/+$/,``),n=e.transport??(e=>fetch(e));async function r(r,i,a){let o=new URL(`${t}/api${i}`),s=new Headers(await e.headers?.()),c;if(r===`GET`)for(let[e,t]of Object.entries(a??{}))t!=null&&o.searchParams.set(e,String(t));else a!==void 0&&(s.set(`content-type`,`application/json`),c=JSON.stringify(a));let l=await n(new Request(o,{method:r,headers:s,body:c})),u=await l.json().catch(()=>null);if(!l.ok){let e=u;throw new v(l.status,typeof e?.error==`string`?e.error:`http_error`,typeof e?.message==`string`?e.message:`request failed with status ${l.status}`,typeof e?.reason==`string`?e.reason:void 0)}return u}function i(e,t){let[n,r]=e.split(` `);return[n,r.replace(/:(\w+)/g,(e,n)=>encodeURIComponent(t[n]))]}async function a(e,...[t,n]){let[a,o]=i(e,t);return await r(a,o,n)}return{call:a,auth:()=>r(`GET`,`/auth`,void 0),me:()=>a(`GET /me`,{}),projects:{list:()=>a(`GET /projects`,{}),create:(e,t)=>a(`PUT /projects/:project`,{project:e},t),update:(e,t)=>a(`PATCH /projects/:project`,{project:e},t)},environments:{create:(e,t)=>a(`PUT /projects/:project/:environment`,y(e),t),update:(e,t)=>a(`PATCH /projects/:project/:environment`,y(e),t)},secrets:{list:e=>a(`GET /secrets/:project/:environment`,y(e)),reveal:e=>a(`POST /reveals`,{},{path:e}),set:(e,t)=>a(`PATCH /secrets/:project/:environment`,y(e),t),dryRun:(e,t)=>{let[n,a]=i(`PATCH /secrets/:project/:environment`,y(e));return r(n,`${a}?dryRun=1`,t)},history:e=>a(`GET /secrets/:project/:environment/:key/versions`,y(e)),restore:(e,t)=>a(`POST /secrets/:project/:environment/:key/restore`,y(e),{version:t}),rename:(e,t)=>a(`PATCH /secrets/:project/:environment/:key`,y(e),{key:t}),update:(e,t)=>a(`PATCH /secrets/:project/:environment/:key`,y(e),t)},members:{list:e=>a(`GET /members`,{},{path:e}),get:e=>a(`GET /members/:member`,{member:e}),add:(e,t={})=>a(`PUT /members/:member`,{member:e},t),remove:e=>a(`DELETE /members/:member`,{member:e})},tokens:{list:e=>a(`GET /members/:member/tokens`,{member:e}),issue:(e,t)=>a(`POST /members/:member/tokens`,{member:e},t),revoke:(e,t)=>a(`DELETE /members/:member/tokens/:id`,{member:e,id:t})},access:{set:(e,t)=>a(`PATCH /access/:member`,{member:e},t)},sessions:{list:()=>a(`GET /sessions`,{}),revoke:e=>a(`DELETE /sessions/:id`,{id:e})},identities:{list:()=>a(`GET /identities`,{}),unlink:e=>a(`DELETE /identities/:id`,{id:e})},deviceLogins:{get:e=>a(`GET /device-logins/:code`,{code:e}),decide:(e,t)=>a(`POST /device-logins/:code`,{code:e},{approve:t})},syncs:{providers:()=>a(`GET /syncs/providers`,{}),list:e=>a(`GET /syncs/:project/:environment`,y(e)),add:(e,t)=>a(`POST /syncs/:project/:environment`,y(e),t),update:(e,t)=>a(`PATCH /syncs/by-id/:id`,{id:e},t),remove:e=>a(`DELETE /syncs/by-id/:id`,{id:e}),run:e=>a(`POST /syncs/by-id/:id/runs`,{id:e})},audit:{list:(e={})=>a(`GET /audit`,{},e),verify:()=>a(`GET /audit/verification`,{}),keys:()=>a(`GET /audit/keys`,{})}}}async function x(e,t,n){let r=Object.create(null);for(let{key:e,value:t}of n)r[e]=t;let[i,a]=await Promise.allSettled([e.secrets.list(t),e.secrets.dryRun(t,{...r})]);if(i.status===`rejected`)throw i.reason;if(a.status===`rejected`)throw a.reason;let[{keys:o},s]=[i.value,a.value],c=new Map(o.map(e=>[e.key,e.version])),l=[],u=Object.create(null);for(let[e,t]of Object.entries(r)){let n=s.keys[e];l.push({key:e,action:n,version:c.get(e)??null}),n!==`unchanged`&&(u[e]=t)}return{plan:l,changes:{...u}}}var S=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),C=o(((e,t)=>{t.exports=S()})),w=f.createContext(null);function T(e){return f.useContext(w)}var E={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},D=new class{#e=E;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function O(e){setTimeout(e,0)}var ee=typeof window>`u`||`Deno`in globalThis;function k(){}function A(e,t){return typeof e==`function`?e(t):e}function te(e){return typeof e==`number`&&e>=0&&e!==1/0}function j(e,t){return Math.max(e+(t||0)-Date.now(),0)}function M(e,t){return typeof e==`function`?e(t):e}function N(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==F(o,t.options))return!1}else if(!L(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function P(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(I(t.options.mutationKey)!==I(a))return!1}else if(!L(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function F(e,t){return(t?.queryKeyHashFn||I)(e)}function I(e){return JSON.stringify(e,(e,t)=>z(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function L(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!L(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!L(e[r],t[r]))return!1;return!0}return!1}var ne=Object.prototype.hasOwnProperty;function R(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ie(e)&&ie(t);if(!r&&!(z(e)&&z(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ne.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=R(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function re(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ie(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function z(e){if(!ae(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!ae(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function ae(e){return Object.prototype.toString.call(e)===`[object Object]`}function oe(e){return new Promise(t=>{D.setTimeout(t,e)})}function se(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:R(e,t)}function ce(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function le(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var B=Symbol();function ue(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===B?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function de(e,t){return typeof e==`function`?e(...t):!!e}function fe(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var pe=()=>ee,V=()=>pe(),H=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},U=new class extends H{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},me=O;function he(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=me,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var W=he(),G=new class extends H{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function ge(e){return Math.min(1e3*2**e,3e4)}function _e(e){return(e??`online`)!==`online`||G.isOnline()}var K=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ve(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(k);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new K(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>U.isFocused()&&(e.networkMode===`always`||G.isOnline())&&e.canRun(),p=()=>_e(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(V()?0:3),a=e.retryDelay??ge,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),oe(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var ye=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),te(this.gcTime)&&(this.#e=D.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(V()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(D.clearTimeout(this.#e),this.#e=void 0)}};function be(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{fe(e,()=>t.signal,()=>n=!0)},u=ue(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?le:ce;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Se:xe,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:xe(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function xe(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Se(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Ce=class extends ye{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ee(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ee(this.options);e.data!==void 0&&(this.setState(Te(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=se(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(k).catch(k):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>M(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===B||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>M(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!j(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ue(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?be(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=ve({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof K&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof K){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...we(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Te(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),W.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function we(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:_e(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Te(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ee(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var De=class extends ye{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Oe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=ve({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),W.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Oe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ke=class extends H{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new De({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=q(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=q(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=q(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=q(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){W.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>P(t,e))}findAll(e={}){return this.getAll().filter(t=>P(e,t))}notify(e){W.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return W.batch(()=>Promise.all(e.map(e=>e.continue().catch(k))))}};function q(e){return e.options.scope?.id}var Ae=class extends H{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??F(r,t),a=this.get(i);return a||(a=new Ce({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){W.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>N(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>N(e,t)):t}notify(e){W.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){W.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){W.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},je=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ae,this.#t=e.mutationCache||new ke,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=U.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=G.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(M(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=A(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return W.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;W.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return W.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=W.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(k).catch(k)}invalidateQueries(e,t={}){return W.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=W.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(k)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(k)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(M(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(M(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(k).catch(k)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(k).catch(k)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return G.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(I(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{L(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(I(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{L(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=F(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===B&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function J(e){return e}var Me={canManageGrants:!1,canReadAudit:!1,canCreateProject:!1};function Ne(e,t){if(e===null)return Me;let n=e.instanceRole===`owner`||e.instanceRole===`root-admin`;return{canManageGrants:n,canReadAudit:e.canReadAudit,canCreateProject:n}}function Pe(e){return e.includes(`secret.read`)}function Fe(){return T().options.context.client}var Ie=class extends Error{};function Y(e){return e instanceof v?e.status:void 0}function Le(e){return e instanceof Ie?e.message:e instanceof v?e.status===401?`Your session has ended. Sign in again, then retry.`:e.code===`cross_origin`?`coffre refused a change that did not come from this page. Reload, then retry.`:e.status===403?`You hold no grant that covers this. Someone with grant.manage on the project can add one.`:e.status===404?`Not found. It may have been renamed or archived.`:e.status===400||e.status===409?e.message:`coffre is unavailable. Nothing was read or written.`:`The request could not be sent. Nothing was changed.`}function Re(e){return{ok:!1,error:Le(e),signedOut:Y(e)===401}}async function X(e){try{return{ok:!0,...await e()}}catch(e){return Re(e)}}function ze(e,t){return`${e===`user`?`user`:`token`}:${t}`}var Be=1e4;function Ve(){return new je({defaultOptions:{queries:{staleTime:Be,refetchOnWindowFocus:!0,retry:!1}}})}var Z={me:[`me`],auth:[`auth`],projects:[`projects`],grants:e=>[`grants`,e],secrets:({project:e,environment:t})=>[`secrets`,e,t],syncs:({project:e,environment:t})=>[`syncs`,e,t],directory:[`directory`],report:e=>[`report`,e],credentials:e=>[`credentials`,e],identities:[`identities`],sessions:[`sessions`],audit:[`audit`]};function He(e){return e.flatMap(e=>e.grants.map(t=>({id:t.id,principalType:e.principalType,principalId:e.principalId,role:t.role,roleName:t.roleName,permissions:t.permissions,scope:t.environment===null?`project`:`environment`,environmentSlug:t.environment,expiresAt:t.expiresAt})))}function Ue(e){return X(async()=>{let{members:t,removed:n}=await e.members.list();return{principals:t.map(({principalType:e,principalId:t,instanceRole:n,isRootAdmin:r,tampered:i})=>({principalType:e,principalId:t,instanceRole:n,isRootAdmin:r,tampered:i})),removed:n}})}var We=e=>X(()=>e.projects.list()),Q={me:e=>J({queryKey:Z.me,queryFn:async()=>{try{return await e.me()}catch(e){if(Y(e)===401)return null;throw e}}}),auth:e=>J({queryKey:Z.auth,queryFn:()=>e.auth()}),projects:e=>J({queryKey:Z.projects,queryFn:()=>We(e)}),grants:(e,t)=>J({queryKey:Z.grants(t),queryFn:()=>X(async()=>({grants:He((await e.members.list(t)).members)}))}),secrets:(e,t)=>J({queryKey:Z.secrets(t),queryFn:()=>X(()=>e.secrets.list(`${t.project}/${t.environment}`))}),syncs:(e,t)=>J({queryKey:Z.syncs(t),queryFn:()=>X(()=>e.syncs.list(`${t.project}/${t.environment}`))}),directory:(e,t)=>J({queryKey:[...Z.directory,{owner:t}],queryFn:()=>t?Ue(e):Promise.resolve({ok:!1,error:`Only owners can manage users and service accounts.`,signedOut:!1})}),report:(e,t,n)=>J({queryKey:[...Z.report(t),{owner:n}],queryFn:()=>n?X(async()=>{try{return{report:await e.members.get(t)}}catch(e){if(Y(e)===404)return{report:null};throw e}}):Promise.resolve(null)}),credentials:(e,t,n)=>J({queryKey:[...Z.credentials(t),{allowed:n}],queryFn:()=>n?X(()=>e.tokens.list(t)):Promise.resolve(null)}),identities:e=>J({queryKey:Z.identities,queryFn:()=>X(()=>e.identities.list())}),sessions:e=>J({queryKey:Z.sessions,queryFn:()=>X(()=>e.sessions.list())}),auditEntries:(e,t)=>J({queryKey:[...Z.audit,`entries`,t],staleTime:0,queryFn:()=>X(()=>e.audit.list({limit:200,decision:t.decision,actor:t.actorId,detail:t.detail}))}),auditChain:e=>J({queryKey:[...Z.audit,`chain`],staleTime:0,queryFn:()=>Ge(e)})};async function Ge(e){try{let t=await e.audit.verify();return t.ok?{integrity:`intact`,through:t.through,entries:t.entries,checkpoint:t.checkpoint,pending:t.pending??0}:{integrity:`broken`,through:t.through,failedAtSeq:t.failedAtSeq,author:t.author,reason:t.reason}}catch(e){let t=Y(e);return t===403?{integrity:`owners-only`}:{integrity:`unknown`,problem:t===void 0?`the request never got an answer`:`the request failed with HTTP ${t}`}}}function Ke(e,t,n){let r=n.ok?n.projects:[],i=t?.registered===!0?t:null;return{auth:e,principal:t===null?null:t.principal,instanceRole:i?.instanceRole??null,projects:r,capabilities:Ne(i,r),registrationRequired:t!==null&&!t.registered,accessTampered:t?.tampered===!0}}async function qe(e,t){let[n,r,i]=await Promise.all([e.fetchQuery(Q.auth(t)),e.fetchQuery(Q.me(t)),e.fetchQuery(Q.projects(t))]);return Ke(n,r,i)}function Je(e,t){if(!e.ok)return e;let n=e.projects.find(e=>e.slug===t);return n===void 0?{ok:!1,error:null}:{ok:!0,project:n,managesAccess:n.permissions.includes(`grant.manage`)}}async function Ye(e,t,n){let r=Je(await e.fetchQuery(Q.projects(t)),n);r.ok&&r.managesAccess&&await e.fetchQuery(Q.grants(t,n))}async function Xe(e,t){let n=await qe(e,t);return e.fetchQuery(Q.directory(t,n.capabilities.canManageGrants))}async function Ze(e,t,n,r){let i=await qe(e,t),a=ze(n,r),o=i.capabilities.canManageGrants;await Promise.all([e.fetchQuery(Q.report(t,a,o)),n===`service`?e.fetchQuery(Q.credentials(t,a,o&&i.auth.signin!==null)):null,...Qe(i.projects).map(n=>e.fetchQuery(Q.grants(t,n.slug)))])}function Qe(e){return e.filter(e=>e.permissions.includes(`grant.manage`))}var $e={places:()=>[Z.projects,Z.me],secrets:e=>[Z.secrets(e),Z.syncs(e),Z.projects],syncs:e=>[Z.syncs(e)],access:(e,t)=>[Z.grants(e),Z.report(t),Z.projects,Z.me],admission:()=>[Z.directory],role:e=>[Z.directory,Z.report(e),Z.me,Z.projects],removal:e=>[Z.directory,Z.report(e),[`grants`]],credentials:e=>[Z.credentials(e)],identities:()=>[Z.identities,Z.sessions],sessions:()=>[Z.sessions]};async function et(e,t){await Promise.all([...t,Z.audit].map(t=>e.invalidateQueries({queryKey:t})))}var $=C(),tt=[`blue`,`green`,`amber`,`violet`];function nt(e){let t=2166136261;for(let n of e)t=Math.imul(t^n.charCodeAt(0),16777619)>>>0;return tt[t%tt.length]}function rt({name:e,size:t=`sm`}){return(0,$.jsx)(`span`,{className:`tile tile-${nt(e)}${t===`lg`?` tile-lg`:``}`,"aria-hidden":!0,children:e.slice(0,1)})}function it({tile:e,lead:t,title:n,aside:r,description:i,meta:a,actions:o}){return(0,$.jsxs)(`header`,{className:`page-head`,children:[(0,$.jsxs)(`div`,{className:`page-head-text`,children:[e!==void 0&&(0,$.jsx)(rt,{name:e,size:`lg`}),t,(0,$.jsxs)(`div`,{style:{minWidth:0},children:[(0,$.jsxs)(`h1`,{className:`page-title`,children:[(0,$.jsx)(`span`,{children:n}),r!=null&&(0,$.jsx)(`span`,{className:`page-title-aside`,children:r})]}),i!==void 0&&(0,$.jsx)(`p`,{className:`page-desc`,children:i}),a!==void 0&&(0,$.jsx)(`div`,{className:`page-meta`,children:a})]})]}),o!==void 0&&o!==!1&&(0,$.jsx)(`div`,{className:`page-actions`,children:o})]})}function at({title:e,description:t,actions:n,children:r,labelledBy:i,tone:a}){return(0,$.jsxs)(`section`,{className:`card${a===`danger`?` card-danger`:``}`,"aria-labelledby":i,children:[(0,$.jsxs)(`div`,{className:`card-head`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`card-title`,id:i,children:e}),t!==void 0&&(0,$.jsx)(`p`,{className:`card-desc`,children:t})]}),n]}),r]})}function ot({label:e,children:t}){return(0,$.jsxs)(`div`,{className:`fact`,children:[(0,$.jsx)(`dt`,{children:e}),(0,$.jsx)(`dd`,{children:t})]})}function st({icon:e,label:t,title:n,children:r,actions:i}){return(0,$.jsxs)(`div`,{className:`closed`,role:`status`,children:[e!==void 0&&(0,$.jsx)(`div`,{className:`closed-icon`,"aria-hidden":!0,children:e}),t!==void 0&&(0,$.jsx)(`p`,{className:`closed-label`,children:t}),(0,$.jsx)(`h1`,{className:`closed-title`,children:n}),(0,$.jsx)(`div`,{className:`closed-body`,children:r}),i!==void 0&&(0,$.jsx)(`div`,{className:`closed-actions`,children:i})]})}export{s as $,V as A,D as B,Fe as C,W as D,we as E,R as F,g as G,w as H,M as I,p as J,b as K,re as L,te as M,k as N,U as O,se as P,o as Q,de as R,X as S,Oe as T,C as U,T as V,v as W,x as X,m as Y,d as Z,Ke as _,rt as a,ze as b,Z as c,Ye as d,l as et,qe as f,et as g,Q as h,it as i,I as j,H as k,Xe as l,Je as m,st as n,$e as o,Qe as p,h as q,ot as r,Ve as s,at as t,Ze as u,Ie as v,Pe as w,Y as x,Le as y,j as z};
@@ -0,0 +1 @@
1
+ import{U as e,V as t,Z as n,et as r}from"./page-CGmvjSy4.js";import{C as i,P as a,R as o,a as s,d as c,h as l,m as u,n as d,t as f}from"./link-DP8SVWon.js";var p=`__root__`;function m(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function h(e){return e instanceof Response&&!!e.options}function g(e){if(typeof e==`object`&&e&&e.isSerializedRedirect)return m(e)}var _=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=p:this.parentRoute||i();let r=n?p:t?.path;r&&r!==`/`&&(r=u(r));let a=t?.id||r,o=n?p:c([this.parentRoute.id===`__root__`?``:this.parentRoute.id,a]);r===`__root__`&&(r=`/`),o!==`__root__`&&(o=c([`/`,o]));let s=o===`__root__`?`/`:c([this.parentRoute.fullPath,r]);this._path=r,this._id=o,this._fullPath=s,this._to=l(s)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>m({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},v=class extends _{constructor(e){super(e)}},y=r(n(),1),b=y.createContext(void 0),x=y.createContext(void 0),S={get(){},subscribe(){return{unsubscribe(){}}}};function C(e,t){let n=y.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=o(n.current,i):i}}function w(e){let n=t(),r=y.useContext(e.from?x:b),a=e.from?n.stores.getRouteMatchStore(e.from):n.stores.matchStores.get(r),o=C(e,n),s=d(a??S,e=>e?o(e):S);if(s!==S)return s;(e.shouldThrow??!0)&&i()}function T(e){return w({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function E(e){let{select:t,...n}=e;return w({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function D(e){return w({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function O(e){return w({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function k(e){let n=t();return y.useCallback(t=>n.navigate({...t,from:t.from??e?.from}),[e?.from,n])}function A(e){return w({...e,select:t=>e.select?e.select(t.context):t.context})}var j=e(),M=class extends _{constructor(e){super(e),this.useMatch=e=>w({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>A({...e,from:this.id}),this.useSearch=e=>O({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>D({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>E({...e,from:this.id}),this.useLoaderData=e=>T({...e,from:this.id}),this.useNavigate=()=>k({from:this.fullPath}),this.Link=y.forwardRef((e,t)=>(0,j.jsx)(f,{ref:t,from:this.fullPath,...e}))}};function N(e){return new M(e)}function P(){return e=>I(e)}var F=class extends v{constructor(e){super(e),this.useMatch=e=>w({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>A({...e,from:this.id}),this.useSearch=e=>O({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>D({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>E({...e,from:this.id}),this.useLoaderData=e=>T({...e,from:this.id}),this.useNavigate=()=>k({from:this.fullPath}),this.Link=y.forwardRef((e,t)=>(0,j.jsx)(f,{ref:t,from:this.fullPath,...e}))}};function I(e){return new F(e)}function L(e){return new R(e,{silent:!0}).createRoute}var R=class{constructor(e,t){this.path=e,this.createRoute=e=>{let t=N(e);return t.isRoot=!1,t},this.silent=t?.silent}};function z(e,t){let n,r,i,o,c=()=>(n||=e().then(e=>{n=void 0,r=e[t??`default`]}).catch(e=>{if(i=e,a(i)&&i instanceof Error&&typeof window<`u`&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;sessionStorage.getItem(e)||(sessionStorage.setItem(e,`1`),o=!0)}}),n),l=function(e){if(o)throw window.location.reload(),new Promise(()=>{});if(i)throw i;if(!r)if(s)s(c());else throw c();return y.createElement(r,e)};return l.preload=c,l}var B=`modulepreload`,V=function(e){return`/`+e},H={},U=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=V(t,n),t=s(t),t in H)return;H[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:B,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};export{k as a,h as c,p as d,P as i,g as l,z as n,C as o,L as r,b as s,U as t,m as u};
@@ -0,0 +1 @@
1
+ import{C as e,U as t,Z as n,a as r,b as i,et as a,h as o,i as s,n as c,o as l,p as u}from"./page-CGmvjSy4.js";import{t as d}from"./link-DP8SVWon.js";import{E as f,l as p,n as m}from"./use-change-BRRMJocl.js";import{n as h,t as g}from"./use-shell-BMGlJ25Q.js";import{t as _}from"./useSuspenseQuery-CSXyDALB.js";import{n as v}from"./dist-QVHMLatb.js";import{a as y,c as b,i as x,o as S,s as C}from"./ui-BdipqGpP.js";import{A as w,J as T,l as E,p as D,q as O,v as k}from"./icons-BQ27Ds9u.js";import{t as A}from"./row-state-ByET1OKX.js";import{a as j,i as M,o as ee,r as N}from"./directory-nDExpkAz.js";import{t as P}from"./use-action-DRm9yVhV.js";import{n as F,t as I}from"./grants-CjoOnxzz.js";import{r as L,t as R}from"./offboarding-CNr_1tnl.js";var z=a(n(),1);function B(e,t){return Object.hasOwn(e.environments,t)?e.environments[t]:null}function V(e,t){if(e.length===0)return{level:`none`,expiresAt:null,environments:{}};let[n]=e;if(e.length===1&&n.environmentSlug===null&&(n.role===`owner`||n.role===`viewer`||n.role===`developer`))return{level:n.role,expiresAt:n.expiresAt,environments:{}};let r={};for(let n of e){let e=n.environmentSlug;if(e===null||!t.includes(e)||Object.hasOwn(r,e)||n.role!==`viewer`&&n.role!==`developer`)return{level:`custom`,expiresAt:null,environments:{}};r[e]={role:n.role,expiresAt:n.expiresAt}}return{level:`env`,expiresAt:null,environments:r}}function H(e,t,n){if(t===`env`&&(e.level===`viewer`||e.level===`developer`)&&Object.keys(e.environments).length===0){let r={role:e.level,expiresAt:e.expiresAt};return{...e,level:t,environments:Object.fromEntries(n.map(e=>[e,r]))}}return{...e,level:t}}function U(e,t,n){let r={...e.environments};return n===null?delete r[t]:r[t]=n,{...e,environments:r}}function W(e){switch(e.level){case`none`:case`custom`:return[];case`owner`:case`viewer`:case`developer`:return[{role:e.level,environmentSlug:null,expiresAt:e.expiresAt}];case`env`:return Object.entries(e.environments).map(([e,t])=>({environmentSlug:e,...t}))}}function G(e,t){return e===t||e!==null&&t!==null&&Date.parse(e)===Date.parse(t)}function K(e,t){if(t.level===`custom`)return[];let n=e=>`${e.role}@${e.environmentSlug??``}`,r=new Map(W(t).map(e=>[n(e),e])),i=new Map(e.map(e=>[n(e),e])),a=[];for(let[e,t]of r)i.has(e)||a.push({kind:`create`,...t});for(let[e,t]of i){let n=r.get(e);n!==void 0&&!G(t.expiresAt,n.expiresAt)&&a.push({kind:`expiry`,grant:t,expiresAt:n.expiresAt})}for(let[e,t]of i)r.has(e)||a.push({kind:`revoke`,grant:t});return a}function q(e,t){let n=t=>t===null?e:`${e}/${t}`,r=(e,t)=>t===null?e:{role:e,until:t},i={};for(let e of t)e.kind===`revoke`&&(i[n(e.grant.environmentSlug)]=null);for(let e of t)e.kind===`expiry`&&(i[n(e.grant.environmentSlug)]=r(e.grant.role,e.expiresAt)),e.kind===`create`&&(i[n(e.environmentSlug)]=r(e.role,e.expiresAt));return i}function J(e){return e===``?null:new Date(`${e}T23:59:59Z`).toISOString()}function Y(e){return e===null?``:e.slice(0,10)}var X=t();function Z(t,n){let r=e(),{projects:a,capabilities:s}=g(),c=u(a),{data:l}=_(o.report(r,i(t,n),s.canManageGrants)),d=h({queries:c.map(e=>o.grants(r,e.slug))});return{report:l,access:c.map((e,r)=>{let i=d[r].data;return{project:e,grants:i.ok?i.grants.filter(e=>e.principalType===t&&e.principalId===n):[],grantsError:i.ok?null:i.error}})}}function Q({principalType:e,principalId:t}){let{instanceRole:n}=g(),{report:a,access:o}=Z(e,t),{status:l,dismiss:u}=m(p.queryKey),f=l(i(e,t)),h=M[e],_=e===`user`,v=_?`/users`:`/tokens`,y=a?.ok===!0?a.report:null,b=y?.status===`removed`,S=y!==null&&!b?{principalType:e,principalId:t,instanceRole:y.instanceRole,isRootAdmin:y.isRootAdmin,tampered:y.status===`tampered`}:void 0;if(a?.ok===!0&&y===null||a===null&&o.length===0)return(0,X.jsx)(c,{icon:_?(0,X.jsx)(O,{size:18}):(0,X.jsx)(k,{size:18}),label:(0,X.jsx)(`span`,{className:`mono`,children:t}),title:_?`No such user for you`:`No such token for you`,actions:(0,X.jsxs)(d,{className:`btn`,to:v,children:[`All `,_?`users`:`tokens`]}),children:a===null?`A ${h}'s page lists its access to the projects where you manage access, and you manage none.`:`No ${h} by that name has ever been registered here.`});let w=o.flatMap(({project:e,grants:t})=>t.map(t=>({project:e,grant:t}))),T=o.filter(e=>e.grantsError!==null),E=b?[]:o.filter(({project:e,grantsError:t})=>e.archivedAt===null&&t===null);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(s,{lead:(0,X.jsx)(ee,{type:e,id:t,size:`lg`}),title:t,meta:b?(0,X.jsx)(`span`,{className:`tag tag-red`,children:`Removed`}):S?.principalType===`user`&&(0,X.jsx)(N,{principal:S}),actions:(E.length>0||S!==void 0)&&(0,X.jsxs)(X.Fragment,{children:[E.length>0&&(0,X.jsx)(te,{principalType:e,principalId:t,access:E}),S!==void 0&&(0,X.jsx)(j,{principal:S,trigger:`btn btn-icon`})]})}),f.state===`failed`&&(0,X.jsx)(`div`,{className:`report-notice`,children:(0,X.jsx)(A,{status:f,onDismiss:()=>u(f.mutationId)})}),a?.ok===!1&&(0,X.jsx)(`div`,{className:`report-notice`,children:(0,X.jsx)(C,{tone:`bad`,children:a.error})}),b&&y!==null&&(0,X.jsx)(L,{report:y}),!b&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h2`,{className:`section-title`,children:`Project access`}),T.map(({project:e,grantsError:t})=>(0,X.jsx)(`div`,{style:{marginBottom:`0.75rem`},children:(0,X.jsxs)(C,{tone:`bad`,children:[(0,X.jsx)(`span`,{className:`mono`,children:e.slug}),`: `,t]})},e.slug)),(0,X.jsx)(`section`,{className:`card`,"aria-label":`Project access`,children:w.length===0?(0,X.jsx)(x,{title:`No project access yet`,children:E.length>0?`Edit access gives this ${h} access to several projects at once.`:`None of the projects where you manage access has a grant for this ${h}.`}):(0,X.jsx)(F,{lead:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(D,{size:14}),`Project`]}),children:w.map(({project:e,grant:t},n)=>(0,X.jsx)(I,{number:n+1,project:e.slug,grant:t,leadLabel:`Project`,lead:(0,X.jsxs)(`span`,{className:`cell-project`,children:[(0,X.jsx)(r,{name:e.slug}),(0,X.jsx)(d,{className:`cell-link`,to:`/projects/$project`,params:{project:e.slug},search:{tab:_?`users`:`tokens`},children:e.name}),e.archivedAt!==null&&(0,X.jsx)(`span`,{className:`tag tag-red`,children:`archived`})]})},t.id))})}),n!==`root-admin`&&(0,X.jsx)(`p`,{className:`hint section-foot`,children:`Only projects where you manage access are listed.`})]}),y!==null&&(0,X.jsx)(R,{report:y})]})}function te({principalType:t,principalId:n,access:a}){let o=e(),[s,c]=(0,z.useState)(!1),[u,d]=(0,z.useState)({}),{pending:p,error:m,setError:h,run:g}=P(),_=M[t],x=a.map(({project:e,grants:t})=>{let n=e.environments.filter(e=>e.details!==null&&e.details.archivedAt===null).map(e=>e.slug),r=V(t,n),i=Object.hasOwn(u,e.slug)?u[e.slug]:r;return{project:e,grants:t,environments:n,held:r,plan:i,changes:K(t,i)}}),C=x.filter(e=>e.changes.length>0);function T(){c(!1),d({}),h(null)}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>c(!0),children:[(0,X.jsx)(w,{size:14}),`Edit access`]}),(0,X.jsx)(S,{open:s,onOpenChange:e=>e?c(!0):T(),title:(0,X.jsxs)(X.Fragment,{children:[`Edit access for `,(0,X.jsx)(`span`,{className:`mono`,children:n})]}),description:`Set what this ${_} can reach on each project you manage, and until when. Saving applies only what you changed.`,wide:!0,children:(0,X.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),g(()=>o.access.set(i(t,n),Object.assign({},...C.map(({project:e,changes:t})=>q(e.slug,t)))),{affects:C.flatMap(({project:e})=>l.access(e.slug,i(t,n))),onSuccess:()=>{v.success(`Updated ${n}’s access on ${C.length} project${C.length===1?``:`s`}`),T()}})},children:[(0,X.jsxs)(`ul`,{className:`plan-list`,children:[(0,X.jsxs)(`li`,{className:`plan-head`,"aria-hidden":`true`,children:[(0,X.jsx)(`span`,{children:`Project`}),(0,X.jsx)(`span`,{children:`Access`}),(0,X.jsx)(`span`,{children:`Expires`})]}),x.map(({project:e,grants:t,environments:n,held:i,plan:a,changes:o})=>{let s=`plan-${e.slug}`,c=t=>d(n=>({...n,[e.slug]:t}));return(0,X.jsxs)(`li`,{className:`plan-row${o.length>0?` is-changed`:``}`,children:[(0,X.jsxs)(`label`,{className:`plan-project`,htmlFor:s,children:[(0,X.jsx)(r,{name:e.slug}),(0,X.jsxs)(`span`,{className:`plan-project-text`,children:[(0,X.jsx)(`span`,{className:`plan-project-name`,children:e.name}),i.level===`custom`&&(0,X.jsxs)(`span`,{className:`plan-project-held`,children:[`Holds `,t.map(e=>f(e)).join(`, `)]})]})]}),(0,X.jsxs)(`select`,{id:s,className:`select select-sm`,value:a.level,onChange:e=>c(H(a,e.target.value,n)),children:[i.level===`custom`&&(0,X.jsx)(`option`,{value:`custom`,children:`Keep as is`}),(0,X.jsx)(`option`,{value:`none`,children:`No access`}),(0,X.jsx)(`option`,{value:`owner`,children:`Owner`}),(0,X.jsx)(`option`,{value:`viewer`,children:`Read: all`}),(0,X.jsx)(`option`,{value:`developer`,children:`Write: all`}),n.length>0&&(0,X.jsx)(`option`,{value:`env`,children:`Per environment…`})]}),(a.level===`owner`||a.level===`viewer`||a.level===`developer`)&&(0,X.jsx)($,{label:`${e.name} expires`,expiresAt:a.expiresAt,onChange:e=>c({...a,expiresAt:e})}),a.level===`env`&&(0,X.jsx)(`ul`,{className:`plan-envs`,"aria-label":`Environments of ${e.name}`,children:n.map(t=>{let n=B(a,t);return(0,X.jsxs)(`li`,{className:`plan-env`,children:[(0,X.jsx)(`label`,{className:`mono`,htmlFor:`${s}-${t}`,children:t}),(0,X.jsxs)(`select`,{id:`${s}-${t}`,className:`select select-sm`,value:n?.role??``,onChange:e=>{let r=e.target.value;c(U(a,t,r===`viewer`||r===`developer`?{role:r,expiresAt:n?.expiresAt??null}:null))},children:[(0,X.jsx)(`option`,{value:``,children:`No access`}),(0,X.jsx)(`option`,{value:`viewer`,children:`Read`}),(0,X.jsx)(`option`,{value:`developer`,children:`Write`})]}),n!==null&&(0,X.jsx)($,{label:`${t} of ${e.name} expires`,expiresAt:n.expiresAt,onChange:e=>c(U(a,t,{...n,expiresAt:e}))})]},t)})}),o.length>0&&(0,X.jsx)(`ul`,{className:`plan-changes`,"aria-label":`Changes to ${e.name}`,children:o.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(ne,{change:e})},e.kind===`create`?`+${e.role}@${e.environmentSlug??``}`:e.grant.id))})]},e.slug)})]}),(0,X.jsx)(y,{error:m}),(0,X.jsxs)(`div`,{className:`dialog-actions`,children:[(0,X.jsx)(`button`,{className:`btn`,type:`button`,onClick:T,children:`Cancel`}),(0,X.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:p||C.length===0,children:[p&&(0,X.jsx)(b,{}),`Save changes`]})]})]})})]})}function $({label:e,expiresAt:t,onChange:n}){let r=Y(t);return(0,X.jsxs)(`span`,{className:`expiry${r===``?` is-never`:``}`,children:[(0,X.jsx)(`input`,{className:`input select-sm`,type:`date`,"aria-label":e,min:new Date().toISOString().slice(0,10),value:r,onChange:e=>n(J(e.target.value))}),(0,X.jsx)(`span`,{className:`expiry-never`,"aria-hidden":`true`,children:`Never`}),(0,X.jsx)(`button`,{className:`btn btn-quiet btn-sm btn-icon`,type:`button`,"aria-label":`${e}: never`,title:`Never expires`,onClick:()=>n(null),children:(0,X.jsx)(T,{size:12})})]})}function ne({change:e}){let t=e=>e===null?``:` until ${Y(e)}`;switch(e.kind){case`create`:return(0,X.jsxs)(`span`,{className:`tag tag-green`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`+`}),(0,X.jsx)(`span`,{className:`visually-hidden`,children:`Adds`}),f({...e,roleName:e.role}),t(e.expiresAt)]});case`expiry`:return(0,X.jsxs)(`span`,{className:`tag tag-blue`,children:[(0,X.jsx)(E,{size:12}),(0,X.jsx)(`span`,{className:`visually-hidden`,children:`Moves the expiry of`}),f(e.grant),e.expiresAt===null?`, no expiry`:t(e.expiresAt)]});case`revoke`:return(0,X.jsxs)(`span`,{className:`tag tag-red`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`−`}),(0,X.jsx)(`span`,{className:`visually-hidden`,children:`Removes`}),f(e.grant)]})}}export{Q as t};
@@ -0,0 +1,3 @@
1
+ import{C as e,G as t,J as n,S as r,U as i,W as a,X as o,Y as s,Z as c,c as l,et as u,g as d,h as f,i as p,n as m,o as h,q as g,t as _,w as v,y}from"./page-CGmvjSy4.js";import{t as b}from"./link-DP8SVWon.js";import{f as x}from"./suspense-C7KwSnTG.js";import{C as S,a as C,n as w,r as T,t as E,v as ee,w as D,x as O}from"./use-change-BRRMJocl.js";import{t as k}from"./use-shell-BMGlJ25Q.js";import{t as A}from"./useSuspenseQuery-CSXyDALB.js";import{n as j}from"./dist-QVHMLatb.js";import{a as M,c as N,d as P,h as F,i as te,l as I,n as L,o as R,p as z,r as ne,s as B,t as V,u as H}from"./ui-BdipqGpP.js";import{i as U}from"./affordances-Bq2-oUB5.js";import{A as re,D as W,F as G,H as K,J as q,M as ie,P as J,S as ae,U as oe,V as se,W as ce,d as le,f as Y,g as X,h as ue,i as de,j as fe,k as pe,l as me,n as he,r as ge,v as _e}from"./icons-BQ27Ds9u.js";import{a as ve,i as ye,r as be}from"./row-state-ByET1OKX.js";import{t as xe}from"./projects._project._environment-DDxu_HHD.js";import{t as Z}from"./use-action-DRm9yVhV.js";import{t as Se}from"./validation-9Cl_XS-l.js";var Ce=/^[A-Za-z_][A-Za-z0-9_]{0,127}$/;function we(e){let t=[],n=[],r=new Set,i=e.split(/\r\n|\n|\r/);for(let e=0;e<i.length;e++){let a=e+1,o=i[e].trim();if(o===``||o.startsWith(`#`))continue;let s=o.startsWith(`export `)?o.slice(7).trim():o,c=s.indexOf(`=`);if(c===-1){n.push({line:a,text:o,reason:`no "=" on this line`});continue}let l=s.slice(0,c).trim();if(!Ce.test(l)){n.push({line:a,text:l,reason:`key must match ^[A-Za-z_][A-Za-z0-9_]*$`});continue}let u=s.slice(c+1).trim(),d;if(u.startsWith(`"`)){let e=Ee(u,`"`);if(e===-1){n.push({line:a,text:l,reason:`unterminated double quote (multi-line values are not supported)`});continue}if(d=De(u.slice(1,e)),Te(u.slice(e+1))){n.push({line:a,text:l,reason:`unexpected text after the closing quote`});continue}}else if(u.startsWith(`'`)){let e=u.indexOf(`'`,1);if(e===-1){n.push({line:a,text:l,reason:`unterminated single quote (multi-line values are not supported)`});continue}if(d=u.slice(1,e),Te(u.slice(e+1))){n.push({line:a,text:l,reason:`unexpected text after the closing quote`});continue}}else{let e=u.indexOf(` #`);e!==-1&&(u=u.slice(0,e)),d=u.trim()}if(d.includes(`\0`)){n.push({line:a,text:l,reason:`value contains a NUL byte, which cannot be passed in an environment`});continue}if(r.has(l)){n.push({line:a,text:l,reason:`duplicate key in this file`});continue}r.add(l),t.push({key:l,value:d,line:a})}return{entries:t,problems:n}}function Te(e){let t=e.trim();return t!==``&&!t.startsWith(`#`)}function Ee(e,t){for(let n=1;n<e.length;n++){if(e[n]===`\\`){n++;continue}if(e[n]===t)return n}return-1}function De(e){return e.replace(/\\(.)/g,(e,t)=>{switch(t){case`n`:return`
2
+ `;case`r`:return`\r`;case`\\`:case`"`:case`'`:return t;default:return e}})}var Q=u(c(),1);function Oe(e,t){return e!==null&&e.version===t}var $=i(),ke=2e3,Ae=6e4;function je({project:t,environment:n,canRun:r}){let i={project:t,environment:n},{data:a}=A({...f.syncs(e(),i),refetchInterval:e=>e.state.data?.ok===!0&&e.state.data.syncs.some(e=>e.running)?ke:!1});if(a.ok&&a.syncs.length===0&&!a.canManage)return null;let o=a.ok&&a.canManage;return(0,$.jsx)(_,{labelledBy:`syncs`,title:`Syncs`,description:`Destinations these secrets are pushed to. A change goes out when it is saved, and every hour coffre checks each destination and repairs what drifted.`,actions:o?(0,$.jsx)(Re,{project:t,environment:n}):void 0,children:a.ok?a.syncs.length===0?(0,$.jsxs)(te,{title:`Not synced anywhere`,children:[`Push these secrets where your code runs, such as GitHub Actions or Vercel, and keep them current there. Anything else can read them with `,(0,$.jsx)(`code`,{children:`coffre run`}),`.`]}):(0,$.jsx)(`div`,{className:`dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt syncs stacks`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Destination`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Status`}),(0,$.jsx)(`th`,{className:`col-shrink col-hide-narrow`,children:`Token`}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:a.syncs.map(e=>(0,$.jsx)(Me,{place:i,sync:e,canRun:r,canManage:o},e.id))})]})}):(0,$.jsx)(`div`,{className:`card-body`,children:(0,$.jsx)(M,{error:a.error})})})}function Me({place:t,sync:n,canRun:r,canManage:i}){let[a,o]=(0,Q.useState)(!1),s=e(),c=Z(),l=Z(),u=c.pending||l.pending,d=c.error??l.error;function f(){c.run(()=>s.syncs.run(n.id),{affects:h.syncs(t),onSuccess:e=>Fe(n,e.outcome)})}function p(e){l.run(()=>s.syncs.update(n.id,{paused:e}),{affects:h.syncs(t),onSuccess:()=>j.success(e?`Paused ${n.destination}`:`Resumed ${n.destination}`,{action:{label:`Undo`,onClick:()=>p(!e)}})})}let m=d??(n.offered?n.lastError:null);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:m!==null&&!n.running?`has-error`:void 0,children:[(0,$.jsx)(`td`,{className:`col-destination`,children:(0,$.jsxs)(`span`,{className:`cell-account`,children:[(0,$.jsx)(K,{brand:n.brand,size:15}),(0,$.jsxs)(`span`,{className:`cell-stack`,children:[(0,$.jsx)(`span`,{children:n.providerLabel}),n.offered?(0,$.jsx)(`small`,{className:`mono`,children:n.destination}):(0,$.jsx)(`small`,{children:`No longer offered by this deployment`})]})]})}),(0,$.jsx)(`td`,{className:`nowrap col-status`,children:(0,$.jsxs)(`span`,{className:`cell-stack`,children:[(0,$.jsx)(Ne,{sync:n}),(0,$.jsx)(`small`,{children:(0,$.jsx)(Pe,{sync:n})})]})}),(0,$.jsx)(`td`,{className:`col-shrink col-hide-narrow cell-mono cell-muted`,children:n.credential}),(0,$.jsxs)(`td`,{className:`col-actions`,children:[(0,$.jsxs)(`div`,{className:`acts`,children:[r&&!n.paused&&(0,$.jsxs)(`button`,{className:`act`,onClick:f,disabled:u||n.running||!n.offered,title:n.offered?void 0:`This deployment no longer offers this provider`,children:[c.pending?(0,$.jsx)(N,{size:13}):(0,$.jsx)(se,{size:13}),`Run now`]}),i&&(0,$.jsxs)(F.Root,{children:[(0,$.jsx)(F.Trigger,{asChild:!0,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,"aria-label":`More for ${n.destination}`,disabled:u,children:(0,$.jsx)(W,{size:16})})}),(0,$.jsx)(F.Portal,{children:(0,$.jsxs)(F.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,$.jsxs)(F.Item,{className:`menu-item`,onSelect:()=>p(!n.paused),children:[n.paused?(0,$.jsx)(fe,{size:14}):(0,$.jsx)(pe,{size:14}),n.paused?`Resume`:`Pause`]}),(0,$.jsx)(F.Separator,{className:`menu-sep`}),(0,$.jsxs)(F.Item,{className:`menu-item menu-item-danger`,onSelect:()=>o(!0),children:[(0,$.jsx)(q,{size:14}),`Remove`]})]})})]})]}),(0,$.jsx)(L,{open:a,onOpenChange:o,title:(0,$.jsxs)($.Fragment,{children:[`Stop syncing to `,(0,$.jsx)(`span`,{className:`mono`,children:n.destination}),`?`]}),body:`Nothing more is pushed to ${n.providerLabel}. Keys coffre already pushed stay there; remove them at ${n.providerLabel} if they should go too.`,confirmLabel:`Remove sync`,onConfirm:()=>l.run(()=>s.syncs.remove(n.id),{affects:h.syncs(t),onSuccess:()=>j.success(`No longer syncing to ${n.destination}`)})})]})]}),m!==null&&!n.running&&(0,$.jsx)(`tr`,{className:`row-error`,children:(0,$.jsx)(`td`,{colSpan:4,children:(0,$.jsx)(M,{error:m})})})]})}function Ne({sync:e}){return e.offered?e.running?(0,$.jsxs)(`span`,{className:`tag tag-blue`,children:[(0,$.jsx)(N,{size:11}),`Pushing`]}):e.paused?(0,$.jsx)(`span`,{className:`tag tag-outline`,children:`Paused`}):e.lastStatus===`failed`?(0,$.jsx)(`span`,{className:`tag tag-red`,children:`Failed`}):e.pending>0?(0,$.jsxs)(`span`,{className:`tag tag-amber`,children:[e.pending,` pending`]}):e.lastStatus===`partial`?(0,$.jsx)(`span`,{className:`tag tag-amber`,children:`Partial`}):e.lastRunAt===null?(0,$.jsx)(`span`,{className:`tag`,children:`Not run yet`}):(0,$.jsx)(`span`,{className:`tag tag-green`,children:`In sync`}):(0,$.jsx)(`span`,{className:`tag tag-outline`,children:`Unavailable`})}function Pe({sync:e}){let t=e.skipped.length,n=[];return(e.synced>0||e.pending===0)&&n.push(`${e.synced} synced`),e.pending>0&&n.push(`${e.pending} pending`),t>0&&n.push((0,$.jsx)(P,{label:(0,$.jsx)(`ul`,{style:{margin:0,paddingLeft:`1rem`},children:e.skipped.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`span`,{className:`mono`,children:e.key}),`: `,e.reason]},e.key))}),children:(0,$.jsxs)(`button`,{type:`button`,className:`tag tag-amber tag-button`,children:[(0,$.jsx)(ge,{size:11}),t,` skipped`]})})),e.lastRunAt!==null&&n.push((0,$.jsx)(I,{iso:e.lastRunAt,display:`relative`})),(0,$.jsx)($.Fragment,{children:n.map((e,t)=>(0,$.jsxs)(Q.Fragment,{children:[t>0&&` · `,e]},t))})}function Fe(e,t){if(t.status===`busy`){j(`A run is already under way`,{description:`Its result appears here when it ends.`});return}let n=t.upserted.length+t.deleted.length;if(t.status===`failed`)j.error(`Could not sync to ${e.destination}`,{description:t.error??void 0});else if(t.status===`partial`)j.warning(`${t.failed.length} of ${n+t.failed.length} changes failed`,{description:t.failed[0]?.message});else if(n===0)j.success(`${e.destination} was already current`);else{let n=[t.upserted.length>0&&`pushed ${t.upserted.length}`,t.deleted.length>0&&`removed ${t.deleted.length}`].filter(Boolean);j.success(`${Le(n.join(`, `))} to ${e.destination}`)}}async function Ie(e,t,n,i){let a=j.loading(`Pushing to ${n.destination}`,{description:`The first push is under way.`}),o=Date.now()+Ae;for(;Date.now()<o;){await new Promise(e=>setTimeout(e,ke));let o=await r(()=>e.syncs.list(t)),s=o.ok?o.syncs.find(e=>e.id===n.id):void 0;if(!(s===void 0||s.running||s.lastRunAt===null)){await i(),s.lastStatus===`failed`?j.error(`Could not sync to ${n.destination}`,{id:a,description:s.lastError??void 0}):s.lastStatus===`partial`?j.warning(`Synced to ${n.destination}, but not every key`,{id:a,description:s.lastError??void 0}):j.success(`Synced to ${n.destination}`,{id:a,description:`${s.synced} ${s.synced===1?`key is`:`keys are`} there now.`});return}}await i(),j(`Still pushing to ${n.destination}`,{id:a,description:`Its result appears in the list when it ends.`})}function Le(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Re({project:e,environment:t}){let[n,r]=(0,Q.useState)(!1);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn btn-sm`,onClick:()=>r(!0),children:[(0,$.jsx)(ie,{size:14}),`Add sync`]}),(0,$.jsx)(R,{open:n,onOpenChange:r,title:(0,$.jsxs)($.Fragment,{children:[`Sync `,(0,$.jsxs)(`span`,{className:`mono`,children:[e,`/`,t]})]}),description:`Every key in this environment is pushed to the destination and kept current. coffre only ever removes keys it pushed itself.`,wide:!0,children:(0,$.jsx)(ze,{children:n=>(0,$.jsx)(Be,{project:e,environment:t,providers:n,onDone:()=>r(!1)})})})]})}function ze({children:t}){let n=e(),[i,a]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{let e=!0;return r(()=>n.syncs.providers()).then(t=>{e&&a(t)}),()=>{e=!1}},[n]),i===null?(0,$.jsxs)(`p`,{className:`picker-empty sync-providers-state`,children:[(0,$.jsx)(N,{size:13}),`Loading where coffre can sync to…`]}):i.ok?i.providers.length===0?(0,$.jsxs)(`p`,{className:`picker-empty sync-providers-state`,children:[`This instance offers nowhere to sync to. Whoever runs coffre lists the providers in its`,` `,(0,$.jsx)(`span`,{className:`mono`,children:`syncs`}),` settings.`]}):t(i.providers):(0,$.jsx)(`div`,{className:`sync-providers-state`,children:(0,$.jsx)(M,{error:i.error})})}function Be({project:r,environment:i,providers:a,onDone:o}){let[c,l]=(0,Q.useState)(a[0]),[u,f]=(0,Q.useState)(()=>n(a[0])),[p,m]=(0,Q.useState)(``),_=e(),v=x(),{pending:y,error:b,setError:S,run:C}=Z(),w=g(c,u);function T(e){l(e),f(n(e)),S(null)}function E(e,t){f(n=>({...n,[e]:t}))}return(0,$.jsxs)(`form`,{className:`form`,style:{marginTop:`1.25rem`},onSubmit:e=>{e.preventDefault(),C(()=>_.syncs.add(`${r}/${i}`,{provider:c.id,config:t(c,u),credential:p.trim()}),{affects:h.syncs({project:r,environment:i}),onSuccess:e=>{o(),Ie(_,`${r}/${i}`,e,()=>d(v,h.syncs({project:r,environment:i})))}})},children:[a.length>1&&(0,$.jsx)(`div`,{className:`choice-grid sync-providers`,role:`group`,"aria-label":`Destination`,children:a.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`choice`,"aria-pressed":e.id===c.id,onClick:()=>T(e),children:[(0,$.jsx)(K,{brand:e.brand}),e.label]},e.id))}),(0,$.jsx)(`div`,{className:`form-row`,children:c.fields.map(e=>{if(!s(e,u))return null;if(e.type===`text`)return(0,$.jsxs)(`label`,{className:`field`,children:[(0,$.jsxs)(`span`,{className:`label`,children:[e.label,e.optional===!0&&(0,$.jsx)(`span`,{className:`hint`,children:` (optional)`})]}),(0,$.jsx)(`input`,{className:`input input-mono`,value:u[e.name],placeholder:e.placeholder,spellCheck:!1,autoComplete:`off`,onChange:t=>E(e.name,t.target.value)}),e.hint!==void 0&&(0,$.jsx)(`span`,{className:`hint`,children:e.hint})]},`${c.id}.${e.name}`);let t=u[e.name];return(0,$.jsxs)(`div`,{className:`field field-options`,role:`group`,"aria-label":e.label,children:[(0,$.jsx)(`span`,{className:`label`,children:e.label}),(0,$.jsx)(`div`,{className:`segmented`,children:e.options.map(n=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":t.includes(n.value),onClick:()=>E(e.name,e.multiple?t.includes(n.value)?t.filter(e=>e!==n.value):[...t,n.value]:[n.value]),children:n.label},n.value))}),e.hint!==void 0&&(0,$.jsx)(`span`,{className:`hint`,children:e.hint})]},`${c.id}.${e.name}`)})}),(0,$.jsxs)(`label`,{className:`field`,children:[(0,$.jsx)(`span`,{className:`label`,children:`Token`}),(0,$.jsx)(`input`,{className:`input input-mono`,value:p,placeholder:c.credential.placeholder,spellCheck:!1,autoComplete:`off`,onChange:e=>m(e.target.value)}),(0,$.jsxs)(`span`,{className:`hint`,children:[`The secret that holds it, as `,(0,$.jsx)(`code`,{children:`project/environment/KEY`}),`. An environment of its own, such as `,(0,$.jsx)(`code`,{children:`ops/sync`}),`, keeps it from everyone who reads these secrets. You need read access to it.`]})]}),(0,$.jsx)(B,{tone:`info`,children:c.credential.hint}),(0,$.jsx)(M,{error:b}),(0,$.jsxs)(`div`,{className:`dialog-actions`,children:[(0,$.jsx)(`button`,{className:`btn`,type:`button`,onClick:o,children:`Cancel`}),(0,$.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:y||w!==null||p.trim()===``,title:w===null?void 0:`${w} is required`,children:[y&&(0,$.jsx)(N,{}),`Start syncing`]})]})]})}var Ve=45;function He(){let{project:t,environment:n}=xe.useParams(),{data:r}=A(f.secrets(e(),{project:t,environment:n}));return r.ok?(0,$.jsx)(Ue,{project:t,environment:n,permissions:r.permissions,keys:r.keys},`${t}/${n}`):(0,$.jsx)(m,{icon:(0,$.jsx)(ae,{size:18}),label:(0,$.jsxs)(`span`,{className:`mono`,children:[t,`/`,n]}),title:`This environment is closed to you`,actions:(0,$.jsxs)(b,{className:`btn`,to:`/projects/$project`,params:{project:t},children:[`Back to `,t]}),children:r.error})}function Ue({project:t,environment:n,permissions:r,keys:i}){let a=e(),{principal:o}=k(),s=E(O(a,{project:t,environment:n},o?.id??null)),c=E(ee(a,{project:t,environment:n})),u=E(C(a,{project:t,environment:n})),{status:d,dismiss:f}=w(l.secrets({project:t,environment:n})),[m,h]=(0,Q.useState)([]),[g,b]=(0,Q.useState)({}),[x,A]=(0,Q.useState)(()=>new Set),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(xe.useSearch().filter??``),I=(0,Q.useRef)(0),L=r.includes(`secret.write`),R=r.includes(`secret.archive`),z=v(r),B=i.filter(e=>!e.archived),V=i.filter(e=>e.archived),H=new Set(i.map(e=>e.key)),U=B.filter(e=>D(g,e.key)!==void 0),re=S(B,m,g),W=[...m.map(e=>e.key.trim()),...U.flatMap(e=>{let t=D(g,e.key);return t===void 0||t.archived?[]:[t.key.trim()]})],K=W.some(e=>e===``),q=W.some(e=>e!==``&&Se(e)!==null),J=m.length+U.length,se=J>0&&!K&&!q&&!re;function ce(e,t){b(n=>{let r={...D(n,e.key)??{key:e.key,value:null,archived:!1},...t};if(r.key!==e.key||r.value!==null||r.archived)return{...n,[e.key]:r};let{[e.key]:i,...a}=n;return a})}function le(e){b(t=>{let{[e]:n,...r}=t;return r}),A(t=>{let n=new Set(t);return n.delete(e),n})}function Y(){h(e=>[{id:I.current++,key:``,value:``},...e])}function X(){h([]),b({}),A(new Set),N(null);for(let e of i){let t=d(e.key);t.state===`failed`&&f(t.mutationId)}}function de(){if(!se)return;let e={active:B,drafts:m,changes:g};h([]),b({}),A(new Set),N(null),s(e,{onError:t=>{let n=t instanceof T?t.outcome:e;h(n.drafts),b(n.changes),N(y(t))}})}function fe(e){c({key:e},{onSuccess:()=>j.success(`${e} restored`,{action:{label:`Undo`,onClick:()=>u({key:e})}})})}let pe=(0,Q.useRef)(de);pe.current=de,(0,Q.useEffect)(()=>{if(J===0)return;function e(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),pe.current())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[J]);let ge=[...m.map(e=>({key:e.key.trim()||`unnamed`,what:H.has(e.key.trim())?`new version`:`added`})),...U.map(e=>{let t=D(g,e.key);if(t.archived)return{key:e.key,what:`archived`};let n=t.key.trim()!==e.key;return n&&t.value!==null?{key:e.key,what:`→ ${t.key.trim()}, new value`}:n?{key:e.key,what:`→ ${t.key.trim()}`}:{key:e.key,what:`new value`}})],ve=K?null:re?`Two pending edits would end up with the same name. Secret names are unique in an environment.`:q?`Names are letters, digits and underscores, and cannot start with a digit.`:null,ye=P.trim().toLowerCase(),be=ye===``?B:B.filter(e=>e.key.toLowerCase().includes(ye));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{tile:t,title:n,aside:(0,$.jsx)(We,{project:t,environment:n}),actions:(0,$.jsxs)($.Fragment,{children:[L&&z&&(0,$.jsx)(tt,{project:t,environment:n}),L&&(0,$.jsxs)(`button`,{className:`btn btn-primary`,onClick:Y,children:[(0,$.jsx)(ie,{size:14}),`New secret`]})]})}),(B.length>0||m.length>0)&&(0,$.jsxs)(`div`,{className:`toolbar`,children:[(0,$.jsxs)(`label`,{className:`filter input-group`,children:[(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Filter secrets by name`}),(0,$.jsx)(G,{size:14,className:`input-icon`}),(0,$.jsx)(`input`,{className:`input`,type:`search`,placeholder:`Filter by name…`,spellCheck:!1,autoComplete:`off`,value:P,onChange:e=>F(e.target.value)})]}),(0,$.jsx)(`div`,{className:`toolbar-meta`,children:(0,$.jsxs)(`span`,{className:`th`,title:`Run a process with these secrets in its environment`,children:[(0,$.jsx)(oe,{size:14}),(0,$.jsxs)(`code`,{children:[`coffre run `,t,`/`,n,` -- …`]}),(0,$.jsx)(ne,{value:`coffre run ${t}/${n} -- `,label:`Copy command`})]})})]}),(0,$.jsx)(`section`,{className:`card`,"aria-label":`Secrets`,children:B.length===0&&m.length===0?(0,$.jsx)(te,{title:`No secrets yet`,actions:L?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn btn-primary`,onClick:Y,children:[(0,$.jsx)(ie,{size:14}),`New secret`]}),z&&(0,$.jsx)(tt,{project:t,environment:n})]}):void 0,children:L?`Add them one by one, or import an existing .env file. Nothing is written until you save, or until you have seen the import plan.`:`Nothing has been written to this environment, and adding the first secret needs secret.write.`}):(0,$.jsx)(`div`,{className:`dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt secrets stacks`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:`n`,children:`#`}),(0,$.jsx)(`th`,{className:`col-key`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(_e,{size:14}),`Key`]})}),(0,$.jsx)(`th`,{children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(ae,{size:14}),`Value`,!z&&(0,$.jsx)(`span`,{className:`th-note`,children:`hidden from you`})]})}),(0,$.jsx)(`th`,{className:`col-version`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(ue,{size:14}),`Version`]})}),(0,$.jsx)(`th`,{className:`col-written col-hide-narrow`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(me,{size:14}),`Last written`]})}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsxs)(`tbody`,{children:[m.map(e=>(0,$.jsx)(Xe,{draft:e,existingVersion:i.find(t=>t.key===e.key.trim())?.version??null,disabled:!1,onChange:t=>h(n=>n.map(n=>n.id===e.id?{...n,...t}:n)),onRemove:()=>h(t=>t.filter(t=>t.id!==e.id))},e.id)),be.map(e=>{let r=D(g,e.key),i=d(e.key);return(0,$.jsx)(Je,{number:B.indexOf(e)+1,project:t,environment:n,entry:e,change:r??{key:e.key,value:null,archived:!1},editing:r?.archived!==!0&&(x.has(e.key)||r!==void 0),canWrite:L,canArchive:R,canReveal:z,status:i,disabled:i.state===`pending`,columns:6,onEdit:()=>A(t=>new Set(t).add(e.key)),onPatch:t=>ce(e,t),onUndo:()=>le(e.key),onMarkArchive:()=>{A(t=>{let n=new Set(t);return n.delete(e.key),n}),b(t=>({...t,[e.key]:{key:e.key,value:null,archived:!0}}))}},e.key)}),be.length===0&&B.length>0&&(0,$.jsx)(`tr`,{children:(0,$.jsxs)(`td`,{colSpan:6,className:`cell-muted`,style:{padding:`1rem`},children:[`No secret name contains “`,P.trim(),`”.`]})})]})]})})}),(0,$.jsx)(je,{project:t,environment:n,canRun:L||r.includes(`environment.manage`)}),V.length>0&&(0,$.jsx)(_,{labelledBy:`archived-secrets`,title:`Archived`,description:(0,$.jsxs)($.Fragment,{children:[`Retired, so no longer served or injected by `,(0,$.jsx)(`code`,{children:`coffre run`}),`. Their history and audit trail are intact, and restoring is immediate.`]}),children:(0,$.jsx)(`div`,{className:`dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt secrets secrets-archived stacks`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:`n`,children:`#`}),(0,$.jsx)(`th`,{className:`col-key`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(_e,{size:14}),`Key`]})}),(0,$.jsx)(`th`,{className:`col-version`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(ue,{size:14}),`Version`]})}),(0,$.jsx)(`th`,{className:`col-written col-hide-narrow`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(me,{size:14}),`Last written`]})}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:V.map((e,r)=>(0,$.jsx)(Ze,{number:r+1,project:t,environment:n,entry:e,canArchive:R,canReveal:z,status:d(e.key),onRestore:()=>fe(e.key),onDismiss:f},e.key))})]})})}),J>0&&(0,$.jsx)(`div`,{className:`savebar`,role:`region`,"aria-label":`Unsaved changes`,children:(0,$.jsxs)(`div`,{className:`savebar-inner`,children:[(0,$.jsxs)(`span`,{className:`savebar-count`,children:[(0,$.jsx)(`span`,{className:`dot`,"aria-hidden":!0}),J,` unsaved change`,J===1?``:`s`]}),(0,$.jsxs)(`span`,{className:`savebar-summary`,children:[ge.slice(0,3).map((e,t)=>(0,$.jsxs)(`span`,{children:[t>0&&` · `,(0,$.jsx)(`span`,{className:`mono`,children:e.key}),` `,e.what]},`${e.key}:${t}`)),ge.length>3&&` · and ${ge.length-3} more`]}),(0,$.jsxs)(`div`,{className:`savebar-actions`,children:[(0,$.jsx)(`button`,{className:`btn btn-sm`,onClick:X,children:`Discard`}),(0,$.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:de,disabled:!se,title:`Save (⌘ Enter or Ctrl Enter)`,"aria-keyshortcuts":`Meta+Enter Control+Enter`,children:[`Save `,J===1?`change`:`${J} changes`]})]}),(M??ve)!==null&&(0,$.jsxs)(`p`,{className:`savebar-error`,role:`alert`,children:[(0,$.jsx)(he,{size:14}),(0,$.jsx)(`span`,{children:M??ve})]})]})})]})}function We({project:e,environment:t}){let{projects:n}=k(),r=n.find(t=>t.slug===e)?.environments.find(e=>e.slug===t)?.name;return r===void 0?null:(0,$.jsx)($.Fragment,{children:r})}function Ge({masked:e,className:t=``,...n}){let[r,i]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{i(typeof CSS<`u`&&CSS.supports(`-webkit-text-security`,`disc`))},[]),(0,$.jsx)(`input`,{...n,type:e&&!r?`password`:`text`,className:`${t}${e&&r?` is-masked`:``}`,autoComplete:`off`,spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":`true`,"data-bwignore":!0})}function Ke({label:e,value:t,onChange:n,placeholder:r,disabled:i,autoFocus:a,onEscape:o}){let[s,c]=(0,Q.useState)(!1);return(0,$.jsxs)(`div`,{className:`input-group`,children:[(0,$.jsx)(Ge,{className:`input input-mono`,masked:!s,"aria-label":e,placeholder:r,value:t,disabled:i,autoFocus:a,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Escape`&&o!==void 0&&o()}}),(0,$.jsx)(`button`,{type:`button`,className:`btn btn-quiet btn-sm btn-icon input-addon`,"aria-label":s?`Mask the value`:`Show the value`,"aria-pressed":s,onClick:()=>c(e=>!e),children:s?(0,$.jsx)(Y,{size:14}):(0,$.jsx)(le,{size:14})})]})}function qe(e){let[t,n]=(0,Q.useState)(()=>Date.now());return(0,Q.useEffect)(()=>{if(e===null)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e===null?0:Math.max(0,Math.ceil(Ve-(t-e.at)/1e3))}function Je({number:t,project:n,environment:r,entry:i,change:o,editing:s,canWrite:c,canArchive:l,canReveal:u,status:d,disabled:f,columns:p,onEdit:m,onPatch:h,onUndo:g,onMarkArchive:_}){let[v,b]=(0,Q.useState)(null),x=e(),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),[E,ee]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),k=Oe(v,i.version)?v:null;(0,Q.useEffect)(()=>{v!==null&&!Oe(v,i.version)&&b(null)},[v,i.version]),(0,Q.useEffect)(()=>{if(v===null)return;let e=setTimeout(()=>b(null),Ve*1e3);return()=>clearTimeout(e)},[v]);let A=qe(k),j=s&&Oe(D,i.version)?D:null;(0,Q.useEffect)(()=>{s||O(null)},[s]);async function P(){if(k!==null)return k.value;C(!0);try{let{values:e}=await x.secrets.reveal(`${n}/${r}/${i.key}`),t=e[i.key];return ee(null),b({value:t,version:i.version,at:Date.now()}),t}catch(e){return ee(e instanceof a?y(e):`The request could not be sent. Nothing was read.`),null}finally{C(!1)}}function te(){k===null?P():b(null)}let I=o.archived,L=o.key!==i.key,R=o.value!==null,B=s?Se(o.key.trim()):null,V=I?` is-leaving`:s&&(L||R)?` is-changed`:k===null?``:` is-revealed`,G=i.version??0;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:`secret-row${V} ${ve(d)}`,children:[(0,$.jsx)(`td`,{className:`n`,children:t}),(0,$.jsx)(`td`,{className:`cell-key`,"data-label":`Key`,children:s&&c?(0,$.jsxs)(`div`,{className:`edit-stack`,children:[(0,$.jsx)(`input`,{className:`input input-mono`,"aria-label":`Name for ${i.key}`,"aria-invalid":B!==null,spellCheck:!1,autoComplete:`off`,value:o.key,disabled:f,onChange:e=>h({key:e.target.value}),onKeyDown:e=>{e.key===`Escape`&&g()}}),(B!==null||L)&&(0,$.jsx)(`span`,{className:`edit-note${B===null?``:` edit-note-error`}`,children:B??(0,$.jsxs)($.Fragment,{children:[`Renamed from `,(0,$.jsx)(`span`,{className:`mono`,children:i.key})]})})]}):(0,$.jsxs)(`div`,{className:`key-cell`,children:[(0,$.jsx)(`span`,{children:z(i.key)}),I&&(0,$.jsx)(`span`,{className:`tag tag-red`,children:`will be archived`})]})}),(0,$.jsx)(`td`,{"data-label":`Value`,children:s&&c?(0,$.jsxs)(`div`,{className:`edit-stack`,children:[(0,$.jsx)(Ke,{label:`New value for ${i.key}`,value:o.value??j?.value??``,placeholder:`New value`,disabled:f,autoFocus:!0,onChange:e=>h({value:e===(j?.value??``)?null:e}),onEscape:g}),(0,$.jsxs)(`span`,{className:`edit-note`,children:[(0,$.jsx)(`span`,{children:R?`Saving appends v${G+1}; v${G} stays restorable.`:j===null?`Nothing is decrypted to edit. Left empty, v${G} stays current.`:`This is v${G}. Change it to append v${G+1}.`}),u&&!R&&j===null&&(0,$.jsxs)(`button`,{type:`button`,className:`act`,disabled:S,onClick:async()=>{let e=await P();e!==null&&O({value:e,version:i.version,at:Date.now()})},children:[S&&(0,$.jsx)(N,{size:12}),`Start from current value`]})]})]}):k!==null&&!I?(0,$.jsxs)(`div`,{className:`revealed`,style:{"--reveal-ttl":`${Ve}s`},children:[(0,$.jsx)(`span`,{className:`revealed-value`,children:k.value===``?`(empty)`:k.value}),(0,$.jsxs)(`span`,{className:`revealed-note`,children:[`Hides in `,A,`s`]}),(0,$.jsx)(`span`,{className:`revealed-meter`,"aria-hidden":!0})]}):(0,$.jsx)(`span`,{className:`mask`,"aria-label":`Hidden`,children:`••••••••••••`})}),(0,$.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:s&&R?(0,$.jsxs)(`span`,{className:`version-shift`,children:[`v`,G,` → `,(0,$.jsxs)(`b`,{children:[`v`,G+1]})]}):(0,$.jsx)(`span`,{className:`version-shift`,children:i.version===null?`—`:`v${i.version}`})}),(0,$.jsx)(`td`,{className:`col-written col-hide-narrow`,"data-label":`Last written`,children:(0,$.jsx)(Ye,{entry:i})}),(0,$.jsx)(`td`,{className:`col-actions`,children:d.state===`pending`?(0,$.jsx)(ye,{status:d}):(0,$.jsx)(`div`,{className:`acts`,children:I?(0,$.jsx)(H,{label:`Keep`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:g,disabled:f,"aria-label":`Keep ${i.key}`,children:(0,$.jsx)(J,{size:14})})}):s?(0,$.jsx)(H,{label:L||R?`Undo changes`:`Cancel`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:g,disabled:f,"aria-label":`${L||R?`Undo changes to`:`Stop editing`} ${i.key}`,children:L||R?(0,$.jsx)(J,{size:14}):(0,$.jsx)(q,{size:15})})}):(0,$.jsxs)($.Fragment,{children:[k!==null&&(0,$.jsx)(ne,{variant:`act`,value:k.value,label:`Copy ${i.key}`}),(0,$.jsx)(U,{canReveal:u,children:(0,$.jsx)(H,{label:k===null?`Reveal`:`Hide`,children:(0,$.jsx)(`button`,{className:`act act-icon act-accent`,onClick:te,disabled:S,"aria-label":`${k===null?`Reveal`:`Hide`} ${i.key}`,children:S?(0,$.jsx)(N,{size:13}):k===null?(0,$.jsx)(le,{size:15}):(0,$.jsx)(Y,{size:15})})})}),c&&(0,$.jsx)(H,{label:`Edit`,children:(0,$.jsx)(`button`,{className:`act act-icon`,onClick:()=>{k!==null&&O(k),b(null),m()},disabled:f,"aria-label":`Edit ${i.key}`,children:(0,$.jsx)(re,{size:14})})}),(u||l)&&(0,$.jsxs)(F.Root,{children:[(0,$.jsx)(F.Trigger,{asChild:!0,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,"aria-label":`More for ${i.key}`,disabled:f,children:(0,$.jsx)(W,{size:16})})}),(0,$.jsx)(F.Portal,{children:(0,$.jsxs)(F.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,$.jsx)(U,{canReveal:u,children:(0,$.jsxs)(F.Item,{className:`menu-item`,onSelect:()=>T(e=>!e),children:[(0,$.jsx)(X,{size:14}),w?`Hide history`:`Version history`]})}),l&&(0,$.jsxs)($.Fragment,{children:[u&&(0,$.jsx)(F.Separator,{className:`menu-sep`}),(0,$.jsxs)(F.Item,{className:`menu-item menu-item-danger`,onSelect:()=>{b(null),_()},children:[(0,$.jsx)(de,{size:14}),`Archive`,(0,$.jsx)(`span`,{className:`menu-hint`,children:`on save`})]})]})]})})]})]})})})]}),w&&u&&(0,$.jsx)(`tr`,{className:`detail-row`,children:(0,$.jsx)(`td`,{colSpan:p,children:(0,$.jsx)(Qe,{project:n,environment:r,secretKey:i.key,currentVersion:i.version,canWrite:c,onClose:()=>T(!1),onRolledBack:()=>b(null)})})}),E!==null&&(0,$.jsx)(`tr`,{className:`row-error`,children:(0,$.jsx)(`td`,{colSpan:p,children:(0,$.jsx)(M,{error:E})})})]})}function Ye({entry:e}){if(e.updatedBy===null&&e.updatedAt===null)return(0,$.jsx)(`span`,{className:`cell-muted`,children:`—`});let t=e.updatedBy??`unknown`;return(0,$.jsxs)(`span`,{className:`written`,children:[(0,$.jsx)(`span`,{className:`written-by`,title:t,children:t.split(`@`)[0]}),e.updatedAt!==null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`cell-muted`,"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{className:`cell-muted`,children:(0,$.jsx)(I,{iso:e.updatedAt,display:`relative`})})]})]})}function Xe({draft:e,existingVersion:t,disabled:n,onChange:r,onRemove:i}){let[a,o]=(0,Q.useState)(!1),s=e.key.trim(),c=s===``?a?`Give it a name.`:null:Se(s),l=s!==``&&t!==null;return(0,$.jsxs)(`tr`,{className:`secret-row is-draft`,children:[(0,$.jsx)(`td`,{className:`n`,"aria-label":`New`,children:`+`}),(0,$.jsx)(`td`,{className:`cell-key`,"data-label":`New secret`,children:(0,$.jsxs)(`div`,{className:`edit-stack`,children:[(0,$.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,"aria-label":`Name of the new secret`,"aria-invalid":c!==null,placeholder:`NAME_OF_SECRET`,spellCheck:!1,autoComplete:`off`,value:e.key,disabled:n,onBlur:()=>o(!0),onChange:e=>r({key:e.target.value}),onKeyDown:e=>{e.key===`Escape`&&i()}}),(c!==null||l)&&(0,$.jsx)(`span`,{className:`edit-note${c===null?``:` edit-note-error`}`,children:c??`This name already exists here. Saving appends a new version to it rather than creating a second secret.`})]})}),(0,$.jsx)(`td`,{"data-label":`Value`,children:(0,$.jsx)(`div`,{className:`edit-stack`,children:(0,$.jsx)(Ke,{label:`Value for ${s===``?`the new secret`:s}`,value:e.value,placeholder:`Value`,disabled:n,onChange:e=>r({value:e}),onEscape:i})})}),(0,$.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:(0,$.jsx)(`span`,{className:`version-shift`,children:l?(0,$.jsxs)($.Fragment,{children:[`v`,t,` → `,(0,$.jsxs)(`b`,{children:[`v`,t+1]})]}):(0,$.jsx)(`b`,{children:`new`})})}),(0,$.jsx)(`td`,{className:`col-written col-hide-narrow`,children:(0,$.jsx)(`span`,{className:`cell-muted`,children:`—`})}),(0,$.jsx)(`td`,{className:`col-actions`,children:(0,$.jsx)(`div`,{className:`acts`,children:(0,$.jsx)(H,{label:`Remove`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:i,disabled:n,"aria-label":s===``?`Remove this new secret`:`Remove new secret ${s}`,children:(0,$.jsx)(q,{size:15})})})})})]})}function Ze({number:e,project:t,environment:n,entry:r,canArchive:i,canReveal:a,status:o,onRestore:s,onDismiss:c}){let[l,u]=(0,Q.useState)(!1);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:`secret-row is-archived ${ve(o)}`,children:[(0,$.jsx)(`td`,{className:`n`,children:e}),(0,$.jsx)(`td`,{className:`cell-key`,"data-label":`Key`,children:z(r.key)}),(0,$.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:(0,$.jsx)(`span`,{className:`version-shift`,children:r.version===null?`—`:`v${r.version}`})}),(0,$.jsx)(`td`,{className:`col-written col-hide-narrow`,"data-label":`Last written`,children:(0,$.jsx)(Ye,{entry:r})}),(0,$.jsx)(`td`,{className:`col-actions`,children:(0,$.jsxs)(`div`,{className:`acts`,children:[(0,$.jsx)(U,{canReveal:a,children:(0,$.jsx)(H,{label:l?`Hide history`:`Version history`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:()=>u(e=>!e),"aria-label":`${l?`Hide history of`:`Version history of`} ${r.key}`,"aria-expanded":l,children:(0,$.jsx)(X,{size:15})})})}),i&&(o.state===`pending`?(0,$.jsx)(ye,{status:o}):(0,$.jsx)(H,{label:`Restore`,children:(0,$.jsx)(`button`,{className:`act act-icon`,onClick:s,"aria-label":`Restore ${r.key}`,children:(0,$.jsx)(J,{size:14})})}))]})})]}),l&&(0,$.jsx)(`tr`,{className:`detail-row`,children:(0,$.jsx)(`td`,{colSpan:5,children:(0,$.jsx)(Qe,{project:t,environment:n,secretKey:r.key,currentVersion:r.version,canWrite:!1,onClose:()=>u(!1),onRolledBack:()=>void 0})})}),(0,$.jsx)(be,{status:o,columns:5,onDismiss:()=>o.state===`failed`&&c(o.mutationId)})]})}function Qe({project:t,environment:n,secretKey:r,currentVersion:i,canWrite:o,onClose:s,onRolledBack:c}){let[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),p=e(),{pending:m,error:g,run:_}=Z();return(0,Q.useEffect)(()=>{let e=!1;return p.secrets.history(`${t}/${n}/${r}`).then(t=>{e||(u(t.versions),f(null))}).catch(t=>{e||f(t instanceof a?y(t):`The version history could not be loaded.`)}),()=>{e=!0}},[p,t,n,r,i]),(0,$.jsxs)(`div`,{className:`history`,children:[(0,$.jsxs)(`div`,{className:`history-head`,children:[(0,$.jsxs)(`span`,{className:`history-title th`,children:[(0,$.jsx)(X,{size:14}),`Versions of `,(0,$.jsx)(`span`,{className:`mono`,children:r})]}),(0,$.jsx)(`button`,{className:`act`,onClick:s,children:`Close`})]}),d===null?l===null?(0,$.jsxs)(`p`,{className:`hint history-body`,children:[(0,$.jsx)(N,{size:13}),` Loading versions…`]}):(0,$.jsx)(`div`,{className:`dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:`col-shrink`,children:`Version`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Written (UTC)`}),(0,$.jsx)(`th`,{children:`By`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Key id`}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:l.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsxs)(`td`,{className:`cell-mono nowrap`,children:[`v`,e.version,` `,e.current&&(0,$.jsx)(`span`,{className:`tag tag-blue`,children:`current`})]}),(0,$.jsx)(`td`,{className:`nowrap`,children:(0,$.jsx)(I,{iso:e.createdAt})}),(0,$.jsx)(`td`,{children:e.createdBy}),(0,$.jsx)(`td`,{className:`cell-mono cell-muted nowrap`,children:e.kek}),(0,$.jsx)(`td`,{className:`col-actions`,children:o&&!e.current&&(0,$.jsx)(V,{trigger:(0,$.jsxs)(`button`,{className:`act`,disabled:m,children:[(0,$.jsx)(J,{size:13}),`Roll back`]}),title:(0,$.jsxs)($.Fragment,{children:[`Roll `,(0,$.jsx)(`span`,{className:`mono`,children:r}),` back to v`,e.version,`?`]}),body:(0,$.jsxs)($.Fragment,{children:[`The current pointer moves to v`,e.version,`. Nothing is copied or deleted, every version stays readable, and the next write continues the numbering forward. Anything reading`,` `,(0,$.jsxs)(`span`,{className:`mono`,children:[t,`/`,n]}),` `,`picks up the change immediately.`]}),confirmLabel:`Roll back to v${e.version}`,destructive:!1,onConfirm:()=>_(()=>p.secrets.restore(`${t}/${n}/${r}`,e.version),{affects:h.secrets({project:t,environment:n}),onSuccess:()=>{c(),j.success(`${r} rolled back to v${e.version}`)}})})})]},e.version))})]})}):(0,$.jsx)(`div`,{className:`history-body`,children:(0,$.jsx)(M,{error:d})}),g!==null&&(0,$.jsx)(`div`,{className:`history-body`,children:(0,$.jsx)(M,{error:g})}),(0,$.jsx)(`p`,{className:`history-note`,children:`Metadata only. Listing versions decrypts nothing.`})]})}var $e={added:`tag tag-green`,changed:`tag tag-blue`,unchanged:`tag`};async function et(e,t,n){let r=we(n);return r.entries.length===0?{plan:[],changes:{},problems:r.problems}:{...await o(e,t,r.entries),problems:r.problems}}function tt({project:t,environment:n}){let[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)([]),[l,u]=(0,Q.useState)(!1),d=e(),{pending:f,error:p,setError:m,run:g}=Z(),_=`${t}/${n}`;function v(){g(()=>et(d,_,r),{affects:[],onSuccess:e=>{c(e.problems),o({entries:e.plan,changes:e.changes})}})}function y(){if(a===null)return;let e=Object.keys(a.changes).length;g(()=>d.secrets.set(_,a.changes),{affects:h.secrets({project:t,environment:n}),onSuccess:()=>{j.success(`Imported ${e} change${e===1?``:`s`}`),b()}})}function b(){u(!1),o(null),i(``),c([]),m(null)}let x=a?.entries.filter(e=>e.action!==`unchanged`)??[];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn`,onClick:()=>u(!0),children:[(0,$.jsx)(ce,{size:14}),`Import .env`]}),(0,$.jsx)(R,{open:l,onOpenChange:e=>e?u(!0):b(),title:(0,$.jsxs)($.Fragment,{children:[`Import into`,` `,(0,$.jsxs)(`span`,{className:`mono`,children:[t,`/`,n]})]}),wide:!0,description:(0,$.jsx)($.Fragment,{children:`Paste a .env file. It is read by the CLI’s own parser, so this page and the CLI cannot disagree about what it means, and malformed lines are reported rather than guessed at. coffre compares it with the current values without sending any to this page.`}),children:(0,$.jsxs)(`div`,{className:`form`,style:{marginTop:`1.25rem`},children:[(0,$.jsxs)(`label`,{className:`field`,children:[(0,$.jsx)(`span`,{className:`label`,children:`File contents`}),(0,$.jsx)(`textarea`,{className:`textarea`,autoFocus:!0,spellCheck:!1,placeholder:`DATABASE_URL=postgres://…
3
+ STRIPE_KEY="sk_live_…"`,value:r,onChange:e=>{i(e.target.value),o(null),c([])}})]}),a!==null&&a.entries.length>0&&(0,$.jsx)(`div`,{className:`card dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Key`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Plan`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Current`})]})}),(0,$.jsx)(`tbody`,{children:a.entries.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{className:`cell-key`,children:z(e.key)}),(0,$.jsx)(`td`,{className:`col-shrink`,children:(0,$.jsx)(`span`,{className:$e[e.action],children:e.action})}),(0,$.jsx)(`td`,{className:`col-shrink cell-mono cell-muted`,children:e.version===null?`—`:`v${e.version}`})]},e.key))})]})}),a!==null&&a.entries.length>0&&x.length===0&&(0,$.jsx)(B,{tone:`good`,children:`Every key already has this value. There is nothing to write.`}),s.length>0&&(0,$.jsxs)(B,{tone:`bad`,children:[(0,$.jsxs)(`strong`,{children:[s.length,` line`,s.length===1?``:`s`,` could not be parsed`]}),(0,$.jsx)(`ul`,{style:{margin:`0.375rem 0 0`,paddingLeft:`1.1rem`},children:s.map(e=>(0,$.jsxs)(`li`,{children:[`Line `,e.line,`: `,e.reason,` `,(0,$.jsxs)(`span`,{className:`mono`,children:[`(`,e.text,`)`]})]},e.line))})]}),(0,$.jsx)(M,{error:p}),(0,$.jsxs)(`div`,{className:`dialog-actions`,children:[(0,$.jsx)(`button`,{className:`btn`,onClick:b,children:`Cancel`}),a===null?(0,$.jsxs)(`button`,{className:`btn btn-primary`,disabled:f||r.trim()===``,onClick:v,children:[f&&(0,$.jsx)(N,{}),`Preview changes`]}):(0,$.jsxs)(`button`,{className:`btn btn-primary`,disabled:f||x.length===0,onClick:y,children:[f&&(0,$.jsx)(N,{}),`Write `,x.length,` change`,x.length===1?``:`s`]})]})]})})]})}export{He as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects._project._environment-CHzbboGp.js","_coffre/assets/page-CGmvjSy4.js","_coffre/assets/link-DP8SVWon.js","_coffre/assets/suspense-C7KwSnTG.js","_coffre/assets/use-change-BRRMJocl.js","_coffre/assets/row-state-ByET1OKX.js","_coffre/assets/ui-BdipqGpP.js","_coffre/assets/icons-BQ27Ds9u.js","_coffre/assets/use-shell-BMGlJ25Q.js","_coffre/assets/useSuspenseQuery-CSXyDALB.js","_coffre/assets/dist-QVHMLatb.js","_coffre/assets/affordances-Bq2-oUB5.js","_coffre/assets/use-action-DRm9yVhV.js","_coffre/assets/validation-9Cl_XS-l.js"])))=>i.map(i=>d[i]);
2
+ import{h as e}from"./page-CGmvjSy4.js";import{n as t,r as n,t as r}from"./preload-helper-ClBkJ19f.js";var i=n(`/projects/$project/$environment`)({validateSearch:e=>({filter:typeof e.filter==`string`&&e.filter!==``?e.filter:void 0}),loader:({context:{client:t,queryClient:n},params:r})=>Promise.all([n.fetchQuery(e.secrets(t,r)),n.fetchQuery(e.syncs(t,r))]),component:t(()=>r(()=>import(`./projects._project._environment-CHzbboGp.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])),`component`)});export{i as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects._project.index-DZ9l6d-1.js","_coffre/assets/page-CGmvjSy4.js","_coffre/assets/link-DP8SVWon.js","_coffre/assets/use-change-BRRMJocl.js","_coffre/assets/suspense-C7KwSnTG.js","_coffre/assets/row-state-ByET1OKX.js","_coffre/assets/ui-BdipqGpP.js","_coffre/assets/icons-BQ27Ds9u.js","_coffre/assets/use-shell-BMGlJ25Q.js","_coffre/assets/useSuspenseQuery-CSXyDALB.js","_coffre/assets/useQuery-D__2KBOs.js","_coffre/assets/dist-QVHMLatb.js","_coffre/assets/project-environments-CfIH5kFM.js","_coffre/assets/directory-nDExpkAz.js","_coffre/assets/use-action-DRm9yVhV.js","_coffre/assets/validation-9Cl_XS-l.js","_coffre/assets/grants-CjoOnxzz.js"])))=>i.map(i=>d[i]);
2
+ import{d as e}from"./page-CGmvjSy4.js";import{n as t,r as n,t as r}from"./preload-helper-ClBkJ19f.js";var i=n(`/projects/$project/`)({validateSearch:e=>({tab:e.tab===`users`||e.tab===`tokens`||e.tab===`settings`?e.tab:void 0}),loader:({context:{client:t,queryClient:n},params:r})=>e(n,t,r.project),component:t(()=>r(()=>import(`./projects._project.index-DZ9l6d-1.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])),`component`)});export{i as t};
@@ -0,0 +1 @@
1
+ import{C as e,U as t,V as n,Z as r,c as i,et as a,h as o,i as s,m as c,n as l,o as u,t as d}from"./page-CGmvjSy4.js";import{t as f}from"./link-DP8SVWon.js";import{D as p,E as m,T as h,_ as g,d as _,f as v,i as y,n as b,p as x,s as S,t as C}from"./use-change-BRRMJocl.js";import{t as w}from"./use-shell-BMGlJ25Q.js";import{t as T}from"./useSuspenseQuery-CSXyDALB.js";import{t as E}from"./useQuery-D__2KBOs.js";import{n as D}from"./dist-QVHMLatb.js";import{a as O,c as k,h as A,i as j,n as M,o as N,s as P}from"./ui-BdipqGpP.js";import{t as ee}from"./project-environments-CfIH5kFM.js";import{A as te,D as F,F as I,G as L,I as ne,M as R,P as z,a as B,i as V,p as re,q as ie,v as H,y as ae}from"./icons-BQ27Ds9u.js";import{a as U,i as W,t as G}from"./row-state-ByET1OKX.js";import{t as K}from"./projects._project.index-CIAsjvg6.js";import{i as q,o as oe,s as se}from"./directory-nDExpkAz.js";import{t as J}from"./use-action-DRm9yVhV.js";import{n as Y}from"./validation-9Cl_XS-l.js";import{i as ce,n as le,r as ue,t as de}from"./grants-CjoOnxzz.js";var X=a(r(),1),Z=t();function fe({principalType:t,canList:n,grants:r,value:i,onChange:a}){let s=e(),c=E(o.directory(s,n)).data??null,[l,u]=(0,X.useState)(``),d=(0,X.useId)(),p=q[t],h=t===`user`?`User`:`Token`;if(!n||c?.ok===!1)return(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:t===`user`?`Email`:`Service token common name`}),(0,Z.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:t===`user`?`someone@acme.example`:`ci-deploy`,value:i,onChange:e=>a(e.target.value)}),(0,Z.jsxs)(`span`,{className:`hint`,children:[`The `,p,` must already be registered under `,t===`user`?`Users`:`Tokens`,`.`]})]});let g=c?.principals.filter(e=>e.principalType===t)??[],_=l.trim().toLowerCase(),v=g.filter(e=>e.principalId.toLowerCase().includes(_));return(0,Z.jsxs)(`fieldset`,{className:`field picker`,children:[(0,Z.jsx)(`legend`,{className:`label`,children:h}),(0,Z.jsxs)(`label`,{className:`input-group`,children:[(0,Z.jsxs)(`span`,{className:`visually-hidden`,children:[`Filter `,p,`s by name`]}),(0,Z.jsx)(I,{size:14,className:`input-icon`}),(0,Z.jsx)(`input`,{className:`input`,type:`search`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:t===`user`?`Filter by email…`:`Filter by name…`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v.length===1&&(e.preventDefault(),a(v[0].principalId))}})]}),(0,Z.jsx)(`div`,{className:`picker-list`,children:c===null?(0,Z.jsxs)(`p`,{className:`picker-empty`,children:[(0,Z.jsx)(k,{size:13}),`Loading `,p,`s…`]}):g.length===0?(0,Z.jsxs)(`p`,{className:`picker-empty`,children:[`No `,p,`s are registered yet.`,` `,(0,Z.jsx)(f,{to:t===`user`?`/users`:`/tokens`,children:`Add one`}),` first.`]}):v.length===0?(0,Z.jsxs)(`p`,{className:`picker-empty`,children:[`No registered `,p,` matches “`,l.trim(),`”.`]}):v.map(e=>{let n=r.filter(n=>n.principalType===t&&n.principalId===e.principalId).map(m),o=e.principalId===i;return(0,Z.jsxs)(`label`,{className:`picker-option${o?` is-chosen`:``}`,children:[(0,Z.jsx)(`input`,{type:`radio`,className:`visually-hidden`,name:d,value:e.principalId,checked:o,onChange:()=>a(e.principalId)}),(0,Z.jsx)(oe,{type:t,id:e.principalId}),(0,Z.jsx)(`span`,{className:`picker-name`,children:e.principalId}),n.length>0&&(0,Z.jsxs)(`span`,{className:`picker-held`,children:[(0,Z.jsx)(`span`,{className:`visually-hidden`,children:`holds`}),n.map(e=>(0,Z.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,Z.jsx)(B,{size:14,className:`picker-check`})]},e.principalId)})})]})}var pe=[{key:`environments`,label:`Environments`,icon:(0,Z.jsx)(ae,{size:15})},{key:`users`,label:`Users`,icon:(0,Z.jsx)(ie,{size:15})},{key:`tokens`,label:`Tokens`,icon:(0,Z.jsx)(H,{size:15})},{key:`settings`,label:`Settings`,icon:(0,Z.jsx)(ne,{size:15})}];function me(){let{project:t}=K.useParams(),{data:n}=T(o.projects(e())),r=c(n,t);return r.ok?r.managesAccess?(0,Z.jsx)(he,{project:r.project}):(0,Z.jsx)(Q,{project:r.project,grants:[],grantsError:null}):(0,Z.jsx)(l,{icon:(0,Z.jsx)(re,{size:18}),label:(0,Z.jsx)(`span`,{className:`mono`,children:t}),title:`No project here for you`,actions:(0,Z.jsx)(f,{className:`btn`,to:`/projects`,children:`All projects`}),children:r.error??`There is no such project, or you hold no grant on it. The two look the same on purpose: an answer that told them apart would let anyone list project names.`})}function he({project:t}){let{data:n}=T(o.grants(e(),t.slug));return n.ok?(0,Z.jsx)(Q,{project:t,grants:n.grants,grantsError:null}):(0,Z.jsx)(Q,{project:t,grants:[],grantsError:n.error})}function Q({project:e,grants:t,grantsError:n}){let r=K.useSearch(),i=e.permissions.includes(`project.manage`),a=e.permissions.includes(`environment.manage`),o=e.permissions.includes(`grant.manage`),c=pe.filter(({key:e})=>e===`environments`||(e===`users`||e===`tokens`)&&o||e===`settings`&&i),l=c.find(({key:e})=>e===r.tab)?.key??`environments`,u=l===`users`?`user`:`service`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s,{tile:e.slug,title:e.name,aside:(0,Z.jsx)(`span`,{className:`page-title-slug`,children:e.slug}),actions:l===`environments`?a&&(0,Z.jsx)(_e,{project:e.slug}):(l===`users`||l===`tokens`)&&n===null&&(0,Z.jsx)(ye,{principalType:u,project:e.slug,environments:e.environments,grants:t})}),e.archivedAt!==null&&(0,Z.jsx)(`div`,{style:{marginBottom:`1.25rem`},children:(0,Z.jsxs)(P,{tone:`bad`,children:[(0,Z.jsx)(`strong`,{children:`This project is archived.`}),` Its environments serve no reads, to people or to machines, until it is restored.`]})}),c.length>1&&(0,Z.jsx)(`nav`,{className:`tabs`,"aria-label":`Project sections`,children:c.map(({key:t,label:n,icon:r})=>(0,Z.jsxs)(f,{to:`/projects/$project`,params:{project:e.slug},search:{tab:t===`environments`?void 0:t},activeOptions:{exact:!0,explicitUndefined:!0},"aria-current":t===l?`page`:void 0,children:[r,n]},t))}),l===`environments`&&(0,Z.jsx)(ge,{project:e,canManage:a}),(l===`users`||l===`tokens`)&&(n===null?(0,Z.jsx)(ve,{principalType:u,project:e.slug,grants:t.filter(e=>e.principalType===u)}):(0,Z.jsx)(P,{tone:`bad`,children:n})),l===`settings`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(be,{project:e}),(0,Z.jsx)(xe,{project:e})]})]})}function ge({project:e,canManage:t}){let n=e.environments.filter(ee).filter(e=>e.details.archivedAt!==null),r=e.environments.filter(e=>e.details===null||e.details.archivedAt===null),{failedAdds:a,dismiss:o}=b(i.projects),s=a(e.environments.map(t=>_(e.slug,t.slug))).filter(({ids:t})=>t.every(t=>t.startsWith(`${e.slug}/`)));return(0,Z.jsxs)(Z.Fragment,{children:[r.length===0&&s.length===0?(0,Z.jsx)(`div`,{className:`card`,children:(0,Z.jsx)(j,{title:`No environments yet`,children:t?`Add the first with Add environment.`:`Creating environments needs environment.manage on this project.`})}):(0,Z.jsxs)(`ul`,{className:`env-grid`,"aria-label":`Environments`,children:[r.map(n=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)($,{project:e.slug,environment:n,isAdmin:t})},`${e.slug}:${n.slug}`)),s.map(({mutationId:e,vars:t,status:n})=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`div`,{className:`env-card is-muted is-failed`,children:[(0,Z.jsxs)(`div`,{className:`env-card-text`,children:[(0,Z.jsx)(`span`,{className:`env-card-name`,children:t.name}),(0,Z.jsx)(`span`,{className:`env-card-meta`,children:(0,Z.jsx)(`span`,{className:`mono`,children:t.slug})})]}),(0,Z.jsx)(G,{status:n,onDismiss:()=>o(e),children:`Not added.`})]})},e))]}),n.length>0&&(0,Z.jsxs)(`section`,{"aria-labelledby":`archived-environments`,children:[(0,Z.jsx)(`h2`,{className:`section-title`,id:`archived-environments`,children:`Archived`}),(0,Z.jsx)(`ul`,{className:`env-grid`,children:n.map(n=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)($,{project:e.slug,environment:n,isAdmin:t})},n.slug))})]})]})}function $({project:t,environment:n,isAdmin:r}){let[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(n.slug),[d,p]=(0,X.useState)(n.name),m=e(),h=C(g(m,t)),v=C(y(m,t)),{status:x,dismiss:S}=b(i.projects),w=x(_(t,n.slug)),T=w.state===`pending`,E=n.details,D=E!==null&&E.archivedAt!==null,O=E?.secretCount??null,k=E!==null&&!D&&n.accessible&&!T,j=r&&E!==null,P=l===``?null:Y(l);return(0,Z.jsxs)(`div`,{className:`env-card${k?` is-link`:` is-muted`} ${U(w)}`,children:[(0,Z.jsxs)(`div`,{className:`env-card-text`,children:[k?(0,Z.jsx)(f,{className:`env-card-name stretch`,to:`/projects/$project/$environment`,params:{project:t,environment:n.slug},children:n.name}):(0,Z.jsx)(`span`,{className:`env-card-name`,children:n.name}),(0,Z.jsxs)(`span`,{className:`env-card-meta`,children:[(0,Z.jsx)(`span`,{className:`mono`,children:n.slug}),D?(0,Z.jsx)(`span`,{className:`tag tag-red`,children:`archived`}):!n.accessible&&!T?(0,Z.jsx)(`span`,{className:`tag tag-outline`,children:`no secret access`}):O!==null&&(0,Z.jsxs)(`span`,{children:[O,` secret`,O===1?``:`s`]})]})]}),T&&(0,Z.jsx)(W,{status:w}),j&&!T&&(0,Z.jsxs)(A.Root,{children:[(0,Z.jsx)(A.Trigger,{asChild:!0,children:(0,Z.jsx)(`button`,{className:`act act-quiet env-card-menu`,"aria-label":`Actions for ${n.slug}`,children:(0,Z.jsx)(F,{size:16})})}),(0,Z.jsx)(A.Portal,{children:(0,Z.jsxs)(A.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,Z.jsxs)(A.Item,{className:`menu-item`,onSelect:()=>{u(n.slug),p(n.name),o(!0)},children:[(0,Z.jsx)(te,{size:14}),`Rename`]}),(0,Z.jsx)(A.Separator,{className:`menu-sep`}),(0,Z.jsxs)(A.Item,{className:`menu-item${D?``:` menu-item-danger`}`,onSelect:()=>c(!0),children:[D?(0,Z.jsx)(z,{size:14}):(0,Z.jsx)(V,{size:14}),D?`Restore`:`Archive…`]})]})})]}),j&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{open:a,onOpenChange:o,title:(0,Z.jsxs)(Z.Fragment,{children:[`Rename`,` `,(0,Z.jsxs)(`span`,{className:`mono`,children:[t,`/`,n.slug]})]}),children:(0,Z.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),h({from:n.slug,slug:l,name:d.trim()}),o(!1)},children:[(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:`Slug`}),(0,Z.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,value:l,"aria-invalid":P!==null,onChange:e=>u(e.target.value)}),(0,Z.jsx)(`span`,{className:`hint${P===null?``:` edit-note-error`}`,children:P??`Anything running coffre run ${t}/${n.slug} will need the new path.`})]}),(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:`Display name`}),(0,Z.jsx)(`input`,{className:`input`,value:d,onChange:e=>p(e.target.value)})]}),(0,Z.jsxs)(`div`,{className:`dialog-actions`,children:[(0,Z.jsx)(`button`,{className:`btn`,type:`button`,onClick:()=>o(!1),children:`Cancel`}),(0,Z.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:l===``||P!==null||d.trim()===``,children:`Save`})]})]})}),(0,Z.jsx)(M,{open:s,onOpenChange:c,title:(0,Z.jsxs)(Z.Fragment,{children:[D?`Restore`:`Archive`,` `,(0,Z.jsxs)(`span`,{className:`mono`,children:[t,`/`,n.slug]}),`?`]}),body:O===null?(0,Z.jsx)(Z.Fragment,{children:`This changes whether the environment serves secrets to principals who have access. Values and history remain stored.`}):D?(0,Z.jsxs)(Z.Fragment,{children:[`The environment starts serving its `,O,` secret`,O===1?``:`s`,` again, to everyone who holds a grant on it.`]}):(0,Z.jsxs)(Z.Fragment,{children:[`Its `,O,` secret`,O===1?``:`s`,` stop being served, so anything running `,(0,Z.jsx)(`code`,{children:`coffre run`}),` against`,` `,(0,Z.jsxs)(`span`,{className:`mono`,children:[t,`/`,n.slug]}),` `,`loses them at its next start. Values and history survive, and restoring is one click.`]}),confirmLabel:D?`Restore environment`:`Archive environment`,destructive:!D,onConfirm:()=>v({slug:n.slug,archived:!D})})]}),(0,Z.jsx)(G,{status:w,onDismiss:()=>w.state===`failed`&&S(w.mutationId)})]})}function _e({project:t}){let[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(``),c=C(S(e(),t)),l=i===``?null:Y(i);function u(){r(!1)}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>r(!0),children:[(0,Z.jsx)(R,{size:14}),`Add environment`]}),(0,Z.jsx)(N,{open:n,onOpenChange:e=>e?r(!0):u(),title:(0,Z.jsxs)(Z.Fragment,{children:[`New environment in `,(0,Z.jsx)(`span`,{className:`mono`,children:t})]}),children:(0,Z.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),c({slug:i,name:o.trim()}),a(``),s(``),u()},children:[(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:`Slug`}),(0,Z.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:`staging`,value:i,"aria-invalid":l!==null,onChange:e=>a(e.target.value)}),(0,Z.jsx)(`span`,{className:`hint${l===null?``:` edit-note-error`}`,children:l??(0,Z.jsxs)(Z.Fragment,{children:[`The CLI will address it as`,` `,(0,Z.jsxs)(`span`,{className:`mono`,children:[t,`/`,i===``?`staging`:i]}),`.`]})})]}),(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:`Display name`}),(0,Z.jsx)(`input`,{className:`input`,placeholder:`Staging`,value:o,onChange:e=>s(e.target.value)})]}),(0,Z.jsxs)(`div`,{className:`dialog-actions`,children:[(0,Z.jsx)(`button`,{className:`btn`,type:`button`,onClick:u,children:`Cancel`}),(0,Z.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:i===``||l!==null||o.trim()===``,children:`Add environment`})]})]})})]})}function ve({principalType:e,project:t,grants:n}){let r=e===`user`,i=ce(t,n,e);return(0,Z.jsx)(`section`,{className:`card`,"aria-label":r?`Users with access`:`Tokens with access`,children:n.length===0&&i.length===0?(0,Z.jsxs)(j,{title:r?`No user has access`:`No token has access`,children:[`Add `,r?`a user`:`a token`,` with permissions on the whole project or on one environment.`]}):(0,Z.jsxs)(le,{lead:(0,Z.jsxs)(`span`,{className:`th`,children:[r?(0,Z.jsx)(L,{size:14}):(0,Z.jsx)(H,{size:14}),r?`Email`:`Name`]}),children:[n.map((e,n)=>(0,Z.jsx)(de,{number:n+1,project:t,grant:e,leadLabel:r?`Email`:`Name`,lead:(0,Z.jsx)(se,{type:e.principalType,id:e.principalId})},x(e))),(0,Z.jsx)(ue,{refused:i})]})})}function ye({principalType:t,project:n,environments:r,grants:i}){let{capabilities:a}=w(),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(`viewer:`),[f,m]=(0,X.useState)(``),g=C(v(e(),n)),_=p(r),y=t===`user`?`user`:`token`;function b(){s(!1)}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>s(!0),children:[(0,Z.jsx)(R,{size:14}),`Add `,y]}),(0,Z.jsx)(N,{open:o,onOpenChange:e=>e?s(!0):b(),title:(0,Z.jsxs)(Z.Fragment,{children:[`Give a `,y,` access to `,(0,Z.jsx)(`span`,{className:`mono`,children:n})]}),wide:!0,description:`Owners manage the whole project and its access. Read and write can cover every environment, or one.`,children:(0,Z.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault();let n=h(u);g({principalType:t,principalId:c.trim(),role:n.role,roleName:_.find(e=>e.value===u)?.label??n.role,environmentSlug:n.environmentSlug,expiresAt:f===``?null:new Date(`${f}T23:59:59Z`).toISOString()}),l(``),m(``),d(`viewer:`),b()},children:[(0,Z.jsx)(fe,{principalType:t,canList:a.canManageGrants,grants:i,value:c,onChange:l}),(0,Z.jsxs)(`div`,{className:`form-row`,children:[(0,Z.jsxs)(`label`,{className:`field`,style:{flexGrow:2},children:[(0,Z.jsx)(`span`,{className:`label`,children:`Permissions`}),(0,Z.jsx)(`select`,{className:`select`,value:u,onChange:e=>d(e.target.value),children:_.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsxs)(`span`,{className:`label`,children:[`Expires `,(0,Z.jsx)(`span`,{className:`hint`,children:`(optional)`})]}),(0,Z.jsx)(`input`,{className:`input`,type:`date`,value:f,onChange:e=>m(e.target.value)})]})]}),(0,Z.jsxs)(`div`,{className:`dialog-actions`,children:[(0,Z.jsx)(`button`,{className:`btn`,type:`button`,onClick:b,children:`Cancel`}),(0,Z.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:c.trim()===``,children:`Grant access`})]})]})})]})}function be({project:t}){let r=n(),[i,a]=(0,X.useState)(t.slug),[o,s]=(0,X.useState)(t.name),c=e(),{pending:l,error:d,run:f}=J(),p=i===``?null:Y(i),m=i!==t.slug||o.trim()!==t.name;return(0,X.useEffect)(()=>{a(t.slug),s(t.name)},[t.slug,t.name]),(0,Z.jsxs)(`section`,{className:`card`,"aria-labelledby":`general-settings`,children:[(0,Z.jsx)(`div`,{className:`card-head`,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(`h2`,{className:`card-title`,id:`general-settings`,children:`General`})})}),(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),f(()=>c.projects.update(t.slug,{slug:i,name:o}),{affects:u.places(),onSuccess:async()=>{D.success(`Project renamed`),i!==t.slug&&await r.navigate({to:`/projects/$project`,params:{project:i},search:{tab:`settings`}})}})},children:[(0,Z.jsxs)(`div`,{className:`card-body form-row`,children:[(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:`Slug`}),(0,Z.jsx)(`input`,{className:`input input-mono`,spellCheck:!1,value:i,"aria-invalid":p!==null,onChange:e=>a(e.target.value)}),(0,Z.jsx)(`span`,{className:`hint${p===null?``:` edit-note-error`}`,children:p??`Scripts that name the old slug will need the new one.`})]}),(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:`Display name`}),(0,Z.jsx)(`input`,{className:`input`,value:o,onChange:e=>s(e.target.value)})]})]}),(0,Z.jsxs)(`div`,{className:`card-foot`,children:[d!==null&&(0,Z.jsx)(`span`,{className:`hint`,children:(0,Z.jsx)(O,{error:d})}),(0,Z.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:!m||l||i===``||p!==null||o.trim()===``,children:[l&&(0,Z.jsx)(k,{}),`Save`]})]})]})]})}function xe({project:t}){let[n,r]=(0,X.useState)(!1),i=e(),{pending:a,error:o,run:s}=J(),c=t.archivedAt!==null;return(0,Z.jsxs)(d,{labelledBy:`danger-zone`,title:`Danger zone`,tone:`danger`,children:[(0,Z.jsxs)(`div`,{className:`card-row`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`card-row-title`,children:c?`Restore project`:`Archive project`}),(0,Z.jsx)(`p`,{className:`card-row-desc`,children:c?`The project reappears in listings and its environments serve reads again, for everyone who holds a grant on it.`:`Every environment stops serving reads, including to machine callers already running. Nothing is deleted, and you can restore it here at any time.`}),o!==null&&(0,Z.jsx)(`div`,{style:{marginTop:`0.5rem`},children:(0,Z.jsx)(O,{error:o})})]}),(0,Z.jsxs)(`button`,{className:`btn ${c?``:`btn-danger-outline`}`,onClick:()=>r(!0),disabled:a,children:[a?(0,Z.jsx)(k,{}):c?(0,Z.jsx)(z,{size:14}):(0,Z.jsx)(V,{size:14}),c?`Restore project`:`Archive project…`]})]}),(0,Z.jsx)(M,{open:n,onOpenChange:r,title:(0,Z.jsxs)(Z.Fragment,{children:[c?`Restore`:`Archive`,` `,(0,Z.jsx)(`span`,{className:`mono`,children:t.slug}),`?`]}),body:c?(0,Z.jsx)(Z.Fragment,{children:`The project reappears in listings and its environments start serving reads again, for everyone who holds a grant on it.`}):(0,Z.jsxs)(Z.Fragment,{children:[`Every environment in `,(0,Z.jsx)(`span`,{className:`mono`,children:t.slug}),` stops serving reads, including to machine callers already running. Nothing is deleted: values, versions and the audit trail over them stay intact, and you can restore it here at any time.`]}),confirmLabel:c?`Restore project`:`Archive project`,destructive:!c,onConfirm:()=>s(()=>i.projects.update(t.slug,{archived:!c}),{affects:u.places(),onSuccess:()=>D.success(c?`${t.slug} restored`:`${t.slug} archived`)})})]})}export{me as component};
@@ -0,0 +1 @@
1
+ import{C as e,U as t,Z as n,a as r,et as i,h as a,i as o,n as s}from"./page-CGmvjSy4.js";import{t as c}from"./link-DP8SVWon.js";import{c as l,h as u,n as d,t as f}from"./use-change-BRRMJocl.js";import{t as p}from"./use-shell-BMGlJ25Q.js";import{t as m}from"./useSuspenseQuery-CSXyDALB.js";import{i as h,o as g}from"./ui-BdipqGpP.js";import{n as _}from"./project-environments-CfIH5kFM.js";import{n as v,r as y}from"./affordances-Bq2-oUB5.js";import{M as b,h as x,p as S,r as C,y as w}from"./icons-BQ27Ds9u.js";import{a as T,i as E,r as D}from"./row-state-ByET1OKX.js";import{n as O}from"./validation-9Cl_XS-l.js";var k=i(n()),A=t();function j(){let{data:t,refetch:n}=m(a.projects(e())),{capabilities:r}=p(),{failedAdds:i}=d(u.queryKey),l=t.ok?i(t.projects.map(e=>e.slug)):[];if(!t.ok)return(0,A.jsx)(s,{icon:(0,A.jsx)(C,{size:18}),title:`Projects could not be listed`,actions:t.signedOut?(0,A.jsx)(c,{className:`btn`,to:`/login`,children:`Sign in again`}):(0,A.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>void n(),children:`Try again`}),children:t.error});let f=t.projects.filter(e=>e.archivedAt===null),g=t.projects.filter(e=>e.archivedAt!==null);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(o,{title:`Projects`,actions:(0,A.jsx)(y,{capabilities:r,children:(0,A.jsx)(P,{})})}),f.length===0&&l.length===0?(0,A.jsx)(`div`,{className:`card`,children:(0,A.jsx)(h,{title:`Nothing here for you yet`,children:(0,A.jsx)(v,{capabilities:r,hasArchivedProjects:g.length>0})})}):(0,A.jsx)(`section`,{className:`card`,"aria-label":`Projects`,children:(0,A.jsx)(M,{projects:f,refused:!0})}),g.length>0&&(0,A.jsxs)(`section`,{"aria-labelledby":`archived-projects`,children:[(0,A.jsx)(`h2`,{className:`section-title`,id:`archived-projects`,children:`Archived`}),(0,A.jsx)(`div`,{className:`card`,children:(0,A.jsx)(M,{projects:g})})]})]})}function M({projects:e,refused:t=!1}){let{status:n,failedAdds:r,dismiss:i}=d(u.queryKey);return(0,A.jsx)(`div`,{className:`dt-wrap`,children:(0,A.jsxs)(`table`,{className:`dt projects 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-project`,children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(S,{size:14}),`Project`]})}),(0,A.jsx)(`th`,{children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(w,{size:14}),`Environments`]})}),(0,A.jsx)(`th`,{className:`col-shrink col-secrets`,children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(x,{size:14}),`Secrets`]})})]})}),(0,A.jsxs)(`tbody`,{children:[e.map((e,t)=>(0,A.jsx)(N,{number:t+1,project:e,status:n(e.slug),onDismiss:i},e.slug)),t&&r(e.map(e=>e.slug)).map(({mutationId:e,vars:t,status:n})=>(0,A.jsxs)(D,{status:n,columns:4,onDismiss:()=>i(e),children:[`Project `,t.slug,` was not created.`]},e))]})]})})}function N({number:e,project:t,status:n,onDismiss:i}){let a=t.secretCount,o=n.state===`pending`,s=t.archivedAt!==null,l=t.environments.filter(e=>e.details===null||e.details.archivedAt===null);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`tr`,{className:`row-link ${T(n)}`,children:[(0,A.jsx)(`td`,{className:`n`,children:e}),(0,A.jsx)(`td`,{className:`col-project`,children:(0,A.jsxs)(`span`,{className:`cell-project`,children:[(0,A.jsx)(r,{name:t.slug}),(0,A.jsxs)(`span`,{className:`cell-stack`,children:[o?(0,A.jsx)(`span`,{children:t.name}):(0,A.jsx)(c,{className:`cell-link stretch`,to:`/projects/$project`,params:{project:t.slug},children:t.name}),(0,A.jsx)(`small`,{className:`mono`,children:t.slug})]})]})}),(0,A.jsx)(`td`,{className:`col-envs`,"data-label":`Environments`,children:s||l.length===0?(0,A.jsx)(`span`,{className:`cell-muted`,children:l.length===0?`No environments yet`:`${l.length} environment${l.length===1?``:`s`}`}):(0,A.jsx)(`span`,{className:`env-links`,"aria-label":`Environments in ${t.slug}`,children:l.map(e=>_(e)?(0,A.jsxs)(c,{className:`env-link`,to:`/projects/$project/$environment`,params:{project:t.slug,environment:e.slug},children:[e.slug,(0,A.jsx)(`span`,{className:`count`,children:e.details.secretCount})]},e.slug):(0,A.jsx)(`span`,{className:`env-link`,title:`You can see this environment exists, but not open it`,children:e.slug},e.slug))})}),(0,A.jsx)(`td`,{className:`col-secrets num nowrap`,children:o?(0,A.jsx)(E,{status:n}):a!==null&&!s?(0,A.jsxs)(A.Fragment,{children:[a,(0,A.jsxs)(`span`,{className:`narrow-only`,children:[` secret`,a===1?``:`s`]})]}):(0,A.jsx)(`span`,{className:`cell-muted wide-only`,children:`—`})})]}),(0,A.jsx)(D,{status:n,columns:4,onDismiss:()=>n.state===`failed`&&i(n.mutationId)})]})}function P(){let[t,n]=(0,k.useState)(``),[r,i]=(0,k.useState)(``),[a,o]=(0,k.useState)(!1),s=f(l(e())),c=t===``?null:O(t);function u(){o(!1)}return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>o(!0),children:[(0,A.jsx)(b,{size:14}),`New project`]}),(0,A.jsx)(g,{open:a,onOpenChange:e=>e?o(!0):u(),title:`New project`,description:`A project holds environments, and access is granted on it or on one of its environments. You become its owner.`,children:(0,A.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),s({slug:t,name:r.trim()}),n(``),i(``),u()},children:[(0,A.jsxs)(`label`,{className:`field`,children:[(0,A.jsx)(`span`,{className:`label`,children:`Slug`}),(0,A.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:`market`,value:t,"aria-invalid":c!==null,"aria-describedby":`new-project-slug-hint`,onChange:e=>n(e.target.value)}),(0,A.jsx)(`span`,{className:`hint${c===null?``:` edit-note-error`}`,id:`new-project-slug-hint`,children:c??`Used in paths, as in market/prod. Renaming it later is safe.`})]}),(0,A.jsxs)(`label`,{className:`field`,children:[(0,A.jsx)(`span`,{className:`label`,children:`Display name`}),(0,A.jsx)(`input`,{className:`input`,placeholder:`Market data platform`,value:r,onChange:e=>i(e.target.value)})]}),(0,A.jsxs)(`div`,{className:`dialog-actions`,children:[(0,A.jsx)(`button`,{className:`btn`,type:`button`,onClick:u,children:`Cancel`}),(0,A.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:t===``||c!==null||r.trim()===``,children:`Create project`})]})]})})]})}export{j as component};
@@ -0,0 +1 @@
1
+ import{U as e,Z as t,et as n}from"./page-CGmvjSy4.js";import{c as r}from"./ui-BdipqGpP.js";import{J as i,n as a}from"./icons-BQ27Ds9u.js";var o=n(t(),1),s={polite:null,urgent:null},c=0,l=new Set;function u(e,{urgent:t=!1}={}){let n={text:e,id:c++};s=t?{...s,urgent:n}:{...s,polite:n};for(let e of l)e()}function d(e){return l.add(e),()=>l.delete(e)}function f(){return s}var p={polite:null,urgent:null};function m(){return p}var h=e();function g(e){return e.state===`pending`?e.kind===`removing`?`is-removing`:`is-saving`:e.state===`failed`?`is-failed`:``}function _({status:e}){return e.state===`pending`?(0,h.jsxs)(`span`,{className:`row-pending`,children:[(0,h.jsx)(r,{size:13}),e.words.pending]}):null}function v({status:e,columns:t,onDismiss:n,children:r}){return e.state===`failed`?(0,h.jsx)(`tr`,{className:`row-error row-failure`,children:(0,h.jsx)(`td`,{colSpan:t,children:(0,h.jsx)(y,{status:e,onDismiss:n,children:r})})}):null}function y({status:e,onDismiss:t,children:n}){return e.state===`failed`?(0,h.jsxs)(`div`,{className:`row-failure-line`,children:[(0,h.jsxs)(`p`,{className:`error-line`,children:[(0,h.jsx)(a,{size:14}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:n??e.words.failed}),` `,e.error]})]}),(0,h.jsx)(`button`,{type:`button`,className:`act act-quiet`,onClick:t,"aria-label":`Dismiss`,children:(0,h.jsx)(i,{size:13})})]}):null}function b(){let{polite:e,urgent:t}=(0,o.useSyncExternalStore)(d,f,m);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:`visually-hidden`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:e!==null&&(0,h.jsx)(`span`,{children:e.text},e.id)}),(0,h.jsx)(`div`,{className:`visually-hidden`,role:`alert`,"aria-live":`assertive`,"aria-atomic":`true`,children:t!==null&&(0,h.jsx)(`span`,{children:t.text},t.id)})]})}export{g as a,_ as i,b as n,u as o,v as r,y as t};
@@ -0,0 +1 @@
1
+ import{C as e,U as t,h as n,i as r,r as i,t as a}from"./page-CGmvjSy4.js";import{t as o}from"./link-DP8SVWon.js";import{t as s}from"./use-shell-BMGlJ25Q.js";import{t as c}from"./useSuspenseQuery-CSXyDALB.js";var l=t(),u=new Intl.ListFormat(`en`,{type:`disjunction`});function d(){let{auth:t,capabilities:d}=s(),{data:f}=c(n.directory(e(),d.canManageGrants)),p=t?.signin?.providers.map(e=>e.label)??[],m=f?.ok===!0?f.principals:null,h=m?.filter(e=>e.isRootAdmin)??[],g=m?.filter(e=>e.principalType===`user`).length??0,_=m?.filter(e=>e.principalType===`service`).length??0;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r,{title:`Settings`}),(0,l.jsx)(a,{labelledBy:`instance`,title:`Instance`,description:`Set in the deployment's configuration, so shown here rather than edited.`,children:(0,l.jsxs)(`dl`,{className:`facts`,children:[(0,l.jsx)(i,{label:`Sign-in`,children:t?.signin?`coffre’s own sign-in, with ${u.format(p)}. Only invited members get in.`:`Cloudflare Access. coffre has no sign-in of its own; every request carries an Access assertion that is verified at the origin.`}),m!==null&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i,{label:`Root admins`,children:(0,l.jsx)(`span`,{className:`fact-list`,children:h.map(e=>(0,l.jsx)(`span`,{className:`mono`,children:e.principalId},e.principalId))})}),(0,l.jsx)(i,{label:`Directory`,children:(0,l.jsxs)(`span`,{children:[(0,l.jsxs)(o,{to:`/users`,children:[g,` user`,g===1?``:`s`]}),` · `,(0,l.jsxs)(o,{to:`/tokens`,children:[_,` token`,_===1?``:`s`]})]})})]})]})})]})}export{d as component};
@@ -0,0 +1 @@
1
+ import{A as e,B as t,D as n,E as r,I as i,L as a,M as o,N as s,O as c,P as l,R as u,U as d,Z as f,et as p,k as m,z as h}from"./page-CGmvjSy4.js";var g=p(f(),1),_=d(),v=g.createContext(void 0),y=e=>{let t=g.useContext(v);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},b=({client:e,children:t})=>(g.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,_.jsx)(v.Provider,{value:e,children:t})),x=class extends m{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),C(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!a(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&T(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||i(this.options.staleTime,this.#t)!==i(t.staleTime,this.#t))&&this.#g();let o=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||o!==this.#f)&&this.#v(o)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return a(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(s)),t}#h(t){return!e()&&i(this.options.enabled,this.#t)!==!1&&o(t)}#g(){this.#b();let e=i(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let n=h(this.#r.dataUpdatedAt,e)+1;this.#u=t.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#_(){return i(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=t.setInterval(()=>{(this.options.refetchIntervalInBackground||c.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(t.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(t.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,a=this.options,o=this.#r,s=this.#i,c=this.#a,u=e===n?this.#n:e.state,{state:d}=e,f={...d},p=!1,m;if(t._optimisticResults){let i=this.hasListeners(),o=!i&&C(e,t),s=i&&T(e,n,t,a);(o||s)&&(f={...f,...r(d.data,e.options)}),t._optimisticResults===`isRestoring`&&(f.fetchStatus=`idle`)}let{error:h,errorUpdatedAt:g,status:_}=f;m=f.data;let v=!1;if(t.placeholderData!==void 0&&m===void 0&&_===`pending`){let e;o?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=o.data,v=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(_=`success`,m=l(o?.data,e,t),p=!0)}if(t.select&&m!==void 0&&!v)if(o&&m===s?.data&&t.select===this.#s)m=this.#c;else try{this.#s=t.select,m=t.select(m),m=l(o?.data,m,t),this.#c=m,this.#o=null}catch(e){this.#o=e}else m===void 0&&(this.#o=null);this.#o&&(h=this.#o,m=this.#c,g=Date.now(),_=`error`,p=!1);let y=f.fetchStatus===`fetching`,b=_===`pending`,x=_===`error`,S=b&&y,w=m!==void 0;return{status:_,fetchStatus:f.fetchStatus,isPending:b,isSuccess:_===`success`,isError:x,isInitialLoading:S,isLoading:S,data:m,dataUpdatedAt:f.dataUpdatedAt,error:h,errorUpdatedAt:g,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:y,isRefetching:y&&!b,isLoadingError:x&&!w,isPaused:f.fetchStatus===`paused`,isPlaceholderData:p,isRefetchError:x&&w,isStale:E(e,t),refetch:this.refetch,isEnabled:i(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),a(t,e))return;this.#r=t;let r=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();n.batch(()=>{r&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function S(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&i(t.retryOnMount,e)===!1)}function C(e,t){return S(e,t)||e.state.data!==void 0&&w(e,t,t.refetchOnMount)}function w(e,t,n){if(i(t.enabled,e)!==!1&&i(t.staleTime,e)!==`static`){let r=i(n,e);return r===`always`||r!==!1&&E(e,t)}return!1}function T(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&E(e,n)}function E(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(i(t.staleTime,e))}var D=g.createContext(!1),O=()=>g.useContext(D);D.Provider;function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=g.createContext(k()),j=()=>g.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?u(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{g.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||u(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e?.suspense&&t.isPending,R=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});export{M as a,j as c,b as d,y as f,L as i,O as l,I as n,P as o,R as r,N as s,F as t,x as u};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/tokens._token-Dui_4KfS.js","_coffre/assets/page-CGmvjSy4.js","_coffre/assets/use-change-BRRMJocl.js","_coffre/assets/suspense-C7KwSnTG.js","_coffre/assets/row-state-ByET1OKX.js","_coffre/assets/ui-BdipqGpP.js","_coffre/assets/link-DP8SVWon.js","_coffre/assets/icons-BQ27Ds9u.js","_coffre/assets/use-shell-BMGlJ25Q.js","_coffre/assets/useSuspenseQuery-CSXyDALB.js","_coffre/assets/use-action-DRm9yVhV.js","_coffre/assets/principal-page-DNLb_q_e.js","_coffre/assets/dist-QVHMLatb.js","_coffre/assets/directory-nDExpkAz.js","_coffre/assets/grants-CjoOnxzz.js","_coffre/assets/offboarding-CNr_1tnl.js"])))=>i.map(i=>d[i]);
2
+ import{u as e}from"./page-CGmvjSy4.js";import{n as t,r as n,t as r}from"./preload-helper-ClBkJ19f.js";var i=n(`/tokens/$token`)({loader:({context:{client:t,queryClient:n},params:r})=>e(n,t,`service`,r.token),component:t(()=>r(()=>import(`./tokens._token-Dui_4KfS.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])),`component`)});export{i as t};
@@ -0,0 +1 @@
1
+ import{C as e,U as t,Z as n,b as r,et as i,h as a,o,t as s}from"./page-CGmvjSy4.js";import{n as c,t as l,y as u}from"./use-change-BRRMJocl.js";import{t as d}from"./use-shell-BMGlJ25Q.js";import{t as f}from"./useSuspenseQuery-CSXyDALB.js";import{a as p,c as m,i as h,l as g,o as _,r as v,s as y,t as b}from"./ui-BdipqGpP.js";import{J as x,M as S,v as C}from"./icons-BQ27Ds9u.js";import{a as w,i as T,r as E}from"./row-state-ByET1OKX.js";import{t as D}from"./tokens._token-DWmbqzNk.js";import{t as O}from"./use-action-DRm9yVhV.js";import{t as k}from"./principal-page-DNLb_q_e.js";var A=i(n(),1),j=t(),M=[30,90,180,365];function N({serviceId:t,tokens:n}){let r=u(e(),t),i=l(r),{status:a,dismiss:o}=c(r.list.queryKey);return(0,j.jsx)(s,{labelledBy:`service-tokens`,title:`Credentials`,description:`Bearer tokens this service presents to the API. Each is shown once, when it is issued; coffre keeps only a hash.`,actions:(0,j.jsx)(P,{serviceId:t}),children:n.length===0?(0,j.jsx)(h,{title:`No live credentials`,children:`Nothing can act as this service until a token is issued.`}):(0,j.jsx)(`div`,{className:`dt-wrap`,children:(0,j.jsxs)(`table`,{className:`dt`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{children:`Token`}),(0,j.jsx)(`th`,{className:`col-shrink`,children:`Issued (UTC)`}),(0,j.jsx)(`th`,{className:`col-shrink`,children:`Last used`}),(0,j.jsx)(`th`,{className:`col-shrink`,children:`Expires`}),(0,j.jsx)(`th`,{className:`col-actions`,children:(0,j.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,j.jsx)(`tbody`,{children:n.map(e=>{let t=a(e.id);return(0,j.jsxs)(A.Fragment,{children:[(0,j.jsxs)(`tr`,{className:w(t),children:[(0,j.jsx)(`td`,{children:(0,j.jsxs)(`span`,{className:`cell-account`,children:[(0,j.jsx)(C,{size:15}),(0,j.jsxs)(`span`,{className:`cell-stack`,children:[(0,j.jsx)(`span`,{children:e.label??`Unlabelled`}),(0,j.jsx)(`small`,{className:`mono`,children:e.hint})]})]})}),(0,j.jsx)(`td`,{className:`nowrap`,children:(0,j.jsxs)(`span`,{className:`cell-stack`,children:[(0,j.jsx)(g,{iso:e.createdAt}),(0,j.jsxs)(`small`,{children:[`by `,e.createdBy]})]})}),(0,j.jsx)(`td`,{className:`nowrap cell-muted`,children:e.lastUsedAt===null?`Never`:(0,j.jsxs)(`span`,{className:`cell-stack`,children:[(0,j.jsx)(g,{iso:e.lastUsedAt,display:`relative`}),e.lastUsedIp!==null&&(0,j.jsx)(`small`,{className:`mono`,children:e.lastUsedIp})]})}),(0,j.jsx)(`td`,{className:`nowrap cell-muted`,children:(0,j.jsx)(g,{iso:e.expiresAt,display:`relative`})}),(0,j.jsx)(`td`,{className:`col-actions`,children:t.state===`pending`?(0,j.jsx)(T,{status:t}):(0,j.jsx)(b,{trigger:(0,j.jsxs)(`button`,{className:`act`,children:[(0,j.jsx)(x,{size:13}),`Revoke`]}),title:(0,j.jsxs)(j.Fragment,{children:[`Revoke `,(0,j.jsx)(`span`,{className:`mono`,children:e.hint}),`?`]}),body:`Whatever uses it is refused from its next request. Issue a new token first if the service should keep working.`,confirmLabel:`Revoke token`,onConfirm:()=>i(e)})})]}),(0,j.jsx)(E,{status:t,columns:5,onDismiss:()=>t.state===`failed`&&o(t.mutationId)})]},e.id)})})]})})})}function P({serviceId:t}){let[n,i]=(0,A.useState)(!1),[a,s]=(0,A.useState)(``),[c,l]=(0,A.useState)(90),[u,d]=(0,A.useState)(null),f=e(),{pending:h,error:b,setError:x,run:C}=O();function w(){i(!1),d(null),s(``),x(null)}return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`button`,{className:`btn btn-sm`,onClick:()=>i(!0),children:[(0,j.jsx)(S,{size:14}),`Issue token`]}),(0,j.jsx)(_,{open:n,onOpenChange:e=>e?i(!0):w(),title:u===null?`Issue a token`:`Copy the token now`,children:u===null?(0,j.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),C(()=>f.tokens.issue(r(`service`,t),{label:a.trim()===``?null:a.trim(),expiresInDays:c}),{affects:o.credentials(r(`service`,t)),onSuccess:e=>d(e)})},children:[(0,j.jsxs)(`div`,{className:`form-row`,children:[(0,j.jsxs)(`label`,{className:`field`,children:[(0,j.jsx)(`span`,{className:`label`,children:`Label`}),(0,j.jsx)(`input`,{className:`input`,value:a,maxLength:120,placeholder:`GitHub Actions deploy`,onChange:e=>s(e.target.value)})]}),(0,j.jsxs)(`label`,{className:`field`,style:{flex:`0 0 9rem`},children:[(0,j.jsx)(`span`,{className:`label`,children:`Expires after`}),(0,j.jsx)(`select`,{className:`select`,value:c,onChange:e=>l(Number(e.target.value)),children:M.map(e=>(0,j.jsxs)(`option`,{value:e,children:[e,` days`]},e))})]})]}),(0,j.jsx)(p,{error:b}),(0,j.jsxs)(`div`,{className:`dialog-actions`,children:[(0,j.jsx)(`button`,{className:`btn`,type:`button`,onClick:w,children:`Cancel`}),(0,j.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:h,children:[h&&(0,j.jsx)(m,{}),`Issue token`]})]})]}):(0,j.jsxs)(`div`,{className:`form`,children:[(0,j.jsxs)(y,{tone:`info`,children:[`This is the only time the value is shown. Store it where the service reads its configuration, as `,(0,j.jsx)(`span`,{className:`mono`,children:`COFFRE_TOKEN`}),`.`]}),(0,j.jsxs)(`div`,{className:`token-once`,children:[(0,j.jsx)(`code`,{className:`mono`,children:u.token}),(0,j.jsx)(v,{value:u.token,label:`Copy token`})]}),(0,j.jsxs)(`p`,{className:`hint`,children:[`Expires `,(0,j.jsx)(g,{iso:u.expiresAt}),`. Send it as`,` `,(0,j.jsx)(`span`,{className:`mono`,children:`Authorization: Bearer …`})]}),(0,j.jsx)(`div`,{className:`dialog-actions`,children:(0,j.jsx)(`button`,{className:`btn btn-primary`,type:`button`,onClick:w,children:`Done`})})]})})]})}function F(){let{token:t}=D.useParams(),n=e(),{auth:i,capabilities:o}=d(),s=r(`service`,t),c=o.canManageGrants,{data:l}=f(a.report(n,s,c)),{data:u}=f(a.credentials(n,s,c&&i.signin!==null)),p=l?.ok===!0&&l.report?.status===`active`;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(k,{principalType:`service`,principalId:t}),p&&u?.ok===!0&&(0,j.jsx)(N,{serviceId:t,tokens:u.tokens})]})}export{F as component};
@@ -0,0 +1 @@
1
+ import{C as e,U as t,h as n,i as r,n as i}from"./page-CGmvjSy4.js";import{t as a}from"./use-shell-BMGlJ25Q.js";import{t as o}from"./useSuspenseQuery-CSXyDALB.js";import{v as s}from"./icons-BQ27Ds9u.js";import{n as c,t as l}from"./directory-nDExpkAz.js";import{n as u}from"./offboarding-CNr_1tnl.js";var d=t();function f(){let{capabilities:t}=a(),{data:f}=o(n.directory(e(),t.canManageGrants));if(!f.ok)return(0,d.jsx)(i,{icon:(0,d.jsx)(s,{size:18}),label:`Tokens`,title:`Tokens are closed to you`,children:f.error});let p=f.principals.filter(e=>e.principalType===`service`);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(r,{title:`Tokens`,actions:(0,d.jsx)(l,{principalType:`service`})}),(0,d.jsx)(c,{principalType:`service`,principals:p,hasRemoved:f.removed.some(e=>e.principalType===`service`)}),(0,d.jsx)(u,{principalType:`service`,removed:f.removed})]})}export{f as component};