@coffre/ui 0.1.13 → 0.1.15

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 (96) hide show
  1. package/dist/client/_coffre/assets/{account-DHSs5h2f.js → account-DGGcVkqt.js} +1 -1
  2. package/dist/client/_coffre/assets/{account-CyJDFhek.js → account-DqjL4kP9.js} +2 -2
  3. package/dist/client/_coffre/assets/{affordances-BQD5B421.js → affordances-B9nFwqIv.js} +1 -1
  4. package/dist/client/_coffre/assets/{audit-rMy9mU9Q.js → audit-CcQmaSan.js} +1 -1
  5. package/dist/client/_coffre/assets/audit-XwuBA4r9.js +2 -0
  6. package/dist/client/_coffre/assets/{auth.device-DuvaComb.js → auth.device-CFCn1DXA.js} +1 -1
  7. package/dist/client/_coffre/assets/{auth.device-yBt_sLZW.js → auth.device-CHHcm089.js} +2 -2
  8. package/dist/client/_coffre/assets/{directory-C4BMGC7-.js → directory-skRBmF1Y.js} +1 -1
  9. package/dist/client/_coffre/assets/{dist-BNkBTkxj.js → dist-BHhATf1q.js} +1 -1
  10. package/dist/client/_coffre/assets/globals-DCrHjrpD.css +1 -0
  11. package/dist/client/_coffre/assets/{grants-CyDW25eX.js → grants-BEmVXYg5.js} +1 -1
  12. package/dist/client/_coffre/assets/{icons-BRl8DlXW.js → icons-BFziRUf9.js} +1 -1
  13. package/dist/client/_coffre/assets/index-Bo6udWLL.js +12 -0
  14. package/dist/client/_coffre/assets/{link-CqlAJWBd.js → link-Bg_PHv45.js} +1 -1
  15. package/dist/client/_coffre/assets/{login-B73b6bsJ.js → login-GV0ZjCQy.js} +1 -1
  16. package/dist/client/_coffre/assets/login-pzHGDqU5.js +2 -0
  17. package/dist/client/_coffre/assets/{offboarding--5vSKNHv.js → offboarding-CXV0KyMt.js} +1 -1
  18. package/dist/client/_coffre/assets/{page-Dngv8FMr.js → page-CDuo3uft.js} +1 -1
  19. package/dist/client/_coffre/assets/{preload-helper-DBha3tys.js → preload-helper-CYFH1xAV.js} +1 -1
  20. package/dist/client/_coffre/assets/{principal-page-C4qDD-d8.js → principal-page-BmgkTnAl.js} +1 -1
  21. package/dist/client/_coffre/assets/projects._project._environment-5PA9NHET.js +2 -0
  22. package/dist/client/_coffre/assets/{projects._project._environment-or_AX6o5.js → projects._project._environment-B-5I0ZFP.js} +1 -1
  23. package/dist/client/_coffre/assets/projects._project.index-BzJQojbd.js +2 -0
  24. package/dist/client/_coffre/assets/{projects._project.index-iynQgenH.js → projects._project.index-wjtfc8E6.js} +1 -1
  25. package/dist/client/_coffre/assets/{projects.index-CGW8mRil.js → projects.index-dl7dfnGW.js} +1 -1
  26. package/dist/client/_coffre/assets/{row-state-BlarvG7E.js → row-state-BzGdu73b.js} +1 -1
  27. package/dist/client/_coffre/assets/{settings-D-7RJIDf.js → settings-DnENNWn8.js} +1 -1
  28. package/dist/client/_coffre/assets/{suspense-q_eJaZ18.js → suspense-Cnh1cNc1.js} +1 -1
  29. package/dist/client/_coffre/assets/{tokens._token-C53NqScg.js → tokens._token-BJiMX2TJ.js} +1 -1
  30. package/dist/client/_coffre/assets/tokens._token-C2s6HHWK.js +2 -0
  31. package/dist/client/_coffre/assets/{tokens.index-DBZTLnbi.js → tokens.index-D4HYaFJl.js} +1 -1
  32. package/dist/client/_coffre/assets/{ui-BPWFJNz7.js → ui-Ch0beQy-.js} +1 -1
  33. package/dist/client/_coffre/assets/{unregistered-CLhgtwUt.js → unregistered-wV1yqr9t.js} +1 -1
  34. package/dist/client/_coffre/assets/{use-action-LULgF26O.js → use-action-cgaBRBBH.js} +1 -1
  35. package/dist/client/_coffre/assets/{use-change-Bd6NZJj9.js → use-change-DIpkq9iI.js} +1 -1
  36. package/dist/client/_coffre/assets/{use-shell-Dx92Huhb.js → use-shell-BJwawvkh.js} +1 -1
  37. package/dist/client/_coffre/assets/useQuery-BHCBwHtH.js +1 -0
  38. package/dist/client/_coffre/assets/{useSuspenseQuery-tP9HFZ8w.js → useSuspenseQuery-BfnNEmf7.js} +1 -1
  39. package/dist/client/_coffre/assets/users._user--OY2srG0.js +1 -0
  40. package/dist/client/_coffre/assets/users._user-Cj4NY0p5.js +2 -0
  41. package/dist/client/_coffre/assets/{users.index-Cs9tibIv.js → users.index-C7_aZ0jb.js} +1 -1
  42. package/dist/server/.vite/manifest.json +155 -155
  43. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-C-_y9u60.js +162 -0
  44. package/dist/server/_coffre/assets/{account-BUhhOS5-.js → account-BJtaf5d7.js} +5 -5
  45. package/dist/server/_coffre/assets/{account-B_h55GCs.js → account-CL3AX6kY.js} +2 -2
  46. package/dist/server/_coffre/assets/{audit-B8Ck358-.js → audit-BtjuffEH.js} +4 -4
  47. package/dist/server/_coffre/assets/{audit-DFsXfeAQ.js → audit-DiHTzVVe.js} +2 -2
  48. package/dist/server/_coffre/assets/{auth.device-cqjWACvB.js → auth.device-8RMD0nyz.js} +2 -2
  49. package/dist/server/_coffre/assets/{auth.device-BXf_JjT7.js → auth.device-dUMx6Srl.js} +2 -2
  50. package/dist/server/_coffre/assets/{directory-C9SfNgpM.js → directory-9Jc5MEra.js} +2 -2
  51. package/dist/server/_coffre/assets/globals-DCrHjrpD.css +1 -0
  52. package/dist/server/_coffre/assets/{grants--315KmXu.js → grants-D5-q8fXB.js} +2 -2
  53. package/dist/server/_coffre/assets/{login-LBpXXfsQ.js → login-C80ImEsO.js} +1 -1
  54. package/dist/server/_coffre/assets/{login-CQSkYW_D.js → login-DmpfrcPB.js} +3 -3
  55. package/dist/server/_coffre/assets/{offboarding-CykelNis.js → offboarding-CXIgvZbO.js} +2 -2
  56. package/dist/server/_coffre/assets/{page-BGeDoQO5.js → page-x4nICC9d.js} +2 -0
  57. package/dist/server/_coffre/assets/{principal-page-CRdoAQOq.js → principal-page-BO6Ijpqv.js} +8 -8
  58. package/dist/server/_coffre/assets/{projects._project._environment-BrDqn8kW.js → projects._project._environment-BMqZsCfi.js} +6 -6
  59. package/dist/server/_coffre/assets/{projects._project._environment-BXU1Mee5.js → projects._project._environment-BeXpetmJ.js} +2 -2
  60. package/dist/server/_coffre/assets/{projects._project.index-CAxBU4tY.js → projects._project.index-B74-XdI3.js} +9 -9
  61. package/dist/server/_coffre/assets/{projects._project.index-CYyUVTCl.js → projects._project.index-DZ1KZvHR.js} +2 -2
  62. package/dist/server/_coffre/assets/{projects.index-D6ZoDE_0.js → projects.index-D7F7hiVe.js} +4 -4
  63. package/dist/server/_coffre/assets/{router-Bu2qtyqw.js → router-fxr2e6Ht.js} +70 -22
  64. package/dist/server/_coffre/assets/{settings-ByeF6hBa.js → settings-DO8wvTmo.js} +3 -3
  65. package/dist/server/_coffre/assets/{suspense-beD01bb8.js → suspense-WsBv84ga.js} +1 -1
  66. package/dist/server/_coffre/assets/{tokens._token-D2E4P3Qc.js → tokens._token-CVWTFOM-.js} +7 -7
  67. package/dist/server/_coffre/assets/{tokens._token-CM01QPCq.js → tokens._token-DhcJxsf3.js} +2 -2
  68. package/dist/server/_coffre/assets/{tokens.index-Cmrgn3mU.js → tokens.index-hvPM5IjY.js} +5 -5
  69. package/dist/server/_coffre/assets/{unregistered-DSArejP9.js → unregistered-DKdzrjVr.js} +2 -2
  70. package/dist/server/_coffre/assets/{use-action-C2wz34kq.js → use-action-D6KlY-sv.js} +2 -2
  71. package/dist/server/_coffre/assets/{use-change-CJpGSNIq.js → use-change-CAcOZo-a.js} +2 -2
  72. package/dist/server/_coffre/assets/{use-shell-C3iYcyP1.js → use-shell-C-yuQ1hA.js} +2 -2
  73. package/dist/server/_coffre/assets/{useQuery-ChxaQ4Cb.js → useQuery-MqmaAeUF.js} +2 -2
  74. package/dist/server/_coffre/assets/{useSuspenseQuery-BjAmlGZl.js → useSuspenseQuery-BDvlOPB7.js} +2 -2
  75. package/dist/server/_coffre/assets/{users._user-BVeR9fZP.js → users._user-dCIYuxyZ.js} +2 -2
  76. package/dist/server/_coffre/assets/{users._user-Cih2Etf4.js → users._user-pLdzKe1F.js} +2 -2
  77. package/dist/server/_coffre/assets/{users.index-Bo2_a95G.js → users.index-CDCDlQxN.js} +5 -5
  78. package/dist/server/index.js +2 -2
  79. package/package.json +3 -3
  80. package/src/components/shell.tsx +26 -2
  81. package/src/lib/instance.ts +13 -0
  82. package/src/lib/queries.ts +2 -0
  83. package/src/routes/__root.tsx +2 -1
  84. package/src/styles/globals.css +5 -0
  85. package/dist/client/_coffre/assets/audit-Bcyp_dU1.js +0 -2
  86. package/dist/client/_coffre/assets/globals-BJkzu6T5.css +0 -1
  87. package/dist/client/_coffre/assets/index-CA1mtrIx.js +0 -12
  88. package/dist/client/_coffre/assets/login-BO1KAGPU.js +0 -2
  89. package/dist/client/_coffre/assets/projects._project._environment-eBKxOZ0_.js +0 -2
  90. package/dist/client/_coffre/assets/projects._project.index-DHdXfEh-.js +0 -2
  91. package/dist/client/_coffre/assets/tokens._token-0u7midqA.js +0 -2
  92. package/dist/client/_coffre/assets/useQuery-BIIZz1CB.js +0 -1
  93. package/dist/client/_coffre/assets/users._user-BXtaL8Ee.js +0 -2
  94. package/dist/client/_coffre/assets/users._user-CNYVkXaY.js +0 -1
  95. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-T9tMsCwo.js +0 -162
  96. package/dist/server/_coffre/assets/globals-BJkzu6T5.css +0 -1
