@coffre/ui 0.1.14 → 0.1.16

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 (108) hide show
  1. package/dist/client/_coffre/assets/{account-DqjL4kP9.js → account-BoLGAxbD.js} +2 -2
  2. package/dist/client/_coffre/assets/{account-DGGcVkqt.js → account-CnnuRTDB.js} +1 -1
  3. package/dist/client/_coffre/assets/{affordances-B9nFwqIv.js → affordances-CEafRJcN.js} +1 -1
  4. package/dist/client/_coffre/assets/audit-CHSvKLWX.js +1 -0
  5. package/dist/client/_coffre/assets/audit-Cn4hmS4u.js +2 -0
  6. package/dist/client/_coffre/assets/{auth.device-CHHcm089.js → auth.device-Co5vrpaA.js} +2 -2
  7. package/dist/client/_coffre/assets/{auth.device-CFCn1DXA.js → auth.device-DAlqWacc.js} +1 -1
  8. package/dist/client/_coffre/assets/{directory-skRBmF1Y.js → directory-H8Eh3MnS.js} +1 -1
  9. package/dist/client/_coffre/assets/{dist-BHhATf1q.js → dist-Braunv_x.js} +1 -1
  10. package/dist/client/_coffre/assets/globals-CpMrgkV6.css +1 -0
  11. package/dist/client/_coffre/assets/{grants-BEmVXYg5.js → grants-DPDxJXU1.js} +1 -1
  12. package/dist/client/_coffre/assets/icons-Dc_-t0lp.js +1 -0
  13. package/dist/client/_coffre/assets/{index-Bo6udWLL.js → index-sUCIXRgJ.js} +3 -3
  14. package/dist/client/_coffre/assets/{link-Bg_PHv45.js → link-DBINMwm6.js} +1 -1
  15. package/dist/client/_coffre/assets/{login-GV0ZjCQy.js → login-BZFYfL1Y.js} +1 -1
  16. package/dist/client/_coffre/assets/login-CYCKWTOD.js +2 -0
  17. package/dist/client/_coffre/assets/{offboarding-CXV0KyMt.js → offboarding-Bwpftp3g.js} +1 -1
  18. package/dist/client/_coffre/assets/page-C_hnzdaR.js +1 -0
  19. package/dist/client/_coffre/assets/{preload-helper-CYFH1xAV.js → preload-helper-CLkO85Nq.js} +1 -1
  20. package/dist/client/_coffre/assets/{principal-page-BmgkTnAl.js → principal-page-DLho8TSJ.js} +1 -1
  21. package/dist/client/_coffre/assets/projects._project._environment-DHRRvQw0.js +3 -0
  22. package/dist/client/_coffre/assets/projects._project._environment-TLI-RjBZ.js +2 -0
  23. package/dist/client/_coffre/assets/projects._project.index-BO-8FZIY.js +2 -0
  24. package/dist/client/_coffre/assets/{projects._project.index-wjtfc8E6.js → projects._project.index-DGl921dP.js} +1 -1
  25. package/dist/client/_coffre/assets/{projects.index-dl7dfnGW.js → projects.index-BDn7Bhoo.js} +1 -1
  26. package/dist/client/_coffre/assets/{row-state-BzGdu73b.js → row-state-DJ-KLamZ.js} +1 -1
  27. package/dist/client/_coffre/assets/{settings-DnENNWn8.js → settings-q9G1QvR_.js} +1 -1
  28. package/dist/client/_coffre/assets/{suspense-Cnh1cNc1.js → suspense-O8sP0mEC.js} +1 -1
  29. package/dist/client/_coffre/assets/tokens._token-B_qczpT9.js +2 -0
  30. package/dist/client/_coffre/assets/tokens._token-T-sqwMbz.js +2 -0
  31. package/dist/client/_coffre/assets/{tokens.index-D4HYaFJl.js → tokens.index-CcXSZnAG.js} +1 -1
  32. package/dist/client/_coffre/assets/{ui-Ch0beQy-.js → ui-BXP2IqrW.js} +2 -2
  33. package/dist/client/_coffre/assets/{unregistered-wV1yqr9t.js → unregistered-D2JXJ90x.js} +1 -1
  34. package/dist/client/_coffre/assets/{use-action-cgaBRBBH.js → use-action-BpzKWhgg.js} +1 -1
  35. package/dist/client/_coffre/assets/use-change-CKj3Inq9.js +1 -0
  36. package/dist/client/_coffre/assets/{use-shell-BJwawvkh.js → use-shell-W0SusPkz.js} +1 -1
  37. package/dist/client/_coffre/assets/useQuery-B-lxFSES.js +1 -0
  38. package/dist/client/_coffre/assets/{useSuspenseQuery-BfnNEmf7.js → useSuspenseQuery-BZ-nzHST.js} +1 -1
  39. package/dist/client/_coffre/assets/users._user-Bb3BGYHl.js +1 -0
  40. package/dist/client/_coffre/assets/users._user-DXmvKrzE.js +2 -0
  41. package/dist/client/_coffre/assets/{users.index-C7_aZ0jb.js → users.index-BvzP3qwW.js} +1 -1
  42. package/dist/server/.vite/manifest.json +205 -205
  43. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-GsKnGGRy.js +162 -0
  44. package/dist/server/_coffre/assets/{account-BJtaf5d7.js → account-CV-a2IU2.js} +8 -8
  45. package/dist/server/_coffre/assets/{account-CL3AX6kY.js → account-hk6wcIXU.js} +4 -4
  46. package/dist/server/_coffre/assets/{audit-DiHTzVVe.js → audit-C1_Ej6YB.js} +2 -2
  47. package/dist/server/_coffre/assets/{audit-BtjuffEH.js → audit-qB9G2AQJ.js} +37 -9
  48. package/dist/server/_coffre/assets/{auth.device-8RMD0nyz.js → auth.device-6JRrWbSV.js} +4 -4
  49. package/dist/server/_coffre/assets/{auth.device-dUMx6Srl.js → auth.device-CLoAxC2T.js} +2 -2
  50. package/dist/server/_coffre/assets/{directory-9Jc5MEra.js → directory-B-_rqsPx.js} +5 -5
  51. package/dist/server/_coffre/assets/globals-CpMrgkV6.css +1 -0
  52. package/dist/server/_coffre/assets/{grants-D5-q8fXB.js → grants-DdKT11Ny.js} +5 -5
  53. package/dist/server/_coffre/assets/{icons-CWsTEfpn.js → icons-DOFT-eWB.js} +3 -2
  54. package/dist/server/_coffre/assets/{login-C80ImEsO.js → login-DRKUKkaW.js} +1 -1
  55. package/dist/server/_coffre/assets/{login-DmpfrcPB.js → login-DnwxVl4Y.js} +5 -5
  56. package/dist/server/_coffre/assets/{offboarding-CXIgvZbO.js → offboarding-CRz-K82H.js} +4 -4
  57. package/dist/server/_coffre/assets/{page-x4nICC9d.js → page-D6n45dcK.js} +28 -0
  58. package/dist/server/_coffre/assets/{principal-page-BO6Ijpqv.js → principal-page-C-EFwJQw.js} +11 -11
  59. package/dist/server/_coffre/assets/{projects._project._environment-BMqZsCfi.js → projects._project._environment-C6uybzeU.js} +9 -9
  60. package/dist/server/_coffre/assets/{projects._project._environment-BeXpetmJ.js → projects._project._environment-CS8DdSMY.js} +2 -2
  61. package/dist/server/_coffre/assets/{projects._project.index-B74-XdI3.js → projects._project.index-3CXwkyTh.js} +12 -12
  62. package/dist/server/_coffre/assets/{projects._project.index-DZ1KZvHR.js → projects._project.index-BGfcNpj0.js} +2 -2
  63. package/dist/server/_coffre/assets/{projects.index-D7F7hiVe.js → projects.index-iSoBpRFz.js} +7 -7
  64. package/dist/server/_coffre/assets/{router-fxr2e6Ht.js → router-9BTgJhWG.js} +20 -20
  65. package/dist/server/_coffre/assets/{row-state-CAItu3n_.js → row-state-C2P57xT1.js} +2 -2
  66. package/dist/server/_coffre/assets/{settings-DO8wvTmo.js → settings-BDQTF5XW.js} +3 -3
  67. package/dist/server/_coffre/assets/{suspense-WsBv84ga.js → suspense-C-2QfDd2.js} +1 -1
  68. package/dist/server/_coffre/assets/tokens._token-CrBMpcbN.js +988 -0
  69. package/dist/server/_coffre/assets/{tokens._token-DhcJxsf3.js → tokens._token-rY86Cjgp.js} +2 -2
  70. package/dist/server/_coffre/assets/{tokens.index-hvPM5IjY.js → tokens.index-Bq5qDW9q.js} +6 -6
  71. package/dist/server/_coffre/assets/{ui-DvlGkmaH.js → ui-Cc0CGMtr.js} +1 -1
  72. package/dist/server/_coffre/assets/{unregistered-DKdzrjVr.js → unregistered-D9ZKLOPJ.js} +3 -3
  73. package/dist/server/_coffre/assets/{use-action-D6KlY-sv.js → use-action-B-xpvVRO.js} +2 -2
  74. package/dist/server/_coffre/assets/{use-change-CAcOZo-a.js → use-change-C8BCf3oU.js} +20 -4
  75. package/dist/server/_coffre/assets/{use-shell-C-yuQ1hA.js → use-shell-DwOzEi87.js} +2 -2
  76. package/dist/server/_coffre/assets/{useQuery-MqmaAeUF.js → useQuery-CTe86qFq.js} +2 -2
  77. package/dist/server/_coffre/assets/{useSuspenseQuery-BDvlOPB7.js → useSuspenseQuery-CSoHzrMb.js} +2 -2
  78. package/dist/server/_coffre/assets/{users._user-dCIYuxyZ.js → users._user-BmLKYeo_.js} +2 -2
  79. package/dist/server/_coffre/assets/{users._user-pLdzKe1F.js → users._user-BmiHwQx3.js} +2 -2
  80. package/dist/server/_coffre/assets/{users.index-CDCDlQxN.js → users.index-BiEax90r.js} +6 -6
  81. package/dist/server/index.js +2 -2
  82. package/package.json +3 -3
  83. package/src/components/trusted-workloads.tsx +379 -0
  84. package/src/lib/audit-sentences.ts +26 -0
  85. package/src/lib/bindings.ts +111 -0
  86. package/src/lib/changes.ts +16 -0
  87. package/src/lib/queries.ts +16 -0
  88. package/src/routes/audit.tsx +7 -0
  89. package/src/routes/tokens.$token.tsx +3 -0
  90. package/src/styles/globals.css +43 -0
  91. package/dist/client/_coffre/assets/audit-CcQmaSan.js +0 -1
  92. package/dist/client/_coffre/assets/audit-XwuBA4r9.js +0 -2
  93. package/dist/client/_coffre/assets/globals-DCrHjrpD.css +0 -1
  94. package/dist/client/_coffre/assets/icons-BFziRUf9.js +0 -1
  95. package/dist/client/_coffre/assets/login-pzHGDqU5.js +0 -2
  96. package/dist/client/_coffre/assets/page-CDuo3uft.js +0 -1
  97. package/dist/client/_coffre/assets/projects._project._environment-5PA9NHET.js +0 -2
  98. package/dist/client/_coffre/assets/projects._project._environment-B-5I0ZFP.js +0 -3
  99. package/dist/client/_coffre/assets/projects._project.index-BzJQojbd.js +0 -2
  100. package/dist/client/_coffre/assets/tokens._token-BJiMX2TJ.js +0 -1
  101. package/dist/client/_coffre/assets/tokens._token-C2s6HHWK.js +0 -2
  102. package/dist/client/_coffre/assets/use-change-DIpkq9iI.js +0 -1
  103. package/dist/client/_coffre/assets/useQuery-BHCBwHtH.js +0 -1
  104. package/dist/client/_coffre/assets/users._user--OY2srG0.js +0 -1
  105. package/dist/client/_coffre/assets/users._user-Cj4NY0p5.js +0 -2
  106. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-C-_y9u60.js +0 -162
  107. package/dist/server/_coffre/assets/globals-DCrHjrpD.css +0 -1
  108. package/dist/server/_coffre/assets/tokens._token-CVWTFOM-.js +0 -286
