UNPKG

@fntio/infra-client

Version:

Self-hosted AWS access portal: credential vending, target-account trust, and grant-driven private networking as CDK stacks and constructs.

2 lines (1 loc) • 46.6 kB
import{d as mt}from"./chunk-H4AVFUDM.js";import{a as tt}from"./chunk-JZCV6CMZ.js";import{a as Ke}from"./chunk-6CP7VLN2.js";import{a as ct}from"./chunk-ONQGCLFI.js";import{a as oe}from"./chunk-64ITJKG6.js";import"./chunk-K4OFWFQE.js";import"./chunk-IKK5DQ3Z.js";import"./chunk-LEEL6MDA.js";import"./chunk-HUXCPIDO.js";import"./chunk-XPF5YBGU.js";import"./chunk-XUEIITMC.js";import{k as J,l as Re,m as Ve,n as Ie,o as Oe,p as q,q as Fe,r as Le}from"./chunk-Z2HQA5DO.js";import"./chunk-2DD7CZB4.js";import{a as $}from"./chunk-J7PZFXOE.js";import{a as le}from"./chunk-Z3HRRJWO.js";import{a as pt}from"./chunk-3PQNISIL.js";import{a as dt}from"./chunk-SH2F2DCQ.js";import{a as it}from"./chunk-V32HQ2F2.js";import{a as Ye,b as Qe,c as Ge,d as fe}from"./chunk-BADG46IJ.js";import{a as Xe}from"./chunk-Q736XS6E.js";import{a as Ze,b as Je}from"./chunk-TVCLJWZS.js";import{a as rt}from"./chunk-WM5A6BAU.js";import{a as at,d as lt,e as st}from"./chunk-JNANYFF2.js";import{b as nt,d as ot}from"./chunk-6NTXC6VK.js";import{a as et}from"./chunk-6HVGPPAG.js";import"./chunk-XOFD5DNL.js";import{a as $e}from"./chunk-PU4UT4HF.js";import"./chunk-Y2PHG5VS.js";import"./chunk-SYLZLLGS.js";import{a as je}from"./chunk-IVXFG5AJ.js";import{c as ie,d as Ue}from"./chunk-2SO4BVIT.js";import"./chunk-2BNLISUN.js";import{a as qe,b as ze,e as He,o as We,p as ae}from"./chunk-T5HLFYHP.js";import{c as ee}from"./chunk-KCJ5HNXP.js";import{a as Be}from"./chunk-3SC2PPSK.js";import{a as re}from"./chunk-B67EMZ2H.js";import{b as te}from"./chunk-MID2IYAR.js";import"./chunk-6GDWMGWO.js";import{a as ne}from"./chunk-7A4HO4AV.js";import{a as ke,b as De,c as X}from"./chunk-ZRDXKVPG.js";import{Aa as a,Ba as s,Ca as N,Eb as Ne,F as he,I as v,Ia as k,Ja as h,K as m,L as u,La as C,Na as l,Pb as Ee,Q as W,R as x,Ra as _e,Rb as Me,Sa as we,Ta as D,U as ve,Ua as Te,Va as I,Xa as d,Ya as y,Z as be,Za as T,_ as r,_a as j,ab as Ae,bb as K,cb as U,db as Y,eb as Se,fb as Pe,ga as L,gb as Q,jb as z,ka as E,kb as G,nb as Z,pb as B,qb as w,rb as R,sa as M,sb as V,ta as _,tb as A,u as xe,ua as g,ub as ge,wa as ye,xa as S,ya as P,za as p}from"./chunk-FYA6QUPZ.js";import{a as O,b as F,e as ue}from"./chunk-WFIHWVQO.js";var se=class n{api=v($);personalization=v(q);toast=v(ee);home=x(null);accounts=x(null);error=x("");favorites=w(()=>new Set(this.home()?.favoriteNumbers??[]));known=x(new Map);remember(t){t.length&&this.known.update(e=>{let o=new Map(e);for(let i of t)o.set(i.accountNumber,i);return o})}load(t={}){this.error.set(""),t.fresh&&(this.home.set(null),this.accounts.set(null)),this.api.home().subscribe({next:e=>{this.home.set(e);let o=e.sectioned?ht([...e.main,...e.favorites,...e.recent]):e.main;this.accounts.set(o),this.remember(o),this.personalization.hydrateFrom(o)},error:()=>{this.accounts.set([]),this.error.set("Could not load your accounts. Try reloading the page.")}})}isFavorite(t){return this.favorites().has(t)}toggleFavorite(t){let e=this.home();if(!e)return Promise.resolve();let o=!this.favorites().has(t.accountNumber),i=(c,f)=>F(O({},c),{favoriteNumbers:f?[...c.favoriteNumbers.filter(b=>b!==t.accountNumber),t.accountNumber]:c.favoriteNumbers.filter(b=>b!==t.accountNumber),favorites:f?[...c.favorites.filter(b=>b.accountNumber!==t.accountNumber),t]:c.favorites.filter(b=>b.accountNumber!==t.accountNumber)});return this.home.set(i(e,o)),new Promise(c=>this.api.setFavorite(t.accountNumber,o).subscribe({error:f=>{this.home.update(me=>me&&i(me,!o));let b=f?.error?.message;this.toast.error(b||"Could not save the favorite."),c()},complete:()=>c()}))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=he({token:n,factory:n.\u0275fac,providedIn:"root"})};function ht(n){let t=new Set;return n.filter(e=>t.has(e.accountNumber)?!1:(t.add(e.accountNumber),!0))}var vt=(n,t)=>t.label;function bt(n,t){if(n&1){let e=h();a(0,"div",1)(1,"app-banner",4),d(2," You no longer have access to this role \u2014 the grant was revoked. The dashboard will refresh. "),s(),a(3,"app-button",5),C("click",function(){m(e);let i=l();return u(i.closed.emit())}),d(4,"Close"),s()()}}function yt(n,t){if(n&1){let e=h();a(0,"div",1)(1,"app-banner",6),d(2),s(),a(3,"app-button",7),C("click",function(){m(e);let i=l();return u(i.vend())}),d(4,"Try again"),s()()}if(n&2){let e=l();r(2),y(e.error()),r(),p("loading",e.loading())}}function wt(n,t){n&1&&(a(0,"p",2),d(1,"Vending credentials\u2026"),s())}function Tt(n,t){n&1&&d(0," Expired \u2014 re-vend to keep working. ")}function At(n,t){if(n&1&&(d(0," Expires in "),a(1,"span",14),d(2),s(),a(3,"span",15),d(4," \xB7 renews itself; re-copy after it does"),s()),n&2){let e=l(2);r(2),y(e.remaining())}}function St(n,t){if(n&1){let e=h();a(0,"app-button",21),C("click",function(){m(e);let i=l(3);return u(i.resetProfileName())}),d(1,"\u21BA Reset"),s()}if(n&2){let e=l(3);p("title","Reset to "+e.resolved().suggested)}}function Pt(n,t){if(n&1&&(a(0,"p",13),d(1," Already written to "),a(2,"code",22),d(3,"~/.aws/credentials"),s(),d(4," as "),a(5,"code",22),d(6),s(),d(7," when the credentials were generated. To use a different profile name, change "),a(8,"span",23),d(9,"Profile name"),s(),d(10," above and click the button \u2014 it updates the existing entry. "),s()),n&2){let e=l(4);r(6),T("[",e.wroteProfile(),"]")}}function Nt(n,t){if(n&1&&(a(0,"app-banner",6),d(1),s()),n&2){let e=l(4);r(),y(e.writeError())}}function Et(n,t){if(n&1){let e=h();a(0,"div",20)(1,"app-button",7),C("click",function(){m(e);let i=l(3);return u(i.writeToFile())}),d(2," Write to ~/.aws/credentials "),s(),_(3,Pt,11,1,"p",13),_(4,Nt,2,1,"app-banner",6),s()}if(n&2){let e=l(3);r(),p("loading",e.writing()),r(2),g(e.wroteProfile()?3:-1),r(),g(e.writeError()?4:-1)}}function Mt(n,t){if(n&1){let e=h();a(0,"app-field",16)(1,"div",17)(2,"input",18),C("ngModelChange",function(i){m(e);let c=l(2);return u(c.setProfileName(i))})("blur",function(){m(e);let i=l(2);return u(i.revertProfileNameIfEmpty())}),s(),_(3,St,2,1,"app-button",19),s()(),_(4,Et,5,3,"div",20)}if(n&2){let e=l(2);p("hint",e.profileHint()),r(2),p("ngModel",e.profileName()),r(),g(e.resolved().source==="override"?3:-1),r(),g(e.bridge.isDesktop?4:-1)}}function kt(n,t){if(n&1&&(a(0,"div")(1,"span",24),d(2),s(),a(3,"div",12)(4,"div",25)(5,"code",26),d(6),s()(),a(7,"div",27),N(8,"app-copy-button",28),s()()()),n&2){let e=t.$implicit;r(2),y(e.label),r(4),y(e.value),r(2),p("text",e.value)}}function Dt(n,t){if(n&1&&(a(0,"div",1),S(1,kt,9,3,"div",null,vt),s()),n&2){let e=l(2);r(),P(e.fields())}}function Rt(n,t){if(n&1&&(a(0,"div",12)(1,"pre",29),d(2),s(),a(3,"div",30),N(4,"app-copy-button",28),s()()),n&2){let e=l(2);r(2),y(e.snippet()),r(2),p("text",e.snippet())}}function Vt(n,t){if(n&1){let e=h();a(0,"div",3)(1,"div",8)(2,"p",9),_(3,Tt,1,0)(4,At,5,1),s(),a(5,"app-button",10),C("click",function(){m(e);let i=l();return u(i.vend())}),d(6," Re-vend "),s()(),a(7,"app-tabs",11),Y("selectedChange",function(i){m(e);let c=l();return U(c.tab,i)||(c.tab=i),u(i)}),s(),_(8,Mt,5,4),_(9,Dt,3,0,"div",1)(10,Rt,5,2,"div",12),a(11,"p",13),d(12," Displayed once, never stored. Anyone with these values can act as this role until they expire. "),s()()}if(n&2){let e=l();r(2),I("text-danger",e.expired())("text-muted-foreground",!e.expired()),r(),g(e.expired()?3:4),r(2),p("loading",e.loading()),r(2),p("tabs",e.tabs),K("selected",e.tab),r(),g(e.tab()==="Credentials file"?8:-1),r(),g(e.tab()==="Fields"?9:10)}}var ut=["Fields","Env vars","Credentials file","PowerShell"],It=/^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/,Ot="Profile names are 1\u201364 characters: letters, digits, '.', '_' or '-'.",ce=class n{static AUTO_RENEW_MS=5*6e4;api=v($);personalization=v(q);cache=v(J);destroyRef=v(W);bridge=v(X);target=A.required();closed=V();grantRevoked=V();tabs=[...ut];tab=x(ut[0]);creds=x(null);loading=x(!1);error=x("");revoked=x(!1);profileName=x("");writing=x(!1);wroteProfile=x("");writeError=x("");now=x(Date.now());remaining=w(()=>{let t=this.creds();return t?ie(new Date(t.expiration).getTime()-this.now()):""});expired=w(()=>{let t=this.creds();return!!t&&new Date(t.expiration).getTime()<=this.now()});snippet=w(()=>{let t=this.creds();if(!t)return"";switch(this.tab()){case"Credentials file":return Ie(t,this.profileName());case"PowerShell":return Oe(t);default:return Ve(t)}});fields=w(()=>{let t=this.creds();return t?[{label:"Access key ID",value:t.accessKeyId},{label:"Secret access key",value:t.secretKey},{label:"Session token",value:t.sessionToken}]:[]});constructor(){let t=setInterval(()=>this.now.set(Date.now()),1e3);this.destroyRef.onDestroy(()=>clearInterval(t)),R(()=>{let e=this.creds();if(!e||this.loading()||this.error()||this.revoked())return;new Date(e.expiration).getTime()-this.now()<=n.AUTO_RENEW_MS&&this.vend()}),R(()=>{let e=this.creds();!e||!this.bridge.isDesktop||e.accessKeyId!==this.autoWrittenKey&&B(()=>this.doWrite(e,!1))})}ngOnInit(){let{accountNumber:t,role:e}=this.target();this.profileName.set(this.personalization.profileName(t,e));let o=this.cache.get(t,e);o?this.creds.set(o):this.vend()}vend(){let{accountNumber:t,role:e}=this.target();this.loading.set(!0),this.error.set(""),this.api.vendCredentials(t,e).subscribe({next:o=>{this.creds.set(o),this.cache.set(t,e,o),this.loading.set(!1)},error:o=>{this.loading.set(!1),o.status===403?(this.cache.clear(t,e),this.revoked.set(!0),this.grantRevoked.emit()):this.error.set(ae(o,"Could not vend credentials. Try again in a moment."))}})}autoWrittenKey="";writeToFile(){return ue(this,null,function*(){let t=this.creds();t&&(yield this.doWrite(t,!0))})}doWrite(t,e){return ue(this,null,function*(){let{accountNumber:o,role:i}=this.target();this.writing.set(!0),this.writeError.set("");try{let{profile:c}=yield this.bridge.writeCredentials({accountNumber:o,role:i,profile:this.profileName(),creds:t});this.wroteProfile.set(c),this.autoWrittenKey=t.accessKeyId;let f=this.profileName().trim();e&&f&&f!==this.personalization.profileName(o,i)&&this.personalization.setProfileName(o,i,f)}catch(c){if(e)if(ke(c)){let f=this.conflictSuggestion(this.profileName());this.profileName.set(f),this.writeError.set(`That profile name is taken by another connected backend \u2014 suggested "${f}"; Write again to use it, or pick your own.`)}else if(De(c)){let f=this.conflictSuggestion(this.profileName());this.profileName.set(f),this.writeError.set(`A profile with that name already exists in your ~/.aws/credentials and was not written by this app, so it was left alone \u2014 suggested "${f}"; Write again to use it, or pick your own.`)}else this.writeError.set("Could not write to ~/.aws/credentials.")}finally{this.writing.set(!1)}})}resolved=w(()=>{let{accountNumber:t,role:e}=this.target();return this.personalization.resolved(t,e)});profileHint=w(()=>{let t=this.resolved();switch(t.source){case"override":return`your own name \u2014 suggested: ${t.suggested}`;case"account":return"set by an admin for this account";case"role":return"set by an admin for this role";default:return"used in the [profile] header; saved for this role"}});setProfileName(t){this.profileName.set(t)}conflictSuggestion(t){let e=(this.bridge.project??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""),o=t.trim()||"profile";return(e&&!o.startsWith(`${e}-`)?`${e}-${o}`:`${o}-2`).slice(0,128)}revertProfileNameIfEmpty(){let{accountNumber:t,role:e}=this.target(),o=this.profileName().trim();o===""?(this.personalization.resetProfileName(t,e),this.profileName.set(this.personalization.profileName(t,e))):It.test(o)?(this.writeError.set(""),this.personalization.setProfileName(t,e,o)):(this.writeError.set(Ot),this.profileName.set(this.personalization.profileName(t,e)))}resetProfileName(){let{accountNumber:t,role:e}=this.target();this.personalization.resetProfileName(t,e),this.profileName.set(this.personalization.profileName(t,e))}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=L({type:n,selectors:[["app-credentials-dialog"]],inputs:{target:[1,"target"]},outputs:{closed:"closed",grantRevoked:"grantRevoked"},decls:5,vars:2,consts:[["width","max-w-2xl",3,"closed","title"],[1,"space-y-3"],[1,"py-6","text-center","text-sm","text-muted-foreground"],[1,"space-y-5"],["tone","warning"],["variant","outline",3,"click"],["tone","danger"],[3,"click","loading"],[1,"flex","items-center","justify-between"],[1,"text-sm"],["variant","outline",3,"click","loading"],[3,"selectedChange","tabs","selected"],[1,"relative"],[1,"text-xs","text-muted-foreground"],[1,"font-semibold","tabular-nums","text-brand-text"],[1,"text-placeholder"],["label","Profile name",3,"hint"],[1,"flex","items-center","gap-2"],[1,"ui-input",3,"ngModelChange","blur","ngModel"],["variant","outline","size","sm",3,"title"],[1,"space-y-2"],["variant","outline","size","sm",3,"click","title"],[1,"font-mono"],[1,"font-medium"],[1,"mb-1","block","text-sm","font-medium","text-surface-foreground"],[1,"overflow-x-auto","rounded-lg","bg-gray-900","p-3","pr-14","ring-1","ring-brand/20"],[1,"whitespace-nowrap","font-mono","text-xs","text-gray-100"],[1,"absolute","right-2","top-1/2","-translate-y-1/2"],["variant","icon",3,"text"],[1,"max-h-72","overflow-auto","rounded-lg","bg-gray-900","p-4","pr-14","text-xs","leading-relaxed","text-gray-100","ring-1","ring-brand/20"],[1,"absolute","right-2","top-2"]],template:function(e,o){e&1&&(a(0,"app-dialog",0),C("closed",function(){return o.closed.emit()}),_(1,bt,5,0,"div",1)(2,yt,5,2,"div",1)(3,wt,2,0,"p",2)(4,Vt,13,10,"div",3),s()),e&2&&(p("title",o.target().role+" in account "+o.target().accountNumber),r(),g(o.revoked()?1:o.error()?2:o.creds()?4:3))},dependencies:[We,qe,ze,He,re,ne,oe,Be,je,it],encapsulation:2})};function Ft(n,t){n&1&&N(0,"app-copy-button",8),n&2&&p("text",t)}function Lt(n,t){n&1&&(a(0,"app-chip",10),d(1),s()),n&2&&(r(),y(t))}function Bt(n,t){if(n&1&&(a(0,"span",5),d(1),s()),n&2){let e=l();p("title",e.dims()),r(),y(e.dims())}}function $t(n,t){if(n&1&&(a(0,"span",21),d(1),s(),N(2,"app-copy-button",22)),n&2){let e=l();p("title","CLI profile "+e.profile()),r(),y(e.profile()),r(),p("text",e.profile())}}function qt(n,t){if(n&1&&(a(0,"app-chip",13),d(1),s()),n&2){let e=l();r(),y(e.grant())}}function zt(n,t){if(n&1&&(a(0,"app-chip",14),N(1,"app-icon",23),d(2),s()),n&2){let e=l();r(),p("strokeWidth",2),r(),T("",e.creds()," ")}}function Ht(n,t){if(n&1){let e=h();a(0,"button",24),C("click",function(){m(e);let i=l();return u(i.favoriteToggle.emit())}),N(1,"app-icon",25),s()}if(n&2){let e=l();I("on",e.favorite()),p("title",e.favorite()?"In your favorites \u2014 click to remove":"Add to your favorites"),M("aria-pressed",e.favorite())("aria-label",(e.favorite()?"Remove ":"Add ")+e.account()+(e.favorite()?" from favorites":" to favorites")),r(),p("set",e.favorite()?"solid":void 0)}}function Wt(n,t){if(n&1){let e=h();a(0,"button",24),C("click",function(){m(e);let i=l();return u(i.autoLoginToggle.emit())}),N(1,"app-icon",26),s()}if(n&2){let e=l();I("on",e.autoLogin()),p("title",e.autoLogin()?"Auto-login on \u2014 click to turn off":"Auto-login off \u2014 click to vend and write this role's credentials when you open the app"),M("aria-pressed",e.autoLogin())("aria-label","Auto-login on sign-in for "+e.role()),r(),p("set",e.autoLogin()?"solid":void 0)}}function jt(n,t){n&1&&N(0,"app-spinner",18)}function Kt(n,t){n&1&&N(0,"app-icon",19)}var de=class n{icon=A("key");role=A.required();roleArn=A("");account=A.required();id=A.required();rawId=A();env=A();dims=A("");profile=A("");grant=A("");creds=A("");favorite=A(null);autoLogin=A(null);consoleBusy=A(!1);favoriteToggle=V();autoLoginToggle=V();console=V();getCredentials=V();static \u0275fac=function(e){return new(e||n)};static \u0275cmp=L({type:n,selectors:[["app-role-row"]],hostAttrs:["role","row",1,"block"],inputs:{icon:[1,"icon"],role:[1,"role"],roleArn:[1,"roleArn"],account:[1,"account"],id:[1,"id"],rawId:[1,"rawId"],env:[1,"env"],dims:[1,"dims"],profile:[1,"profile"],grant:[1,"grant"],creds:[1,"creds"],favorite:[1,"favorite"],autoLogin:[1,"autoLogin"],consoleBusy:[1,"consoleBusy"]},outputs:{favoriteToggle:"favoriteToggle",autoLoginToggle:"autoLoginToggle",console:"console",getCredentials:"getCredentials"},decls:29,vars:19,consts:[[1,"row"],[1,"grid","h-8","w-8","shrink-0","place-items-center","rounded-lg","bg-muted","text-muted-foreground"],[1,"h-4","w-4",3,"name"],[1,"min-w-0"],[1,"line-clamp-2","break-words","text-[13.5px]","font-semibold","leading-snug","text-surface-foreground",3,"title"],[1,"line-clamp-2","break-words","text-xs","leading-snug","text-muted-foreground",3,"title"],[1,"flex","items-center","gap-1","whitespace-nowrap","text-xs","text-muted-foreground"],[1,"font-mono","tabular-nums"],["variant","icon","label","Copy account ID",3,"text"],[1,"hidden","min-w-0","items-center","gap-1.5","md:flex"],["tone","neutral",1,"shrink-0"],[1,"hidden","min-w-0","items-center","gap-1","lg:flex"],[1,"flex","min-w-0","flex-wrap","items-center","gap-1.5"],["tone","warning"],["tone","success",1,"tabular-nums"],[1,"flex","shrink-0","items-center","justify-end","gap-0.5"],["type","button",1,"act",3,"on","title"],["type","button",1,"lnk",3,"click","disabled"],["sizeClass","h-3.5 w-3.5"],["name","external-link",1,"h-3.5","w-3.5"],["type","button",1,"lnk","brand",3,"click"],[1,"line-clamp-2","break-words","font-mono","text-xs","leading-snug","text-muted-foreground",3,"title"],["variant","icon","label","Copy profile name",3,"text"],["name","clock",1,"h-3","w-3",3,"strokeWidth"],["type","button",1,"act",3,"click","title"],["name","star",1,"h-3.5","w-3.5",3,"set"],["name","bolt",1,"h-3.5","w-3.5",3,"set"]],template:function(e,o){if(e&1&&(a(0,"div",0)(1,"span",1),N(2,"app-icon",2),s(),a(3,"span",3)(4,"span",4),d(5),s(),a(6,"span",5),d(7),s(),a(8,"span",6)(9,"span",7),d(10),s(),_(11,Ft,1,1,"app-copy-button",8),s()(),a(12,"span",9),_(13,Lt,2,1,"app-chip",10),_(14,Bt,2,2,"span",5),s(),a(15,"span",11),_(16,$t,3,3),s(),a(17,"span",12),_(18,qt,2,1,"app-chip",13),_(19,zt,3,2,"app-chip",14),s(),a(20,"span",15),_(21,Ht,2,6,"button",16),_(22,Wt,2,6,"button",16),a(23,"button",17),C("click",function(){return o.console.emit()}),_(24,jt,1,0,"app-spinner",18)(25,Kt,1,0,"app-icon",19),d(26," Console "),s(),a(27,"button",20),C("click",function(){return o.getCredentials.emit()}),d(28," Get credentials "),s()()()),e&2){let i,c;r(2),p("name",o.icon()),r(2),p("title",o.roleArn()||o.role()),r(),y(o.role()),r(),p("title",o.account()),r(),y(o.account()),r(3),y(o.id()),r(),g((i=o.rawId())?11:-1,i),r(2),g((c=o.env())?13:-1,c),r(),g(o.dims()?14:-1),r(2),g(o.profile()?16:-1),r(2),g(o.grant()?18:-1),r(),g(o.creds()?19:-1),r(2),g(o.favorite()!==null?21:-1),r(),g(o.autoLogin()!==null?22:-1),r(),p("disabled",o.consoleBusy()),M("aria-busy",o.consoleBusy()||null)("aria-label","Console for "+o.role()+" in "+o.account()),r(),g(o.consoleBusy()?24:25),r(3),M("aria-label","Get credentials for "+o.role()+" in "+o.account())}},dependencies:[te,st,oe,$e],styles:[".row[_ngcontent-%COMP%]{display:grid;grid-template-columns:32px minmax(0,2fr) minmax(0,1fr) minmax(0,1.25fr) minmax(0,.8fr) auto;align-items:center;gap:12px;padding:9px 12px;min-height:60px}@media(max-width:1023px){.row[_ngcontent-%COMP%]{grid-template-columns:32px minmax(0,2fr) minmax(0,1.1fr) minmax(0,.8fr) auto}}@media(max-width:767px){.row[_ngcontent-%COMP%]{grid-template-columns:32px minmax(0,2fr) minmax(0,.8fr) auto}}.act[_ngcontent-%COMP%]{display:inline-grid;place-items:center;height:28px;width:28px;border-radius:6px;color:var(--text-secondary)}.act[_ngcontent-%COMP%]:hover{background:var(--muted);color:var(--surface-foreground)}.act.on[_ngcontent-%COMP%]{color:var(--brand)}.lnk[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:5px;height:28px;padding:0 8px;border-radius:6px;font-size:12.5px;color:var(--muted-foreground);white-space:nowrap}.lnk[_ngcontent-%COMP%]:hover{background:var(--muted)}.lnk[_ngcontent-%COMP%]:disabled{cursor:progress}.lnk.brand[_ngcontent-%COMP%]{color:var(--brand-text)}"]})};var Ut=["prod","staging","dev","sandbox"];function gt(n,t,e){let o=n.dims?.stage?.toLowerCase();if(e&&o){let c=e[o];return Ut.includes(c)?c:"sandbox"}let i=`${n.name??""} ${t.role} ${t.description??""}`.toLowerCase();return/prod|prd|live/.test(i)?"prod":/stag|preprod|test|qa|uat/.test(i)?"staging":/dev|eng/.test(i)?"dev":"sandbox"}var Yt=["panelTpl"],Qt=["toolbar"],Gt=(n,t)=>({$implicit:n,role:t,origin:"search"}),Zt=(n,t)=>({$implicit:n,role:t,origin:"signed-in"}),pe=n=>({$implicit:n}),Jt=(n,t)=>({$implicit:n,role:t,origin:"other"}),Xt=(n,t)=>t.accountNumber+"#"+t.role,en=(n,t)=>t.id,tn=(n,t)=>t.key,H=(n,t)=>t.accountNumber,Ct=(n,t)=>t.roleArn,xt=(n,t)=>t.account.accountNumber+"#"+t.role.role;function nn(n,t){if(n&1&&(a(0,"app-banner",7),d(1),s()),n&2){let e=l();r(),y(e.store.error())}}function on(n,t){n&1&&(a(0,"div",8),N(1,"app-skeleton",11)(2,"app-skeleton",11)(3,"app-skeleton",11),s())}function rn(n,t){if(n&1){let e=h();a(0,"button",19),C("click",function(){let i=m(e).$implicit,c=l(2);return u(c.jumpTo(i.id))}),d(1),a(2,"span",20),d(3),s()()}if(n&2){let e=t.$implicit;r(),T("",e.label," "),r(2),T("\xB7 ",e.count)}}function an(n,t){if(n&1&&(a(0,"option",23),d(1),s()),n&2){let e=t.$implicit,o=l(3);p("value",e),r(),T("By ",o.dimensions.label(e).toLowerCase())}}function ln(n,t){if(n&1){let e=h();a(0,"select",21),C("change",function(i){m(e);let c=l(2);return u(c.groupBy.set(i.target.value))}),a(1,"option",22),d(2,"No grouping"),s(),S(3,an,2,2,"option",23,ye),s(),a(5,"app-filter-popup",24),C("filtersChange",function(i){m(e);let c=l(2);return u(c.setDimFilters(i))}),s()}if(n&2){let e=l(2);p("value",e.groupBy()),r(3),P(e.DIMENSION_KEYS),r(2),p("sections",e.dimSections())("filters",e.dimFilters())}}function sn(n,t){n&1&&(a(0,"p",25),d(1,"Searching\u2026"),s())}function cn(n,t){if(n&1&&(a(0,"app-banner",7),d(1),s()),n&2){let e=l();r(),y(e.error())}}function dn(n,t){if(n&1&&d(0),n&2){let e=l(4);j(' Nothing matches "',e.searchText(),'"',e.dimFilters().length?" with these filters":"",". Try a different account or role name. ")}}function pn(n,t){n&1&&d(0," None of your accounts match these filters. ")}function mn(n,t){if(n&1&&(a(0,"p",26),_(1,dn,1,2)(2,pn,1,0),s()),n&2){let e=l(3);r(),g(e.searchText().trim()?1:2)}}function un(n,t){if(n&1&&(a(0,"h3",30),d(1),a(2,"span",20),d(3),s()()),n&2){let e=l().$implicit;r(),T("",e.label," "),r(2),T("\xB7 ",e.items.length)}}function _n(n,t){n&1&&k(0)}function gn(n,t){if(n&1&&E(0,_n,1,0,"ng-container",31),n&2){let e=t.$implicit,o=l().$implicit;l(5);let i=D(13);p("ngTemplateOutlet",i)("ngTemplateOutletContext",G(2,Gt,o,e))}}function fn(n,t){if(n&1&&S(0,gn,1,5,"ng-container",null,Ct),n&2){let e=t.$implicit;P(e.roles)}}function Cn(n,t){if(n&1&&(_(0,un,4,2,"h3",30),S(1,fn,2,0,null,null,H)),n&2){let e=t.$implicit;g(e.key!==null?0:-1),r(),P(e.items)}}function xn(n,t){if(n&1){let e=h();a(0,"app-load-more",32),C("reached",function(){m(e);let i=l(2);return u(i.loadMore())}),s()}}function hn(n,t){if(n&1&&(a(0,"div",27),S(1,Cn,3,1,null,null,tn),s(),_(3,xn,1,0,"app-load-more",28),a(4,"p",29),d(5),s()),n&2){let e=l(),o=l(2);r(),P(o.groupsOf(e.items())),r(2),g(e.hasMore()?3:-1),r(2),Ae(" ",e.items().length," of ",e.total()," matching account",e.total()===1?"":"s","",e.hasMore()?" \u2014 keep typing to narrow, or scroll for more":""," ")}}function vn(n,t){if(n&1&&(a(0,"div",17),_(1,sn,2,0,"p",25)(2,cn,2,1,"app-banner",7)(3,mn,3,1,"p",26)(4,hn,6,5),s()),n&2){let e=t;r(),g(e.initial()?1:e.error()?2:e.items().length===0?3:4)}}function bn(n,t){n&1&&k(0)}function yn(n,t){if(n&1&&E(0,bn,1,0,"ng-container",31),n&2){let e=t.$implicit;l(3);let o=D(13);p("ngTemplateOutlet",o)("ngTemplateOutletContext",G(2,Zt,e.account,e.role))}}function wn(n,t){if(n&1&&(a(0,"h2",33),d(1,"Signed in now "),a(2,"span",20),d(3),s()(),a(4,"div",34),S(5,yn,1,5,"ng-container",null,xt),s()),n&2){let e=l(2);r(3),T("\xB7 ",e.signedIn().length),r(2),P(e.signedIn())}}function Tn(n,t){n&1&&k(0)}function An(n,t){if(n&1&&E(0,Tn,1,0,"ng-container",31),n&2){let e=t.$implicit;l(3);let o=D(11);p("ngTemplateOutlet",o)("ngTemplateOutletContext",z(2,pe,e))}}function Sn(n,t){if(n&1&&(a(0,"h2",35),d(1,"Favorites "),a(2,"span",20),d(3),s()(),a(4,"div",36),S(5,An,1,4,"ng-container",null,H),s()),n&2){l();let e=Q(0);r(3),T("\xB7 ",e.favorites.length),r(2),P(e.favorites)}}function Pn(n,t){n&1&&k(0)}function Nn(n,t){if(n&1&&E(0,Pn,1,0,"ng-container",31),n&2){let e=t.$implicit;l(3);let o=D(11);p("ngTemplateOutlet",o)("ngTemplateOutletContext",z(2,pe,e))}}function En(n,t){if(n&1&&(a(0,"h2",37),d(1,"Main "),a(2,"span",20),d(3),s()(),a(4,"div",36),S(5,Nn,1,4,"ng-container",null,H),s()),n&2){l();let e=Q(0);r(3),T("\xB7 ",e.main.length),r(2),P(e.main)}}function Mn(n,t){n&1&&k(0)}function kn(n,t){if(n&1&&E(0,Mn,1,0,"ng-container",31),n&2){let e=t.$implicit;l(3);let o=D(11);p("ngTemplateOutlet",o)("ngTemplateOutletContext",z(2,pe,e))}}function Dn(n,t){if(n&1&&(a(0,"h2",38),d(1,"Recently vended "),a(2,"span",20),d(3),s()(),a(4,"div",36),S(5,kn,1,4,"ng-container",null,H),s()),n&2){l();let e=Q(0);r(3),T("\xB7 ",e.recent.length),r(2),P(e.recent)}}function Rn(n,t){n&1&&(a(0,"p",25),d(1,"Loading\u2026"),s())}function Vn(n,t){if(n&1&&(a(0,"app-banner",7),d(1),s()),n&2){let e=l(2);r(),y(e.error())}}function In(n,t){n&1&&k(0)}function On(n,t){if(n&1&&E(0,In,1,0,"ng-container",31),n&2){let e=t.$implicit;l(5);let o=D(13);p("ngTemplateOutlet",o)("ngTemplateOutletContext",G(2,Jt,e.account,e.role))}}function Fn(n,t){if(n&1){let e=h();a(0,"app-load-more",32),C("reached",function(){m(e);let i=l(5);return u(i.showMoreOther())}),s(),a(1,"p",41),d(2),s()}if(n&2){let e=l(3),o=l(2);r(2),j("",o.otherVisible().length," roles shown of ",e.total()," accounts \u2014 more load as you scroll; the search above is the short way")}}function Ln(n,t){if(n&1&&(a(0,"div",27),S(1,On,1,5,"ng-container",null,xt),s(),_(3,Fn,3,2)),n&2){let e=l(2),o=l(2);r(),P(o.otherVisible()),r(2),g(o.otherVisible().length<o.otherRows().length||e.hasMore()?3:-1)}}function Bn(n,t){if(n&1&&(a(0,"h2",39),d(1,"Other accounts "),a(2,"span",20),d(3),s()(),a(4,"div",40),_(5,Rn,2,0,"p",25)(6,Vn,2,1,"app-banner",7)(7,Ln,4,1),s()),n&2){let e=l();r(3),T("\xB7 ",e.total()),r(2),g(e.initial()?5:e.error()?6:7)}}function $n(n,t){n&1&&_(0,Bn,8,2),n&2&&g(t.total()>0?0:-1)}function qn(n,t){n&1&&(a(0,"p",18),d(1," Nothing pinned yet \u2014 star an account in the table or the search results to keep it on top. "),s())}function zn(n,t){if(n&1){let e=h();Se(0),a(1,"div",12,3),C("keydown.escape",function(){m(e);let i=l();return u(i.closeSearch())}),a(3,"nav",13),S(4,rn,4,2,"button",14,en),s(),a(6,"div",15),C("focusin",function(){m(e);let i=l();return u(i.searchOpen.set(!0))}),a(7,"app-search-input",16),C("valueChange",function(i){m(e);let c=l();return u(c.search(i))}),s(),_(8,ln,6,3),_(9,vn,5,1,"div",17),s()(),_(10,wn,7,1),_(11,Sn,7,1),_(12,En,7,1),_(13,Dn,7,1),_(14,$n,1,1),_(15,qn,2,0,"p",18)}if(n&2){let e,o,i=l(),c=Pe(i.store.home());r(4),P(i.jumps()),r(3),p("value",i.searchText()),r(),g(i.dimensions.enabled?8:-1),r(),g((e=i.resultsOpen()&&i.browse())?9:-1,e),r(),g(i.signedIn().length?10:-1),r(),g(c.favorites.length?11:-1),r(),g(c.main.length?12:-1),r(),g(c.recent.length?13:-1),r(),g((o=i.other())?14:-1,o),r(),g(!i.signedIn().length&&!c.main.length&&!c.favorites.length&&!c.recent.length?15:-1)}}function Hn(n,t){if(n&1){let e=h();a(0,"app-empty-state",9),d(1," An administrator needs to grant you a role before anything shows up here \u2014 you can ask for one now. "),a(2,"span",42)(3,"app-button",43),C("click",function(){m(e);let i=l();return u(i.openRequest(null))}),d(4,"Request a role"),s()()()}}function Wn(n,t){if(n&1&&(a(0,"app-empty-state",46),d(1),s()),n&2){let e=l(2);r(),T(' Nothing matches "',e.query(),'". Try a different account or role name. ')}}function jn(n,t){n&1&&k(0)}function Kn(n,t){if(n&1&&E(0,jn,1,0,"ng-container",31),n&2){let e=t.$implicit;l(3);let o=D(11);p("ngTemplateOutlet",o)("ngTemplateOutletContext",z(2,pe,e))}}function Un(n,t){if(n&1){let e=h();a(0,"app-load-more",32),C("reached",function(){m(e);let i=l(3);return u(i.window.loadMore())}),s()}}function Yn(n,t){if(n&1&&(a(0,"div",36),S(1,Kn,1,4,"ng-container",null,H),s(),_(3,Un,1,0,"app-load-more",28)),n&2){let e=l(2);r(),P(e.window.items()),r(2),g(e.window.hasMore()?3:-1)}}function Qn(n,t){if(n&1){let e=h();a(0,"div",44)(1,"app-search-input",45),Y("valueChange",function(i){m(e);let c=l();return U(c.query,i)||(c.query=i),u(i)}),s()(),_(2,Wn,2,1,"app-empty-state",46)(3,Yn,4,1)}if(n&2){let e=l();r(),K("value",e.query),r(),g(e.filtered().length===0?2:3)}}function Gn(n,t){if(n&1&&(a(0,"span",50),d(1),s()),n&2){let e=l(2);p("title",e.dimensions.label("tenant")+" \xB7 "+e.dimensions.label("project")+" \xB7 "+e.dimensions.label("stage")),r(),T("\xB7 ",t)}}function Zn(n,t){if(n&1){let e=h();a(0,"button",54),C("click",function(){m(e);let i=l().$implicit,c=l();return u(c.store.toggleFavorite(i))}),N(1,"app-icon",55),s()}if(n&2){let e=l().$implicit,o=l();I("on",o.store.isFavorite(e.accountNumber)),p("title",o.store.isFavorite(e.accountNumber)?"In your favorites \u2014 click to remove":"Add to your favorites"),M("aria-pressed",o.store.isFavorite(e.accountNumber))("aria-label",(o.store.isFavorite(e.accountNumber)?"Remove ":"Add ")+o.titleOf(e)+(o.store.isFavorite(e.accountNumber)?" from favorites":" to favorites")),r(),p("set",o.store.isFavorite(e.accountNumber)?"solid":void 0)}}function Jn(n,t){if(n&1){let e=h();a(0,"app-role-card",56),C("profileRename",function(i){let c=m(e).$implicit,f=l().$implicit,b=l();return u(b.renameProfile(f,c,i))})("profileReset",function(){let i=m(e).$implicit,c=l().$implicit,f=l();return u(f.personalization.resetProfileName(c.accountNumber,i.role))})("autoLoginToggle",function(){let i=m(e).$implicit,c=l().$implicit,f=l();return u(f.toggleAutoLogin(c.accountNumber,i.role))})("getCredentials",function(){let i=m(e).$implicit,c=l().$implicit,f=l();return u(f.vendTarget.set({accountNumber:c.accountNumber,role:i.role}))})("console",function(){let i=m(e).$implicit,c=l().$implicit,f=l();return u(f.openConsole(c.accountNumber,i.role))}),s()}if(n&2){let e=t.$implicit,o=l().$implicit,i=l();p("env",i.cardEnv(o,e))("account",i.roleDisplayOf(e))("role",i.roleDisplayOf(e))("showRoleRow",!1)("profile",i.profileOf(o,e))("profileSource",i.personalization.resolved(o.accountNumber,e.role).source)("profileSuggested",i.personalization.resolved(o.accountNumber,e.role).suggested)("profileEditable",!0)("id",i.formatId(o.accountNumber))("rawId",o.accountNumber)("grant",i.grantLabel(e))("creds",i.credsFor(o.accountNumber,e.role))("autoLogin",i.bridge.isDesktop?i.autoLogin.isEnabled(o.accountNumber,e.role):null)("icon",i.cardIcon(e))("consoleBusy",i.consoleBusyFor(o.accountNumber,e.role)),M("title",e.roleArn)}}function Xn(n,t){if(n&1&&(a(0,"section",47)(1,"header",48)(2,"span",49),d(3),s(),a(4,"span",20),d(5),s(),_(6,Gn,2,2,"span",50),_(7,Zn,2,6,"button",51),s(),a(8,"div",52),S(9,Jn,1,16,"app-role-card",53,Ct),s()()),n&2){let e,o,i=t.$implicit,c=l();Te("flex-grow",i.roles.length)("flex-basis",c.groupBasis(i.roles.length))("max-width",c.groupMax(i.roles.length)),r(3),y(c.titleOf(i)),r(2),j("\xB7 ",i.roles.length," role",i.roles.length===1?"":"s"),r(),g((e=c.dimensions.summary(i.dims))?6:-1,e),r(),g((o=c.store.home())!=null&&o.sectioned?7:-1),r(2),P(i.roles)}}function eo(n,t){if(n&1){let e=h();a(0,"app-role-row",57),C("favoriteToggle",function(){let i=m(e),c=i.$implicit,f=i.origin,b=l();return u(b.toggleFavorite(c,f))})("autoLoginToggle",function(){let i=m(e),c=i.$implicit,f=i.role,b=l();return u(b.toggleAutoLogin(c.accountNumber,f.role))})("console",function(){let i=m(e),c=i.$implicit,f=i.role,b=l();return u(b.openConsole(c.accountNumber,f.role))})("getCredentials",function(){let i=m(e),c=i.$implicit,f=i.role,b=l();return u(b.vendTarget.set({accountNumber:c.accountNumber,role:f.role}))}),s()}if(n&2){let e=t.$implicit,o=t.role,i=l();p("icon",i.cardIcon(o))("role",i.roleDisplayOf(o))("roleArn",o.roleArn)("account",i.titleOf(e))("id",i.formatId(e.accountNumber))("rawId",e.accountNumber)("env",i.cardEnv(e,o))("dims",i.dimensions.summary(e.dims)||"")("profile",i.profileOf(e,o))("grant",i.grantLabel(o))("creds",i.credsFor(e.accountNumber,o.role))("favorite",i.store.isFavorite(e.accountNumber))("autoLogin",i.bridge.isDesktop?i.autoLogin.isEnabled(e.accountNumber,o.role):null)("consoleBusy",i.consoleBusyFor(e.accountNumber,o.role))}}function to(n,t){if(n&1){let e=h();a(0,"app-credentials-dialog",58),C("closed",function(){m(e);let i=l();return u(i.vendTarget.set(null))})("grantRevoked",function(){m(e);let i=l();return u(i.store.load())}),s()}if(n&2){let e=t.$implicit;p("target",e)}}function no(n,t){if(n&1){let e=h();a(0,"app-panel",59),C("closed",function(){m(e);let i=l();return u(i.closeRequest())}),a(1,"app-request-role-form",60),C("created",function(){m(e);let i=l();return u(i.requestSent.set(!0))})("closed",function(){m(e);let i=l();return u(i.closeRequest())}),s()()}if(n&2){let e=l();p("title",e.requestSent()?"Request sent":"Request a role"),r(),p("presetAccount",e.requestAccount())}}var ft=class n{store=v(se);dimensions=v(Ge);api=v($);toast=v(ee);cache=v(J);autoLogin=v(Re);personalization=v(q);autoVend=v(Fe);bridge=v(X);destroyRef=v(W);route=v(Ee);router=v(Me);vendTarget=x(null);vendTargets=w(()=>this.vendTarget()?[this.vendTarget()]:[]);requestOpen=x(!1);requestSent=x(!1);requestAccount=x(null);panelTpl=ge("panelTpl");toolbar=ge("toolbar");host=v(ve);query=x("");searchText=x("");searchOpen=x(!1);browse=x(null);other=x(null);otherRows=w(()=>(this.other()?.items()??[]).flatMap(t=>t.roles.map(e=>({account:t,role:e}))));otherShown=x(le);otherVisible=w(()=>this.otherRows().slice(0,this.otherShown()));showMoreOther(){let t=this.otherShown()+2*le;this.otherShown.set(t),t>this.otherRows().length&&this.other()?.loadMore()}consoleBusy=x(new Set);consoleKey(t,e){return`${t}#${e}`}consoleBusyFor(t,e){return this.consoleBusy().has(this.consoleKey(t,e))}setConsoleBusy(t,e){this.consoleBusy.update(o=>{let i=new Set(o);return e?i.add(t):i.delete(t),i})}openRequest(t){this.requestAccount.set(t),this.requestOpen.set(!0)}closeRequest(){this.requestOpen.set(!1),this.requestSent.set(!1),this.requestAccount.set(null)}search(t){this.searchText.set(t),this.searchOpen.set(!0),this.browse()?.setQuery(t)}resultsOpen=w(()=>this.searchOpen()&&this.searching());closeSearch(){this.searchOpen.set(!1)}jumps=w(()=>{let t=this.store.home();if(!t?.sectioned)return[];let e=[];this.signedIn().length&&e.push({id:"section-signed-in",label:"Signed in now",count:this.signedIn().length}),t.favorites.length&&e.push({id:"section-favorites",label:"Favorites",count:t.favorites.length}),t.main.length&&e.push({id:"section-main",label:"Main",count:t.main.length}),t.recent.length&&e.push({id:"section-recent",label:"Recently vended",count:t.recent.length});let o=this.other();return o&&o.total()>0&&e.push({id:"section-other",label:"Other accounts",count:o.total()}),e});jumpTo(t){this.closeSearch();let e=this.host.nativeElement.querySelector(`[data-testid="${t}"]`),o=e?.nextElementSibling,i=e?.closest(".overflow-y-auto");if(!e||!o||!i)return;let c=this.toolbar()?.nativeElement.offsetHeight??0,f=i.scrollTop+o.getBoundingClientRect().top-i.getBoundingClientRect().top-c-e.offsetHeight;i.scrollTo({top:Math.max(0,f),behavior:"smooth"})}onDocumentMousedown(t){this.searchOpen()&&!t.target?.closest?.(".searchbox")&&this.searchOpen.set(!1)}signedIn=w(()=>{let t=this.now(),e=this.store.known();return this.cache.live(t).sort((o,i)=>o.expiration.localeCompare(i.expiration)).flatMap(o=>{let i=e.get(o.accountNumber),c=i?.roles.find(f=>f.role===o.role);return i&&c?[{account:i,role:c}]:[]})});toggleFavorite(t,e){this.store.toggleFavorite(t).then(()=>{e==="other"&&this.other()?.reload()})}dimFilters=x([]);dimSections=w(()=>this.dimensions.sections(this.browse()?.facets()));searching=w(()=>this.searchText().trim().length>0||this.dimFilters().length>0);groupBy=x("");DIMENSION_KEYS=Ye;groupsOf(t){let e=this.groupBy();if(!e)return[{key:null,label:"",items:[...t]}];let o=new Map;for(let i of t){let c=i.dims?.[e]??Qe;(o.get(c)??o.set(c,[]).get(c)).push(i)}return[...o.entries()].map(([i,c])=>({key:i,label:i,items:c}))}setDimFilters(t){this.dimFilters.set(t),this.searchOpen.set(!0);let e={};for(let o of t)(e[o.key]??=[]).push(o.value);this.browse()?.setFilters(e)}now=x(Date.now());filtered=w(()=>{let t=this.store.accounts()??[],e=this.query().trim().toLowerCase();return e?t.map(o=>{if(o.accountNumber.toLowerCase().includes(e)||o.name?.toLowerCase().includes(e))return o;let i=o.roles.filter(c=>c.role.toLowerCase().includes(e)||c.roleArn.toLowerCase().includes(e)||c.description?.toLowerCase().includes(e));return F(O({},o),{roles:i})}).filter(o=>o.roles.length>0):t});window=pt(this.filtered,8);groupBasis(t){return`${t*300+(t-1)*16+36}px`}groupMax(t){return`${t*440+(t-1)*16+36}px`}constructor(){this.store.load({fresh:!0}),nt(this.requestOpen,this.panelTpl,()=>this.closeRequest()),this.route.queryParamMap.pipe(Ke()).subscribe(o=>{let i=o.get("vend");if(i){let c=i.indexOf(":"),f=i.slice(0,c),b=decodeURIComponent(i.slice(c+1));f&&b&&this.vendTarget.set({accountNumber:f,role:b})}o.get("request")&&this.openRequest(null),(i||o.get("request"))&&this.router.navigate([],{queryParams:{},replaceUrl:!0})});let t=setInterval(()=>this.now.set(Date.now()),1e3);this.destroyRef.onDestroy(()=>clearInterval(t));let e=new ResizeObserver(([o])=>{this.host.nativeElement.style.setProperty("--toolbar-h",`${Math.round(o.contentRect.height+18)}px`)});R(()=>{let o=this.toolbar()?.nativeElement;e.disconnect(),o&&e.observe(o)}),this.destroyRef.onDestroy(()=>e.disconnect()),R(()=>{!this.store.home()?.sectioned||B(()=>this.browse())||B(()=>{this.browse.set(fe(i=>this.api.listAccountsPage(i),{limit:24,sort:"position"})),this.other.set(fe(i=>this.api.listAccountsPage(F(O({},i),{filters:F(O({},i.filters),{main:["false"],favorite:["false"]})})),{limit:le,sort:"position"}))})}),R(()=>{let o=[...this.browse()?.items()??[],...this.other()?.items()??[]];o.length&&B(()=>{this.personalization.mergeFrom(o),this.store.remember(o)})}),R(()=>{let o=this.store.accounts();o&&this.bridge.isDesktop&&this.autoLogin.hydrate().subscribe(()=>{this.autoLogin.prewarm(o),this.autoVend.start(o)})})}cardIcon(t){return mt(t.icon,t.role)}titleOf(t){return t.name||this.formatId(t.accountNumber)}roleDisplayOf(t){return t.displayName||t.role}renameProfile(t,e,o){this.personalization.setProfileName(t.accountNumber,e.role,o||null)}profileOf(t,e){return this.personalization.profileName(t.accountNumber,e.role)}formatId(t){return t.replace(/(\d{4})(?=\d)/g,"$1 ")}grantLabel(t){return t.expiresAt?`expires ${Ue(t.expiresAt)}`:""}cardEnv(t,e){return gt(t,e,this.dimensions.stages)}credsFor(t,e){let o=this.now(),i=this.cache.peekExpiration(t,e);if(!i)return"";let c=new Date(i).getTime()-o;return c<=0?"":ie(c)}toggleAutoLogin(t,e){let o=!this.autoLogin.isEnabled(t,e);this.autoLogin.setEnabled(t,e,o),this.autoVend.onToggle(t,e,o)}openConsole(t,e){let o=this.consoleKey(t,e);this.consoleBusy().has(o)||(this.setConsoleBusy(o,!0),this.api.consoleSignIn(t,e).pipe(xe(()=>this.setConsoleBusy(o,!1))).subscribe({next:({url:i})=>{this.cache.get(t,e)||this.api.vendCredentials(t,e,{background:!0}).subscribe({next:c=>{this.cache.set(t,e,c),this.bridge.isDesktop&&this.bridge.writeCredentials({accountNumber:t,role:e,profile:this.personalization.profileName(t,e),creds:c}).catch(()=>{})},error:()=>{}}),localStorage.setItem(Le,"1"),this.bridge.isDesktop?this.bridge.openConsole(i):window.open(i,"_blank","noopener")},error:i=>this.toast.error(ae(i,"Could not create a console sign-in link."),i?.status===403?{label:"Request access",path:"/accounts?request=1"}:void 0)}))}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=L({type:n,selectors:[["app-accounts-page"]],viewQuery:function(e,o){e&1&&(_e(o.panelTpl,Yt,5),_e(o.toolbar,Qt,5)),e&2&&we(2)},hostAttrs:[1,"flex","min-h-0","flex-1","flex-col"],hostBindings:function(e,o){e&1&&C("mousedown",function(c){return o.onDocumentMousedown(c)},be)},decls:18,vars:3,consts:[["groupTpl",""],["rowTpl",""],["panelTpl",""],["toolbar",""],["pageHeader","","title","Your access","subtitle","Roles you're allowed to assume, grouped by account.","subtitleInfo","Credentials are short-lived and shown only to you.",3,"showHeaderSearch"],["headerActions","",3,"click"],["name","plus",1,"h-4","w-4",3,"strokeWidth"],["tone","danger"],[1,"rolegrid"],["title","No account access yet"],[3,"target"],["sizeClass","h-56 w-full"],["data-testid","sectioned-toolbar",1,"toolbar",3,"keydown.escape"],["aria-label","Sections",1,"jump"],["type","button"],[1,"searchbox",3,"focusin"],["placeholder","Search everything you have access to \u2014 account, number or role",1,"min-w-0","flex-1",3,"valueChange","value"],["data-testid","search-results",1,"results"],["data-testid","nothing-pinned",1,"mt-4","text-xs","text-muted-foreground"],["type","button",3,"click"],[1,"cnt"],["aria-label","Group by","data-testid","group-by",1,"ui-input","h-9","w-auto","py-0","text-xs",3,"change","value"],["value",""],[3,"value"],["align","end",3,"filtersChange","sections","filters"],[1,"px-4","py-3","text-xs","text-muted-foreground"],[1,"px-4","py-3","text-sm","text-muted-foreground"],[1,"divide-y","divide-border"],["appInfiniteScroll",""],[1,"border-t","border-border","px-4","py-2","text-[11px]","text-text-secondary"],[1,"sect","sub","px-3"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["appInfiniteScroll","",3,"reached"],["data-testid","section-signed-in",1,"sect","pin"],[1,"rows","divide-y","divide-border"],["data-testid","section-favorites",1,"sect","pin"],[1,"cards"],["data-testid","section-main",1,"sect","pin"],["data-testid","section-recent",1,"sect","pin"],["data-testid","section-other",1,"sect","pin"],[1,"rows"],[1,"border-t","border-border","px-3","py-2","text-[11px]","text-text-secondary"],[1,"mt-4","flex","justify-center"],[3,"click"],[1,"mb-3","flex","justify-end"],["compact","","placeholder","Search by account or role",1,"w-[260px]",3,"valueChange","value"],["title","No matches"],[1,"acctgroup"],[1,"acctgroup-h"],[1,"ttl"],[1,"cnt",3,"title"],["type","button",1,"fav",3,"on","title"],[1,"acctgroup-b"],["variant","inline",1,"card",3,"env","account","role","showRoleRow","profile","profileSource","profileSuggested","profileEditable","id","rawId","grant","creds","autoLogin","icon","consoleBusy"],["type","button",1,"fav",3,"click","title"],["name","star",1,"h-3.5","w-3.5",3,"set"],["variant","inline",1,"card",3,"profileRename","profileReset","autoLoginToggle","getCredentials","console","env","account","role","showRoleRow","profile","profileSource","profileSuggested","profileEditable","id","rawId","grant","creds","autoLogin","icon","consoleBusy"],[3,"favoriteToggle","autoLoginToggle","console","getCredentials","icon","role","roleArn","account","id","rawId","env","dims","profile","grant","creds","favorite","autoLogin","consoleBusy"],[3,"closed","grantRevoked","target"],[3,"closed","title"],[3,"created","closed","presetAccount"]],template:function(e,o){if(e&1){let i=h();a(0,"app-page")(1,"app-page-header",4)(2,"app-button",5),C("click",function(){return m(i),u(o.openRequest(null))}),N(3,"app-icon",6),d(4," Request a role "),s()(),_(5,nn,2,1,"app-banner",7)(6,on,4,0,"div",8)(7,zn,16,10)(8,Hn,5,0,"app-empty-state",9)(9,Qn,4,2),s(),E(10,Xn,11,11,"ng-template",null,0,Z)(12,eo,1,14,"ng-template",null,1,Z),S(14,to,1,1,"app-credentials-dialog",10,Xt),E(16,no,2,2,"ng-template",null,2,Z)}e&2&&(r(),p("showHeaderSearch",!1),r(2),p("strokeWidth",2),r(2),g(o.store.error()?5:o.store.home()===null?6:o.store.home().sectioned?7:o.store.accounts().length===0?8:9),r(9),P(o.vendTargets()))},dependencies:[Ne,ce,tt,ot,rt,ne,re,et,te,dt,ct,de,at,lt,Ze,Je,Xe],styles:[".cards[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:16px;margin:0 -18px}.rolegrid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:16px;margin:0 -18px}.sect[_ngcontent-%COMP%]{margin:20px 0 10px;font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--text-secondary)}.sect[_ngcontent-%COMP%]:first-child{margin-top:4px}[_nghost-%COMP%]{--toolbar-h: 84px}.toolbar[_ngcontent-%COMP%], .sect.pin[_ngcontent-%COMP%]{background:linear-gradient(var(--glass-panel-bg),var(--glass-panel-bg)),var(--glass-plate);background-attachment:scroll,fixed}.toolbar[_ngcontent-%COMP%]{position:sticky;top:0;z-index:15;margin:-24px -25px 0;padding:10px 25px 8px}.jump[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:4px 6px;margin-bottom:8px;min-height:22px}.jump[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--text-secondary);padding:2px 8px;border-radius:999px;background:var(--muted)}.jump[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover{color:var(--surface-foreground)}.jump[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .cnt[_ngcontent-%COMP%]{font-weight:500;letter-spacing:0}.searchbox[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;gap:8px}.results[_ngcontent-%COMP%]{position:absolute;inset-inline:0;top:calc(100% + 6px);z-index:30;max-height:min(60vh,560px);overflow-y:auto;border-radius:12px;border:1px solid var(--border-strong);background:var(--popover-bg);box-shadow:0 12px 32px -8px #10182840;backdrop-filter:blur(24px)}.sect.pin[_ngcontent-%COMP%]{position:sticky;top:var(--toolbar-h);z-index:10;margin:12px -25px 6px;padding:8px 25px 6px}.rows[_ngcontent-%COMP%]{border:1px solid var(--border);border-radius:calc(var(--radius) * 3);background:var(--card-bg);overflow:hidden}.sect.sub[_ngcontent-%COMP%]{margin:14px 0 8px;text-transform:none;letter-spacing:0;font-size:12px;color:var(--surface-foreground)}.sect[_ngcontent-%COMP%] .cnt[_ngcontent-%COMP%]{font-weight:500}.acctgroup[_ngcontent-%COMP%]{flex-shrink:1;min-width:min(100%,336px);max-width:100%;border:1px solid var(--border);border-radius:calc(var(--radius) * 3)}.acctgroup-h[_ngcontent-%COMP%]{display:flex;align-items:baseline;gap:10px;padding:14px 18px 0}.ttl[_ngcontent-%COMP%]{font-size:13px;font-weight:600;color:var(--surface-foreground)}.cnt[_ngcontent-%COMP%]{font-size:11px;font-weight:500;color:var(--text-secondary)}.fav[_ngcontent-%COMP%]{margin-left:auto;align-self:center;display:inline-flex;padding:4px;border-radius:6px;color:var(--text-secondary)}.fav[_ngcontent-%COMP%]:hover{background:var(--muted);color:var(--surface-foreground)}.fav.on[_ngcontent-%COMP%]{color:var(--brand)}.acctgroup-b[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:16px;padding:12px 18px 18px}.card[_ngcontent-%COMP%]{flex:1 1 300px;max-width:100%}"]})};export{ft as AccountsPageComponent};