@@ -1,3 +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-Dngv8FMr.js";import{t as m}from"./link-CqlAJWBd.js";import{C as h,a as g,n as _,r as ee,t as v,v as y,w as b,x}from"./use-change-Bd6NZJj9.js";import{t as te}from"./use-shell-Dx92Huhb.js";import{t as S}from"./useSuspenseQuery-tP9HFZ8w.js";import{n as C}from"./dist-BNkBTkxj.js";import{a as w,c as T,h as E,i as ne,l as D,o as O,p as re,r as ie,s as k,t as A,u as j}from"./ui-BPWFJNz7.js";import{i as M}from"./affordances-BQD5B421.js";import{A as ae,B as N,D as oe,M as P,N as se,S as ce,W as F,d as I,f as L,g as R,h as z,i as le,k as B,l as V,n as H,v as U,z as ue}from"./icons-BRl8DlXW.js";import{a as W,i as G,r as K}from"./row-state-BlarvG7E.js";import{t as de}from"./projects._project._environment-eBKxOZ0_.js";import{t as q}from"./use-action-LULgF26O.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`
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-CDuo3uft.js";import{t as m}from"./link-Bg_PHv45.js";import{C as h,a as g,n as _,r as ee,t as v,v as y,w as b,x}from"./use-change-DIpkq9iI.js";import{t as te}from"./use-shell-BJwawvkh.js";import{t as S}from"./useSuspenseQuery-BfnNEmf7.js";import{n as C}from"./dist-BHhATf1q.js";import{a as w,c as T,h as E,i as ne,l as D,o as O,p as re,r as ie,s as k,t as A,u as j}from"./ui-Ch0beQy-.js";import{i as M}from"./affordances-B9nFwqIv.js";import{A as ae,B as N,D as oe,M as P,N as se,S as ce,W as F,d as I,f as L,g as R,h as z,i as le,k as B,l as V,n as H,v as U,z as ue}from"./icons-BFziRUf9.js";import{a as W,i as G,r as K}from"./row-state-BzGdu73b.js";import{t as de}from"./projects._project._environment-5PA9NHET.js";import{t as q}from"./use-action-cgaBRBBH.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
2
  `;case`r`:return`\r`;case`\\`:case`"`:case`'`:return t;default:return e}})}var Y=i(u());function _e(e,t){return e!==null&&e.version===t}var X=n(),Z=45;function ve(){let{project:t,environment:n}=de.useParams(),{data:r}=S(o.secrets(e(),{project:t,environment:n}));return r.ok?(0,X.jsx)(ye,{project:t,environment:n,permissions:r.permissions,keys:r.keys},`${t}/${n}`):(0,X.jsx)(c,{icon:(0,X.jsx)(ce,{size:18}),label:(0,X.jsxs)(`span`,{className:`mono`,children:[t,`/`,n]}),title:`This environment is closed to you`,actions:(0,X.jsxs)(m,{className:`btn`,to:`/projects/$project`,params:{project:t},children:[`Back to `,t]}),children:r.error})}function ye({project:t,environment:n,permissions:r,keys:i}){let o=e(),{principal:c}=te(),l=v(x(o,{project:t,environment:n},c?.id??null)),u=v(y(o,{project:t,environment:n})),m=v(g(o,{project:t,environment:n})),{status:S,dismiss:w}=_(a.secrets({project:t,environment:n})),[T,E]=(0,Y.useState)([]),[D,O]=(0,Y.useState)({}),[re,k]=(0,Y.useState)(()=>new Set),[A,j]=(0,Y.useState)(null),[M,N]=(0,Y.useState)(de.useSearch().filter??``),oe=(0,Y.useRef)(0),P=r.includes(`secret.write`),F=r.includes(`secret.archive`),I=f(r),L=i.filter(e=>!e.archived),R=i.filter(e=>e.archived),le=new Set(i.map(e=>e.key)),B=L.filter(e=>b(D,e.key)!==void 0),W=h(L,T,D),G=[...T.map(e=>e.key.trim()),...B.flatMap(e=>{let t=b(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={...b(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}),k(t=>{let n=new Set(t);return n.delete(e),n})}function ge(){E(e=>[{id:oe.current++,key:``,value:``},...e])}function _e(){E([]),O({}),k(new Set),j(null);for(let e of i){let t=S(e.key);t.state===`failed`&&w(t.mutationId)}}function Z(){if(!pe)return;let e={active:L,drafts:T,changes:D};E([]),O({}),k(new Set),j(null),l(e,{onError:t=>{let n=t instanceof ee?t.outcome:e;E(n.drafts),O(n.changes),j(p(t))}})}function ve(e){u({key:e},{onSuccess:()=>C.success(`${e} restored`,{action:{label:`Undo`,onClick:()=>m({key:e})}})})}let ye=(0,Y.useRef)(Z);ye.current=Z,(0,Y.useEffect)(()=>{if(J===0)return;function e(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),ye.current())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[J]);let xe=[...T.map(e=>({key:e.key.trim()||`unnamed`,what:le.has(e.key.trim())?`new version`:`added`})),...B.map(e=>{let t=b(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`}})],Q=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,Se=M.trim().toLowerCase(),$=Se===``?L:L.filter(e=>e.key.toLowerCase().includes(Se));return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(s,{tile:t,title:n,aside:(0,X.jsx)(be,{project:t,environment:n}),actions:(0,X.jsxs)(X.Fragment,{children:[P&&I&&(0,X.jsx)(ke,{project:t,environment:n}),P&&(0,X.jsxs)(`button`,{className:`btn btn-primary`,onClick:ge,children:[(0,X.jsx)(ae,{size:14}),`New secret`]})]})}),(L.length>0||T.length>0)&&(0,X.jsxs)(`div`,{className:`toolbar`,children:[(0,X.jsxs)(`label`,{className:`filter input-group`,children:[(0,X.jsx)(`span`,{className:`visually-hidden`,children:`Filter secrets by name`}),(0,X.jsx)(se,{size:14,className:`input-icon`}),(0,X.jsx)(`input`,{className:`input`,type:`search`,placeholder:`Filter by name…`,spellCheck:!1,autoComplete:`off`,value:M,onChange:e=>N(e.target.value)})]}),(0,X.jsx)(`div`,{className:`toolbar-meta`,children:(0,X.jsxs)(`span`,{className:`th`,title:`Run a process with these secrets in its environment`,children:[(0,X.jsx)(ue,{size:14}),(0,X.jsxs)(`code`,{children:[`coffre run `,t,`/`,n,` -- …`]}),(0,X.jsx)(ie,{value:`coffre run ${t}/${n} -- `,label:`Copy command`})]})})]}),(0,X.jsx)(`section`,{className:`card`,"aria-label":`Secrets`,children:L.length===0&&T.length===0?(0,X.jsx)(ne,{title:`No secrets yet`,actions:P?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{className:`btn btn-primary`,onClick:ge,children:[(0,X.jsx)(ae,{size:14}),`New secret`]}),I&&(0,X.jsx)(ke,{project:t,environment:n})]}):void 0,children:P?`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,X.jsx)(`div`,{className:`dt-wrap`,children:(0,X.jsxs)(`table`,{className:`dt secrets stacks`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`n`,children:`#`}),(0,X.jsx)(`th`,{className:`col-key`,children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(U,{size:14}),`Key`]})}),(0,X.jsx)(`th`,{children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(ce,{size:14}),`Value`,!I&&(0,X.jsx)(`span`,{className:`th-note`,children:`hidden from you`})]})}),(0,X.jsx)(`th`,{className:`col-version`,children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(z,{size:14}),`Version`]})}),(0,X.jsx)(`th`,{className:`col-written col-hide-narrow`,children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(V,{size:14}),`Last written`]})}),(0,X.jsx)(`th`,{className:`col-actions`,children:(0,X.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,X.jsxs)(`tbody`,{children:[T.map(e=>(0,X.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)),$.map(e=>{let r=b(D,e.key),i=S(e.key);return(0,X.jsx)(Ce,{number:L.indexOf(e)+1,project:t,environment:n,entry:e,change:r??{key:e.key,value:null,archived:!1},editing:r?.archived!==!0&&(re.has(e.key)||r!==void 0),canWrite:P,canArchive:F,canReveal:I,status:i,disabled:i.state===`pending`,columns:6,onEdit:()=>k(t=>new Set(t).add(e.key)),onPatch:t=>me(e,t),onUndo:()=>he(e.key),onMarkArchive:()=>{k(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)}),$.length===0&&L.length>0&&(0,X.jsx)(`tr`,{children:(0,X.jsxs)(`td`,{colSpan:6,className:`cell-muted`,style:{padding:`1rem`},children:[`No secret name contains “`,M.trim(),`”.`]})})]})]})})}),R.length>0&&(0,X.jsx)(d,{labelledBy:`archived-secrets`,title:`Archived`,description:(0,X.jsxs)(X.Fragment,{children:[`Retired, so no longer served or injected by `,(0,X.jsx)(`code`,{children:`coffre run`}),`. Their history and audit trail are intact, and restoring is immediate.`]}),children:(0,X.jsx)(`div`,{className:`dt-wrap`,children:(0,X.jsxs)(`table`,{className:`dt secrets secrets-archived stacks`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`n`,children:`#`}),(0,X.jsx)(`th`,{className:`col-key`,children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(U,{size:14}),`Key`]})}),(0,X.jsx)(`th`,{className:`col-version`,children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(z,{size:14}),`Version`]})}),(0,X.jsx)(`th`,{className:`col-written col-hide-narrow`,children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(V,{size:14}),`Last written`]})}),(0,X.jsx)(`th`,{className:`col-actions`,children:(0,X.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,X.jsx)(`tbody`,{children:R.map((e,r)=>(0,X.jsx)(Te,{number:r+1,project:t,environment:n,entry:e,canArchive:F,canReveal:I,status:S(e.key),onRestore:()=>ve(e.key),onDismiss:w},e.key))})]})})}),J>0&&(0,X.jsx)(`div`,{className:`savebar`,role:`region`,"aria-label":`Unsaved changes`,children:(0,X.jsxs)(`div`,{className:`savebar-inner`,children:[(0,X.jsxs)(`span`,{className:`savebar-count`,children:[(0,X.jsx)(`span`,{className:`dot`,"aria-hidden":!0}),J,` unsaved change`,J===1?``:`s`]}),(0,X.jsxs)(`span`,{className:`savebar-summary`,children:[xe.slice(0,3).map((e,t)=>(0,X.jsxs)(`span`,{children:[t>0&&` · `,(0,X.jsx)(`span`,{className:`mono`,children:e.key}),` `,e.what]},`${e.key}:${t}`)),xe.length>3&&` · and ${xe.length-3} more`]}),(0,X.jsxs)(`div`,{className:`savebar-actions`,children:[(0,X.jsx)(`button`,{className:`btn btn-sm`,onClick:_e,children:`Discard`}),(0,X.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:Z,disabled:!pe,title:`Save (⌘ Enter or Ctrl Enter)`,"aria-keyshortcuts":`Meta+Enter Control+Enter`,children:[`Save `,J===1?`change`:`${J} changes`]})]}),(A??Q)!==null&&(0,X.jsxs)(`p`,{className:`savebar-error`,role:`alert`,children:[(0,X.jsx)(H,{size:14}),(0,X.jsx)(`span`,{children:A??Q})]})]})})]})}function be({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,X.jsx)(X.Fragment,{children:r})}function xe({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,X.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 Q({label:e,value:t,onChange:n,placeholder:r,disabled:i,autoFocus:a,onEscape:o}){let[s,c]=(0,Y.useState)(!1);return(0,X.jsxs)(`div`,{className:`input-group`,children:[(0,X.jsx)(xe,{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,X.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,X.jsx)(L,{size:14}):(0,X.jsx)(I,{size:14})})]})}function Se(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(Z-(t-e.at)/1e3))}function Ce({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,k]=(0,Y.useState)(null),A=_e(v,a.version)?v:null;(0,Y.useEffect)(()=>{v!==null&&!_e(v,a.version)&&y(null)},[v,a.version]),(0,Y.useEffect)(()=>{if(v===null)return;let e=setTimeout(()=>y(null),Z*1e3);return()=>clearTimeout(e)},[v]);let ae=Se(A),N=s&&_e(O,a.version)?O:null;(0,Y.useEffect)(()=>{s||k(null)},[s]);async function se(){if(A!==null)return A.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 ce(){A===null?se():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`:A===null?``:` is-revealed`,K=a.version??0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`tr`,{className:`secret-row${ue} ${W(d)}`,children:[(0,X.jsx)(`td`,{className:`n`,children:t}),(0,X.jsx)(`td`,{className:`cell-key`,"data-label":`Key`,children:s&&c?(0,X.jsxs)(`div`,{className:`edit-stack`,children:[(0,X.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,X.jsx)(`span`,{className:`edit-note${U===null?``:` edit-note-error`}`,children:U??(0,X.jsxs)(X.Fragment,{children:[`Renamed from `,(0,X.jsx)(`span`,{className:`mono`,children:a.key})]})})]}):(0,X.jsxs)(`div`,{className:`key-cell`,children:[(0,X.jsx)(`span`,{children:re(a.key)}),z&&(0,X.jsx)(`span`,{className:`tag tag-red`,children:`will be archived`})]})}),(0,X.jsx)(`td`,{"data-label":`Value`,children:s&&c?(0,X.jsxs)(`div`,{className:`edit-stack`,children:[(0,X.jsx)(Q,{label:`New value for ${a.key}`,value:o.value??N?.value??``,placeholder:`New value`,disabled:f,autoFocus:!0,onChange:e=>g({value:e===(N?.value??``)?null:e}),onEscape:_}),(0,X.jsxs)(`span`,{className:`edit-note`,children:[(0,X.jsx)(`span`,{children:H?`Saving appends v${K+1}; v${K} stays restorable.`:N===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&&N===null&&(0,X.jsxs)(`button`,{type:`button`,className:`act`,disabled:x,onClick:async()=>{let e=await se();e!==null&&k({value:e,version:a.version,at:Date.now()})},children:[x&&(0,X.jsx)(T,{size:12}),`Start from current value`]})]})]}):A!==null&&!z?(0,X.jsxs)(`div`,{className:`revealed`,style:{"--reveal-ttl":`${Z}s`},children:[(0,X.jsx)(`span`,{className:`revealed-value`,children:A.value===``?`(empty)`:A.value}),(0,X.jsxs)(`span`,{className:`revealed-note`,children:[`Hides in `,ae,`s`]}),(0,X.jsx)(`span`,{className:`revealed-meter`,"aria-hidden":!0})]}):(0,X.jsx)(`span`,{className:`mask`,"aria-label":`Hidden`,children:`••••••••••••`})}),(0,X.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:s&&H?(0,X.jsxs)(`span`,{className:`version-shift`,children:[`v`,K,` → `,(0,X.jsxs)(`b`,{children:[`v`,K+1]})]}):(0,X.jsx)(`span`,{className:`version-shift`,children:a.version===null?`—`:`v${a.version}`})}),(0,X.jsx)(`td`,{className:`col-written col-hide-narrow`,"data-label":`Last written`,children:(0,X.jsx)($,{entry:a})}),(0,X.jsx)(`td`,{className:`col-actions`,children:d.state===`pending`?(0,X.jsx)(G,{status:d}):(0,X.jsx)(`div`,{className:`acts`,children:z?(0,X.jsx)(j,{label:`Keep`,children:(0,X.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:_,disabled:f,"aria-label":`Keep ${a.key}`,children:(0,X.jsx)(P,{size:14})})}):s?(0,X.jsx)(j,{label:V||H?`Undo changes`:`Cancel`,children:(0,X.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,X.jsx)(P,{size:14}):(0,X.jsx)(F,{size:15})})}):(0,X.jsxs)(X.Fragment,{children:[A!==null&&(0,X.jsx)(ie,{variant:`act`,value:A.value,label:`Copy ${a.key}`}),(0,X.jsx)(M,{canReveal:u,children:(0,X.jsx)(j,{label:A===null?`Reveal`:`Hide`,children:(0,X.jsx)(`button`,{className:`act act-icon act-accent`,onClick:ce,disabled:x,"aria-label":`${A===null?`Reveal`:`Hide`} ${a.key}`,children:x?(0,X.jsx)(T,{size:13}):A===null?(0,X.jsx)(I,{size:15}):(0,X.jsx)(L,{size:15})})})}),c&&(0,X.jsx)(j,{label:`Edit`,children:(0,X.jsx)(`button`,{className:`act act-icon`,onClick:()=>{A!==null&&k(A),y(null),h()},disabled:f,"aria-label":`Edit ${a.key}`,children:(0,X.jsx)(B,{size:14})})}),(u||l)&&(0,X.jsxs)(E.Root,{children:[(0,X.jsx)(E.Trigger,{asChild:!0,children:(0,X.jsx)(`button`,{className:`act act-icon act-quiet`,"aria-label":`More for ${a.key}`,disabled:f,children:(0,X.jsx)(oe,{size:16})})}),(0,X.jsx)(E.Portal,{children:(0,X.jsxs)(E.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,X.jsx)(M,{canReveal:u,children:(0,X.jsxs)(E.Item,{className:`menu-item`,onSelect:()=>C(e=>!e),children:[(0,X.jsx)(R,{size:14}),S?`Hide history`:`Version history`]})}),l&&(0,X.jsxs)(X.Fragment,{children:[u&&(0,X.jsx)(E.Separator,{className:`menu-sep`}),(0,X.jsxs)(E.Item,{className:`menu-item menu-item-danger`,onSelect:()=>{y(null),ee()},children:[(0,X.jsx)(le,{size:14}),`Archive`,(0,X.jsx)(`span`,{className:`menu-hint`,children:`on save`})]})]})]})})]})]})})})]}),S&&u&&(0,X.jsx)(`tr`,{className:`detail-row`,children:(0,X.jsx)(`td`,{colSpan:m,children:(0,X.jsx)(Ee,{project:n,environment:i,secretKey:a.key,currentVersion:a.version,canWrite:c,onClose:()=>C(!1),onRolledBack:()=>y(null)})})}),ne!==null&&(0,X.jsx)(`tr`,{className:`row-error`,children:(0,X.jsx)(`td`,{colSpan:m,children:(0,X.jsx)(w,{error:ne})})})]})}function $({entry:e}){if(e.updatedBy===null&&e.updatedAt===null)return(0,X.jsx)(`span`,{className:`cell-muted`,children:`—`});let t=e.updatedBy??`unknown`;return(0,X.jsxs)(`span`,{className:`written`,children:[(0,X.jsx)(`span`,{className:`written-by`,title:t,children:t.split(`@`)[0]}),e.updatedAt!==null&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`cell-muted`,"aria-hidden":!0,children:`·`}),(0,X.jsx)(`span`,{className:`cell-muted`,children:(0,X.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,X.jsxs)(`tr`,{className:`secret-row is-draft`,children:[(0,X.jsx)(`td`,{className:`n`,"aria-label":`New`,children:`+`}),(0,X.jsx)(`td`,{className:`cell-key`,"data-label":`New secret`,children:(0,X.jsxs)(`div`,{className:`edit-stack`,children:[(0,X.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,X.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,X.jsx)(`td`,{"data-label":`Value`,children:(0,X.jsx)(`div`,{className:`edit-stack`,children:(0,X.jsx)(Q,{label:`Value for ${s===``?`the new secret`:s}`,value:e.value,placeholder:`Value`,disabled:n,onChange:e=>r({value:e}),onEscape:i})})}),(0,X.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:(0,X.jsx)(`span`,{className:`version-shift`,children:l?(0,X.jsxs)(X.Fragment,{children:[`v`,t,` → `,(0,X.jsxs)(`b`,{children:[`v`,t+1]})]}):(0,X.jsx)(`b`,{children:`new`})})}),(0,X.jsx)(`td`,{className:`col-written col-hide-narrow`,children:(0,X.jsx)(`span`,{className:`cell-muted`,children:`—`})}),(0,X.jsx)(`td`,{className:`col-actions`,children:(0,X.jsx)(`div`,{className:`acts`,children:(0,X.jsx)(j,{label:`Remove`,children:(0,X.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,X.jsx)(F,{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,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`tr`,{className:`secret-row is-archived ${W(o)}`,children:[(0,X.jsx)(`td`,{className:`n`,children:e}),(0,X.jsx)(`td`,{className:`cell-key`,"data-label":`Key`,children:re(r.key)}),(0,X.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:(0,X.jsx)(`span`,{className:`version-shift`,children:r.version===null?`—`:`v${r.version}`})}),(0,X.jsx)(`td`,{className:`col-written col-hide-narrow`,"data-label":`Last written`,children:(0,X.jsx)($,{entry:r})}),(0,X.jsx)(`td`,{className:`col-actions`,children:(0,X.jsxs)(`div`,{className:`acts`,children:[(0,X.jsx)(M,{canReveal:a,children:(0,X.jsx)(j,{label:l?`Hide history`:`Version history`,children:(0,X.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,X.jsx)(R,{size:15})})})}),i&&(o.state===`pending`?(0,X.jsx)(G,{status:o}):(0,X.jsx)(j,{label:`Restore`,children:(0,X.jsx)(`button`,{className:`act act-icon`,onClick:s,"aria-label":`Restore ${r.key}`,children:(0,X.jsx)(P,{size:14})})}))]})})]}),l&&(0,X.jsx)(`tr`,{className:`detail-row`,children:(0,X.jsx)(`td`,{colSpan:5,children:(0,X.jsx)(Ee,{project:t,environment:n,secretKey:r.key,currentVersion:r.version,canWrite:!1,onClose:()=>u(!1),onRolledBack:()=>void 0})})}),(0,X.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,X.jsxs)(`div`,{className:`history`,children:[(0,X.jsxs)(`div`,{className:`history-head`,children:[(0,X.jsxs)(`span`,{className:`history-title th`,children:[(0,X.jsx)(R,{size:14}),`Versions of `,(0,X.jsx)(`span`,{className:`mono`,children:i})]}),(0,X.jsx)(`button`,{className:`act`,onClick:s,children:`Close`})]}),f===null?u===null?(0,X.jsxs)(`p`,{className:`hint history-body`,children:[(0,X.jsx)(T,{size:13}),` Loading versions…`]}):(0,X.jsx)(`div`,{className:`dt-wrap`,children:(0,X.jsxs)(`table`,{className:`dt`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`col-shrink`,children:`Version`}),(0,X.jsx)(`th`,{className:`col-shrink`,children:`Written (UTC)`}),(0,X.jsx)(`th`,{children:`By`}),(0,X.jsx)(`th`,{className:`col-shrink`,children:`Key id`}),(0,X.jsx)(`th`,{className:`col-actions`,children:(0,X.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,X.jsx)(`tbody`,{children:u.map(e=>(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`td`,{className:`cell-mono nowrap`,children:[`v`,e.version,` `,e.current&&(0,X.jsx)(`span`,{className:`tag tag-blue`,children:`current`})]}),(0,X.jsx)(`td`,{className:`nowrap`,children:(0,X.jsx)(D,{iso:e.createdAt})}),(0,X.jsx)(`td`,{children:e.createdBy}),(0,X.jsx)(`td`,{className:`cell-mono cell-muted nowrap`,children:e.kek}),(0,X.jsx)(`td`,{className:`col-actions`,children:o&&!e.current&&(0,X.jsx)(A,{trigger:(0,X.jsxs)(`button`,{className:`act`,disabled:g,children:[(0,X.jsx)(P,{size:13}),`Roll back`]}),title:(0,X.jsxs)(X.Fragment,{children:[`Roll `,(0,X.jsx)(`span`,{className:`mono`,children:i}),` back to v`,e.version,`?`]}),body:(0,X.jsxs)(X.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,X.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,X.jsx)(`div`,{className:`history-body`,children:(0,X.jsx)(w,{error:f})}),_!==null&&(0,X.jsx)(`div`,{className:`history-body`,children:(0,X.jsx)(w,{error:_})}),(0,X.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,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{className:`btn`,onClick:()=>d(!0),children:[(0,X.jsx)(N,{size:14}),`Import .env`]}),(0,X.jsx)(O,{open:u,onOpenChange:e=>e?d(!0):y(),title:(0,X.jsxs)(X.Fragment,{children:[`Import into`,` `,(0,X.jsxs)(`span`,{className:`mono`,children:[t,`/`,n]})]}),wide:!0,description:(0,X.jsx)(X.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,X.jsxs)(`div`,{className:`form`,style:{marginTop:`1.25rem`},children:[(0,X.jsxs)(`label`,{className:`field`,children:[(0,X.jsx)(`span`,{className:`label`,children:`File contents`}),(0,X.jsx)(`textarea`,{className:`textarea`,autoFocus:!0,spellCheck:!1,placeholder:`DATABASE_URL=postgres://…
3
3
  STRIPE_KEY="sk_live_…"`,value:r,onChange:e=>{i(e.target.value),o(null),c([])}})]}),a!==null&&a.entries.length>0&&(0,X.jsx)(`div`,{className:`card dt-wrap`,children:(0,X.jsxs)(`table`,{className:`dt`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{children:`Key`}),(0,X.jsx)(`th`,{className:`col-shrink`,children:`Plan`}),(0,X.jsx)(`th`,{className:`col-shrink`,children:`Current`})]})}),(0,X.jsx)(`tbody`,{children:a.entries.map(e=>(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`td`,{className:`cell-key`,children:re(e.key)}),(0,X.jsx)(`td`,{className:`col-shrink`,children:(0,X.jsx)(`span`,{className:De[e.action],children:e.action})}),(0,X.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,X.jsx)(k,{tone:`good`,children:`Every key already has this value. There is nothing to write.`}),s.length>0&&(0,X.jsxs)(k,{tone:`bad`,children:[(0,X.jsxs)(`strong`,{children:[s.length,` line`,s.length===1?``:`s`,` could not be parsed`]}),(0,X.jsx)(`ul`,{style:{margin:`0.375rem 0 0`,paddingLeft:`1.1rem`},children:s.map(e=>(0,X.jsxs)(`li`,{children:[`Line `,e.line,`: `,e.reason,` `,(0,X.jsxs)(`span`,{className:`mono`,children:[`(`,e.text,`)`]})]},e.line))})]}),(0,X.jsx)(w,{error:m}),(0,X.jsxs)(`div`,{className:`dialog-actions`,children:[(0,X.jsx)(`button`,{className:`btn`,onClick:y,children:`Cancel`}),a===null?(0,X.jsxs)(`button`,{className:`btn btn-primary`,disabled:p||r.trim()===``,onClick:ee,children:[p&&(0,X.jsx)(T,{}),`Preview changes`]}):(0,X.jsxs)(`button`,{className:`btn btn-primary`,disabled:p||b.length===0,onClick:v,children:[p&&(0,X.jsx)(T,{}),`Write `,b.length,` change`,b.length===1?``:`s`]})]})]})})]})}export{ve as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects._project.index-wjtfc8E6.js","_coffre/assets/page-CDuo3uft.js","_coffre/assets/link-Bg_PHv45.js","_coffre/assets/use-change-DIpkq9iI.js","_coffre/assets/suspense-Cnh1cNc1.js","_coffre/assets/row-state-BzGdu73b.js","_coffre/assets/ui-Ch0beQy-.js","_coffre/assets/icons-BFziRUf9.js","_coffre/assets/use-shell-BJwawvkh.js","_coffre/assets/useSuspenseQuery-BfnNEmf7.js","_coffre/assets/useQuery-BHCBwHtH.js","_coffre/assets/dist-BHhATf1q.js","_coffre/assets/project-environments-CfIH5kFM.js","_coffre/assets/directory-skRBmF1Y.js","_coffre/assets/use-action-cgaBRBBH.js","_coffre/assets/validation-9Cl_XS-l.js","_coffre/assets/grants-BEmVXYg5.js"])))=>i.map(i=>d[i]);
2
+ import{d as e}from"./page-CDuo3uft.js";import{n as t,r as n,t as r}from"./preload-helper-CYFH1xAV.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-wjtfc8E6.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-Dngv8FMr.js";import{t as f}from"./link-CqlAJWBd.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-Bd6NZJj9.js";import{t as w}from"./use-shell-Dx92Huhb.js";import{t as T}from"./useSuspenseQuery-tP9HFZ8w.js";import{t as E}from"./useQuery-BIIZz1CB.js";import{n as D}from"./dist-BNkBTkxj.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-BPWFJNz7.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-BRl8DlXW.js";import{a as U,i as W,t as G}from"./row-state-BlarvG7E.js";import{t as K}from"./projects._project.index-DHdXfEh-.js";import{i as q,o as oe,s as se}from"./directory-C4BMGC7-.js";import{t as J}from"./use-action-LULgF26O.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-CyDW25eX.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-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 +1 @@
1
- import{C as e,U as t,X as n,a as r,h as i,i as a,n as o,q as s}from"./page-Dngv8FMr.js";import{t as c}from"./link-CqlAJWBd.js";import{c as l,h as u,n as d,t as f}from"./use-change-Bd6NZJj9.js";import{t as p}from"./use-shell-Dx92Huhb.js";import{t as m}from"./useSuspenseQuery-tP9HFZ8w.js";import{i as h,o as g}from"./ui-BPWFJNz7.js";import{n as _}from"./project-environments-CfIH5kFM.js";import{n as v,r as y}from"./affordances-BQD5B421.js";import{A as b,h as x,p as S,r as C,y as w}from"./icons-BRl8DlXW.js";import{a as T,i as E,r as D}from"./row-state-BlarvG7E.js";import{n as O}from"./validation-9Cl_XS-l.js";var k=n(s()),A=t();function j(){let{data:t,refetch:n}=m(i.projects(e())),{capabilities:r}=p(),{failedAdds:s}=d(u.queryKey),l=t.ok?s(t.projects.map(e=>e.slug)):[];if(!t.ok)return(0,A.jsx)(o,{icon:(0,A.jsx)(C,{size:18}),title:`Projects could not be listed`,actions:t.signedOut?(0,A.jsx)(c,{className:`btn`,to:`/login`,children:`Sign in again`}):(0,A.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>void n(),children:`Try again`}),children:t.error});let f=t.projects.filter(e=>e.archivedAt===null),g=t.projects.filter(e=>e.archivedAt!==null);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(a,{title:`Projects`,actions:(0,A.jsx)(y,{capabilities:r,children:(0,A.jsx)(P,{})})}),f.length===0&&l.length===0?(0,A.jsx)(`div`,{className:`card`,children:(0,A.jsx)(h,{title:`Nothing here for you yet`,children:(0,A.jsx)(v,{capabilities:r,hasArchivedProjects:g.length>0})})}):(0,A.jsx)(`section`,{className:`card`,"aria-label":`Projects`,children:(0,A.jsx)(M,{projects:f,refused:!0})}),g.length>0&&(0,A.jsxs)(`section`,{"aria-labelledby":`archived-projects`,children:[(0,A.jsx)(`h2`,{className:`section-title`,id:`archived-projects`,children:`Archived`}),(0,A.jsx)(`div`,{className:`card`,children:(0,A.jsx)(M,{projects:g})})]})]})}function M({projects:e,refused:t=!1}){let{status:n,failedAdds:r,dismiss:i}=d(u.queryKey);return(0,A.jsx)(`div`,{className:`dt-wrap`,children:(0,A.jsxs)(`table`,{className:`dt projects stacks`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{children:[(0,A.jsx)(`th`,{className:`n`,children:`#`}),(0,A.jsx)(`th`,{className:`col-project`,children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(S,{size:14}),`Project`]})}),(0,A.jsx)(`th`,{children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(w,{size:14}),`Environments`]})}),(0,A.jsx)(`th`,{className:`col-shrink col-secrets`,children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(x,{size:14}),`Secrets`]})})]})}),(0,A.jsxs)(`tbody`,{children:[e.map((e,t)=>(0,A.jsx)(N,{number:t+1,project:e,status:n(e.slug),onDismiss:i},e.slug)),t&&r(e.map(e=>e.slug)).map(({mutationId:e,vars:t,status:n})=>(0,A.jsxs)(D,{status:n,columns:4,onDismiss:()=>i(e),children:[`Project `,t.slug,` was not created.`]},e))]})]})})}function N({number:e,project:t,status:n,onDismiss:i}){let a=t.secretCount,o=n.state===`pending`,s=t.archivedAt!==null,l=t.environments.filter(e=>e.details===null||e.details.archivedAt===null);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`tr`,{className:`row-link ${T(n)}`,children:[(0,A.jsx)(`td`,{className:`n`,children:e}),(0,A.jsx)(`td`,{className:`col-project`,children:(0,A.jsxs)(`span`,{className:`cell-project`,children:[(0,A.jsx)(r,{name:t.slug}),(0,A.jsxs)(`span`,{className:`cell-stack`,children:[o?(0,A.jsx)(`span`,{children:t.name}):(0,A.jsx)(c,{className:`cell-link stretch`,to:`/projects/$project`,params:{project:t.slug},children:t.name}),(0,A.jsx)(`small`,{className:`mono`,children:t.slug})]})]})}),(0,A.jsx)(`td`,{className:`col-envs`,"data-label":`Environments`,children:s||l.length===0?(0,A.jsx)(`span`,{className:`cell-muted`,children:l.length===0?`No environments yet`:`${l.length} environment${l.length===1?``:`s`}`}):(0,A.jsx)(`span`,{className:`env-links`,"aria-label":`Environments in ${t.slug}`,children:l.map(e=>_(e)?(0,A.jsxs)(c,{className:`env-link`,to:`/projects/$project/$environment`,params:{project:t.slug,environment:e.slug},children:[e.slug,(0,A.jsx)(`span`,{className:`count`,children:e.details.secretCount})]},e.slug):(0,A.jsx)(`span`,{className:`env-link`,title:`You can see this environment exists, but not open it`,children:e.slug},e.slug))})}),(0,A.jsx)(`td`,{className:`col-secrets num nowrap`,children:o?(0,A.jsx)(E,{status:n}):a!==null&&!s?(0,A.jsxs)(A.Fragment,{children:[a,(0,A.jsxs)(`span`,{className:`narrow-only`,children:[` secret`,a===1?``:`s`]})]}):(0,A.jsx)(`span`,{className:`cell-muted wide-only`,children:`—`})})]}),(0,A.jsx)(D,{status:n,columns:4,onDismiss:()=>n.state===`failed`&&i(n.mutationId)})]})}function P(){let[t,n]=(0,k.useState)(``),[r,i]=(0,k.useState)(``),[a,o]=(0,k.useState)(!1),s=f(l(e())),c=t===``?null:O(t);function u(){o(!1)}return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>o(!0),children:[(0,A.jsx)(b,{size:14}),`New project`]}),(0,A.jsx)(g,{open:a,onOpenChange:e=>e?o(!0):u(),title:`New project`,description:`A project holds environments, and access is granted on it or on one of its environments. You become its owner.`,children:(0,A.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),s({slug:t,name:r.trim()}),n(``),i(``),u()},children:[(0,A.jsxs)(`label`,{className:`field`,children:[(0,A.jsx)(`span`,{className:`label`,children:`Slug`}),(0,A.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:`market`,value:t,"aria-invalid":c!==null,"aria-describedby":`new-project-slug-hint`,onChange:e=>n(e.target.value)}),(0,A.jsx)(`span`,{className:`hint${c===null?``:` edit-note-error`}`,id:`new-project-slug-hint`,children:c??`Used in paths, as in market/prod. Renaming it later is safe.`})]}),(0,A.jsxs)(`label`,{className:`field`,children:[(0,A.jsx)(`span`,{className:`label`,children:`Display name`}),(0,A.jsx)(`input`,{className:`input`,placeholder:`Market data platform`,value:r,onChange:e=>i(e.target.value)})]}),(0,A.jsxs)(`div`,{className:`dialog-actions`,children:[(0,A.jsx)(`button`,{className:`btn`,type:`button`,onClick:u,children:`Cancel`}),(0,A.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:t===``||c!==null||r.trim()===``,children:`Create project`})]})]})})]})}export{j as component};
1
+ import{C as e,U as t,X as n,a as r,h as i,i as a,n as o,q as s}from"./page-CDuo3uft.js";import{t as c}from"./link-Bg_PHv45.js";import{c as l,h as u,n as d,t as f}from"./use-change-DIpkq9iI.js";import{t as p}from"./use-shell-BJwawvkh.js";import{t as m}from"./useSuspenseQuery-BfnNEmf7.js";import{i as h,o as g}from"./ui-Ch0beQy-.js";import{n as _}from"./project-environments-CfIH5kFM.js";import{n as v,r as y}from"./affordances-B9nFwqIv.js";import{A as b,h as x,p as S,r as C,y as w}from"./icons-BFziRUf9.js";import{a as T,i as E,r as D}from"./row-state-BzGdu73b.js";import{n as O}from"./validation-9Cl_XS-l.js";var k=n(s()),A=t();function j(){let{data:t,refetch:n}=m(i.projects(e())),{capabilities:r}=p(),{failedAdds:s}=d(u.queryKey),l=t.ok?s(t.projects.map(e=>e.slug)):[];if(!t.ok)return(0,A.jsx)(o,{icon:(0,A.jsx)(C,{size:18}),title:`Projects could not be listed`,actions:t.signedOut?(0,A.jsx)(c,{className:`btn`,to:`/login`,children:`Sign in again`}):(0,A.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>void n(),children:`Try again`}),children:t.error});let f=t.projects.filter(e=>e.archivedAt===null),g=t.projects.filter(e=>e.archivedAt!==null);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(a,{title:`Projects`,actions:(0,A.jsx)(y,{capabilities:r,children:(0,A.jsx)(P,{})})}),f.length===0&&l.length===0?(0,A.jsx)(`div`,{className:`card`,children:(0,A.jsx)(h,{title:`Nothing here for you yet`,children:(0,A.jsx)(v,{capabilities:r,hasArchivedProjects:g.length>0})})}):(0,A.jsx)(`section`,{className:`card`,"aria-label":`Projects`,children:(0,A.jsx)(M,{projects:f,refused:!0})}),g.length>0&&(0,A.jsxs)(`section`,{"aria-labelledby":`archived-projects`,children:[(0,A.jsx)(`h2`,{className:`section-title`,id:`archived-projects`,children:`Archived`}),(0,A.jsx)(`div`,{className:`card`,children:(0,A.jsx)(M,{projects:g})})]})]})}function M({projects:e,refused:t=!1}){let{status:n,failedAdds:r,dismiss:i}=d(u.queryKey);return(0,A.jsx)(`div`,{className:`dt-wrap`,children:(0,A.jsxs)(`table`,{className:`dt projects stacks`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{children:[(0,A.jsx)(`th`,{className:`n`,children:`#`}),(0,A.jsx)(`th`,{className:`col-project`,children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(S,{size:14}),`Project`]})}),(0,A.jsx)(`th`,{children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(w,{size:14}),`Environments`]})}),(0,A.jsx)(`th`,{className:`col-shrink col-secrets`,children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(x,{size:14}),`Secrets`]})})]})}),(0,A.jsxs)(`tbody`,{children:[e.map((e,t)=>(0,A.jsx)(N,{number:t+1,project:e,status:n(e.slug),onDismiss:i},e.slug)),t&&r(e.map(e=>e.slug)).map(({mutationId:e,vars:t,status:n})=>(0,A.jsxs)(D,{status:n,columns:4,onDismiss:()=>i(e),children:[`Project `,t.slug,` was not created.`]},e))]})]})})}function N({number:e,project:t,status:n,onDismiss:i}){let a=t.secretCount,o=n.state===`pending`,s=t.archivedAt!==null,l=t.environments.filter(e=>e.details===null||e.details.archivedAt===null);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`tr`,{className:`row-link ${T(n)}`,children:[(0,A.jsx)(`td`,{className:`n`,children:e}),(0,A.jsx)(`td`,{className:`col-project`,children:(0,A.jsxs)(`span`,{className:`cell-project`,children:[(0,A.jsx)(r,{name:t.slug}),(0,A.jsxs)(`span`,{className:`cell-stack`,children:[o?(0,A.jsx)(`span`,{children:t.name}):(0,A.jsx)(c,{className:`cell-link stretch`,to:`/projects/$project`,params:{project:t.slug},children:t.name}),(0,A.jsx)(`small`,{className:`mono`,children:t.slug})]})]})}),(0,A.jsx)(`td`,{className:`col-envs`,"data-label":`Environments`,children:s||l.length===0?(0,A.jsx)(`span`,{className:`cell-muted`,children:l.length===0?`No environments yet`:`${l.length} environment${l.length===1?``:`s`}`}):(0,A.jsx)(`span`,{className:`env-links`,"aria-label":`Environments in ${t.slug}`,children:l.map(e=>_(e)?(0,A.jsxs)(c,{className:`env-link`,to:`/projects/$project/$environment`,params:{project:t.slug,environment:e.slug},children:[e.slug,(0,A.jsx)(`span`,{className:`count`,children:e.details.secretCount})]},e.slug):(0,A.jsx)(`span`,{className:`env-link`,title:`You can see this environment exists, but not open it`,children:e.slug},e.slug))})}),(0,A.jsx)(`td`,{className:`col-secrets num nowrap`,children:o?(0,A.jsx)(E,{status:n}):a!==null&&!s?(0,A.jsxs)(A.Fragment,{children:[a,(0,A.jsxs)(`span`,{className:`narrow-only`,children:[` secret`,a===1?``:`s`]})]}):(0,A.jsx)(`span`,{className:`cell-muted wide-only`,children:`—`})})]}),(0,A.jsx)(D,{status:n,columns:4,onDismiss:()=>n.state===`failed`&&i(n.mutationId)})]})}function P(){let[t,n]=(0,k.useState)(``),[r,i]=(0,k.useState)(``),[a,o]=(0,k.useState)(!1),s=f(l(e())),c=t===``?null:O(t);function u(){o(!1)}return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>o(!0),children:[(0,A.jsx)(b,{size:14}),`New project`]}),(0,A.jsx)(g,{open:a,onOpenChange:e=>e?o(!0):u(),title:`New project`,description:`A project holds environments, and access is granted on it or on one of its environments. You become its owner.`,children:(0,A.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),s({slug:t,name:r.trim()}),n(``),i(``),u()},children:[(0,A.jsxs)(`label`,{className:`field`,children:[(0,A.jsx)(`span`,{className:`label`,children:`Slug`}),(0,A.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:`market`,value:t,"aria-invalid":c!==null,"aria-describedby":`new-project-slug-hint`,onChange:e=>n(e.target.value)}),(0,A.jsx)(`span`,{className:`hint${c===null?``:` edit-note-error`}`,id:`new-project-slug-hint`,children:c??`Used in paths, as in market/prod. Renaming it later is safe.`})]}),(0,A.jsxs)(`label`,{className:`field`,children:[(0,A.jsx)(`span`,{className:`label`,children:`Display name`}),(0,A.jsx)(`input`,{className:`input`,placeholder:`Market data platform`,value:r,onChange:e=>i(e.target.value)})]}),(0,A.jsxs)(`div`,{className:`dialog-actions`,children:[(0,A.jsx)(`button`,{className:`btn`,type:`button`,onClick:u,children:`Cancel`}),(0,A.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:t===``||c!==null||r.trim()===``,children:`Create project`})]})]})})]})}export{j as component};
@@ -1 +1 @@
1
- import{U as e,X as t,q as n}from"./page-Dngv8FMr.js";import{c as r}from"./ui-BPWFJNz7.js";import{W as i,n as a}from"./icons-BRl8DlXW.js";var o=t(n(),1),s={polite:null,urgent:null},c=0,l=new Set;function u(e,{urgent:t=!1}={}){let n={text:e,id:c++};s=t?{...s,urgent:n}:{...s,polite:n};for(let e of l)e()}function d(e){return l.add(e),()=>l.delete(e)}function f(){return s}var p={polite:null,urgent:null};function m(){return p}var h=e();function g(e){return e.state===`pending`?e.kind===`removing`?`is-removing`:`is-saving`:e.state===`failed`?`is-failed`:``}function _({status:e}){return e.state===`pending`?(0,h.jsxs)(`span`,{className:`row-pending`,children:[(0,h.jsx)(r,{size:13}),e.words.pending]}):null}function v({status:e,columns:t,onDismiss:n,children:r}){return e.state===`failed`?(0,h.jsx)(`tr`,{className:`row-error row-failure`,children:(0,h.jsx)(`td`,{colSpan:t,children:(0,h.jsx)(y,{status:e,onDismiss:n,children:r})})}):null}function y({status:e,onDismiss:t,children:n}){return e.state===`failed`?(0,h.jsxs)(`div`,{className:`row-failure-line`,children:[(0,h.jsxs)(`p`,{className:`error-line`,children:[(0,h.jsx)(a,{size:14}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:n??e.words.failed}),` `,e.error]})]}),(0,h.jsx)(`button`,{type:`button`,className:`act act-quiet`,onClick:t,"aria-label":`Dismiss`,children:(0,h.jsx)(i,{size:13})})]}):null}function b(){let{polite:e,urgent:t}=(0,o.useSyncExternalStore)(d,f,m);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:`visually-hidden`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:e!==null&&(0,h.jsx)(`span`,{children:e.text},e.id)}),(0,h.jsx)(`div`,{className:`visually-hidden`,role:`alert`,"aria-live":`assertive`,"aria-atomic":`true`,children:t!==null&&(0,h.jsx)(`span`,{children:t.text},t.id)})]})}export{g as a,_ as i,b as n,u as o,v as r,y as t};
1
+ import{U as e,X as t,q as n}from"./page-CDuo3uft.js";import{c as r}from"./ui-Ch0beQy-.js";import{W as i,n as a}from"./icons-BFziRUf9.js";var o=t(n(),1),s={polite:null,urgent:null},c=0,l=new Set;function u(e,{urgent:t=!1}={}){let n={text:e,id:c++};s=t?{...s,urgent:n}:{...s,polite:n};for(let e of l)e()}function d(e){return l.add(e),()=>l.delete(e)}function f(){return s}var p={polite:null,urgent:null};function m(){return p}var h=e();function g(e){return e.state===`pending`?e.kind===`removing`?`is-removing`:`is-saving`:e.state===`failed`?`is-failed`:``}function _({status:e}){return e.state===`pending`?(0,h.jsxs)(`span`,{className:`row-pending`,children:[(0,h.jsx)(r,{size:13}),e.words.pending]}):null}function v({status:e,columns:t,onDismiss:n,children:r}){return e.state===`failed`?(0,h.jsx)(`tr`,{className:`row-error row-failure`,children:(0,h.jsx)(`td`,{colSpan:t,children:(0,h.jsx)(y,{status:e,onDismiss:n,children:r})})}):null}function y({status:e,onDismiss:t,children:n}){return e.state===`failed`?(0,h.jsxs)(`div`,{className:`row-failure-line`,children:[(0,h.jsxs)(`p`,{className:`error-line`,children:[(0,h.jsx)(a,{size:14}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:n??e.words.failed}),` `,e.error]})]}),(0,h.jsx)(`button`,{type:`button`,className:`act act-quiet`,onClick:t,"aria-label":`Dismiss`,children:(0,h.jsx)(i,{size:13})})]}):null}function b(){let{polite:e,urgent:t}=(0,o.useSyncExternalStore)(d,f,m);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:`visually-hidden`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:e!==null&&(0,h.jsx)(`span`,{children:e.text},e.id)}),(0,h.jsx)(`div`,{className:`visually-hidden`,role:`alert`,"aria-live":`assertive`,"aria-atomic":`true`,children:t!==null&&(0,h.jsx)(`span`,{children:t.text},t.id)})]})}export{g as a,_ as i,b as n,u as o,v as r,y as t};
@@ -1 +1 @@
1
- import{C as e,U as t,h as n,i as r,r as i,t as a}from"./page-Dngv8FMr.js";import{t as o}from"./link-CqlAJWBd.js";import{t as s}from"./use-shell-Dx92Huhb.js";import{t as c}from"./useSuspenseQuery-tP9HFZ8w.js";var l=t(),u=new Intl.ListFormat(`en`,{type:`disjunction`});function d(){let{auth:t,capabilities:d}=s(),{data:f}=c(n.directory(e(),d.canManageGrants)),p=t?.signin?.providers.map(e=>e.label)??[],m=f?.ok===!0?f.principals:null,h=m?.filter(e=>e.isRootAdmin)??[],g=m?.filter(e=>e.principalType===`user`).length??0,_=m?.filter(e=>e.principalType===`service`).length??0;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r,{title:`Settings`}),(0,l.jsx)(a,{labelledBy:`instance`,title:`Instance`,description:`Set in the deployment's configuration, so shown here rather than edited.`,children:(0,l.jsxs)(`dl`,{className:`facts`,children:[(0,l.jsx)(i,{label:`Sign-in`,children:t?.signin?`coffre’s own sign-in, with ${u.format(p)}. Only invited members get in.`:`Cloudflare Access. coffre has no sign-in of its own; every request carries an Access assertion that is verified at the origin.`}),m!==null&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i,{label:`Root admins`,children:(0,l.jsx)(`span`,{className:`fact-list`,children:h.map(e=>(0,l.jsx)(`span`,{className:`mono`,children:e.principalId},e.principalId))})}),(0,l.jsx)(i,{label:`Directory`,children:(0,l.jsxs)(`span`,{children:[(0,l.jsxs)(o,{to:`/users`,children:[g,` user`,g===1?``:`s`]}),` · `,(0,l.jsxs)(o,{to:`/tokens`,children:[_,` token`,_===1?``:`s`]})]})})]})]})})]})}export{d as component};
1
+ import{C as e,U as t,h as n,i as r,r as i,t as a}from"./page-CDuo3uft.js";import{t as o}from"./link-Bg_PHv45.js";import{t as s}from"./use-shell-BJwawvkh.js";import{t as c}from"./useSuspenseQuery-BfnNEmf7.js";var l=t(),u=new Intl.ListFormat(`en`,{type:`disjunction`});function d(){let{auth:t,capabilities:d}=s(),{data:f}=c(n.directory(e(),d.canManageGrants)),p=t?.signin?.providers.map(e=>e.label)??[],m=f?.ok===!0?f.principals:null,h=m?.filter(e=>e.isRootAdmin)??[],g=m?.filter(e=>e.principalType===`user`).length??0,_=m?.filter(e=>e.principalType===`service`).length??0;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r,{title:`Settings`}),(0,l.jsx)(a,{labelledBy:`instance`,title:`Instance`,description:`Set in the deployment's configuration, so shown here rather than edited.`,children:(0,l.jsxs)(`dl`,{className:`facts`,children:[(0,l.jsx)(i,{label:`Sign-in`,children:t?.signin?`coffre’s own sign-in, with ${u.format(p)}. Only invited members get in.`:`Cloudflare Access. coffre has no sign-in of its own; every request carries an Access assertion that is verified at the origin.`}),m!==null&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i,{label:`Root admins`,children:(0,l.jsx)(`span`,{className:`fact-list`,children:h.map(e=>(0,l.jsx)(`span`,{className:`mono`,children:e.principalId},e.principalId))})}),(0,l.jsx)(i,{label:`Directory`,children:(0,l.jsxs)(`span`,{children:[(0,l.jsxs)(o,{to:`/users`,children:[g,` user`,g===1?``:`s`]}),` · `,(0,l.jsxs)(o,{to:`/tokens`,children:[_,` token`,_===1?``:`s`]})]})})]})]})})]})}export{d as component};
@@ -1 +1 @@
1
- import{A as e,B as t,D as n,E as r,I as i,L as a,M as o,N as s,O as c,P as l,R as u,U as d,X as f,k as p,q as m,z as h}from"./page-Dngv8FMr.js";var g=f(m(),1),_=d(),v=g.createContext(void 0),y=e=>{let t=g.useContext(v);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},b=({client:e,children:t})=>(g.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,_.jsx)(v.Provider,{value:e,children:t})),x=class extends p{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),C(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!a(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&T(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||i(this.options.staleTime,this.#t)!==i(t.staleTime,this.#t))&&this.#g();let o=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||o!==this.#f)&&this.#v(o)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return a(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(s)),t}#h(t){return!e()&&i(this.options.enabled,this.#t)!==!1&&o(t)}#g(){this.#b();let e=i(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let n=h(this.#r.dataUpdatedAt,e)+1;this.#u=t.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#_(){return i(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=t.setInterval(()=>{(this.options.refetchIntervalInBackground||c.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(t.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(t.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,a=this.options,o=this.#r,s=this.#i,c=this.#a,u=e===n?this.#n:e.state,{state:d}=e,f={...d},p=!1,m;if(t._optimisticResults){let i=this.hasListeners(),o=!i&&C(e,t),s=i&&T(e,n,t,a);(o||s)&&(f={...f,...r(d.data,e.options)}),t._optimisticResults===`isRestoring`&&(f.fetchStatus=`idle`)}let{error:h,errorUpdatedAt:g,status:_}=f;m=f.data;let v=!1;if(t.placeholderData!==void 0&&m===void 0&&_===`pending`){let e;o?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=o.data,v=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(_=`success`,m=l(o?.data,e,t),p=!0)}if(t.select&&m!==void 0&&!v)if(o&&m===s?.data&&t.select===this.#s)m=this.#c;else try{this.#s=t.select,m=t.select(m),m=l(o?.data,m,t),this.#c=m,this.#o=null}catch(e){this.#o=e}else m===void 0&&(this.#o=null);this.#o&&(h=this.#o,m=this.#c,g=Date.now(),_=`error`,p=!1);let y=f.fetchStatus===`fetching`,b=_===`pending`,x=_===`error`,S=b&&y,w=m!==void 0;return{status:_,fetchStatus:f.fetchStatus,isPending:b,isSuccess:_===`success`,isError:x,isInitialLoading:S,isLoading:S,data:m,dataUpdatedAt:f.dataUpdatedAt,error:h,errorUpdatedAt:g,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:y,isRefetching:y&&!b,isLoadingError:x&&!w,isPaused:f.fetchStatus===`paused`,isPlaceholderData:p,isRefetchError:x&&w,isStale:E(e,t),refetch:this.refetch,isEnabled:i(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),a(t,e))return;this.#r=t;let r=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();n.batch(()=>{r&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function S(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&i(t.retryOnMount,e)===!1)}function C(e,t){return S(e,t)||e.state.data!==void 0&&w(e,t,t.refetchOnMount)}function w(e,t,n){if(i(t.enabled,e)!==!1&&i(t.staleTime,e)!==`static`){let r=i(n,e);return r===`always`||r!==!1&&E(e,t)}return!1}function T(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&E(e,n)}function E(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(i(t.staleTime,e))}var D=g.createContext(!1),O=()=>g.useContext(D);D.Provider;function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=g.createContext(k()),j=()=>g.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?u(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{g.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||u(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e?.suspense&&t.isPending,R=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});export{M as a,j as c,b as d,y as f,L as i,O as l,I as n,P as o,R as r,N as s,F as t,x as u};
1
+ import{A as e,B as t,D as n,E as r,I as i,L as a,M as o,N as s,O as c,P as l,R as u,U as d,X as f,k as p,q as m,z as h}from"./page-CDuo3uft.js";var g=f(m(),1),_=d(),v=g.createContext(void 0),y=e=>{let t=g.useContext(v);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},b=({client:e,children:t})=>(g.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,_.jsx)(v.Provider,{value:e,children:t})),x=class extends p{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),C(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!a(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&T(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||i(this.options.staleTime,this.#t)!==i(t.staleTime,this.#t))&&this.#g();let o=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||o!==this.#f)&&this.#v(o)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return a(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(s)),t}#h(t){return!e()&&i(this.options.enabled,this.#t)!==!1&&o(t)}#g(){this.#b();let e=i(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let n=h(this.#r.dataUpdatedAt,e)+1;this.#u=t.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#_(){return i(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=t.setInterval(()=>{(this.options.refetchIntervalInBackground||c.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(t.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(t.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,a=this.options,o=this.#r,s=this.#i,c=this.#a,u=e===n?this.#n:e.state,{state:d}=e,f={...d},p=!1,m;if(t._optimisticResults){let i=this.hasListeners(),o=!i&&C(e,t),s=i&&T(e,n,t,a);(o||s)&&(f={...f,...r(d.data,e.options)}),t._optimisticResults===`isRestoring`&&(f.fetchStatus=`idle`)}let{error:h,errorUpdatedAt:g,status:_}=f;m=f.data;let v=!1;if(t.placeholderData!==void 0&&m===void 0&&_===`pending`){let e;o?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=o.data,v=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(_=`success`,m=l(o?.data,e,t),p=!0)}if(t.select&&m!==void 0&&!v)if(o&&m===s?.data&&t.select===this.#s)m=this.#c;else try{this.#s=t.select,m=t.select(m),m=l(o?.data,m,t),this.#c=m,this.#o=null}catch(e){this.#o=e}else m===void 0&&(this.#o=null);this.#o&&(h=this.#o,m=this.#c,g=Date.now(),_=`error`,p=!1);let y=f.fetchStatus===`fetching`,b=_===`pending`,x=_===`error`,S=b&&y,w=m!==void 0;return{status:_,fetchStatus:f.fetchStatus,isPending:b,isSuccess:_===`success`,isError:x,isInitialLoading:S,isLoading:S,data:m,dataUpdatedAt:f.dataUpdatedAt,error:h,errorUpdatedAt:g,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:y,isRefetching:y&&!b,isLoadingError:x&&!w,isPaused:f.fetchStatus===`paused`,isPlaceholderData:p,isRefetchError:x&&w,isStale:E(e,t),refetch:this.refetch,isEnabled:i(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),a(t,e))return;this.#r=t;let r=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();n.batch(()=>{r&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function S(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&i(t.retryOnMount,e)===!1)}function C(e,t){return S(e,t)||e.state.data!==void 0&&w(e,t,t.refetchOnMount)}function w(e,t,n){if(i(t.enabled,e)!==!1&&i(t.staleTime,e)!==`static`){let r=i(n,e);return r===`always`||r!==!1&&E(e,t)}return!1}function T(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&E(e,n)}function E(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(i(t.staleTime,e))}var D=g.createContext(!1),O=()=>g.useContext(D);D.Provider;function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=g.createContext(k()),j=()=>g.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?u(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{g.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||u(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e?.suspense&&t.isPending,R=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});export{M as a,j as c,b as d,y as f,L as i,O as l,I as n,P as o,R as r,N as s,F as t,x as u};
@@ -1 +1 @@
1
- import{C as e,U as t,X as n,b as r,h as i,o as a,q as o,t as s}from"./page-Dngv8FMr.js";import{n as c,t as l,y as u}from"./use-change-Bd6NZJj9.js";import{t as d}from"./use-shell-Dx92Huhb.js";import{t as f}from"./useSuspenseQuery-tP9HFZ8w.js";import{a as p,c as m,i as h,l as g,o as _,r as v,s as y,t as b}from"./ui-BPWFJNz7.js";import{A as x,W as S,v as C}from"./icons-BRl8DlXW.js";import{a as w,i as T,r as E}from"./row-state-BlarvG7E.js";import{t as D}from"./tokens._token-0u7midqA.js";import{t as O}from"./use-action-LULgF26O.js";import{t as k}from"./principal-page-C4qDD-d8.js";var A=n(o(),1),j=t(),M=[30,90,180,365];function N({serviceId:t,tokens:n}){let r=u(e(),t),i=l(r),{status:a,dismiss:o}=c(r.list.queryKey);return(0,j.jsx)(s,{labelledBy:`service-tokens`,title:`Credentials`,description:`Bearer tokens this service presents to the API. Each is shown once, when it is issued; coffre keeps only a hash.`,actions:(0,j.jsx)(P,{serviceId:t}),children:n.length===0?(0,j.jsx)(h,{title:`No live credentials`,children:`Nothing can act as this service until a token is issued.`}):(0,j.jsx)(`div`,{className:`dt-wrap`,children:(0,j.jsxs)(`table`,{className:`dt`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{children:`Token`}),(0,j.jsx)(`th`,{className:`col-shrink`,children:`Issued (UTC)`}),(0,j.jsx)(`th`,{className:`col-shrink`,children:`Last used`}),(0,j.jsx)(`th`,{className:`col-shrink`,children:`Expires`}),(0,j.jsx)(`th`,{className:`col-actions`,children:(0,j.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,j.jsx)(`tbody`,{children:n.map(e=>{let t=a(e.id);return(0,j.jsxs)(A.Fragment,{children:[(0,j.jsxs)(`tr`,{className:w(t),children:[(0,j.jsx)(`td`,{children:(0,j.jsxs)(`span`,{className:`cell-account`,children:[(0,j.jsx)(C,{size:15}),(0,j.jsxs)(`span`,{className:`cell-stack`,children:[(0,j.jsx)(`span`,{children:e.label??`Unlabelled`}),(0,j.jsx)(`small`,{className:`mono`,children:e.hint})]})]})}),(0,j.jsx)(`td`,{className:`nowrap`,children:(0,j.jsxs)(`span`,{className:`cell-stack`,children:[(0,j.jsx)(g,{iso:e.createdAt}),(0,j.jsxs)(`small`,{children:[`by `,e.createdBy]})]})}),(0,j.jsx)(`td`,{className:`nowrap cell-muted`,children:e.lastUsedAt===null?`Never`:(0,j.jsxs)(`span`,{className:`cell-stack`,children:[(0,j.jsx)(g,{iso:e.lastUsedAt,display:`relative`}),e.lastUsedIp!==null&&(0,j.jsx)(`small`,{className:`mono`,children:e.lastUsedIp})]})}),(0,j.jsx)(`td`,{className:`nowrap cell-muted`,children:(0,j.jsx)(g,{iso:e.expiresAt,display:`relative`})}),(0,j.jsx)(`td`,{className:`col-actions`,children:t.state===`pending`?(0,j.jsx)(T,{status:t}):(0,j.jsx)(b,{trigger:(0,j.jsxs)(`button`,{className:`act`,children:[(0,j.jsx)(S,{size:13}),`Revoke`]}),title:(0,j.jsxs)(j.Fragment,{children:[`Revoke `,(0,j.jsx)(`span`,{className:`mono`,children:e.hint}),`?`]}),body:`Whatever uses it is refused from its next request. Issue a new token first if the service should keep working.`,confirmLabel:`Revoke token`,onConfirm:()=>i(e)})})]}),(0,j.jsx)(E,{status:t,columns:5,onDismiss:()=>t.state===`failed`&&o(t.mutationId)})]},e.id)})})]})})})}function P({serviceId:t}){let[n,i]=(0,A.useState)(!1),[o,s]=(0,A.useState)(``),[c,l]=(0,A.useState)(90),[u,d]=(0,A.useState)(null),f=e(),{pending:h,error:b,setError:S,run:C}=O();function w(){i(!1),d(null),s(``),S(null)}return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`button`,{className:`btn btn-sm`,onClick:()=>i(!0),children:[(0,j.jsx)(x,{size:14}),`Issue token`]}),(0,j.jsx)(_,{open:n,onOpenChange:e=>e?i(!0):w(),title:u===null?`Issue a token`:`Copy the token now`,children:u===null?(0,j.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),C(()=>f.tokens.issue(r(`service`,t),{label:o.trim()===``?null:o.trim(),expiresInDays:c}),{affects:a.credentials(r(`service`,t)),onSuccess:e=>d(e)})},children:[(0,j.jsxs)(`div`,{className:`form-row`,children:[(0,j.jsxs)(`label`,{className:`field`,children:[(0,j.jsx)(`span`,{className:`label`,children:`Label`}),(0,j.jsx)(`input`,{className:`input`,value:o,maxLength:120,placeholder:`GitHub Actions deploy`,onChange:e=>s(e.target.value)})]}),(0,j.jsxs)(`label`,{className:`field`,style:{flex:`0 0 9rem`},children:[(0,j.jsx)(`span`,{className:`label`,children:`Expires after`}),(0,j.jsx)(`select`,{className:`select`,value:c,onChange:e=>l(Number(e.target.value)),children:M.map(e=>(0,j.jsxs)(`option`,{value:e,children:[e,` days`]},e))})]})]}),(0,j.jsx)(p,{error:b}),(0,j.jsxs)(`div`,{className:`dialog-actions`,children:[(0,j.jsx)(`button`,{className:`btn`,type:`button`,onClick:w,children:`Cancel`}),(0,j.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:h,children:[h&&(0,j.jsx)(m,{}),`Issue token`]})]})]}):(0,j.jsxs)(`div`,{className:`form`,children:[(0,j.jsxs)(y,{tone:`info`,children:[`This is the only time the value is shown. Store it where the service reads its configuration, as `,(0,j.jsx)(`span`,{className:`mono`,children:`COFFRE_TOKEN`}),`.`]}),(0,j.jsxs)(`div`,{className:`token-once`,children:[(0,j.jsx)(`code`,{className:`mono`,children:u.token}),(0,j.jsx)(v,{value:u.token,label:`Copy token`})]}),(0,j.jsxs)(`p`,{className:`hint`,children:[`Expires `,(0,j.jsx)(g,{iso:u.expiresAt}),`. Send it as`,` `,(0,j.jsx)(`span`,{className:`mono`,children:`Authorization: Bearer …`})]}),(0,j.jsx)(`div`,{className:`dialog-actions`,children:(0,j.jsx)(`button`,{className:`btn btn-primary`,type:`button`,onClick:w,children:`Done`})})]})})]})}function F(){let{token:t}=D.useParams(),n=e(),{auth:a,capabilities:o}=d(),s=r(`service`,t),c=o.canManageGrants,{data:l}=f(i.report(n,s,c)),{data:u}=f(i.credentials(n,s,c&&a.signin!==null)),p=l?.ok===!0&&l.report?.status===`active`;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(k,{principalType:`service`,principalId:t}),p&&u?.ok===!0&&(0,j.jsx)(N,{serviceId:t,tokens:u.tokens})]})}export{F as component};
1
+ import{C as e,U as t,X as n,b as r,h as i,o as a,q as o,t as s}from"./page-CDuo3uft.js";import{n as c,t as l,y as u}from"./use-change-DIpkq9iI.js";import{t as d}from"./use-shell-BJwawvkh.js";import{t as f}from"./useSuspenseQuery-BfnNEmf7.js";import{a as p,c as m,i as h,l as g,o as _,r as v,s as y,t as b}from"./ui-Ch0beQy-.js";import{A as x,W as S,v as C}from"./icons-BFziRUf9.js";import{a as w,i as T,r as E}from"./row-state-BzGdu73b.js";import{t as D}from"./tokens._token-C2s6HHWK.js";import{t as O}from"./use-action-cgaBRBBH.js";import{t as k}from"./principal-page-BmgkTnAl.js";var A=n(o(),1),j=t(),M=[30,90,180,365];function N({serviceId:t,tokens:n}){let r=u(e(),t),i=l(r),{status:a,dismiss:o}=c(r.list.queryKey);return(0,j.jsx)(s,{labelledBy:`service-tokens`,title:`Credentials`,description:`Bearer tokens this service presents to the API. Each is shown once, when it is issued; coffre keeps only a hash.`,actions:(0,j.jsx)(P,{serviceId:t}),children:n.length===0?(0,j.jsx)(h,{title:`No live credentials`,children:`Nothing can act as this service until a token is issued.`}):(0,j.jsx)(`div`,{className:`dt-wrap`,children:(0,j.jsxs)(`table`,{className:`dt`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{children:`Token`}),(0,j.jsx)(`th`,{className:`col-shrink`,children:`Issued (UTC)`}),(0,j.jsx)(`th`,{className:`col-shrink`,children:`Last used`}),(0,j.jsx)(`th`,{className:`col-shrink`,children:`Expires`}),(0,j.jsx)(`th`,{className:`col-actions`,children:(0,j.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,j.jsx)(`tbody`,{children:n.map(e=>{let t=a(e.id);return(0,j.jsxs)(A.Fragment,{children:[(0,j.jsxs)(`tr`,{className:w(t),children:[(0,j.jsx)(`td`,{children:(0,j.jsxs)(`span`,{className:`cell-account`,children:[(0,j.jsx)(C,{size:15}),(0,j.jsxs)(`span`,{className:`cell-stack`,children:[(0,j.jsx)(`span`,{children:e.label??`Unlabelled`}),(0,j.jsx)(`small`,{className:`mono`,children:e.hint})]})]})}),(0,j.jsx)(`td`,{className:`nowrap`,children:(0,j.jsxs)(`span`,{className:`cell-stack`,children:[(0,j.jsx)(g,{iso:e.createdAt}),(0,j.jsxs)(`small`,{children:[`by `,e.createdBy]})]})}),(0,j.jsx)(`td`,{className:`nowrap cell-muted`,children:e.lastUsedAt===null?`Never`:(0,j.jsxs)(`span`,{className:`cell-stack`,children:[(0,j.jsx)(g,{iso:e.lastUsedAt,display:`relative`}),e.lastUsedIp!==null&&(0,j.jsx)(`small`,{className:`mono`,children:e.lastUsedIp})]})}),(0,j.jsx)(`td`,{className:`nowrap cell-muted`,children:(0,j.jsx)(g,{iso:e.expiresAt,display:`relative`})}),(0,j.jsx)(`td`,{className:`col-actions`,children:t.state===`pending`?(0,j.jsx)(T,{status:t}):(0,j.jsx)(b,{trigger:(0,j.jsxs)(`button`,{className:`act`,children:[(0,j.jsx)(S,{size:13}),`Revoke`]}),title:(0,j.jsxs)(j.Fragment,{children:[`Revoke `,(0,j.jsx)(`span`,{className:`mono`,children:e.hint}),`?`]}),body:`Whatever uses it is refused from its next request. Issue a new token first if the service should keep working.`,confirmLabel:`Revoke token`,onConfirm:()=>i(e)})})]}),(0,j.jsx)(E,{status:t,columns:5,onDismiss:()=>t.state===`failed`&&o(t.mutationId)})]},e.id)})})]})})})}function P({serviceId:t}){let[n,i]=(0,A.useState)(!1),[o,s]=(0,A.useState)(``),[c,l]=(0,A.useState)(90),[u,d]=(0,A.useState)(null),f=e(),{pending:h,error:b,setError:S,run:C}=O();function w(){i(!1),d(null),s(``),S(null)}return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`button`,{className:`btn btn-sm`,onClick:()=>i(!0),children:[(0,j.jsx)(x,{size:14}),`Issue token`]}),(0,j.jsx)(_,{open:n,onOpenChange:e=>e?i(!0):w(),title:u===null?`Issue a token`:`Copy the token now`,children:u===null?(0,j.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),C(()=>f.tokens.issue(r(`service`,t),{label:o.trim()===``?null:o.trim(),expiresInDays:c}),{affects:a.credentials(r(`service`,t)),onSuccess:e=>d(e)})},children:[(0,j.jsxs)(`div`,{className:`form-row`,children:[(0,j.jsxs)(`label`,{className:`field`,children:[(0,j.jsx)(`span`,{className:`label`,children:`Label`}),(0,j.jsx)(`input`,{className:`input`,value:o,maxLength:120,placeholder:`GitHub Actions deploy`,onChange:e=>s(e.target.value)})]}),(0,j.jsxs)(`label`,{className:`field`,style:{flex:`0 0 9rem`},children:[(0,j.jsx)(`span`,{className:`label`,children:`Expires after`}),(0,j.jsx)(`select`,{className:`select`,value:c,onChange:e=>l(Number(e.target.value)),children:M.map(e=>(0,j.jsxs)(`option`,{value:e,children:[e,` days`]},e))})]})]}),(0,j.jsx)(p,{error:b}),(0,j.jsxs)(`div`,{className:`dialog-actions`,children:[(0,j.jsx)(`button`,{className:`btn`,type:`button`,onClick:w,children:`Cancel`}),(0,j.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:h,children:[h&&(0,j.jsx)(m,{}),`Issue token`]})]})]}):(0,j.jsxs)(`div`,{className:`form`,children:[(0,j.jsxs)(y,{tone:`info`,children:[`This is the only time the value is shown. Store it where the service reads its configuration, as `,(0,j.jsx)(`span`,{className:`mono`,children:`COFFRE_TOKEN`}),`.`]}),(0,j.jsxs)(`div`,{className:`token-once`,children:[(0,j.jsx)(`code`,{className:`mono`,children:u.token}),(0,j.jsx)(v,{value:u.token,label:`Copy token`})]}),(0,j.jsxs)(`p`,{className:`hint`,children:[`Expires `,(0,j.jsx)(g,{iso:u.expiresAt}),`. Send it as`,` `,(0,j.jsx)(`span`,{className:`mono`,children:`Authorization: Bearer …`})]}),(0,j.jsx)(`div`,{className:`dialog-actions`,children:(0,j.jsx)(`button`,{className:`btn btn-primary`,type:`button`,onClick:w,children:`Done`})})]})})]})}function F(){let{token:t}=D.useParams(),n=e(),{auth:a,capabilities:o}=d(),s=r(`service`,t),c=o.canManageGrants,{data:l}=f(i.report(n,s,c)),{data:u}=f(i.credentials(n,s,c&&a.signin!==null)),p=l?.ok===!0&&l.report?.status===`active`;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(k,{principalType:`service`,principalId:t}),p&&u?.ok===!0&&(0,j.jsx)(N,{serviceId:t,tokens:u.tokens})]})}export{F as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/tokens._token-BJiMX2TJ.js","_coffre/assets/page-CDuo3uft.js","_coffre/assets/use-change-DIpkq9iI.js","_coffre/assets/suspense-Cnh1cNc1.js","_coffre/assets/row-state-BzGdu73b.js","_coffre/assets/ui-Ch0beQy-.js","_coffre/assets/link-Bg_PHv45.js","_coffre/assets/icons-BFziRUf9.js","_coffre/assets/use-shell-BJwawvkh.js","_coffre/assets/useSuspenseQuery-BfnNEmf7.js","_coffre/assets/use-action-cgaBRBBH.js","_coffre/assets/principal-page-BmgkTnAl.js","_coffre/assets/dist-BHhATf1q.js","_coffre/assets/directory-skRBmF1Y.js","_coffre/assets/grants-BEmVXYg5.js","_coffre/assets/offboarding-CXV0KyMt.js"])))=>i.map(i=>d[i]);
2
+ import{u as e}from"./page-CDuo3uft.js";import{n as t,r as n,t as r}from"./preload-helper-CYFH1xAV.js";var i=n(`/tokens/$token`)({loader:({context:{client:t,queryClient:n},params:r})=>e(n,t,`service`,r.token),component:t(()=>r(()=>import(`./tokens._token-BJiMX2TJ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])),`component`)});export{i as t};
@@ -1 +1 @@
1
- import{C as e,U as t,h as n,i as r,n as i}from"./page-Dngv8FMr.js";import{t as a}from"./use-shell-Dx92Huhb.js";import{t as o}from"./useSuspenseQuery-tP9HFZ8w.js";import{v as s}from"./icons-BRl8DlXW.js";import{n as c,t as l}from"./directory-C4BMGC7-.js";import{n as u}from"./offboarding--5vSKNHv.js";var d=t();function f(){let{capabilities:t}=a(),{data:f}=o(n.directory(e(),t.canManageGrants));if(!f.ok)return(0,d.jsx)(i,{icon:(0,d.jsx)(s,{size:18}),label:`Tokens`,title:`Tokens are closed to you`,children:f.error});let p=f.principals.filter(e=>e.principalType===`service`);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(r,{title:`Tokens`,actions:(0,d.jsx)(l,{principalType:`service`})}),(0,d.jsx)(c,{principalType:`service`,principals:p,hasRemoved:f.removed.some(e=>e.principalType===`service`)}),(0,d.jsx)(u,{principalType:`service`,removed:f.removed})]})}export{f as component};
1
+ import{C as e,U as t,h as n,i as r,n as i}from"./page-CDuo3uft.js";import{t as a}from"./use-shell-BJwawvkh.js";import{t as o}from"./useSuspenseQuery-BfnNEmf7.js";import{v as s}from"./icons-BFziRUf9.js";import{n as c,t as l}from"./directory-skRBmF1Y.js";import{n as u}from"./offboarding-CXV0KyMt.js";var d=t();function f(){let{capabilities:t}=a(),{data:f}=o(n.directory(e(),t.canManageGrants));if(!f.ok)return(0,d.jsx)(i,{icon:(0,d.jsx)(s,{size:18}),label:`Tokens`,title:`Tokens are closed to you`,children:f.error});let p=f.principals.filter(e=>e.principalType===`service`);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(r,{title:`Tokens`,actions:(0,d.jsx)(l,{principalType:`service`})}),(0,d.jsx)(c,{principalType:`service`,principals:p,hasRemoved:f.removed.some(e=>e.principalType===`service`)}),(0,d.jsx)(u,{principalType:`service`,removed:f.removed})]})}export{f as component};
@@ -1,4 +1,4 @@
1
- import{U as e,X as t,Y as n,q as r}from"./page-Dngv8FMr.js";import{z as i}from"./link-CqlAJWBd.js";import{W as a,_ as o,a as s,n as c,r as l,u,x as d}from"./icons-BRl8DlXW.js";var f=t(i(),1),p=t(r(),1);function m(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function h(...e){return t=>{let n=!1,r=e.map(e=>{let r=m(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():m(e[t],null)}}}}function g(...e){return p.useCallback(h(...e),e)}var _=n({Root:()=>y,Slot:()=>y,Slottable:()=>S,createSlot:()=>v,createSlottable:()=>x});function v(e){let t=p.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];O(r)&&typeof M==`function`&&(r=M(r._payload)),p.Children.forEach(r,e=>{if(E(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;O(n)&&typeof M==`function`&&(n=M(n._payload)),a=C(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=p.cloneElement(a,void 0,s):!o&&p.Children.count(r)===1&&p.isValidElement(r)&&(a=r);let c=a?T(a):void 0,l=g(n,c);if(!a){if(r||r===0)throw Error(o?j(e):A(e));return r}let u=w(i,a.props??{});return a.type!==p.Fragment&&(u.ref=n?l:c),p.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var y=v(`Slot`),b=Symbol.for(`radix.slottable`);function x(e){let t=e=>`child`in e?e.children(e.child):e.children;return t.displayName=`${e}.Slottable`,t.__radixId=b,t}var S=x(`Slottable`),C=(e,t)=>{if(`child`in e.props){let t=e.props.child;return p.isValidElement(t)?p.cloneElement(t,void 0,e.props.children(t.props.children)):null}return p.isValidElement(t)?t:null};function w(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function T(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function E(e){return p.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===b}var D=Symbol.for(`react.lazy`);function O(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===D&&`_payload`in e&&k(e._payload)}function k(e){return typeof e==`object`&&!!e&&`then`in e}var A=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,j=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,M=p.use,N=e(),P=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=v(`Primitive.${t}`),r=p.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,N.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function F(e,t){e&&f.flushSync(()=>e.dispatchEvent(t))}var ee=P,I=n({Root:()=>ae,VISUALLY_HIDDEN_STYLES:()=>re,VisuallyHidden:()=>ie}),te=Object.defineProperty,ne=(e,t)=>te(e,`name`,{value:t,configurable:!0}),re=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),ie=p.forwardRef(ne(function(e,t){return(0,N.jsx)(P.span,{...e,ref:t,style:{...re,...e.style}})},`VisuallyHidden`)),ae=ie,oe=n({AccessibleIcon:()=>ce,Root:()=>le}),se=Object.defineProperty,ce=((e,t)=>se(e,`name`,{value:t,configurable:!0}))(({children:e,label:t})=>{let n=p.Children.only(e);return(0,N.jsxs)(N.Fragment,{children:[p.cloneElement(n,{"aria-hidden":`true`,focusable:`false`}),(0,N.jsx)(ae,{children:t})]})},`AccessibleIcon`),le=ce;function L(e,t=[]){let n=[];function r(t,r){let i=p.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=p.useMemo(()=>o,Object.values(o));return(0,N.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=p.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>p.createContext(e));return function(n){let r=n?.[e]||t;return p.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,ue(i,...t)]}function ue(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function de(e){let t=e+`CollectionProvider`,[n,r]=L(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=p.useRef(null),a=p.useRef(new Map).current;return(0,N.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=v(s),l=p.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=g(t,a(s,n).collectionRef);return(0,N.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=v(u),m=p.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=p.useRef(null),s=g(t,o),c=a(u,n);return p.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,N.jsx)(f,{[d]:``,ref:s,children:r})});m.displayName=u;function h(t){let n=a(e+`CollectionConsumer`,t);return p.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:m},h,r]}var fe=new WeakMap,pe=class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],fe.set(this,!0)}set(e,t){return fe.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=ge(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=me(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=me(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return me(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function me(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=he(e,t);return n===-1?void 0:e[n]}function he(e,t){let n=e.length,r=ge(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}function ge(e){return e!==e||e===0?0:Math.trunc(e)}function _e(e){let t=e+`CollectionProvider`,[n,r]=L(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new pe,setItemMap:()=>void 0}),o=({state:e,...t})=>e?(0,N.jsx)(c,{...t,state:e}):(0,N.jsx)(s,{...t});o.displayName=t;let s=e=>{let t=_();return(0,N.jsx)(c,{...e,state:t})};s.displayName=t+`Init`;let c=e=>{let{scope:t,children:n,state:r}=e,a=p.useRef(null),[o,s]=p.useState(null),c=g(a,s),[l,u]=r;return p.useEffect(()=>{if(!o)return;let e=xe(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,N.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})};c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=v(l),d=p.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=g(t,a(l,n).collectionRef);return(0,N.jsx)(u,{ref:i,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,m=v(f),h=p.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=p.useRef(null),[s,c]=p.useState(null),l=g(t,o,c),{setItemMap:u}=a(f,n),d=p.useRef(i);ve(d.current,i)||(d.current=i);let h=d.current;return p.useEffect(()=>{let e=h;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(be):(t.set(s,{...e,element:s}),t.toSorted(be)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new pe(e)))}},[s,h,u]),(0,N.jsx)(m,{"data-radix-collection-item":``,ref:l,children:r})});h.displayName=f;function _(){return p.useState(new pe)}function y(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return[{Provider:o,Slot:d,ItemSlot:h},{createCollectionScope:r,useCollection:y,useInitCollection:_}]}function ve(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}function ye(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function be(e,t){return!e[1].element||!t[1].element?0:ye(e[1].element,t[1].element)?-1:1}function xe(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}var Se=Object.defineProperty,Ce=(e,t)=>Se(e,`name`,{value:t,configurable:!0}),we=!!(typeof window<`u`&&window.document&&window.document.createElement);function R(e,t,{checkForDefaultPrevented:n=!0}={}){return Ce(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}Ce(R,`composeEventHandlers`);function Te(e){if(!we)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}Ce(Te,`getOwnerWindow`);function Ee(e){if(!we)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}Ce(Ee,`getOwnerDocument`);function De(e,t=!1){let{activeElement:n}=Ee(e);if(!n?.nodeName)return null;if(Oe(n)&&n.contentDocument)return De(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=Ee(n).getElementById(e);if(t)return t}}return n}Ce(De,`getActiveElement`);function Oe(e){return e.tagName===`IFRAME`}Ce(Oe,`isFrame`);var z=globalThis?.document?p.useLayoutEffect:()=>{},ke=p.useEffectEvent,Ae=p.useInsertionEffect;function je(e){if(typeof ke==`function`)return ke(e);let t=p.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof Ae==`function`?Ae(()=>{t.current=e}):z(()=>{t.current=e}),p.useMemo(()=>((...e)=>t.current?.(...e)),[])}var Me=Object.defineProperty,Ne=(e,t)=>Me(e,`name`,{value:t,configurable:!0}),Pe=p.useInsertionEffect||z;function B({prop:e,defaultProp:t,onChange:n=Ne(()=>{},`onChange`),caller:r}){let[i,a,o]=Fe({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,p.useCallback(t=>{if(s){let n=Ie(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}Ne(B,`useControllableState`);function Fe({defaultProp:e,onChange:t}){let[n,r]=p.useState(e),i=p.useRef(n),a=p.useRef(t);return Pe(()=>{a.current=t},[t]),p.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}Ne(Fe,`useUncontrolledState`);function Ie(e){return typeof e==`function`}Ne(Ie,`isFunction`);var Le=Symbol(`RADIX:SYNC_STATE`);function Re(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=je(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=p.useReducer((t,n)=>{if(n.type===Le)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),m=d.state,h=p.useRef(m);p.useEffect(()=>{h.current!==m&&(h.current=m,c||l(m))},[m,h,c]);let g=p.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return p.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:Le,state:i})},[i,d.state,c]),[g,f]}Ne(Re,`useControllableStateReducer`);var ze=Object.defineProperty,Be=(e,t)=>ze(e,`name`,{value:t,configurable:!0});function Ve(e,t){return p.useReducer((e,n)=>t[e][n]??e,e)}Be(Ve,`useStateMachine`);var V=Be(e=>{let{present:t,children:n}=e,r=He(t),i=typeof n==`function`?n({present:r.isPresent}):p.Children.only(n),a=We(r.ref,Ke(i));return typeof n==`function`||r.isPresent?p.cloneElement(i,{ref:a}):null},`Presence`);function He(e){let[t,n]=p.useState(),r=p.useRef(null),i=p.useRef(e),a=p.useRef(`none`),o=p.useRef(void 0),[s,c]=Ve(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return p.useEffect(()=>{s===`mounted`?(a.current=o.current??Ge(r.current),o.current=void 0):a.current=`none`},[s]),z(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=Ge(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),z(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=Be(a=>{let o=Ge(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=Be(e=>{e.target===t&&(a.current=Ge(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:p.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=Ge(t)}else r.current=null;n(e)},[])}}Be(He,`usePresence`);function Ue(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Be(Ue,`setRef`);function We(...e){let t=p.useRef(e);return t.current=e,p.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Ue(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Ue(n[e],null)}}},[])}Be(We,`useStableComposedRefs`);function Ge(e){return e?.animationName||`none`}Be(Ge,`getAnimationName`);function Ke(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Be(Ke,`getElementRef`);var qe=p.useId||(()=>void 0),Je=0;function H(e){let[t,n]=p.useState(qe());return z(()=>{e||n(e=>e??String(Je++))},[e]),e||(t?`radix-${t}`:``)}var Ye=n({Collapsible:()=>rt,CollapsibleContent:()=>st,CollapsibleTrigger:()=>at,Content:()=>ft,Root:()=>ut,Trigger:()=>dt,createCollapsibleScope:()=>et}),Xe=Object.defineProperty,Ze=(e,t)=>Xe(e,`name`,{value:t,configurable:!0}),Qe=`Collapsible`,[$e,et]=L(Qe),[tt,nt]=$e(Qe),rt=p.forwardRef(Ze(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=B({prop:r,defaultProp:i??!1,onChange:o,caller:Qe});return(0,N.jsx)(tt,{scope:n,disabled:a,contentId:H(),open:c,onOpenToggle:p.useCallback(()=>l(e=>!e),[l]),children:(0,N.jsx)(P.div,{"data-state":lt(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),it=`CollapsibleTrigger`,at=p.forwardRef(Ze(function(e,t){let{__scopeCollapsible:n,...r}=e,i=nt(it,n);return(0,N.jsx)(P.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":lt(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:R(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),ot=`CollapsibleContent`,st=p.forwardRef(Ze(function(e,t){let{forceMount:n,...r}=e,i=nt(ot,e.__scopeCollapsible);return(0,N.jsx)(V,{present:n||i.open,children:({present:e})=>(0,N.jsx)(ct,{...r,ref:t,present:e})})},`CollapsibleContent`)),ct=p.forwardRef(Ze(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=nt(ot,n),[s,c]=p.useState(r),l=p.useRef(null),u=g(t,l),d=p.useRef(0),f=d.current,m=p.useRef(0),h=m.current,_=o.open||s,v=p.useRef(_),y=p.useRef(void 0);return p.useEffect(()=>{let e=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(e)},[]),z(()=>{let e=l.current;if(e){y.current=y.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,m.current=t.width,v.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),c(r)}},[o.open,r]),(0,N.jsx)(P.div,{"data-state":lt(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!_,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:_&&i})},`CollapsibleContentImpl`));function lt(e){return e?`open`:`closed`}Ze(lt,`getState`);var ut=rt,dt=at,ft=st,pt=n({DirectionProvider:()=>ht,Provider:()=>_t,useDirection:()=>gt}),mt=p.createContext(void 0),ht=e=>{let{dir:t,children:n}=e;return(0,N.jsx)(mt.Provider,{value:t,children:n})};function gt(e){let t=p.useContext(mt);return e||t||`ltr`}var _t=ht,vt=n({Accordion:()=>kt,AccordionContent:()=>Jt,AccordionHeader:()=>Wt,AccordionItem:()=>Ht,AccordionTrigger:()=>Kt,Content:()=>en,Header:()=>Qt,Item:()=>Zt,Root:()=>Xt,Trigger:()=>$t,createAccordionScope:()=>Dt}),yt=Object.defineProperty,bt=(e,t)=>yt(e,`name`,{value:t,configurable:!0}),xt=`Accordion`,St=[`Home`,`End`,`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`],[Ct,wt,Tt]=de(xt),[Et,Dt]=L(xt,[Tt,et]),Ot=et(),kt=p.forwardRef(bt(function(e,t){let{type:n,...r}=e,i=r,a=r;return(0,N.jsx)(Ct.Provider,{scope:e.__scopeAccordion,children:n===`multiple`?(0,N.jsx)(Ft,{...a,ref:t}):(0,N.jsx)(Pt,{...i,ref:t})})},`Accordion`)),[At,jt]=Et(xt),[Mt,Nt]=Et(xt,{collapsible:!1}),Pt=p.forwardRef(bt(function(e,t){let{value:n,defaultValue:r,onValueChange:i=bt(()=>{},`onValueChange`),collapsible:a=!1,...o}=e,[s,c]=B({prop:n,defaultProp:r??``,onChange:i,caller:xt});return(0,N.jsx)(At,{scope:e.__scopeAccordion,value:p.useMemo(()=>s?[s]:[],[s]),onItemOpen:c,onItemClose:p.useCallback(()=>a&&c(``),[a,c]),children:(0,N.jsx)(Mt,{scope:e.__scopeAccordion,collapsible:a,children:(0,N.jsx)(Rt,{...o,ref:t})})})},`AccordionImplSingle`)),Ft=p.forwardRef(bt(function(e,t){let{value:n,defaultValue:r,onValueChange:i=bt(()=>{},`onValueChange`),...a}=e,[o,s]=B({prop:n,defaultProp:r??[],onChange:i,caller:xt}),c=p.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=p.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,N.jsx)(At,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:(0,N.jsx)(Mt,{scope:e.__scopeAccordion,collapsible:!0,children:(0,N.jsx)(Rt,{...a,ref:t})})})},`AccordionImplMultiple`)),[It,Lt]=Et(xt),Rt=p.forwardRef(bt(function(e,t){let{__scopeAccordion:n,disabled:r,dir:i,orientation:a=`vertical`,...o}=e,s=g(p.useRef(null),t),c=wt(n),l=gt(i)===`ltr`,u=R(e.onKeyDown,e=>{if(!St.includes(e.key))return;let t=e.target,n=c().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),i=n.length;if(r===-1)return;e.preventDefault();let o=r,s=i-1,u=bt(()=>{o=r+1,o>s&&(o=0)},`moveNext`),d=bt(()=>{o=r-1,o<0&&(o=s)},`movePrev`);switch(e.key){case`Home`:o=0;break;case`End`:o=s;break;case`ArrowRight`:a===`horizontal`&&(l?u():d());break;case`ArrowDown`:a===`vertical`&&u();break;case`ArrowLeft`:a===`horizontal`&&(l?d():u());break;case`ArrowUp`:a===`vertical`&&d();break}n[o%i].ref.current?.focus()});return(0,N.jsx)(It,{scope:n,disabled:r,direction:i,orientation:a,children:(0,N.jsx)(Ct.Slot,{scope:n,children:(0,N.jsx)(P.div,{...o,"data-orientation":a,ref:s,onKeyDown:r?void 0:u})})})},`AccordionImpl`)),zt=`AccordionItem`,[Bt,Vt]=Et(zt),Ht=p.forwardRef(bt(function(e,t){let{__scopeAccordion:n,value:r,...i}=e,a=Lt(zt,n),o=jt(zt,n),s=Ot(n),c=H(),l=r&&o.value.includes(r)||!1,u=a.disabled||e.disabled;return(0,N.jsx)(Bt,{scope:n,open:l,disabled:u,triggerId:c,children:(0,N.jsx)(ut,{"data-orientation":a.orientation,"data-state":Yt(l),...s,...i,ref:t,disabled:u,open:l,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})},`AccordionItem`)),Ut=`AccordionHeader`,Wt=p.forwardRef(bt(function(e,t){let{__scopeAccordion:n,...r}=e,i=Lt(xt,n),a=Vt(Ut,n);return(0,N.jsx)(P.h3,{"data-orientation":i.orientation,"data-state":Yt(a.open),"data-disabled":a.disabled?``:void 0,...r,ref:t})},`AccordionHeader`)),Gt=`AccordionTrigger`,Kt=p.forwardRef(bt(function(e,t){let{__scopeAccordion:n,...r}=e,i=Lt(xt,n),a=Vt(Gt,n),o=Nt(Gt,n),s=Ot(n);return(0,N.jsx)(Ct.ItemSlot,{scope:n,children:(0,N.jsx)(dt,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...s,...r,ref:t})})},`AccordionTrigger`)),qt=`AccordionContent`,Jt=p.forwardRef(bt(function(e,t){let{__scopeAccordion:n,...r}=e,i=Lt(xt,n),a=Vt(qt,n),o=Ot(n);return(0,N.jsx)(ft,{role:`region`,"aria-labelledby":a.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":`var(--radix-collapsible-content-height)`,"--radix-accordion-content-width":`var(--radix-collapsible-content-width)`,...e.style}})},`AccordionContent`));function Yt(e){return e?`open`:`closed`}bt(Yt,`getState`);var Xt=kt,Zt=Ht,Qt=Wt,$t=Kt,en=Jt;function U(e){let t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>((...e)=>t.current?.(...e)),[])}var tn=Object.defineProperty,nn=(e,t)=>tn(e,`name`,{value:t,configurable:!0}),rn=`dismissableLayer.update`,an=`dismissableLayer.pointerDownOutside`,on=`dismissableLayer.focusOutside`,sn,cn=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),ln=p.forwardRef(nn(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=p.useContext(cn),[d,f]=p.useState(null),m=d?.ownerDocument??globalThis?.document,[,h]=p.useState({}),_=g(t,f),v=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=y?v.indexOf(y):-1,x=d?v.indexOf(d):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,C=x>=b,w=p.useRef(!1),T=pn(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:w,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:p.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return C&&!t},[u.branches,C])}),E=mn(e=>{if(r&&w.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},m),D=d?x===v.length-1:!1,O=U(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return p.useEffect(()=>{if(D)return m.addEventListener(`keydown`,O,{capture:!0}),()=>m.removeEventListener(`keydown`,O,{capture:!0})},[m,D,O]),p.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(sn=m.body.style.pointerEvents,m.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),hn(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=sn))}},[d,m,n,u]),p.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),hn())},[d,u]),p.useEffect(()=>{let e=nn(()=>h({}),`handleUpdate`);return document.addEventListener(rn,e),()=>document.removeEventListener(rn,e)},[]),(0,N.jsx)(P.div,{...l,ref:_,style:{pointerEvents:S?C?`auto`:`none`:void 0,...e.style},onFocusCapture:R(e.onFocusCapture,E.onFocusCapture),onBlurCapture:R(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:R(e.onPointerDownCapture,T.onPointerDownCapture)})},`DismissableLayer`)),un=p.forwardRef(nn(function(e,t){let n=p.useContext(cn),r=p.useRef(null),i=g(t,r);return p.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,N.jsx)(P.div,{...e,ref:i})},`DismissableLayerBranch`));function dn(){let e=p.useContext(cn),[t,n]=p.useState(null);return p.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}nn(dn,`useDismissableLayerSurface`);var fn=nn(()=>!0,`IS_TRUE`);function pn(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=fn}=t,s=U(e),c=p.useRef(!1),l=p.useRef(!1),u=p.useRef(new Map),d=p.useRef(()=>{});return p.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}nn(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}nn(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}nn(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}nn(p,`handleInteractionBubble`);let m=nn(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||gn(an,s,p,{discrete:!0})};if(nn(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:nn(()=>c.current=!0,`onPointerDownCapture`)}}nn(pn,`usePointerDownOutside`);function mn(e,t=globalThis?.document){let n=U(e),r=p.useRef(!1);return p.useEffect(()=>{let e=nn(e=>{e.target&&!r.current&&gn(on,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:nn(()=>r.current=!0,`onFocusCapture`),onBlurCapture:nn(()=>r.current=!1,`onBlurCapture`)}}nn(mn,`useFocusOutside`);function hn(){let e=new CustomEvent(rn);document.dispatchEvent(e)}nn(hn,`dispatchUpdate`);function gn(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?F(i,a):i.dispatchEvent(a)}nn(gn,`handleAndDispatchCustomEvent`);var _n=ln,vn=un,yn=Object.defineProperty,bn=(e,t)=>yn(e,`name`,{value:t,configurable:!0}),xn=`focusScope.autoFocusOnMount`,Sn=`focusScope.autoFocusOnUnmount`,Cn={bubbles:!1,cancelable:!0},wn=p.forwardRef(bn(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=p.useState(null),l=U(i),u=U(a),d=p.useRef(null),f=g(t,c),m=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let e=function(e){if(m.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:jn(d.current,{select:!0})},t=function(e){if(m.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||jn(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&jn(s)};bn(e,`handleFocusIn`),bn(t,`handleFocusOut`),bn(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,m.paused]),p.useEffect(()=>{if(s){Mn.add(m);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(xn,Cn);s.addEventListener(xn,l),s.dispatchEvent(t),t.defaultPrevented||(Tn(Fn(Dn(s)),{select:!0}),document.activeElement===e&&jn(s))}return()=>{s.removeEventListener(xn,l),setTimeout(()=>{let t=new CustomEvent(Sn,Cn);s.addEventListener(Sn,u),s.dispatchEvent(t),t.defaultPrevented||jn(e??document.body,{select:!0}),s.removeEventListener(Sn,u),Mn.remove(m)},0)}}},[s,l,u,m]);let h=p.useCallback(e=>{if(!n&&!r||m.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=En(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&jn(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&jn(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,m.paused]);return(0,N.jsx)(P.div,{tabIndex:-1,...o,ref:f,onKeyDown:h})},`FocusScope`));function Tn(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(jn(r,{select:t}),document.activeElement!==n)return}bn(Tn,`focusFirst`);function En(e){let t=Dn(e);return[On(t,e),On(t.reverse(),e)]}bn(En,`getTabbableEdges`);function Dn(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:bn(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}bn(Dn,`getTabbableCandidates`);function On(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):kn(r,{upTo:t})))return r}bn(On,`findVisible`);function kn(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}bn(kn,`isHidden`);function An(e){return e instanceof HTMLInputElement&&`select`in e}bn(An,`isSelectableInput`);function jn(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&An(e)&&t&&e.select()}}bn(jn,`focus`);var Mn=Nn();function Nn(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Pn(e,t),e.unshift(t)},remove(t){e=Pn(e,t),e[0]?.resume()}}}bn(Nn,`createFocusScopesStack`);function Pn(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}bn(Pn,`arrayRemove`);function Fn(e){return e.filter(e=>e.tagName!==`A`)}bn(Fn,`removeLinks`);var In=n({Portal:()=>Rn,Root:()=>zn}),Ln=Object.defineProperty,Rn=p.forwardRef(((e,t)=>Ln(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=p.useState(!1);z(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?f.createPortal((0,N.jsx)(P.div,{...r,ref:t}),o):null},`Portal`)),zn=Rn,Bn=0,Vn=null;function Hn(){p.useEffect(()=>{Vn||={start:Un(),end:Un()};let{start:e,end:t}=Vn;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Bn++,()=>{Bn===1&&(Vn?.start.remove(),Vn?.end.remove(),Vn=null),Bn=Math.max(0,Bn-1)}},[])}function Un(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Wn=function(){return Wn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Wn.apply(this,arguments)};function Gn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Kn(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var qn=`right-scroll-bar-position`,Jn=`width-before-scroll-bar`,Yn=`with-scroll-bars-hidden`,Xn=`--removed-body-scroll-bar-size`;function Zn(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Qn(e,t){var n=(0,p.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var $n=typeof window<`u`?p.useLayoutEffect:p.useEffect,er=new WeakMap;function tr(e,t){var n=Qn(t||null,function(t){return e.forEach(function(e){return Zn(e,t)})});return $n(function(){var t=er.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Zn(e,null)}),i.forEach(function(e){r.has(e)||Zn(e,a)})}er.set(n,e)},[e]),n}function nr(e){return e}function rr(e,t){t===void 0&&(t=nr);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function ir(e){e===void 0&&(e={});var t=rr(null);return t.options=Wn({async:!0,ssr:!1},e),t}var ar=function(e){var t=e.sideCar,n=Gn(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return p.createElement(r,Wn({},n))};ar.isSideCarExport=!0;function or(e,t){return e.useMedium(t),ar}var sr=ir(),cr=function(){},lr=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:cr,onWheelCapture:cr,onTouchMoveCapture:cr}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=Gn(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=tr([n,t]),w=Wn(Wn({},x),i);return p.createElement(p.Fragment,null,u&&p.createElement(S,{sideCar:sr,removeScrollBar:l,shards:d,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?p.cloneElement(p.Children.only(s),Wn(Wn({},w),{ref:C})):p.createElement(y,Wn({},w,{className:c,ref:C}),s))});lr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},lr.classNames={fullWidth:Jn,zeroRight:qn};var ur,dr=function(){if(ur)return ur;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function fr(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=dr();return t&&e.setAttribute(`nonce`,t),e}function pr(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function mr(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var hr=function(){var e=0,t=null;return{add:function(n){e==0&&(t=fr())&&(pr(t,n),mr(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},gr=function(){var e=hr();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},_r=function(){var e=gr();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},vr={left:0,top:0,right:0,gap:0},yr=function(e){return parseInt(e||``,10)||0},br=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[yr(n),yr(r),yr(i)]},xr=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return vr;var t=br(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Sr=_r(),Cr=`data-scroll-locked`,wr=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
1
+ import{U as e,X as t,Y as n,q as r}from"./page-CDuo3uft.js";import{z as i}from"./link-Bg_PHv45.js";import{W as a,_ as o,a as s,n as c,r as l,u,x as d}from"./icons-BFziRUf9.js";var f=t(i(),1),p=t(r(),1);function m(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function h(...e){return t=>{let n=!1,r=e.map(e=>{let r=m(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():m(e[t],null)}}}}function g(...e){return p.useCallback(h(...e),e)}var _=n({Root:()=>y,Slot:()=>y,Slottable:()=>S,createSlot:()=>v,createSlottable:()=>x});function v(e){let t=p.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];O(r)&&typeof M==`function`&&(r=M(r._payload)),p.Children.forEach(r,e=>{if(E(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;O(n)&&typeof M==`function`&&(n=M(n._payload)),a=C(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=p.cloneElement(a,void 0,s):!o&&p.Children.count(r)===1&&p.isValidElement(r)&&(a=r);let c=a?T(a):void 0,l=g(n,c);if(!a){if(r||r===0)throw Error(o?j(e):A(e));return r}let u=w(i,a.props??{});return a.type!==p.Fragment&&(u.ref=n?l:c),p.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var y=v(`Slot`),b=Symbol.for(`radix.slottable`);function x(e){let t=e=>`child`in e?e.children(e.child):e.children;return t.displayName=`${e}.Slottable`,t.__radixId=b,t}var S=x(`Slottable`),C=(e,t)=>{if(`child`in e.props){let t=e.props.child;return p.isValidElement(t)?p.cloneElement(t,void 0,e.props.children(t.props.children)):null}return p.isValidElement(t)?t:null};function w(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function T(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function E(e){return p.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===b}var D=Symbol.for(`react.lazy`);function O(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===D&&`_payload`in e&&k(e._payload)}function k(e){return typeof e==`object`&&!!e&&`then`in e}var A=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,j=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,M=p.use,N=e(),P=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=v(`Primitive.${t}`),r=p.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,N.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function F(e,t){e&&f.flushSync(()=>e.dispatchEvent(t))}var ee=P,I=n({Root:()=>ae,VISUALLY_HIDDEN_STYLES:()=>re,VisuallyHidden:()=>ie}),te=Object.defineProperty,ne=(e,t)=>te(e,`name`,{value:t,configurable:!0}),re=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),ie=p.forwardRef(ne(function(e,t){return(0,N.jsx)(P.span,{...e,ref:t,style:{...re,...e.style}})},`VisuallyHidden`)),ae=ie,oe=n({AccessibleIcon:()=>ce,Root:()=>le}),se=Object.defineProperty,ce=((e,t)=>se(e,`name`,{value:t,configurable:!0}))(({children:e,label:t})=>{let n=p.Children.only(e);return(0,N.jsxs)(N.Fragment,{children:[p.cloneElement(n,{"aria-hidden":`true`,focusable:`false`}),(0,N.jsx)(ae,{children:t})]})},`AccessibleIcon`),le=ce;function L(e,t=[]){let n=[];function r(t,r){let i=p.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=p.useMemo(()=>o,Object.values(o));return(0,N.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=p.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>p.createContext(e));return function(n){let r=n?.[e]||t;return p.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,ue(i,...t)]}function ue(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function de(e){let t=e+`CollectionProvider`,[n,r]=L(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=p.useRef(null),a=p.useRef(new Map).current;return(0,N.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=v(s),l=p.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=g(t,a(s,n).collectionRef);return(0,N.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=v(u),m=p.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=p.useRef(null),s=g(t,o),c=a(u,n);return p.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,N.jsx)(f,{[d]:``,ref:s,children:r})});m.displayName=u;function h(t){let n=a(e+`CollectionConsumer`,t);return p.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:m},h,r]}var fe=new WeakMap,pe=class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],fe.set(this,!0)}set(e,t){return fe.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=ge(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=me(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=me(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return me(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function me(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=he(e,t);return n===-1?void 0:e[n]}function he(e,t){let n=e.length,r=ge(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}function ge(e){return e!==e||e===0?0:Math.trunc(e)}function _e(e){let t=e+`CollectionProvider`,[n,r]=L(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new pe,setItemMap:()=>void 0}),o=({state:e,...t})=>e?(0,N.jsx)(c,{...t,state:e}):(0,N.jsx)(s,{...t});o.displayName=t;let s=e=>{let t=_();return(0,N.jsx)(c,{...e,state:t})};s.displayName=t+`Init`;let c=e=>{let{scope:t,children:n,state:r}=e,a=p.useRef(null),[o,s]=p.useState(null),c=g(a,s),[l,u]=r;return p.useEffect(()=>{if(!o)return;let e=xe(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,N.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})};c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=v(l),d=p.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=g(t,a(l,n).collectionRef);return(0,N.jsx)(u,{ref:i,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,m=v(f),h=p.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=p.useRef(null),[s,c]=p.useState(null),l=g(t,o,c),{setItemMap:u}=a(f,n),d=p.useRef(i);ve(d.current,i)||(d.current=i);let h=d.current;return p.useEffect(()=>{let e=h;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(be):(t.set(s,{...e,element:s}),t.toSorted(be)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new pe(e)))}},[s,h,u]),(0,N.jsx)(m,{"data-radix-collection-item":``,ref:l,children:r})});h.displayName=f;function _(){return p.useState(new pe)}function y(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return[{Provider:o,Slot:d,ItemSlot:h},{createCollectionScope:r,useCollection:y,useInitCollection:_}]}function ve(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}function ye(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function be(e,t){return!e[1].element||!t[1].element?0:ye(e[1].element,t[1].element)?-1:1}function xe(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}var Se=Object.defineProperty,Ce=(e,t)=>Se(e,`name`,{value:t,configurable:!0}),we=!!(typeof window<`u`&&window.document&&window.document.createElement);function R(e,t,{checkForDefaultPrevented:n=!0}={}){return Ce(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}Ce(R,`composeEventHandlers`);function Te(e){if(!we)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}Ce(Te,`getOwnerWindow`);function Ee(e){if(!we)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}Ce(Ee,`getOwnerDocument`);function De(e,t=!1){let{activeElement:n}=Ee(e);if(!n?.nodeName)return null;if(Oe(n)&&n.contentDocument)return De(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=Ee(n).getElementById(e);if(t)return t}}return n}Ce(De,`getActiveElement`);function Oe(e){return e.tagName===`IFRAME`}Ce(Oe,`isFrame`);var z=globalThis?.document?p.useLayoutEffect:()=>{},ke=p.useEffectEvent,Ae=p.useInsertionEffect;function je(e){if(typeof ke==`function`)return ke(e);let t=p.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof Ae==`function`?Ae(()=>{t.current=e}):z(()=>{t.current=e}),p.useMemo(()=>((...e)=>t.current?.(...e)),[])}var Me=Object.defineProperty,Ne=(e,t)=>Me(e,`name`,{value:t,configurable:!0}),Pe=p.useInsertionEffect||z;function B({prop:e,defaultProp:t,onChange:n=Ne(()=>{},`onChange`),caller:r}){let[i,a,o]=Fe({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,p.useCallback(t=>{if(s){let n=Ie(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}Ne(B,`useControllableState`);function Fe({defaultProp:e,onChange:t}){let[n,r]=p.useState(e),i=p.useRef(n),a=p.useRef(t);return Pe(()=>{a.current=t},[t]),p.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}Ne(Fe,`useUncontrolledState`);function Ie(e){return typeof e==`function`}Ne(Ie,`isFunction`);var Le=Symbol(`RADIX:SYNC_STATE`);function Re(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=je(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=p.useReducer((t,n)=>{if(n.type===Le)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),m=d.state,h=p.useRef(m);p.useEffect(()=>{h.current!==m&&(h.current=m,c||l(m))},[m,h,c]);let g=p.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return p.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:Le,state:i})},[i,d.state,c]),[g,f]}Ne(Re,`useControllableStateReducer`);var ze=Object.defineProperty,Be=(e,t)=>ze(e,`name`,{value:t,configurable:!0});function Ve(e,t){return p.useReducer((e,n)=>t[e][n]??e,e)}Be(Ve,`useStateMachine`);var V=Be(e=>{let{present:t,children:n}=e,r=He(t),i=typeof n==`function`?n({present:r.isPresent}):p.Children.only(n),a=We(r.ref,Ke(i));return typeof n==`function`||r.isPresent?p.cloneElement(i,{ref:a}):null},`Presence`);function He(e){let[t,n]=p.useState(),r=p.useRef(null),i=p.useRef(e),a=p.useRef(`none`),o=p.useRef(void 0),[s,c]=Ve(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return p.useEffect(()=>{s===`mounted`?(a.current=o.current??Ge(r.current),o.current=void 0):a.current=`none`},[s]),z(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=Ge(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),z(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=Be(a=>{let o=Ge(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=Be(e=>{e.target===t&&(a.current=Ge(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:p.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=Ge(t)}else r.current=null;n(e)},[])}}Be(He,`usePresence`);function Ue(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}Be(Ue,`setRef`);function We(...e){let t=p.useRef(e);return t.current=e,p.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Ue(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():Ue(n[e],null)}}},[])}Be(We,`useStableComposedRefs`);function Ge(e){return e?.animationName||`none`}Be(Ge,`getAnimationName`);function Ke(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Be(Ke,`getElementRef`);var qe=p.useId||(()=>void 0),Je=0;function H(e){let[t,n]=p.useState(qe());return z(()=>{e||n(e=>e??String(Je++))},[e]),e||(t?`radix-${t}`:``)}var Ye=n({Collapsible:()=>rt,CollapsibleContent:()=>st,CollapsibleTrigger:()=>at,Content:()=>ft,Root:()=>ut,Trigger:()=>dt,createCollapsibleScope:()=>et}),Xe=Object.defineProperty,Ze=(e,t)=>Xe(e,`name`,{value:t,configurable:!0}),Qe=`Collapsible`,[$e,et]=L(Qe),[tt,nt]=$e(Qe),rt=p.forwardRef(Ze(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=B({prop:r,defaultProp:i??!1,onChange:o,caller:Qe});return(0,N.jsx)(tt,{scope:n,disabled:a,contentId:H(),open:c,onOpenToggle:p.useCallback(()=>l(e=>!e),[l]),children:(0,N.jsx)(P.div,{"data-state":lt(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),it=`CollapsibleTrigger`,at=p.forwardRef(Ze(function(e,t){let{__scopeCollapsible:n,...r}=e,i=nt(it,n);return(0,N.jsx)(P.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":lt(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:R(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),ot=`CollapsibleContent`,st=p.forwardRef(Ze(function(e,t){let{forceMount:n,...r}=e,i=nt(ot,e.__scopeCollapsible);return(0,N.jsx)(V,{present:n||i.open,children:({present:e})=>(0,N.jsx)(ct,{...r,ref:t,present:e})})},`CollapsibleContent`)),ct=p.forwardRef(Ze(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=nt(ot,n),[s,c]=p.useState(r),l=p.useRef(null),u=g(t,l),d=p.useRef(0),f=d.current,m=p.useRef(0),h=m.current,_=o.open||s,v=p.useRef(_),y=p.useRef(void 0);return p.useEffect(()=>{let e=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(e)},[]),z(()=>{let e=l.current;if(e){y.current=y.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,m.current=t.width,v.current||(e.style.transitionDuration=y.current.transitionDuration,e.style.animationName=y.current.animationName),c(r)}},[o.open,r]),(0,N.jsx)(P.div,{"data-state":lt(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!_,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:_&&i})},`CollapsibleContentImpl`));function lt(e){return e?`open`:`closed`}Ze(lt,`getState`);var ut=rt,dt=at,ft=st,pt=n({DirectionProvider:()=>ht,Provider:()=>_t,useDirection:()=>gt}),mt=p.createContext(void 0),ht=e=>{let{dir:t,children:n}=e;return(0,N.jsx)(mt.Provider,{value:t,children:n})};function gt(e){let t=p.useContext(mt);return e||t||`ltr`}var _t=ht,vt=n({Accordion:()=>kt,AccordionContent:()=>Jt,AccordionHeader:()=>Wt,AccordionItem:()=>Ht,AccordionTrigger:()=>Kt,Content:()=>en,Header:()=>Qt,Item:()=>Zt,Root:()=>Xt,Trigger:()=>$t,createAccordionScope:()=>Dt}),yt=Object.defineProperty,bt=(e,t)=>yt(e,`name`,{value:t,configurable:!0}),xt=`Accordion`,St=[`Home`,`End`,`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`],[Ct,wt,Tt]=de(xt),[Et,Dt]=L(xt,[Tt,et]),Ot=et(),kt=p.forwardRef(bt(function(e,t){let{type:n,...r}=e,i=r,a=r;return(0,N.jsx)(Ct.Provider,{scope:e.__scopeAccordion,children:n===`multiple`?(0,N.jsx)(Ft,{...a,ref:t}):(0,N.jsx)(Pt,{...i,ref:t})})},`Accordion`)),[At,jt]=Et(xt),[Mt,Nt]=Et(xt,{collapsible:!1}),Pt=p.forwardRef(bt(function(e,t){let{value:n,defaultValue:r,onValueChange:i=bt(()=>{},`onValueChange`),collapsible:a=!1,...o}=e,[s,c]=B({prop:n,defaultProp:r??``,onChange:i,caller:xt});return(0,N.jsx)(At,{scope:e.__scopeAccordion,value:p.useMemo(()=>s?[s]:[],[s]),onItemOpen:c,onItemClose:p.useCallback(()=>a&&c(``),[a,c]),children:(0,N.jsx)(Mt,{scope:e.__scopeAccordion,collapsible:a,children:(0,N.jsx)(Rt,{...o,ref:t})})})},`AccordionImplSingle`)),Ft=p.forwardRef(bt(function(e,t){let{value:n,defaultValue:r,onValueChange:i=bt(()=>{},`onValueChange`),...a}=e,[o,s]=B({prop:n,defaultProp:r??[],onChange:i,caller:xt}),c=p.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=p.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,N.jsx)(At,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:l,children:(0,N.jsx)(Mt,{scope:e.__scopeAccordion,collapsible:!0,children:(0,N.jsx)(Rt,{...a,ref:t})})})},`AccordionImplMultiple`)),[It,Lt]=Et(xt),Rt=p.forwardRef(bt(function(e,t){let{__scopeAccordion:n,disabled:r,dir:i,orientation:a=`vertical`,...o}=e,s=g(p.useRef(null),t),c=wt(n),l=gt(i)===`ltr`,u=R(e.onKeyDown,e=>{if(!St.includes(e.key))return;let t=e.target,n=c().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),i=n.length;if(r===-1)return;e.preventDefault();let o=r,s=i-1,u=bt(()=>{o=r+1,o>s&&(o=0)},`moveNext`),d=bt(()=>{o=r-1,o<0&&(o=s)},`movePrev`);switch(e.key){case`Home`:o=0;break;case`End`:o=s;break;case`ArrowRight`:a===`horizontal`&&(l?u():d());break;case`ArrowDown`:a===`vertical`&&u();break;case`ArrowLeft`:a===`horizontal`&&(l?d():u());break;case`ArrowUp`:a===`vertical`&&d();break}n[o%i].ref.current?.focus()});return(0,N.jsx)(It,{scope:n,disabled:r,direction:i,orientation:a,children:(0,N.jsx)(Ct.Slot,{scope:n,children:(0,N.jsx)(P.div,{...o,"data-orientation":a,ref:s,onKeyDown:r?void 0:u})})})},`AccordionImpl`)),zt=`AccordionItem`,[Bt,Vt]=Et(zt),Ht=p.forwardRef(bt(function(e,t){let{__scopeAccordion:n,value:r,...i}=e,a=Lt(zt,n),o=jt(zt,n),s=Ot(n),c=H(),l=r&&o.value.includes(r)||!1,u=a.disabled||e.disabled;return(0,N.jsx)(Bt,{scope:n,open:l,disabled:u,triggerId:c,children:(0,N.jsx)(ut,{"data-orientation":a.orientation,"data-state":Yt(l),...s,...i,ref:t,disabled:u,open:l,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})},`AccordionItem`)),Ut=`AccordionHeader`,Wt=p.forwardRef(bt(function(e,t){let{__scopeAccordion:n,...r}=e,i=Lt(xt,n),a=Vt(Ut,n);return(0,N.jsx)(P.h3,{"data-orientation":i.orientation,"data-state":Yt(a.open),"data-disabled":a.disabled?``:void 0,...r,ref:t})},`AccordionHeader`)),Gt=`AccordionTrigger`,Kt=p.forwardRef(bt(function(e,t){let{__scopeAccordion:n,...r}=e,i=Lt(xt,n),a=Vt(Gt,n),o=Nt(Gt,n),s=Ot(n);return(0,N.jsx)(Ct.ItemSlot,{scope:n,children:(0,N.jsx)(dt,{"aria-disabled":a.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:a.triggerId,...s,...r,ref:t})})},`AccordionTrigger`)),qt=`AccordionContent`,Jt=p.forwardRef(bt(function(e,t){let{__scopeAccordion:n,...r}=e,i=Lt(xt,n),a=Vt(qt,n),o=Ot(n);return(0,N.jsx)(ft,{role:`region`,"aria-labelledby":a.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":`var(--radix-collapsible-content-height)`,"--radix-accordion-content-width":`var(--radix-collapsible-content-width)`,...e.style}})},`AccordionContent`));function Yt(e){return e?`open`:`closed`}bt(Yt,`getState`);var Xt=kt,Zt=Ht,Qt=Wt,$t=Kt,en=Jt;function U(e){let t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>((...e)=>t.current?.(...e)),[])}var tn=Object.defineProperty,nn=(e,t)=>tn(e,`name`,{value:t,configurable:!0}),rn=`dismissableLayer.update`,an=`dismissableLayer.pointerDownOutside`,on=`dismissableLayer.focusOutside`,sn,cn=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),ln=p.forwardRef(nn(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=p.useContext(cn),[d,f]=p.useState(null),m=d?.ownerDocument??globalThis?.document,[,h]=p.useState({}),_=g(t,f),v=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=y?v.indexOf(y):-1,x=d?v.indexOf(d):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,C=x>=b,w=p.useRef(!1),T=pn(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:w,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:p.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return C&&!t},[u.branches,C])}),E=mn(e=>{if(r&&w.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},m),D=d?x===v.length-1:!1,O=U(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return p.useEffect(()=>{if(D)return m.addEventListener(`keydown`,O,{capture:!0}),()=>m.removeEventListener(`keydown`,O,{capture:!0})},[m,D,O]),p.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(sn=m.body.style.pointerEvents,m.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),hn(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=sn))}},[d,m,n,u]),p.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),hn())},[d,u]),p.useEffect(()=>{let e=nn(()=>h({}),`handleUpdate`);return document.addEventListener(rn,e),()=>document.removeEventListener(rn,e)},[]),(0,N.jsx)(P.div,{...l,ref:_,style:{pointerEvents:S?C?`auto`:`none`:void 0,...e.style},onFocusCapture:R(e.onFocusCapture,E.onFocusCapture),onBlurCapture:R(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:R(e.onPointerDownCapture,T.onPointerDownCapture)})},`DismissableLayer`)),un=p.forwardRef(nn(function(e,t){let n=p.useContext(cn),r=p.useRef(null),i=g(t,r);return p.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,N.jsx)(P.div,{...e,ref:i})},`DismissableLayerBranch`));function dn(){let e=p.useContext(cn),[t,n]=p.useState(null);return p.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}nn(dn,`useDismissableLayerSurface`);var fn=nn(()=>!0,`IS_TRUE`);function pn(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=fn}=t,s=U(e),c=p.useRef(!1),l=p.useRef(!1),u=p.useRef(new Map),d=p.useRef(()=>{});return p.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}nn(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}nn(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}nn(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}nn(p,`handleInteractionBubble`);let m=nn(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||gn(an,s,p,{discrete:!0})};if(nn(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:nn(()=>c.current=!0,`onPointerDownCapture`)}}nn(pn,`usePointerDownOutside`);function mn(e,t=globalThis?.document){let n=U(e),r=p.useRef(!1);return p.useEffect(()=>{let e=nn(e=>{e.target&&!r.current&&gn(on,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:nn(()=>r.current=!0,`onFocusCapture`),onBlurCapture:nn(()=>r.current=!1,`onBlurCapture`)}}nn(mn,`useFocusOutside`);function hn(){let e=new CustomEvent(rn);document.dispatchEvent(e)}nn(hn,`dispatchUpdate`);function gn(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?F(i,a):i.dispatchEvent(a)}nn(gn,`handleAndDispatchCustomEvent`);var _n=ln,vn=un,yn=Object.defineProperty,bn=(e,t)=>yn(e,`name`,{value:t,configurable:!0}),xn=`focusScope.autoFocusOnMount`,Sn=`focusScope.autoFocusOnUnmount`,Cn={bubbles:!1,cancelable:!0},wn=p.forwardRef(bn(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=p.useState(null),l=U(i),u=U(a),d=p.useRef(null),f=g(t,c),m=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let e=function(e){if(m.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:jn(d.current,{select:!0})},t=function(e){if(m.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||jn(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&jn(s)};bn(e,`handleFocusIn`),bn(t,`handleFocusOut`),bn(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,m.paused]),p.useEffect(()=>{if(s){Mn.add(m);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(xn,Cn);s.addEventListener(xn,l),s.dispatchEvent(t),t.defaultPrevented||(Tn(Fn(Dn(s)),{select:!0}),document.activeElement===e&&jn(s))}return()=>{s.removeEventListener(xn,l),setTimeout(()=>{let t=new CustomEvent(Sn,Cn);s.addEventListener(Sn,u),s.dispatchEvent(t),t.defaultPrevented||jn(e??document.body,{select:!0}),s.removeEventListener(Sn,u),Mn.remove(m)},0)}}},[s,l,u,m]);let h=p.useCallback(e=>{if(!n&&!r||m.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=En(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&jn(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&jn(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,m.paused]);return(0,N.jsx)(P.div,{tabIndex:-1,...o,ref:f,onKeyDown:h})},`FocusScope`));function Tn(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(jn(r,{select:t}),document.activeElement!==n)return}bn(Tn,`focusFirst`);function En(e){let t=Dn(e);return[On(t,e),On(t.reverse(),e)]}bn(En,`getTabbableEdges`);function Dn(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:bn(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}bn(Dn,`getTabbableCandidates`);function On(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):kn(r,{upTo:t})))return r}bn(On,`findVisible`);function kn(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}bn(kn,`isHidden`);function An(e){return e instanceof HTMLInputElement&&`select`in e}bn(An,`isSelectableInput`);function jn(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&An(e)&&t&&e.select()}}bn(jn,`focus`);var Mn=Nn();function Nn(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Pn(e,t),e.unshift(t)},remove(t){e=Pn(e,t),e[0]?.resume()}}}bn(Nn,`createFocusScopesStack`);function Pn(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}bn(Pn,`arrayRemove`);function Fn(e){return e.filter(e=>e.tagName!==`A`)}bn(Fn,`removeLinks`);var In=n({Portal:()=>Rn,Root:()=>zn}),Ln=Object.defineProperty,Rn=p.forwardRef(((e,t)=>Ln(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=p.useState(!1);z(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?f.createPortal((0,N.jsx)(P.div,{...r,ref:t}),o):null},`Portal`)),zn=Rn,Bn=0,Vn=null;function Hn(){p.useEffect(()=>{Vn||={start:Un(),end:Un()};let{start:e,end:t}=Vn;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Bn++,()=>{Bn===1&&(Vn?.start.remove(),Vn?.end.remove(),Vn=null),Bn=Math.max(0,Bn-1)}},[])}function Un(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Wn=function(){return Wn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Wn.apply(this,arguments)};function Gn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Kn(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var qn=`right-scroll-bar-position`,Jn=`width-before-scroll-bar`,Yn=`with-scroll-bars-hidden`,Xn=`--removed-body-scroll-bar-size`;function Zn(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Qn(e,t){var n=(0,p.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var $n=typeof window<`u`?p.useLayoutEffect:p.useEffect,er=new WeakMap;function tr(e,t){var n=Qn(t||null,function(t){return e.forEach(function(e){return Zn(e,t)})});return $n(function(){var t=er.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Zn(e,null)}),i.forEach(function(e){r.has(e)||Zn(e,a)})}er.set(n,e)},[e]),n}function nr(e){return e}function rr(e,t){t===void 0&&(t=nr);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function ir(e){e===void 0&&(e={});var t=rr(null);return t.options=Wn({async:!0,ssr:!1},e),t}var ar=function(e){var t=e.sideCar,n=Gn(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return p.createElement(r,Wn({},n))};ar.isSideCarExport=!0;function or(e,t){return e.useMedium(t),ar}var sr=ir(),cr=function(){},lr=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:cr,onWheelCapture:cr,onTouchMoveCapture:cr}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=Gn(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=tr([n,t]),w=Wn(Wn({},x),i);return p.createElement(p.Fragment,null,u&&p.createElement(S,{sideCar:sr,removeScrollBar:l,shards:d,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?p.cloneElement(p.Children.only(s),Wn(Wn({},w),{ref:C})):p.createElement(y,Wn({},w,{className:c,ref:C}),s))});lr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},lr.classNames={fullWidth:Jn,zeroRight:qn};var ur,dr=function(){if(ur)return ur;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function fr(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=dr();return t&&e.setAttribute(`nonce`,t),e}function pr(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function mr(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var hr=function(){var e=0,t=null;return{add:function(n){e==0&&(t=fr())&&(pr(t,n),mr(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},gr=function(){var e=hr();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},_r=function(){var e=gr();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},vr={left:0,top:0,right:0,gap:0},yr=function(e){return parseInt(e||``,10)||0},br=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[yr(n),yr(r),yr(i)]},xr=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return vr;var t=br(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Sr=_r(),Cr=`data-scroll-locked`,wr=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
2
  .${Yn} {
3
3
  overflow: hidden ${r};
4
4
  padding-right: ${s}px ${r};
@@ -1 +1 @@
1
- import{U as e,n as t}from"./page-Dngv8FMr.js";import{t as n}from"./use-shell-Dx92Huhb.js";import{V as r}from"./icons-BRl8DlXW.js";var i=e();function a(){let{principal:e,accessTampered:a}=n();return a?(0,i.jsxs)(t,{icon:(0,i.jsx)(r,{size:18}),label:`Integrity check failed`,title:`Your access is on hold`,children:[(0,i.jsxs)(`p`,{children:[`Your access record`,e!==null&&(0,i.jsxs)(i.Fragment,{children:[` `,`(`,(0,i.jsx)(`span`,{className:`mono`,children:e.id}),`)`]}),` `,`was changed outside coffre, so its vault refuses it until someone looks. Nothing you held is available meanwhile.`]}),(0,i.jsx)(`p`,{children:`Ask a coffre owner to remove you under Users and add you again, which starts your access over.`})]}):(0,i.jsxs)(t,{icon:(0,i.jsx)(r,{size:18}),label:`Registration required`,title:`You are not a member yet`,children:[(0,i.jsxs)(`p`,{children:[`Cloudflare Access knows who you are`,e!==null&&(0,i.jsxs)(i.Fragment,{children:[` `,`(`,(0,i.jsx)(`span`,{className:`mono`,children:e.id}),`)`]}),`, but this coffre instance has not registered that identity. Until it does, no projects, secrets, audit entries or API operations are available to you.`]}),(0,i.jsx)(`p`,{children:`Ask a coffre owner or root admin to add your Access email under Users.`})]})}export{a as component};
1
+ import{U as e,n as t}from"./page-CDuo3uft.js";import{t as n}from"./use-shell-BJwawvkh.js";import{V as r}from"./icons-BFziRUf9.js";var i=e();function a(){let{principal:e,accessTampered:a}=n();return a?(0,i.jsxs)(t,{icon:(0,i.jsx)(r,{size:18}),label:`Integrity check failed`,title:`Your access is on hold`,children:[(0,i.jsxs)(`p`,{children:[`Your access record`,e!==null&&(0,i.jsxs)(i.Fragment,{children:[` `,`(`,(0,i.jsx)(`span`,{className:`mono`,children:e.id}),`)`]}),` `,`was changed outside coffre, so its vault refuses it until someone looks. Nothing you held is available meanwhile.`]}),(0,i.jsx)(`p`,{children:`Ask a coffre owner to remove you under Users and add you again, which starts your access over.`})]}):(0,i.jsxs)(t,{icon:(0,i.jsx)(r,{size:18}),label:`Registration required`,title:`You are not a member yet`,children:[(0,i.jsxs)(`p`,{children:[`Cloudflare Access knows who you are`,e!==null&&(0,i.jsxs)(i.Fragment,{children:[` `,`(`,(0,i.jsx)(`span`,{className:`mono`,children:e.id}),`)`]}),`, but this coffre instance has not registered that identity. Until it does, no projects, secrets, audit entries or API operations are available to you.`]}),(0,i.jsx)(`p`,{children:`Ask a coffre owner or root admin to add your Access email under Users.`})]})}export{a as component};
@@ -1 +1 @@
1
- import{X as e,g as t,q as n,y as r}from"./page-Dngv8FMr.js";import{f as i}from"./suspense-q_eJaZ18.js";var a=e(n(),1);function o(){let e=i(),[n,o]=(0,a.useState)(!1),[s,c]=(0,a.useState)(null);async function l(n,{affects:i,onSuccess:a}){o(!0);let s;try{s=await n()}catch(e){c(r(e)),o(!1);return}c(null);try{await t(e,typeof i==`function`?i(s):i),await a?.(s)}catch{c(`The change was saved, but the page could not refresh. Reload before you retry.`)}o(!1)}return{pending:n,error:s,setError:c,run:l}}export{o as t};
1
+ import{X as e,g as t,q as n,y as r}from"./page-CDuo3uft.js";import{f as i}from"./suspense-Cnh1cNc1.js";var a=e(n(),1);function o(){let e=i(),[n,o]=(0,a.useState)(!1),[s,c]=(0,a.useState)(null);async function l(n,{affects:i,onSuccess:a}){o(!0);let s;try{s=await n()}catch(e){c(r(e)),o(!1);return}c(null);try{await t(e,typeof i==`function`?i(s):i),await a?.(s)}catch{c(`The change was saved, but the page could not refresh. Reload before you retry.`)}o(!1)}return{pending:n,error:s,setError:c,run:l}}export{o as t};