@@ -1 +1 @@
1
- import{J as e,U as t,V as n,X as r,q as i}from"./page-CDuo3uft.js";var a=e((e=>{var t=i();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 r(){}var a={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},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=r(i(),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=i();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=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!r(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=i(),n=Ne();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:r,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=r(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};
1
+ import{J as e,U as t,V as n,X as r,q as i}from"./page-C_hnzdaR.js";var a=e((e=>{var t=i();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 r(){}var a={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},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=r(i(),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=i();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=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!r(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=i(),n=Ne();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:r,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=r(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};
@@ -1 +1 @@
1
- import{U as e,X as t,n,q as r}from"./page-CDuo3uft.js";import{t as i}from"./use-shell-BJwawvkh.js";import{a,c as o}from"./ui-Ch0beQy-.js";import{F as s,S as c,j as l}from"./icons-BFziRUf9.js";import{t as u}from"./login-pzHGDqU5.js";import{t as d}from"./signin-errors-CroZWZgm.js";var f=t(r()),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)(n,{icon:(0,p.jsx)(c,{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)(n,{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),[c,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":c===e.id,onClick:()=>m(e.id),children:[(0,p.jsx)(`span`,{className:`provider-mark`,"aria-hidden":!0,children:c===e.id?(0,p.jsx)(o,{}):(0,p.jsx)(l,{brand:e.brand})}),`Continue with `,e.label]})},e.id))})]})}export{m as component};
1
+ import{U as e,X as t,n,q as r}from"./page-C_hnzdaR.js";import{t as i}from"./use-shell-W0SusPkz.js";import{a,c as o}from"./ui-BXP2IqrW.js";import{C as s,I as c,M as l}from"./icons-Dc_-t0lp.js";import{t as u}from"./login-CYCKWTOD.js";import{t as d}from"./signin-errors-CroZWZgm.js";var f=t(r()),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)(n,{icon:(0,p.jsx)(s,{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)(n,{icon:(0,p.jsx)(c,{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),[c,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":c===e.id,onClick:()=>m(e.id),children:[(0,p.jsx)(`span`,{className:`provider-mark`,"aria-hidden":!0,children:c===e.id?(0,p.jsx)(o,{}):(0,p.jsx)(l,{brand:e.brand})}),`Continue with `,e.label]})},e.id))})]})}export{m as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/login-BZFYfL1Y.js","_coffre/assets/page-C_hnzdaR.js","_coffre/assets/use-shell-W0SusPkz.js","_coffre/assets/suspense-O8sP0mEC.js","_coffre/assets/ui-BXP2IqrW.js","_coffre/assets/link-DBINMwm6.js","_coffre/assets/icons-Dc_-t0lp.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-CLkO85Nq.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-BZFYfL1Y.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),`component`)});export{r as t};
@@ -1 +1 @@
1
- import{U as e,t}from"./page-CDuo3uft.js";import{t as n}from"./link-Bg_PHv45.js";import{i as r,l as i,s as a}from"./ui-Ch0beQy-.js";import{V as o,s,v as c}from"./icons-BFziRUf9.js";import{s as l}from"./directory-skRBmF1Y.js";var u=e();function d({report:e}){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(m,{report:e,removed:e.status===`removed`,person:e.principalType===`user`}),e.issuedTokens.length>0&&(0,u.jsx)(h,{report:e})]})}function f({report:e}){let t=e.principalType===`user`;return(0,u.jsx)(`div`,{className:`report-notice`,children:(0,u.jsxs)(a,{children:[`Removed`,e.removedBy!==null&&(0,u.jsxs)(u.Fragment,{children:[` `,`by `,(0,u.jsx)(`span`,{className:`mono`,children:e.removedBy})]}),e.removedAt!==null&&(0,u.jsxs)(u.Fragment,{children:[` `,`on `,(0,u.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 p({principalType:e,removed:t}){let n=e===`user`,r=t.filter(t=>t.principalType===e);return r.length===0?null:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`h2`,{className:`section-title`,children:`Removed`}),(0,u.jsx)(`section`,{className:`card`,"aria-label":n?`Removed users`:`Removed tokens`,children:(0,u.jsx)(`div`,{className:`dt-wrap`,children:(0,u.jsxs)(`table`,{className:`dt directory stacks`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{className:`n`,children:`#`}),(0,u.jsx)(`th`,{className:`col-principal`,children:(0,u.jsxs)(`span`,{className:`th`,children:[n?(0,u.jsx)(o,{size:14}):(0,u.jsx)(c,{size:14}),n?`Email`:`Name`]})}),(0,u.jsx)(`th`,{className:`col-role`,children:`Still to rotate`}),(0,u.jsx)(`th`,{className:`col-actions`,children:(0,u.jsx)(`span`,{className:`visually-hidden`,children:`Report`})})]})}),(0,u.jsx)(`tbody`,{children:r.map((e,t)=>(0,u.jsxs)(`tr`,{className:`row-link`,children:[(0,u.jsx)(`td`,{className:`n`,children:t+1}),(0,u.jsx)(`td`,{className:`col-lead`,"data-label":n?`Email`:`Name`,children:(0,u.jsx)(l,{type:e.principalType,id:e.principalId,stretch:!0})}),(0,u.jsx)(`td`,{className:`col-role`,"data-label":`Still to rotate`,children:e.toRotate===0?(0,u.jsx)(`span`,{className:`cell-muted`,children:`Nothing`}):`${e.toRotate} ${e.toRotate===1?`value`:`values`}`}),(0,u.jsx)(`td`,{className:`col-actions col-open cell-muted`,"aria-hidden":`true`,children:(0,u.jsx)(s,{size:16})})]},e.principalId))})]})})}),(0,u.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 m({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,u.jsx)(t,{labelledBy:`seen-values`,title:a?`Still to rotate`:`Values seen`,description:c,actions:e.rotated>0&&(0,u.jsxs)(`span`,{className:`card-aside`,children:[e.rotated,` already rotated`]}),children:e.exposed.length===0?(0,u.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,u.jsx)(`div`,{className:`dt-wrap`,children:(0,u.jsxs)(`table`,{className:`dt report-values`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`Secret`}),(0,u.jsx)(`th`,{className:`col-shrink`,children:`Version`}),(0,u.jsx)(`th`,{className:`col-shrink`,children:`Last seen`})]})}),(0,u.jsx)(`tbody`,{children:e.exposed.map(e=>(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`td`,{children:(0,u.jsxs)(n,{className:`cell-link mono`,to:`/projects/$project/$environment`,params:{project:e.project,environment:e.environment},search:{filter:e.key},children:[(0,u.jsxs)(`span`,{className:`report-path`,children:[e.project,`/`,e.environment,`/`]}),e.key]})}),(0,u.jsxs)(`td`,{className:`col-shrink cell-mono cell-muted`,children:[`v`,e.version]}),(0,u.jsxs)(`td`,{className:`col-shrink nowrap`,children:[e.how===`wrote`?`Wrote`:`Read`,` `,(0,u.jsx)(i,{iso:e.at,display:`relative`})]})]},`${e.project}/${e.environment}/${e.key}`))})]})})})}function h({report:e}){return(0,u.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,u.jsx)(`div`,{className:`dt-wrap`,children:(0,u.jsxs)(`table`,{className:`dt report-tokens`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`Token`}),(0,u.jsx)(`th`,{className:`col-shrink`,children:`Expires`}),(0,u.jsx)(`th`,{className:`col-shrink col-hide-narrow`,children:`Last used`})]})}),(0,u.jsx)(`tbody`,{children:e.issuedTokens.map(e=>(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`td`,{children:(0,u.jsxs)(`span`,{className:`cell-stack`,children:[(0,u.jsx)(n,{className:`cell-link mono`,to:`/tokens/$token`,params:{token:e.service},children:e.service}),(0,u.jsxs)(`small`,{children:[e.label??`No label`,` · `,(0,u.jsx)(`span`,{className:`mono`,children:e.hint})]})]})}),(0,u.jsx)(`td`,{className:`col-shrink nowrap`,children:(0,u.jsx)(i,{iso:e.expiresAt,display:`relative`})}),(0,u.jsx)(`td`,{className:`col-shrink col-hide-narrow nowrap`,children:e.lastUsedAt===null?(0,u.jsx)(`span`,{className:`cell-muted`,children:`Never`}):(0,u.jsx)(i,{iso:e.lastUsedAt,display:`relative`})})]},e.id))})]})})})}export{p as n,f as r,d as t};
1
+ import{U as e,t}from"./page-C_hnzdaR.js";import{t as n}from"./link-DBINMwm6.js";import{i as r,l as i,s as a}from"./ui-BXP2IqrW.js";import{H as o,s,v as c}from"./icons-Dc_-t0lp.js";import{s as l}from"./directory-H8Eh3MnS.js";var u=e();function d({report:e}){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(m,{report:e,removed:e.status===`removed`,person:e.principalType===`user`}),e.issuedTokens.length>0&&(0,u.jsx)(h,{report:e})]})}function f({report:e}){let t=e.principalType===`user`;return(0,u.jsx)(`div`,{className:`report-notice`,children:(0,u.jsxs)(a,{children:[`Removed`,e.removedBy!==null&&(0,u.jsxs)(u.Fragment,{children:[` `,`by `,(0,u.jsx)(`span`,{className:`mono`,children:e.removedBy})]}),e.removedAt!==null&&(0,u.jsxs)(u.Fragment,{children:[` `,`on `,(0,u.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 p({principalType:e,removed:t}){let n=e===`user`,r=t.filter(t=>t.principalType===e);return r.length===0?null:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`h2`,{className:`section-title`,children:`Removed`}),(0,u.jsx)(`section`,{className:`card`,"aria-label":n?`Removed users`:`Removed tokens`,children:(0,u.jsx)(`div`,{className:`dt-wrap`,children:(0,u.jsxs)(`table`,{className:`dt directory stacks`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{className:`n`,children:`#`}),(0,u.jsx)(`th`,{className:`col-principal`,children:(0,u.jsxs)(`span`,{className:`th`,children:[n?(0,u.jsx)(o,{size:14}):(0,u.jsx)(c,{size:14}),n?`Email`:`Name`]})}),(0,u.jsx)(`th`,{className:`col-role`,children:`Still to rotate`}),(0,u.jsx)(`th`,{className:`col-actions`,children:(0,u.jsx)(`span`,{className:`visually-hidden`,children:`Report`})})]})}),(0,u.jsx)(`tbody`,{children:r.map((e,t)=>(0,u.jsxs)(`tr`,{className:`row-link`,children:[(0,u.jsx)(`td`,{className:`n`,children:t+1}),(0,u.jsx)(`td`,{className:`col-lead`,"data-label":n?`Email`:`Name`,children:(0,u.jsx)(l,{type:e.principalType,id:e.principalId,stretch:!0})}),(0,u.jsx)(`td`,{className:`col-role`,"data-label":`Still to rotate`,children:e.toRotate===0?(0,u.jsx)(`span`,{className:`cell-muted`,children:`Nothing`}):`${e.toRotate} ${e.toRotate===1?`value`:`values`}`}),(0,u.jsx)(`td`,{className:`col-actions col-open cell-muted`,"aria-hidden":`true`,children:(0,u.jsx)(s,{size:16})})]},e.principalId))})]})})}),(0,u.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 m({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,u.jsx)(t,{labelledBy:`seen-values`,title:a?`Still to rotate`:`Values seen`,description:c,actions:e.rotated>0&&(0,u.jsxs)(`span`,{className:`card-aside`,children:[e.rotated,` already rotated`]}),children:e.exposed.length===0?(0,u.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,u.jsx)(`div`,{className:`dt-wrap`,children:(0,u.jsxs)(`table`,{className:`dt report-values`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`Secret`}),(0,u.jsx)(`th`,{className:`col-shrink`,children:`Version`}),(0,u.jsx)(`th`,{className:`col-shrink`,children:`Last seen`})]})}),(0,u.jsx)(`tbody`,{children:e.exposed.map(e=>(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`td`,{children:(0,u.jsxs)(n,{className:`cell-link mono`,to:`/projects/$project/$environment`,params:{project:e.project,environment:e.environment},search:{filter:e.key},children:[(0,u.jsxs)(`span`,{className:`report-path`,children:[e.project,`/`,e.environment,`/`]}),e.key]})}),(0,u.jsxs)(`td`,{className:`col-shrink cell-mono cell-muted`,children:[`v`,e.version]}),(0,u.jsxs)(`td`,{className:`col-shrink nowrap`,children:[e.how===`wrote`?`Wrote`:`Read`,` `,(0,u.jsx)(i,{iso:e.at,display:`relative`})]})]},`${e.project}/${e.environment}/${e.key}`))})]})})})}function h({report:e}){return(0,u.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,u.jsx)(`div`,{className:`dt-wrap`,children:(0,u.jsxs)(`table`,{className:`dt report-tokens`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`Token`}),(0,u.jsx)(`th`,{className:`col-shrink`,children:`Expires`}),(0,u.jsx)(`th`,{className:`col-shrink col-hide-narrow`,children:`Last used`})]})}),(0,u.jsx)(`tbody`,{children:e.issuedTokens.map(e=>(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`td`,{children:(0,u.jsxs)(`span`,{className:`cell-stack`,children:[(0,u.jsx)(n,{className:`cell-link mono`,to:`/tokens/$token`,params:{token:e.service},children:e.service}),(0,u.jsxs)(`small`,{children:[e.label??`No label`,` · `,(0,u.jsx)(`span`,{className:`mono`,children:e.hint})]})]})}),(0,u.jsx)(`td`,{className:`col-shrink nowrap`,children:(0,u.jsx)(i,{iso:e.expiresAt,display:`relative`})}),(0,u.jsx)(`td`,{className:`col-shrink col-hide-narrow nowrap`,children:e.lastUsedAt===null?(0,u.jsx)(`span`,{className:`cell-muted`,children:`Never`}):(0,u.jsx)(i,{iso:e.lastUsedAt,display:`relative`})})]},e.id))})]})})})}export{p as n,f as r,d 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 ee(e,t){return E(e.type,t,e.props)}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(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?O(``+e.key):t.toString(36)}function j(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 M(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,M(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,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=ee(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+=M(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+=M(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return M(j(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 N(e,t,n){if(e==null)return e;var r=[],i=0;return M(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function P(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 F=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)},I={map:N,forEach:function(e,t,n){N(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return N(e,function(){t++}),t},toArray:function(e){return N(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=I,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=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:P}},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,F)}catch(e){F(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),p=Symbol.for(`@coffre/client:CoffreError`),m=class extends Error{static[Symbol.hasInstance](e){return typeof e==`object`&&!!e&&p in e}[p]=!0;status;code;reason;constructor(e,t,n,r){super(n),this.name=`CoffreError`,this.status=e,this.code=t,this.reason=r}};function h(e){let[t=``,n=``,r=``]=e.replace(/^\/+|\/+$/g,``).split(`/`);return{project:t,environment:n,key:r}}function g(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 m(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`,h(e),t),update:(e,t)=>a(`PATCH /projects/:project/:environment`,h(e),t)},secrets:{list:e=>a(`GET /secrets/:project/:environment`,h(e)),reveal:e=>a(`POST /reveals`,{},{path:e}),set:(e,t)=>a(`PATCH /secrets/:project/:environment`,h(e),t),dryRun:(e,t)=>{let[n,a]=i(`PATCH /secrets/:project/:environment`,h(e));return r(n,`${a}?dryRun=1`,t)},history:e=>a(`GET /secrets/:project/:environment/:key/versions`,h(e)),restore:(e,t)=>a(`POST /secrets/:project/:environment/:key/restore`,h(e),{version:t}),rename:(e,t)=>a(`PATCH /secrets/:project/:environment/:key`,h(e),{key:t}),update:(e,t)=>a(`PATCH /secrets/:project/:environment/:key`,h(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})},bindings:{list:e=>a(`GET /members/:member/bindings`,{member:e}),preview:(e,t)=>{let[n,a]=i(`POST /members/:member/bindings`,{member:e});return r(n,`${a}?dryRun=1`,t)},create:(e,t)=>a(`POST /members/:member/bindings`,{member:e},t),remove:(e,t)=>a(`DELETE /members/:member/bindings/:id`,{member:e,id:t}),lookup:e=>a(`GET /workloads/lookup`,{},e)},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})},audit:{list:(e={})=>a(`GET /audit`,{},e),verify:()=>a(`GET /audit/verification`,{}),keys:()=>a(`GET /audit/keys`,{})}}}async function _(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 v=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})),y=o(((e,t)=>{t.exports=v()})),b=f.createContext(null);function x(e){return f.useContext(b)}var S={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},C=new class{#e=S;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 w(e){setTimeout(e,0)}var T=typeof window>`u`||`Deno`in globalThis;function E(){}function ee(e,t){return typeof e==`function`?e(t):e}function D(e){return typeof e==`number`&&e>=0&&e!==1/0}function O(e,t){return Math.max(e+(t||0)-Date.now(),0)}function k(e,t){return typeof e==`function`?e(t):e}function A(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==M(o,t.options))return!1}else if(!P(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 j(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(N(t.options.mutationKey)!==N(a))return!1}else if(!P(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function M(e,t){return(t?.queryKeyHashFn||N)(e)}function N(e){return JSON.stringify(e,(e,t)=>L(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function P(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(!P(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!P(e[r],t[r]))return!1;return!0}return!1}var F=Object.prototype.hasOwnProperty;function I(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ne(e)&&ne(t);if(!r&&!(L(e)&&L(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:F.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=I(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function te(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 ne(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function L(e){if(!re(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!(!re(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function re(e){return Object.prototype.toString.call(e)===`[object Object]`}function ie(e){return new Promise(t=>{C.setTimeout(t,e)})}function ae(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:I(e,t)}function oe(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function se(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var R=Symbol();function ce(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===R?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function le(e,t){return typeof e==`function`?e(...t):!!e}function ue(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 de=()=>T,z=()=>de(),B=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(){}},V=new class extends B{#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`}},fe=w;function pe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=fe,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 H=pe(),U=new class extends B{#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 me(e){return Math.min(1e3*2**e,3e4)}function he(e){return(e??`online`)!==`online`||U.isOnline()}var W=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ge(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(E);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new W(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>V.isFocused()&&(e.networkMode===`always`||U.isOnline())&&e.canRun(),p=()=>he(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??(z()?0:3),a=e.retryDelay??me,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),ie(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 _e=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),D(this.gcTime)&&(this.#e=C.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(z()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(C.clearTimeout(this.#e),this.#e=void 0)}};function ve(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=>{ue(e,()=>t.signal,()=>n=!0)},u=ce(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?se:oe;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?be:ye,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:ye(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 ye(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 be(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var xe=class extends _e{#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=we(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=we(this.options);e.data!==void 0&&(this.setState(Ce(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ae(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(E).catch(E):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=>k(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===R||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>k(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:!O(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=ce(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`?ve(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=ge({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof W&&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 W){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,...Se(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ce(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),H.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Se(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:he(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ce(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function we(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 Te=class extends _e{#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||Ee(),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=ge({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),H.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ee(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var De=class extends B{#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 Te({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=G(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=G(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=G(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=G(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){H.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=>j(t,e))}findAll(e={}){return this.getAll().filter(t=>j(e,t))}notify(e){H.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return H.batch(()=>Promise.all(e.map(e=>e.continue().catch(E))))}};function G(e){return e.options.scope?.id}var Oe=class extends B{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??M(r,t),a=this.get(i);return a||(a=new xe({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(){H.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=>A(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>A(e,t)):t}notify(e){H.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){H.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){H.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ke=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Oe,this.#t=e.mutationCache||new De,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=V.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=U.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(k(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=ee(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return H.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;H.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return H.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=H.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(E).catch(E)}invalidateQueries(e,t={}){return H.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=H.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(E)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(E)}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(k(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(k(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(E).catch(E)}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(E).catch(E)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return U.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(N(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{P(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(N(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{P(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||=M(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===R&&(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 K(e){return e}var Ae={canManageGrants:!1,canReadAudit:!1,canCreateProject:!1};function je(e,t){if(e===null)return Ae;let n=e.instanceRole===`owner`||e.instanceRole===`root-admin`;return{canManageGrants:n,canReadAudit:e.canReadAudit,canCreateProject:n}}function Me(e){return e.includes(`secret.read`)}function Ne(){return x().options.context.client}var Pe=class extends Error{};function q(e){return e instanceof m?e.status:void 0}function Fe(e){return e instanceof Pe?e.message:e instanceof m?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 Ie(e){return{ok:!1,error:Fe(e),signedOut:q(e)===401}}async function J(e){try{return{ok:!0,...await e()}}catch(e){return Ie(e)}}function Le(e,t){return`${e===`user`?`user`:`token`}:${t}`}var Re=1e4;function ze(){return new ke({defaultOptions:{queries:{staleTime:Re,refetchOnWindowFocus:!0,retry:!1}}})}var Y={me:[`me`],auth:[`auth`],projects:[`projects`],grants:e=>[`grants`,e],secrets:({project:e,environment:t})=>[`secrets`,e,t],directory:[`directory`],report:e=>[`report`,e],credentials:e=>[`credentials`,e],bindings:e=>[`bindings`,e],identities:[`identities`],sessions:[`sessions`],audit:[`audit`]};function Be(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 Ve(e){return J(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 He=e=>J(()=>e.projects.list()),X={me:e=>K({queryKey:Y.me,queryFn:async()=>{try{return await e.me()}catch(e){if(q(e)===401)return null;throw e}}}),auth:e=>K({queryKey:Y.auth,queryFn:()=>e.auth()}),projects:e=>K({queryKey:Y.projects,queryFn:()=>He(e)}),grants:(e,t)=>K({queryKey:Y.grants(t),queryFn:()=>J(async()=>({grants:Be((await e.members.list(t)).members)}))}),secrets:(e,t)=>K({queryKey:Y.secrets(t),queryFn:()=>J(()=>e.secrets.list(`${t.project}/${t.environment}`))}),directory:(e,t)=>K({queryKey:[...Y.directory,{owner:t}],queryFn:()=>t?Ve(e):Promise.resolve({ok:!1,error:`Only owners can manage users and service accounts.`,signedOut:!1})}),report:(e,t,n)=>K({queryKey:[...Y.report(t),{owner:n}],queryFn:()=>n?J(async()=>{try{return{report:await e.members.get(t)}}catch(e){if(q(e)===404)return{report:null};throw e}}):Promise.resolve(null)}),credentials:(e,t,n)=>K({queryKey:[...Y.credentials(t),{allowed:n}],queryFn:()=>n?J(()=>e.tokens.list(t)):Promise.resolve(null)}),bindings:(e,t,n)=>K({queryKey:[...Y.bindings(t),{allowed:n}],queryFn:()=>n?J(()=>e.bindings.list(t)):Promise.resolve(null)}),identities:e=>K({queryKey:Y.identities,queryFn:()=>J(()=>e.identities.list())}),sessions:e=>K({queryKey:Y.sessions,queryFn:()=>J(()=>e.sessions.list())}),auditEntries:(e,t)=>K({queryKey:[...Y.audit,`entries`,t],staleTime:0,queryFn:()=>J(()=>e.audit.list({limit:200,decision:t.decision,actor:t.actorId,detail:t.detail}))}),auditChain:e=>K({queryKey:[...Y.audit,`chain`],staleTime:0,queryFn:()=>Ue(e)})};async function Ue(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=q(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 We(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:je(i,r),registrationRequired:t!==null&&!t.registered,instance:i?.instance??null,accessTampered:t?.tampered===!0}}async function Z(e,t){let[n,r,i]=await Promise.all([e.fetchQuery(X.auth(t)),e.fetchQuery(X.me(t)),e.fetchQuery(X.projects(t))]);return We(n,r,i)}function Ge(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 Ke(e,t,n){let r=Ge(await e.fetchQuery(X.projects(t)),n);r.ok&&r.managesAccess&&await e.fetchQuery(X.grants(t,n))}async function qe(e,t){let n=await Z(e,t);return e.fetchQuery(X.directory(t,n.capabilities.canManageGrants))}async function Je(e,t,n,r){let i=await Z(e,t),a=Le(n,r),o=i.capabilities.canManageGrants;await Promise.all([e.fetchQuery(X.report(t,a,o)),n===`service`?e.fetchQuery(X.credentials(t,a,o&&i.auth.signin!==null)):null,n===`service`?e.fetchQuery(X.bindings(t,a,o&&i.auth.signin!==null)):null,...Ye(i.projects).map(n=>e.fetchQuery(X.grants(t,n.slug)))])}function Ye(e){return e.filter(e=>e.permissions.includes(`grant.manage`))}var Xe={places:()=>[Y.projects,Y.me],secrets:e=>[Y.secrets(e),Y.projects],access:(e,t)=>[Y.grants(e),Y.report(t),Y.projects,Y.me],admission:()=>[Y.directory],role:e=>[Y.directory,Y.report(e),Y.me,Y.projects],removal:e=>[Y.directory,Y.report(e),[`grants`]],credentials:e=>[Y.credentials(e)],bindings:e=>[Y.bindings(e)],identities:()=>[Y.identities,Y.sessions],sessions:()=>[Y.sessions]};async function Ze(e,t){await Promise.all([...t,Y.audit].map(t=>e.invalidateQueries({queryKey:t})))}var Q=y(),Qe=[`blue`,`green`,`amber`,`violet`];function $e(e){let t=2166136261;for(let n of e)t=Math.imul(t^n.charCodeAt(0),16777619)>>>0;return Qe[t%Qe.length]}function $({name:e,size:t=`sm`}){return(0,Q.jsx)(`span`,{className:`tile tile-${$e(e)}${t===`lg`?` tile-lg`:``}`,"aria-hidden":!0,children:e.slice(0,1)})}function et({tile:e,lead:t,title:n,aside:r,description:i,meta:a,actions:o}){return(0,Q.jsxs)(`header`,{className:`page-head`,children:[(0,Q.jsxs)(`div`,{className:`page-head-text`,children:[e!==void 0&&(0,Q.jsx)($,{name:e,size:`lg`}),t,(0,Q.jsxs)(`div`,{style:{minWidth:0},children:[(0,Q.jsxs)(`h1`,{className:`page-title`,children:[(0,Q.jsx)(`span`,{children:n}),r!=null&&(0,Q.jsx)(`span`,{className:`page-title-aside`,children:r})]}),i!==void 0&&(0,Q.jsx)(`p`,{className:`page-desc`,children:i}),a!==void 0&&(0,Q.jsx)(`div`,{className:`page-meta`,children:a})]})]}),o!==void 0&&o!==!1&&(0,Q.jsx)(`div`,{className:`page-actions`,children:o})]})}function tt({title:e,description:t,actions:n,children:r,labelledBy:i,tone:a}){return(0,Q.jsxs)(`section`,{className:`card${a===`danger`?` card-danger`:``}`,"aria-labelledby":i,children:[(0,Q.jsxs)(`div`,{className:`card-head`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`card-title`,id:i,children:e}),t!==void 0&&(0,Q.jsx)(`p`,{className:`card-desc`,children:t})]}),n]}),r]})}function nt({label:e,children:t}){return(0,Q.jsxs)(`div`,{className:`fact`,children:[(0,Q.jsx)(`dt`,{children:e}),(0,Q.jsx)(`dd`,{children:t})]})}function rt({icon:e,label:t,title:n,children:r,actions:i}){return(0,Q.jsxs)(`div`,{className:`closed`,role:`status`,children:[e!==void 0&&(0,Q.jsx)(`div`,{className:`closed-icon`,"aria-hidden":!0,children:e}),t!==void 0&&(0,Q.jsx)(`p`,{className:`closed-label`,children:t}),(0,Q.jsx)(`h1`,{className:`closed-title`,children:n}),(0,Q.jsx)(`div`,{className:`closed-body`,children:r}),i!==void 0&&(0,Q.jsx)(`div`,{className:`closed-actions`,children:i})]})}export{z as A,C as B,Ne as C,H as D,Se as E,I as F,g as G,b as H,k as I,o as J,_ as K,te as L,D as M,E as N,V as O,ae as P,le as R,J as S,Ee as T,y as U,x as V,m as W,l as X,s as Y,We as _,$ as a,Le as b,Y as c,Ke as d,Z as f,Ze as g,X as h,et as i,N as j,B as k,qe as l,Ge as m,rt as n,Xe as o,Ye as p,d as q,nt as r,ze as s,tt as t,Je as u,Pe as v,Me as w,q as x,Fe as y,O as z};
@@ -1 +1 @@
1
- import{U as e,V as t,X as n,q as r}from"./page-CDuo3uft.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-Bg_PHv45.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=n(r(),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};
1
+ import{U as e,V as t,X as n,q as r}from"./page-C_hnzdaR.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-DBINMwm6.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=n(r(),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};
@@ -1 +1 @@
1
- import{C as e,U as t,X as n,a as r,b as i,h as a,i as o,n as s,o as c,p as l,q as u}from"./page-CDuo3uft.js";import{t as d}from"./link-Bg_PHv45.js";import{E as f,l as p,n as m}from"./use-change-DIpkq9iI.js";import{n as h,t as g}from"./use-shell-BJwawvkh.js";import{t as _}from"./useSuspenseQuery-BfnNEmf7.js";import{n as v}from"./dist-BHhATf1q.js";import{a as y,c as b,i as x,o as S,s as C}from"./ui-Ch0beQy-.js";import{U as w,W as T,k as E,l as D,p as O,v as k}from"./icons-BFziRUf9.js";import{t as A}from"./row-state-BzGdu73b.js";import{a as j,i as M,o as N,r as ee}from"./directory-skRBmF1Y.js";import{t as P}from"./use-action-cgaBRBBH.js";import{n as F,t as I}from"./grants-BEmVXYg5.js";import{r as L,t as R}from"./offboarding-CXV0KyMt.js";var z=n(u(),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:o,capabilities:s}=g(),c=l(o),{data:u}=_(a.report(r,i(t,n),s.canManageGrants)),d=h({queries:c.map(e=>a.grants(r,e.slug))});return{report:u,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:c}=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&&c.length===0)return(0,X.jsx)(s,{icon:_?(0,X.jsx)(w,{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 T=c.flatMap(({project:e,grants:t})=>t.map(t=>({project:e,grant:t}))),E=c.filter(e=>e.grantsError!==null),D=b?[]:c.filter(({project:e,grantsError:t})=>e.archivedAt===null&&t===null);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{lead:(0,X.jsx)(N,{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)(ee,{principal:S}),actions:(D.length>0||S!==void 0)&&(0,X.jsxs)(X.Fragment,{children:[D.length>0&&(0,X.jsx)(te,{principalType:e,principalId:t,access:D}),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`}),E.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:T.length===0?(0,X.jsx)(x,{title:`No project access yet`,children:D.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)(O,{size:14}),`Project`]}),children:T.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,l]=(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 w(){l(!1),d({}),h(null)}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>l(!0),children:[(0,X.jsx)(E,{size:14}),`Edit access`]}),(0,X.jsx)(S,{open:s,onOpenChange:e=>e?l(!0):w(),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})=>c.access(e.slug,i(t,n))),onSuccess:()=>{v.success(`Updated ${n}’s access on ${C.length} project${C.length===1?``:`s`}`),w()}})},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:w,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)(D,{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};
1
+ import{C as e,U as t,X as n,a as r,b as i,h as a,i as o,n as s,o as c,p as l,q as u}from"./page-C_hnzdaR.js";import{t as d}from"./link-DBINMwm6.js";import{D as f,l as p,n as m}from"./use-change-CKj3Inq9.js";import{n as h,t as g}from"./use-shell-W0SusPkz.js";import{t as _}from"./useSuspenseQuery-BZ-nzHST.js";import{n as v}from"./dist-Braunv_x.js";import{a as y,c as b,i as x,o as S,s as C}from"./ui-BXP2IqrW.js";import{A as w,G as T,W as E,l as D,p as O,v as k}from"./icons-Dc_-t0lp.js";import{t as A}from"./row-state-DJ-KLamZ.js";import{a as j,i as M,o as ee,r as N}from"./directory-H8Eh3MnS.js";import{t as P}from"./use-action-BpzKWhgg.js";import{n as F,t as I}from"./grants-DPDxJXU1.js";import{r as L,t as R}from"./offboarding-Bwpftp3g.js";var z=n(u(),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:o,capabilities:s}=g(),c=l(o),{data:u}=_(a.report(r,i(t,n),s.canManageGrants)),d=h({queries:c.map(e=>a.grants(r,e.slug))});return{report:u,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:c}=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&&c.length===0)return(0,X.jsx)(s,{icon:_?(0,X.jsx)(E,{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=c.flatMap(({project:e,grants:t})=>t.map(t=>({project:e,grant:t}))),T=c.filter(e=>e.grantsError!==null),D=b?[]:c.filter(({project:e,grantsError:t})=>e.archivedAt===null&&t===null);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{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:(D.length>0||S!==void 0)&&(0,X.jsxs)(X.Fragment,{children:[D.length>0&&(0,X.jsx)(te,{principalType:e,principalId:t,access:D}),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:D.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)(O,{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,l]=(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(){l(!1),d({}),h(null)}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>l(!0),children:[(0,X.jsx)(w,{size:14}),`Edit access`]}),(0,X.jsx)(S,{open:s,onOpenChange:e=>e?l(!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})=>c.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)(D,{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,K as t,U as n,W as r,X as i,c as a,h as o,i as s,n as c,o as l,q as u,t as d,w as f,y as p}from"./page-C_hnzdaR.js";import{t as m}from"./link-DBINMwm6.js";import{S as h,T as g,a as _,n as ee,r as v,t as y,w as b,y as x}from"./use-change-CKj3Inq9.js";import{t as te}from"./use-shell-W0SusPkz.js";import{t as S}from"./useSuspenseQuery-BZ-nzHST.js";import{n as C}from"./dist-Braunv_x.js";import{a as w,c as T,h as E,i as ne,l as D,o as O,p as k,r as re,s as A,t as j,u as M}from"./ui-BXP2IqrW.js";import{i as N}from"./affordances-CEafRJcN.js";import{A as ie,B as ae,C as P,G as oe,N as F,O as se,P as ce,V as I,d as L,f as le,g as R,h as z,i as B,j as V,l as H,n as U,v as ue}from"./icons-Dc_-t0lp.js";import{a as W,i as G,r as K}from"./row-state-DJ-KLamZ.js";import{t as de}from"./projects._project._environment-TLI-RjBZ.js";import{t as q}from"./use-action-BpzKWhgg.js";import{t as fe}from"./validation-9Cl_XS-l.js";var J=/^[A-Za-z_][A-Za-z0-9_]{0,127}$/;function pe(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(!J.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=he(u,`"`);if(e===-1){n.push({line:a,text:l,reason:`unterminated double quote (multi-line values are not supported)`});continue}if(d=ge(u.slice(1,e)),me(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),me(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 me(e){let t=e.trim();return t!==``&&!t.startsWith(`#`)}function he(e,t){for(let n=1;n<e.length;n++){if(e[n]===`\\`){n++;continue}if(e[n]===t)return n}return-1}function ge(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 Y=i(u());function X(e,t){return e!==null&&e.version===t}var Z=n(),Q=45;function _e(){let{project:t,environment:n}=de.useParams(),{data:r}=S(o.secrets(e(),{project:t,environment:n}));return r.ok?(0,Z.jsx)(ve,{project:t,environment:n,permissions:r.permissions,keys:r.keys},`${t}/${n}`):(0,Z.jsx)(c,{icon:(0,Z.jsx)(P,{size:18}),label:(0,Z.jsxs)(`span`,{className:`mono`,children:[t,`/`,n]}),title:`This environment is closed to you`,actions:(0,Z.jsxs)(m,{className:`btn`,to:`/projects/$project`,params:{project:t},children:[`Back to `,t]}),children:r.error})}function ve({project:t,environment:n,permissions:r,keys:i}){let o=e(),{principal:c}=te(),l=y(h(o,{project:t,environment:n},c?.id??null)),u=y(x(o,{project:t,environment:n})),m=y(_(o,{project:t,environment:n})),{status:S,dismiss:w}=ee(a.secrets({project:t,environment:n})),[T,E]=(0,Y.useState)([]),[D,O]=(0,Y.useState)({}),[k,A]=(0,Y.useState)(()=>new Set),[j,M]=(0,Y.useState)(null),[N,ie]=(0,Y.useState)(de.useSearch().filter??``),oe=(0,Y.useRef)(0),F=r.includes(`secret.write`),se=r.includes(`secret.archive`),I=f(r),L=i.filter(e=>!e.archived),le=i.filter(e=>e.archived),R=new Set(i.map(e=>e.key)),B=L.filter(e=>g(D,e.key)!==void 0),W=b(L,T,D),G=[...T.map(e=>e.key.trim()),...B.flatMap(e=>{let t=g(D,e.key);return t===void 0||t.archived?[]:[t.key.trim()]})],K=G.some(e=>e===``),q=G.some(e=>e!==``&&fe(e)!==null),J=T.length+B.length,pe=J>0&&!K&&!q&&!W;function me(e,t){O(n=>{let r={...g(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 he(e){O(t=>{let{[e]:n,...r}=t;return r}),A(t=>{let n=new Set(t);return n.delete(e),n})}function ge(){E(e=>[{id:oe.current++,key:``,value:``},...e])}function X(){E([]),O({}),A(new Set),M(null);for(let e of i){let t=S(e.key);t.state===`failed`&&w(t.mutationId)}}function Q(){if(!pe)return;let e={active:L,drafts:T,changes:D};E([]),O({}),A(new Set),M(null),l(e,{onError:t=>{let n=t instanceof v?t.outcome:e;E(n.drafts),O(n.changes),M(p(t))}})}function _e(e){u({key:e},{onSuccess:()=>C.success(`${e} restored`,{action:{label:`Undo`,onClick:()=>m({key:e})}})})}let ve=(0,Y.useRef)(Q);ve.current=Q,(0,Y.useEffect)(()=>{if(J===0)return;function e(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),ve.current())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[J]);let be=[...T.map(e=>({key:e.key.trim()||`unnamed`,what:R.has(e.key.trim())?`new version`:`added`})),...B.map(e=>{let t=g(D,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`}})],$=K?null:W?`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,xe=N.trim().toLowerCase(),Ce=xe===``?L:L.filter(e=>e.key.toLowerCase().includes(xe));return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s,{tile:t,title:n,aside:(0,Z.jsx)(ye,{project:t,environment:n}),actions:(0,Z.jsxs)(Z.Fragment,{children:[F&&I&&(0,Z.jsx)(ke,{project:t,environment:n}),F&&(0,Z.jsxs)(`button`,{className:`btn btn-primary`,onClick:ge,children:[(0,Z.jsx)(V,{size:14}),`New secret`]})]})}),(L.length>0||T.length>0)&&(0,Z.jsxs)(`div`,{className:`toolbar`,children:[(0,Z.jsxs)(`label`,{className:`filter input-group`,children:[(0,Z.jsx)(`span`,{className:`visually-hidden`,children:`Filter secrets by name`}),(0,Z.jsx)(ce,{size:14,className:`input-icon`}),(0,Z.jsx)(`input`,{className:`input`,type:`search`,placeholder:`Filter by name…`,spellCheck:!1,autoComplete:`off`,value:N,onChange:e=>ie(e.target.value)})]}),(0,Z.jsx)(`div`,{className:`toolbar-meta`,children:(0,Z.jsxs)(`span`,{className:`th`,title:`Run a process with these secrets in its environment`,children:[(0,Z.jsx)(ae,{size:14}),(0,Z.jsxs)(`code`,{children:[`coffre run `,t,`/`,n,` -- …`]}),(0,Z.jsx)(re,{value:`coffre run ${t}/${n} -- `,label:`Copy command`})]})})]}),(0,Z.jsx)(`section`,{className:`card`,"aria-label":`Secrets`,children:L.length===0&&T.length===0?(0,Z.jsx)(ne,{title:`No secrets yet`,actions:F?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{className:`btn btn-primary`,onClick:ge,children:[(0,Z.jsx)(V,{size:14}),`New secret`]}),I&&(0,Z.jsx)(ke,{project:t,environment:n})]}):void 0,children:F?`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,Z.jsx)(`div`,{className:`dt-wrap`,children:(0,Z.jsxs)(`table`,{className:`dt secrets stacks`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{children:[(0,Z.jsx)(`th`,{className:`n`,children:`#`}),(0,Z.jsx)(`th`,{className:`col-key`,children:(0,Z.jsxs)(`span`,{className:`th`,children:[(0,Z.jsx)(ue,{size:14}),`Key`]})}),(0,Z.jsx)(`th`,{children:(0,Z.jsxs)(`span`,{className:`th`,children:[(0,Z.jsx)(P,{size:14}),`Value`,!I&&(0,Z.jsx)(`span`,{className:`th-note`,children:`hidden from you`})]})}),(0,Z.jsx)(`th`,{className:`col-version`,children:(0,Z.jsxs)(`span`,{className:`th`,children:[(0,Z.jsx)(z,{size:14}),`Version`]})}),(0,Z.jsx)(`th`,{className:`col-written col-hide-narrow`,children:(0,Z.jsxs)(`span`,{className:`th`,children:[(0,Z.jsx)(H,{size:14}),`Last written`]})}),(0,Z.jsx)(`th`,{className:`col-actions`,children:(0,Z.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,Z.jsxs)(`tbody`,{children:[T.map(e=>(0,Z.jsx)(we,{draft:e,existingVersion:i.find(t=>t.key===e.key.trim())?.version??null,disabled:!1,onChange:t=>E(n=>n.map(n=>n.id===e.id?{...n,...t}:n)),onRemove:()=>E(t=>t.filter(t=>t.id!==e.id))},e.id)),Ce.map(e=>{let r=g(D,e.key),i=S(e.key);return(0,Z.jsx)(Se,{number:L.indexOf(e)+1,project:t,environment:n,entry:e,change:r??{key:e.key,value:null,archived:!1},editing:r?.archived!==!0&&(k.has(e.key)||r!==void 0),canWrite:F,canArchive:se,canReveal:I,status:i,disabled:i.state===`pending`,columns:6,onEdit:()=>A(t=>new Set(t).add(e.key)),onPatch:t=>me(e,t),onUndo:()=>he(e.key),onMarkArchive:()=>{A(t=>{let n=new Set(t);return n.delete(e.key),n}),O(t=>({...t,[e.key]:{key:e.key,value:null,archived:!0}}))}},e.key)}),Ce.length===0&&L.length>0&&(0,Z.jsx)(`tr`,{children:(0,Z.jsxs)(`td`,{colSpan:6,className:`cell-muted`,style:{padding:`1rem`},children:[`No secret name contains “`,N.trim(),`”.`]})})]})]})})}),le.length>0&&(0,Z.jsx)(d,{labelledBy:`archived-secrets`,title:`Archived`,description:(0,Z.jsxs)(Z.Fragment,{children:[`Retired, so no longer served or injected by `,(0,Z.jsx)(`code`,{children:`coffre run`}),`. Their history and audit trail are intact, and restoring is immediate.`]}),children:(0,Z.jsx)(`div`,{className:`dt-wrap`,children:(0,Z.jsxs)(`table`,{className:`dt secrets secrets-archived stacks`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{children:[(0,Z.jsx)(`th`,{className:`n`,children:`#`}),(0,Z.jsx)(`th`,{className:`col-key`,children:(0,Z.jsxs)(`span`,{className:`th`,children:[(0,Z.jsx)(ue,{size:14}),`Key`]})}),(0,Z.jsx)(`th`,{className:`col-version`,children:(0,Z.jsxs)(`span`,{className:`th`,children:[(0,Z.jsx)(z,{size:14}),`Version`]})}),(0,Z.jsx)(`th`,{className:`col-written col-hide-narrow`,children:(0,Z.jsxs)(`span`,{className:`th`,children:[(0,Z.jsx)(H,{size:14}),`Last written`]})}),(0,Z.jsx)(`th`,{className:`col-actions`,children:(0,Z.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,Z.jsx)(`tbody`,{children:le.map((e,r)=>(0,Z.jsx)(Te,{number:r+1,project:t,environment:n,entry:e,canArchive:se,canReveal:I,status:S(e.key),onRestore:()=>_e(e.key),onDismiss:w},e.key))})]})})}),J>0&&(0,Z.jsx)(`div`,{className:`savebar`,role:`region`,"aria-label":`Unsaved changes`,children:(0,Z.jsxs)(`div`,{className:`savebar-inner`,children:[(0,Z.jsxs)(`span`,{className:`savebar-count`,children:[(0,Z.jsx)(`span`,{className:`dot`,"aria-hidden":!0}),J,` unsaved change`,J===1?``:`s`]}),(0,Z.jsxs)(`span`,{className:`savebar-summary`,children:[be.slice(0,3).map((e,t)=>(0,Z.jsxs)(`span`,{children:[t>0&&` · `,(0,Z.jsx)(`span`,{className:`mono`,children:e.key}),` `,e.what]},`${e.key}:${t}`)),be.length>3&&` · and ${be.length-3} more`]}),(0,Z.jsxs)(`div`,{className:`savebar-actions`,children:[(0,Z.jsx)(`button`,{className:`btn btn-sm`,onClick:X,children:`Discard`}),(0,Z.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:Q,disabled:!pe,title:`Save (⌘ Enter or Ctrl Enter)`,"aria-keyshortcuts":`Meta+Enter Control+Enter`,children:[`Save `,J===1?`change`:`${J} changes`]})]}),(j??$)!==null&&(0,Z.jsxs)(`p`,{className:`savebar-error`,role:`alert`,children:[(0,Z.jsx)(U,{size:14}),(0,Z.jsx)(`span`,{children:j??$})]})]})})]})}function ye({project:e,environment:t}){let{projects:n}=te(),r=n.find(t=>t.slug===e)?.environments.find(e=>e.slug===t)?.name;return r===void 0?null:(0,Z.jsx)(Z.Fragment,{children:r})}function be({masked:e,className:t=``,...n}){let[r,i]=(0,Y.useState)(!1);return(0,Y.useEffect)(()=>{i(typeof CSS<`u`&&CSS.supports(`-webkit-text-security`,`disc`))},[]),(0,Z.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 $({label:e,value:t,onChange:n,placeholder:r,disabled:i,autoFocus:a,onEscape:o}){let[s,c]=(0,Y.useState)(!1);return(0,Z.jsxs)(`div`,{className:`input-group`,children:[(0,Z.jsx)(be,{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,Z.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,Z.jsx)(le,{size:14}):(0,Z.jsx)(L,{size:14})})]})}function xe(e){let[t,n]=(0,Y.useState)(()=>Date.now());return(0,Y.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(Q-(t-e.at)/1e3))}function Se({number:t,project:n,environment:i,entry:a,change:o,editing:s,canWrite:c,canArchive:l,canReveal:u,status:d,disabled:f,columns:m,onEdit:h,onPatch:g,onUndo:_,onMarkArchive:ee}){let[v,y]=(0,Y.useState)(null),b=e(),[x,te]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(!1),[ne,D]=(0,Y.useState)(null),[O,A]=(0,Y.useState)(null),j=X(v,a.version)?v:null;(0,Y.useEffect)(()=>{v!==null&&!X(v,a.version)&&y(null)},[v,a.version]),(0,Y.useEffect)(()=>{if(v===null)return;let e=setTimeout(()=>y(null),Q*1e3);return()=>clearTimeout(e)},[v]);let ae=xe(j),P=s&&X(O,a.version)?O:null;(0,Y.useEffect)(()=>{s||A(null)},[s]);async function ce(){if(j!==null)return j.value;te(!0);try{let{values:e}=await b.secrets.reveal(`${n}/${i}/${a.key}`),t=e[a.key];return D(null),y({value:t,version:a.version,at:Date.now()}),t}catch(e){return D(e instanceof r?p(e):`The request could not be sent. Nothing was read.`),null}finally{te(!1)}}function I(){j===null?ce():y(null)}let z=o.archived,V=o.key!==a.key,H=o.value!==null,U=s?fe(o.key.trim()):null,ue=z?` is-leaving`:s&&(V||H)?` is-changed`:j===null?``:` is-revealed`,K=a.version??0;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`tr`,{className:`secret-row${ue} ${W(d)}`,children:[(0,Z.jsx)(`td`,{className:`n`,children:t}),(0,Z.jsx)(`td`,{className:`cell-key`,"data-label":`Key`,children:s&&c?(0,Z.jsxs)(`div`,{className:`edit-stack`,children:[(0,Z.jsx)(`input`,{className:`input input-mono`,"aria-label":`Name for ${a.key}`,"aria-invalid":U!==null,spellCheck:!1,autoComplete:`off`,value:o.key,disabled:f,onChange:e=>g({key:e.target.value}),onKeyDown:e=>{e.key===`Escape`&&_()}}),(U!==null||V)&&(0,Z.jsx)(`span`,{className:`edit-note${U===null?``:` edit-note-error`}`,children:U??(0,Z.jsxs)(Z.Fragment,{children:[`Renamed from `,(0,Z.jsx)(`span`,{className:`mono`,children:a.key})]})})]}):(0,Z.jsxs)(`div`,{className:`key-cell`,children:[(0,Z.jsx)(`span`,{children:k(a.key)}),z&&(0,Z.jsx)(`span`,{className:`tag tag-red`,children:`will be archived`})]})}),(0,Z.jsx)(`td`,{"data-label":`Value`,children:s&&c?(0,Z.jsxs)(`div`,{className:`edit-stack`,children:[(0,Z.jsx)($,{label:`New value for ${a.key}`,value:o.value??P?.value??``,placeholder:`New value`,disabled:f,autoFocus:!0,onChange:e=>g({value:e===(P?.value??``)?null:e}),onEscape:_}),(0,Z.jsxs)(`span`,{className:`edit-note`,children:[(0,Z.jsx)(`span`,{children:H?`Saving appends v${K+1}; v${K} stays restorable.`:P===null?`Nothing is decrypted to edit. Left empty, v${K} stays current.`:`This is v${K}. Change it to append v${K+1}.`}),u&&!H&&P===null&&(0,Z.jsxs)(`button`,{type:`button`,className:`act`,disabled:x,onClick:async()=>{let e=await ce();e!==null&&A({value:e,version:a.version,at:Date.now()})},children:[x&&(0,Z.jsx)(T,{size:12}),`Start from current value`]})]})]}):j!==null&&!z?(0,Z.jsxs)(`div`,{className:`revealed`,style:{"--reveal-ttl":`${Q}s`},children:[(0,Z.jsx)(`span`,{className:`revealed-value`,children:j.value===``?`(empty)`:j.value}),(0,Z.jsxs)(`span`,{className:`revealed-note`,children:[`Hides in `,ae,`s`]}),(0,Z.jsx)(`span`,{className:`revealed-meter`,"aria-hidden":!0})]}):(0,Z.jsx)(`span`,{className:`mask`,"aria-label":`Hidden`,children:`••••••••••••`})}),(0,Z.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:s&&H?(0,Z.jsxs)(`span`,{className:`version-shift`,children:[`v`,K,` → `,(0,Z.jsxs)(`b`,{children:[`v`,K+1]})]}):(0,Z.jsx)(`span`,{className:`version-shift`,children:a.version===null?`—`:`v${a.version}`})}),(0,Z.jsx)(`td`,{className:`col-written col-hide-narrow`,"data-label":`Last written`,children:(0,Z.jsx)(Ce,{entry:a})}),(0,Z.jsx)(`td`,{className:`col-actions`,children:d.state===`pending`?(0,Z.jsx)(G,{status:d}):(0,Z.jsx)(`div`,{className:`acts`,children:z?(0,Z.jsx)(M,{label:`Keep`,children:(0,Z.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:_,disabled:f,"aria-label":`Keep ${a.key}`,children:(0,Z.jsx)(F,{size:14})})}):s?(0,Z.jsx)(M,{label:V||H?`Undo changes`:`Cancel`,children:(0,Z.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:_,disabled:f,"aria-label":`${V||H?`Undo changes to`:`Stop editing`} ${a.key}`,children:V||H?(0,Z.jsx)(F,{size:14}):(0,Z.jsx)(oe,{size:15})})}):(0,Z.jsxs)(Z.Fragment,{children:[j!==null&&(0,Z.jsx)(re,{variant:`act`,value:j.value,label:`Copy ${a.key}`}),(0,Z.jsx)(N,{canReveal:u,children:(0,Z.jsx)(M,{label:j===null?`Reveal`:`Hide`,children:(0,Z.jsx)(`button`,{className:`act act-icon act-accent`,onClick:I,disabled:x,"aria-label":`${j===null?`Reveal`:`Hide`} ${a.key}`,children:x?(0,Z.jsx)(T,{size:13}):j===null?(0,Z.jsx)(L,{size:15}):(0,Z.jsx)(le,{size:15})})})}),c&&(0,Z.jsx)(M,{label:`Edit`,children:(0,Z.jsx)(`button`,{className:`act act-icon`,onClick:()=>{j!==null&&A(j),y(null),h()},disabled:f,"aria-label":`Edit ${a.key}`,children:(0,Z.jsx)(ie,{size:14})})}),(u||l)&&(0,Z.jsxs)(E.Root,{children:[(0,Z.jsx)(E.Trigger,{asChild:!0,children:(0,Z.jsx)(`button`,{className:`act act-icon act-quiet`,"aria-label":`More for ${a.key}`,disabled:f,children:(0,Z.jsx)(se,{size:16})})}),(0,Z.jsx)(E.Portal,{children:(0,Z.jsxs)(E.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,Z.jsx)(N,{canReveal:u,children:(0,Z.jsxs)(E.Item,{className:`menu-item`,onSelect:()=>C(e=>!e),children:[(0,Z.jsx)(R,{size:14}),S?`Hide history`:`Version history`]})}),l&&(0,Z.jsxs)(Z.Fragment,{children:[u&&(0,Z.jsx)(E.Separator,{className:`menu-sep`}),(0,Z.jsxs)(E.Item,{className:`menu-item menu-item-danger`,onSelect:()=>{y(null),ee()},children:[(0,Z.jsx)(B,{size:14}),`Archive`,(0,Z.jsx)(`span`,{className:`menu-hint`,children:`on save`})]})]})]})})]})]})})})]}),S&&u&&(0,Z.jsx)(`tr`,{className:`detail-row`,children:(0,Z.jsx)(`td`,{colSpan:m,children:(0,Z.jsx)(Ee,{project:n,environment:i,secretKey:a.key,currentVersion:a.version,canWrite:c,onClose:()=>C(!1),onRolledBack:()=>y(null)})})}),ne!==null&&(0,Z.jsx)(`tr`,{className:`row-error`,children:(0,Z.jsx)(`td`,{colSpan:m,children:(0,Z.jsx)(w,{error:ne})})})]})}function Ce({entry:e}){if(e.updatedBy===null&&e.updatedAt===null)return(0,Z.jsx)(`span`,{className:`cell-muted`,children:`—`});let t=e.updatedBy??`unknown`;return(0,Z.jsxs)(`span`,{className:`written`,children:[(0,Z.jsx)(`span`,{className:`written-by`,title:t,children:t.split(`@`)[0]}),e.updatedAt!==null&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`cell-muted`,"aria-hidden":!0,children:`·`}),(0,Z.jsx)(`span`,{className:`cell-muted`,children:(0,Z.jsx)(D,{iso:e.updatedAt,display:`relative`})})]})]})}function we({draft:e,existingVersion:t,disabled:n,onChange:r,onRemove:i}){let[a,o]=(0,Y.useState)(!1),s=e.key.trim(),c=s===``?a?`Give it a name.`:null:fe(s),l=s!==``&&t!==null;return(0,Z.jsxs)(`tr`,{className:`secret-row is-draft`,children:[(0,Z.jsx)(`td`,{className:`n`,"aria-label":`New`,children:`+`}),(0,Z.jsx)(`td`,{className:`cell-key`,"data-label":`New secret`,children:(0,Z.jsxs)(`div`,{className:`edit-stack`,children:[(0,Z.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,Z.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,Z.jsx)(`td`,{"data-label":`Value`,children:(0,Z.jsx)(`div`,{className:`edit-stack`,children:(0,Z.jsx)($,{label:`Value for ${s===``?`the new secret`:s}`,value:e.value,placeholder:`Value`,disabled:n,onChange:e=>r({value:e}),onEscape:i})})}),(0,Z.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:(0,Z.jsx)(`span`,{className:`version-shift`,children:l?(0,Z.jsxs)(Z.Fragment,{children:[`v`,t,` → `,(0,Z.jsxs)(`b`,{children:[`v`,t+1]})]}):(0,Z.jsx)(`b`,{children:`new`})})}),(0,Z.jsx)(`td`,{className:`col-written col-hide-narrow`,children:(0,Z.jsx)(`span`,{className:`cell-muted`,children:`—`})}),(0,Z.jsx)(`td`,{className:`col-actions`,children:(0,Z.jsx)(`div`,{className:`acts`,children:(0,Z.jsx)(M,{label:`Remove`,children:(0,Z.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,Z.jsx)(oe,{size:15})})})})})]})}function Te({number:e,project:t,environment:n,entry:r,canArchive:i,canReveal:a,status:o,onRestore:s,onDismiss:c}){let[l,u]=(0,Y.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`tr`,{className:`secret-row is-archived ${W(o)}`,children:[(0,Z.jsx)(`td`,{className:`n`,children:e}),(0,Z.jsx)(`td`,{className:`cell-key`,"data-label":`Key`,children:k(r.key)}),(0,Z.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:(0,Z.jsx)(`span`,{className:`version-shift`,children:r.version===null?`—`:`v${r.version}`})}),(0,Z.jsx)(`td`,{className:`col-written col-hide-narrow`,"data-label":`Last written`,children:(0,Z.jsx)(Ce,{entry:r})}),(0,Z.jsx)(`td`,{className:`col-actions`,children:(0,Z.jsxs)(`div`,{className:`acts`,children:[(0,Z.jsx)(N,{canReveal:a,children:(0,Z.jsx)(M,{label:l?`Hide history`:`Version history`,children:(0,Z.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,Z.jsx)(R,{size:15})})})}),i&&(o.state===`pending`?(0,Z.jsx)(G,{status:o}):(0,Z.jsx)(M,{label:`Restore`,children:(0,Z.jsx)(`button`,{className:`act act-icon`,onClick:s,"aria-label":`Restore ${r.key}`,children:(0,Z.jsx)(F,{size:14})})}))]})})]}),l&&(0,Z.jsx)(`tr`,{className:`detail-row`,children:(0,Z.jsx)(`td`,{colSpan:5,children:(0,Z.jsx)(Ee,{project:t,environment:n,secretKey:r.key,currentVersion:r.version,canWrite:!1,onClose:()=>u(!1),onRolledBack:()=>void 0})})}),(0,Z.jsx)(K,{status:o,columns:5,onDismiss:()=>o.state===`failed`&&c(o.mutationId)})]})}function Ee({project:t,environment:n,secretKey:i,currentVersion:a,canWrite:o,onClose:s,onRolledBack:c}){let[u,d]=(0,Y.useState)(null),[f,m]=(0,Y.useState)(null),h=e(),{pending:g,error:_,run:ee}=q();return(0,Y.useEffect)(()=>{let e=!1;return h.secrets.history(`${t}/${n}/${i}`).then(t=>{e||(d(t.versions),m(null))}).catch(t=>{e||m(t instanceof r?p(t):`The version history could not be loaded.`)}),()=>{e=!0}},[h,t,n,i,a]),(0,Z.jsxs)(`div`,{className:`history`,children:[(0,Z.jsxs)(`div`,{className:`history-head`,children:[(0,Z.jsxs)(`span`,{className:`history-title th`,children:[(0,Z.jsx)(R,{size:14}),`Versions of `,(0,Z.jsx)(`span`,{className:`mono`,children:i})]}),(0,Z.jsx)(`button`,{className:`act`,onClick:s,children:`Close`})]}),f===null?u===null?(0,Z.jsxs)(`p`,{className:`hint history-body`,children:[(0,Z.jsx)(T,{size:13}),` Loading versions…`]}):(0,Z.jsx)(`div`,{className:`dt-wrap`,children:(0,Z.jsxs)(`table`,{className:`dt`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{children:[(0,Z.jsx)(`th`,{className:`col-shrink`,children:`Version`}),(0,Z.jsx)(`th`,{className:`col-shrink`,children:`Written (UTC)`}),(0,Z.jsx)(`th`,{children:`By`}),(0,Z.jsx)(`th`,{className:`col-shrink`,children:`Key id`}),(0,Z.jsx)(`th`,{className:`col-actions`,children:(0,Z.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,Z.jsx)(`tbody`,{children:u.map(e=>(0,Z.jsxs)(`tr`,{children:[(0,Z.jsxs)(`td`,{className:`cell-mono nowrap`,children:[`v`,e.version,` `,e.current&&(0,Z.jsx)(`span`,{className:`tag tag-blue`,children:`current`})]}),(0,Z.jsx)(`td`,{className:`nowrap`,children:(0,Z.jsx)(D,{iso:e.createdAt})}),(0,Z.jsx)(`td`,{children:e.createdBy}),(0,Z.jsx)(`td`,{className:`cell-mono cell-muted nowrap`,children:e.kek}),(0,Z.jsx)(`td`,{className:`col-actions`,children:o&&!e.current&&(0,Z.jsx)(j,{trigger:(0,Z.jsxs)(`button`,{className:`act`,disabled:g,children:[(0,Z.jsx)(F,{size:13}),`Roll back`]}),title:(0,Z.jsxs)(Z.Fragment,{children:[`Roll `,(0,Z.jsx)(`span`,{className:`mono`,children:i}),` back to v`,e.version,`?`]}),body:(0,Z.jsxs)(Z.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,Z.jsxs)(`span`,{className:`mono`,children:[t,`/`,n]}),` `,`picks up the change immediately.`]}),confirmLabel:`Roll back to v${e.version}`,destructive:!1,onConfirm:()=>ee(()=>h.secrets.restore(`${t}/${n}/${i}`,e.version),{affects:l.secrets({project:t,environment:n}),onSuccess:()=>{c(),C.success(`${i} rolled back to v${e.version}`)}})})})]},e.version))})]})}):(0,Z.jsx)(`div`,{className:`history-body`,children:(0,Z.jsx)(w,{error:f})}),_!==null&&(0,Z.jsx)(`div`,{className:`history-body`,children:(0,Z.jsx)(w,{error:_})}),(0,Z.jsx)(`p`,{className:`history-note`,children:`Metadata only. Listing versions decrypts nothing.`})]})}var De={added:`tag tag-green`,changed:`tag tag-blue`,unchanged:`tag`};async function Oe(e,n,r){let i=pe(r);return i.entries.length===0?{plan:[],changes:{},problems:i.problems}:{...await t(e,n,i.entries),problems:i.problems}}function ke({project:t,environment:n}){let[r,i]=(0,Y.useState)(``),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)([]),[u,d]=(0,Y.useState)(!1),f=e(),{pending:p,error:m,setError:h,run:g}=q(),_=`${t}/${n}`;function ee(){g(()=>Oe(f,_,r),{affects:[],onSuccess:e=>{c(e.problems),o({entries:e.plan,changes:e.changes})}})}function v(){if(a===null)return;let e=Object.keys(a.changes).length;g(()=>f.secrets.set(_,a.changes),{affects:l.secrets({project:t,environment:n}),onSuccess:()=>{C.success(`Imported ${e} change${e===1?``:`s`}`),y()}})}function y(){d(!1),o(null),i(``),c([]),h(null)}let b=a?.entries.filter(e=>e.action!==`unchanged`)??[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{className:`btn`,onClick:()=>d(!0),children:[(0,Z.jsx)(I,{size:14}),`Import .env`]}),(0,Z.jsx)(O,{open:u,onOpenChange:e=>e?d(!0):y(),title:(0,Z.jsxs)(Z.Fragment,{children:[`Import into`,` `,(0,Z.jsxs)(`span`,{className:`mono`,children:[t,`/`,n]})]}),wide:!0,description:(0,Z.jsx)(Z.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,Z.jsxs)(`div`,{className:`form`,style:{marginTop:`1.25rem`},children:[(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:`File contents`}),(0,Z.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,Z.jsx)(`div`,{className:`card dt-wrap`,children:(0,Z.jsxs)(`table`,{className:`dt`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{children:[(0,Z.jsx)(`th`,{children:`Key`}),(0,Z.jsx)(`th`,{className:`col-shrink`,children:`Plan`}),(0,Z.jsx)(`th`,{className:`col-shrink`,children:`Current`})]})}),(0,Z.jsx)(`tbody`,{children:a.entries.map(e=>(0,Z.jsxs)(`tr`,{children:[(0,Z.jsx)(`td`,{className:`cell-key`,children:k(e.key)}),(0,Z.jsx)(`td`,{className:`col-shrink`,children:(0,Z.jsx)(`span`,{className:De[e.action],children:e.action})}),(0,Z.jsx)(`td`,{className:`col-shrink cell-mono cell-muted`,children:e.version===null?`—`:`v${e.version}`})]},e.key))})]})}),a!==null&&a.entries.length>0&&b.length===0&&(0,Z.jsx)(A,{tone:`good`,children:`Every key already has this value. There is nothing to write.`}),s.length>0&&(0,Z.jsxs)(A,{tone:`bad`,children:[(0,Z.jsxs)(`strong`,{children:[s.length,` line`,s.length===1?``:`s`,` could not be parsed`]}),(0,Z.jsx)(`ul`,{style:{margin:`0.375rem 0 0`,paddingLeft:`1.1rem`},children:s.map(e=>(0,Z.jsxs)(`li`,{children:[`Line `,e.line,`: `,e.reason,` `,(0,Z.jsxs)(`span`,{className:`mono`,children:[`(`,e.text,`)`]})]},e.line))})]}),(0,Z.jsx)(w,{error:m}),(0,Z.jsxs)(`div`,{className:`dialog-actions`,children:[(0,Z.jsx)(`button`,{className:`btn`,onClick:y,children:`Cancel`}),a===null?(0,Z.jsxs)(`button`,{className:`btn btn-primary`,disabled:p||r.trim()===``,onClick:ee,children:[p&&(0,Z.jsx)(T,{}),`Preview changes`]}):(0,Z.jsxs)(`button`,{className:`btn btn-primary`,disabled:p||b.length===0,onClick:v,children:[p&&(0,Z.jsx)(T,{}),`Write `,b.length,` change`,b.length===1?``:`s`]})]})]})})]})}export{_e as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects._project._environment-DHRRvQw0.js","_coffre/assets/page-C_hnzdaR.js","_coffre/assets/link-DBINMwm6.js","_coffre/assets/use-change-CKj3Inq9.js","_coffre/assets/suspense-O8sP0mEC.js","_coffre/assets/row-state-DJ-KLamZ.js","_coffre/assets/ui-BXP2IqrW.js","_coffre/assets/icons-Dc_-t0lp.js","_coffre/assets/use-shell-W0SusPkz.js","_coffre/assets/useSuspenseQuery-BZ-nzHST.js","_coffre/assets/dist-Braunv_x.js","_coffre/assets/affordances-CEafRJcN.js","_coffre/assets/use-action-BpzKWhgg.js","_coffre/assets/validation-9Cl_XS-l.js"])))=>i.map(i=>d[i]);
2
+ import{h as e}from"./page-C_hnzdaR.js";import{n as t,r as n,t as r}from"./preload-helper-CLkO85Nq.js";var i=n(`/projects/$project/$environment`)({validateSearch:e=>({filter:typeof e.filter==`string`&&e.filter!==``?e.filter:void 0}),loader:({context:{client:t,queryClient:n},params:r})=>n.fetchQuery(e.secrets(t,r)),component:t(()=>r(()=>import(`./projects._project._environment-DHRRvQw0.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-DGl921dP.js","_coffre/assets/page-C_hnzdaR.js","_coffre/assets/link-DBINMwm6.js","_coffre/assets/use-change-CKj3Inq9.js","_coffre/assets/suspense-O8sP0mEC.js","_coffre/assets/row-state-DJ-KLamZ.js","_coffre/assets/ui-BXP2IqrW.js","_coffre/assets/icons-Dc_-t0lp.js","_coffre/assets/use-shell-W0SusPkz.js","_coffre/assets/useSuspenseQuery-BZ-nzHST.js","_coffre/assets/useQuery-B-lxFSES.js","_coffre/assets/dist-Braunv_x.js","_coffre/assets/project-environments-CfIH5kFM.js","_coffre/assets/directory-H8Eh3MnS.js","_coffre/assets/use-action-BpzKWhgg.js","_coffre/assets/validation-9Cl_XS-l.js","_coffre/assets/grants-DPDxJXU1.js"])))=>i.map(i=>d[i]);
2
+ import{d as e}from"./page-C_hnzdaR.js";import{n as t,r as n,t as r}from"./preload-helper-CLkO85Nq.js";var i=n(`/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-DGl921dP.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};
@@ -1 +1 @@
1
- import{C as e,U as t,V as n,X as r,c as i,h as a,i as o,m as s,n as c,o as l,q as u,t as d}from"./page-CDuo3uft.js";import{t as f}from"./link-Bg_PHv45.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-DIpkq9iI.js";import{t as w}from"./use-shell-BJwawvkh.js";import{t as T}from"./useSuspenseQuery-BfnNEmf7.js";import{t as E}from"./useQuery-BHCBwHtH.js";import{n as D}from"./dist-BHhATf1q.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-Ch0beQy-.js";import{t as ee}from"./project-environments-CfIH5kFM.js";import{A as F,D as I,M as L,N as te,P as ne,U as R,V as z,a as re,i as B,k as ie,p as ae,v as V,y as H}from"./icons-BFziRUf9.js";import{a as U,i as W,t as G}from"./row-state-BzGdu73b.js";import{t as K}from"./projects._project.index-BzJQojbd.js";import{i as q,o as oe,s as se}from"./directory-skRBmF1Y.js";import{t as J}from"./use-action-cgaBRBBH.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-BEmVXYg5.js";var X=r(u(),1),Z=t();function fe({principalType:t,canList:n,grants:r,value:i,onChange:o}){let s=e(),c=E(a.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=>o(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)(te,{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(),o(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),a=e.principalId===i;return(0,Z.jsxs)(`label`,{className:`picker-option${a?` is-chosen`:``}`,children:[(0,Z.jsx)(`input`,{type:`radio`,className:`visually-hidden`,name:d,value:e.principalId,checked:a,onChange:()=>o(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)(re,{size:14,className:`picker-check`})]},e.principalId)})})]})}var pe=[{key:`environments`,label:`Environments`,icon:(0,Z.jsx)(H,{size:15})},{key:`users`,label:`Users`,icon:(0,Z.jsx)(R,{size:15})},{key:`tokens`,label:`Tokens`,icon:(0,Z.jsx)(V,{size:15})},{key:`settings`,label:`Settings`,icon:(0,Z.jsx)(ne,{size:15})}];function me(){let{project:t}=K.useParams(),{data:n}=T(a.projects(e())),r=s(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)(c,{icon:(0,Z.jsx)(ae,{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(a.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`),s=e.permissions.includes(`grant.manage`),c=pe.filter(({key:e})=>e===`environments`||(e===`users`||e===`tokens`)&&s||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)(o,{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)(I,{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)(ie,{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)(L,{size:14}):(0,Z.jsx)(B,{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)(F,{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)(z,{size:14}):(0,Z.jsx)(V,{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)(F,{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:u,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:l.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||u||i===``||p!==null||o.trim()===``,children:[u&&(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)(L,{size:14}):(0,Z.jsx)(B,{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:l.places(),onSuccess:()=>D.success(c?`${t.slug} restored`:`${t.slug} archived`)})})]})}export{me as component};
1
+ import{C as e,U as t,V as n,X as r,c as i,h as a,i as o,m as s,n as c,o as l,q as u,t as d}from"./page-C_hnzdaR.js";import{t as f}from"./link-DBINMwm6.js";import{D as p,E as m,O as h,d as g,f as _,i as v,n as y,p as b,s as x,t as S,v as ee}from"./use-change-CKj3Inq9.js";import{t as C}from"./use-shell-W0SusPkz.js";import{t as w}from"./useSuspenseQuery-BZ-nzHST.js";import{t as T}from"./useQuery-B-lxFSES.js";import{n as E}from"./dist-Braunv_x.js";import{a as D,c as O,h as k,i as A,n as j,o as M,s as N}from"./ui-BXP2IqrW.js";import{t as te}from"./project-environments-CfIH5kFM.js";import{A as ne,F as P,H as F,N as I,O as L,P as re,W as ie,a as R,i as z,j as B,p as ae,v as V,y as H}from"./icons-Dc_-t0lp.js";import{a as U,i as W,t as G}from"./row-state-DJ-KLamZ.js";import{t as K}from"./projects._project.index-BO-8FZIY.js";import{i as q,o as oe,s as se}from"./directory-H8Eh3MnS.js";import{t as J}from"./use-action-BpzKWhgg.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-DPDxJXU1.js";var X=r(u(),1),Z=t();function fe({principalType:t,canList:n,grants:r,value:i,onChange:o}){let s=e(),c=T(a.directory(s,n)).data??null,[l,u]=(0,X.useState)(``),d=(0,X.useId)(),m=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=>o(e.target.value)}),(0,Z.jsxs)(`span`,{className:`hint`,children:[`The `,m,` 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 `,m,`s by name`]}),(0,Z.jsx)(re,{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(),o(v[0].principalId))}})]}),(0,Z.jsx)(`div`,{className:`picker-list`,children:c===null?(0,Z.jsxs)(`p`,{className:`picker-empty`,children:[(0,Z.jsx)(O,{size:13}),`Loading `,m,`s…`]}):g.length===0?(0,Z.jsxs)(`p`,{className:`picker-empty`,children:[`No `,m,`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 `,m,` matches “`,l.trim(),`”.`]}):v.map(e=>{let n=r.filter(n=>n.principalType===t&&n.principalId===e.principalId).map(p),a=e.principalId===i;return(0,Z.jsxs)(`label`,{className:`picker-option${a?` is-chosen`:``}`,children:[(0,Z.jsx)(`input`,{type:`radio`,className:`visually-hidden`,name:d,value:e.principalId,checked:a,onChange:()=>o(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)(R,{size:14,className:`picker-check`})]},e.principalId)})})]})}var pe=[{key:`environments`,label:`Environments`,icon:(0,Z.jsx)(H,{size:15})},{key:`users`,label:`Users`,icon:(0,Z.jsx)(ie,{size:15})},{key:`tokens`,label:`Tokens`,icon:(0,Z.jsx)(V,{size:15})},{key:`settings`,label:`Settings`,icon:(0,Z.jsx)(P,{size:15})}];function me(){let{project:t}=K.useParams(),{data:n}=w(a.projects(e())),r=s(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)(c,{icon:(0,Z.jsx)(ae,{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}=w(a.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`),s=e.permissions.includes(`grant.manage`),c=pe.filter(({key:e})=>e===`environments`||(e===`users`||e===`tokens`)&&s||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)(o,{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)(N,{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)(N,{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(te).filter(e=>e.details.archivedAt!==null),r=e.environments.filter(e=>e.details===null||e.details.archivedAt===null),{failedAdds:a,dismiss:o}=y(i.projects),s=a(e.environments.map(t=>g(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)(A,{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=S(ee(m,t)),_=S(v(m,t)),{status:b,dismiss:x}=y(i.projects),C=b(g(t,n.slug)),w=C.state===`pending`,T=n.details,E=T!==null&&T.archivedAt!==null,D=T?.secretCount??null,O=T!==null&&!E&&n.accessible&&!w,A=r&&T!==null,N=l===``?null:Y(l);return(0,Z.jsxs)(`div`,{className:`env-card${O?` is-link`:` is-muted`} ${U(C)}`,children:[(0,Z.jsxs)(`div`,{className:`env-card-text`,children:[O?(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}),E?(0,Z.jsx)(`span`,{className:`tag tag-red`,children:`archived`}):!n.accessible&&!w?(0,Z.jsx)(`span`,{className:`tag tag-outline`,children:`no secret access`}):D!==null&&(0,Z.jsxs)(`span`,{children:[D,` secret`,D===1?``:`s`]})]})]}),w&&(0,Z.jsx)(W,{status:C}),A&&!w&&(0,Z.jsxs)(k.Root,{children:[(0,Z.jsx)(k.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)(L,{size:16})})}),(0,Z.jsx)(k.Portal,{children:(0,Z.jsxs)(k.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,Z.jsxs)(k.Item,{className:`menu-item`,onSelect:()=>{u(n.slug),p(n.name),o(!0)},children:[(0,Z.jsx)(ne,{size:14}),`Rename`]}),(0,Z.jsx)(k.Separator,{className:`menu-sep`}),(0,Z.jsxs)(k.Item,{className:`menu-item${E?``:` menu-item-danger`}`,onSelect:()=>c(!0),children:[E?(0,Z.jsx)(I,{size:14}):(0,Z.jsx)(z,{size:14}),E?`Restore`:`Archive…`]})]})})]}),A&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(M,{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":N!==null,onChange:e=>u(e.target.value)}),(0,Z.jsx)(`span`,{className:`hint${N===null?``:` edit-note-error`}`,children:N??`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===``||N!==null||d.trim()===``,children:`Save`})]})]})}),(0,Z.jsx)(j,{open:s,onOpenChange:c,title:(0,Z.jsxs)(Z.Fragment,{children:[E?`Restore`:`Archive`,` `,(0,Z.jsxs)(`span`,{className:`mono`,children:[t,`/`,n.slug]}),`?`]}),body:D===null?(0,Z.jsx)(Z.Fragment,{children:`This changes whether the environment serves secrets to principals who have access. Values and history remain stored.`}):E?(0,Z.jsxs)(Z.Fragment,{children:[`The environment starts serving its `,D,` secret`,D===1?``:`s`,` again, to everyone who holds a grant on it.`]}):(0,Z.jsxs)(Z.Fragment,{children:[`Its `,D,` secret`,D===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:E?`Restore environment`:`Archive environment`,destructive:!E,onConfirm:()=>_({slug:n.slug,archived:!E})})]}),(0,Z.jsx)(G,{status:C,onDismiss:()=>C.state===`failed`&&x(C.mutationId)})]})}function _e({project:t}){let[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(``),c=S(x(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)(B,{size:14}),`Add environment`]}),(0,Z.jsx)(M,{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)(A,{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)(F,{size:14}):(0,Z.jsx)(V,{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})},b(e))),(0,Z.jsx)(ue,{refused:i})]})})}function ye({principalType:t,project:n,environments:r,grants:i}){let{capabilities:a}=C(),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(`viewer:`),[f,p]=(0,X.useState)(``),g=S(_(e(),n)),v=h(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)(B,{size:14}),`Add `,y]}),(0,Z.jsx)(M,{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=m(u);g({principalType:t,principalId:c.trim(),role:n.role,roleName:v.find(e=>e.value===u)?.label??n.role,environmentSlug:n.environmentSlug,expiresAt:f===``?null:new Date(`${f}T23:59:59Z`).toISOString()}),l(``),p(``),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:v.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=>p(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:u,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:l.places(),onSuccess:async()=>{E.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)(D,{error:d})}),(0,Z.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:!m||u||i===``||p!==null||o.trim()===``,children:[u&&(0,Z.jsx)(O,{}),`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)(D,{error:o})})]}),(0,Z.jsxs)(`button`,{className:`btn ${c?``:`btn-danger-outline`}`,onClick:()=>r(!0),disabled:a,children:[a?(0,Z.jsx)(O,{}):c?(0,Z.jsx)(I,{size:14}):(0,Z.jsx)(z,{size:14}),c?`Restore project`:`Archive project…`]})]}),(0,Z.jsx)(j,{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:l.places(),onSuccess:()=>E.success(c?`${t.slug} restored`:`${t.slug} archived`)})})]})}export{me as component};