1import{a as I,c as te,d as Ge}from"./chunk-OFPSXYOM.js";import"./chunk-4X222LLP.js";import{a as ve}from"./chunk-5NPI4T2V.js";import"./chunk-CLLH2EUN.js";import"./chunk-GHMC245A.js";import{Da as Re,K as ue,T as u,cb as be,db as Le,fa as Z,jb as Me,q as h,r as D,ra as Ne}from"./chunk-45Y3E3X4.js";import{A as Ee,Fa as $e,Ha as De,Ia as ye,L as Fe,P as Ce,S as he,a as P,aa as Ae,ba as Te,ca as Se,f as B,fa as Oe,ga as Pe,ja as Ie,k as ge,u as pe,w as U,z as fe}from"./chunk-URO3ZXDE.js";import{Aa as re,Ad as J,Bd as ee,Db as se,Ec as y,Fc as j,Gb as n,Ha as ae,I as ne,Ic as k,Jc as z,Kb as le,Kc as a,La as N,Mc as V,Nc as X,Oc as K,Pc as $,Qa as c,Qc as Q,Rc as _,Vc as q,Wb as L,Wc as Y,Xa as R,Xc as W,Ya as b,ab as H,ca as w,db as F,dd as v,ed as G,kc as g,mc as p,oc as _e,pc as ce,qc as de,r as ie,rc as C,s as oe,sc as l,tc as s,td as me,uc as O,vc as m,wc as f}from"./chunk-3FBPOHKW.js";var Ve=["emailInput"],Xe=["passwordInput"],Ze=i=>({"is-loading":i});function Be(i,d){if(i&1){let e=y();l(0,"div",12)(1,"p",15),a(2,3),s(),l(3,"small",16),k(4,4),l(5,"a",17),$("click",function(){R(e);let o=_(2);return b(o.reset());}),s(),z(),s()();}if(i&2){let e=_(2);n(2),V(e.loginForm.get("email").value),X(2);}}function je(i,d){if(i&1&&(l(0,"div",13),v(1),s()),i&2){let e=_();n(),G(e.errorMessage);}}function Ke(i,d){if(i&1&&(l(0,"a",25),J(1,"async"),a(2,9),s()),i&2){let e=_(3);C("href",ee(1,1,e.forgotPasswordUrl$),se);}}function Qe(i,d){i&1&&a(0,7,1);}function qe(i,d){i&1&&a(0,7,2);}function Ye(i,d){if(i&1){let e=y();l(0,"form",18),$("ngSubmit",function(){R(e);let o=_(2);return b(o.handleSubmit());}),l(1,"gf-form-group",19)(2,"label",20),a(3,5),s(),O(4,"input",21,0),s(),l(6,"gf-form-group",19)(7,"label",22),a(8,6),s(),O(9,"input",23,1),s(),l(11,"div",24)(12,"small"),g(13,Ke,3,3,"a",25),s(),l(14,"button",26),k(15,7),g(16,Qe,1,0),g(17,qe,1,0),z(),s()(),l(18,"div",27)(19,"small"),k(20,8),O(21,"a",28)(22,"a",29)(23,"a",30),z(),s()()();}if(i&2){let e=_(),t=_();C("formGroup",t.loginForm),n(),C("hidden",e.isEmailValidated),n(5),C("hidden",!e.isEmailValidated),n(7),p(e.isEmailValidated?13:-1),n(),C("ngClass",me(8,Ze,e.isLoading))("setSubmitted",t.resetFormSubmitted),n(2),p(e.isEmailValidated?16:-1),n(),p(e.isEmailValidated?-1:17);}}function We(i,d){if(i&1&&(g(0,Be,6,1,"div",12),g(1,je,2,1,"div",13),g(2,Ye,24,10,"form",14)),i&2){let e=d,t=_();p(e.isEmailValidated?0:-1),n(),p(e.errorMessage?1:-1),n(),p(t.initialized()?2:-1);}}var Ue=(()=>{class i{constructor(){this.store$=c(h),this.fb=c(Ae),this.destroyRef=c(H),this.formSubmitted$=new ie(),this.forgotPasswordUrlBase="/forgetPassword",this.forgotPasswordUrlSubject=new oe(this.forgotPasswordUrlBase),this.state$=this.store$.pipe(D(be)),this.initialized=F(!1),this.resetFormSubmitted=new le(),this.forgotPasswordUrl$=this.forgotPasswordUrlSubject.asObservable();}ngOnInit(){this.initForm(),this.initialize();}ngAfterViewInit(){this.store$.pipe(D(Le),P(this.destroyRef)).subscribe(e=>this.handleIsEmailValidatedChange(e));}ngOnDestroy(){this.store$.dispatch(u.loginResetValidatedEmail());}initForm(){this.loginForm=this.fb.group({email:["",[U.required,U.email]],password:["",this.generatePasswordValidators()]}),this.loginForm.get("email").valueChanges.pipe(P(this.destroyRef)).subscribe(e=>this.forgotPasswordUrlSubject.next(`${this.forgotPasswordUrlBase}?email=${encodeURIComponent(e)}`)),this.formSubmitted$.asObservable().pipe(ae(this.state$),P(this.destroyRef)).subscribe(([e,{isLoading:t,isEmailValidated:o}])=>{this.loginForm.valid&&!t&&(o?this.doLogin():this.validateEmail());});}initialize(){this.store$.pipe(D(Z),w(1)).subscribe(e=>{this.initEmail(e.email),e.destination&&this.initDestination(e.destination),e.error&&this.store$.dispatch(u.loginSetError({error:e.error})),this.initialized.set(!0);});}initEmail(e){let t="",o=localStorage.getItem(Ne);if(e?t=e:o&&(t=o,this.store$.dispatch(u.loginSetEmailAsValidatedFromLocalStorage())),t){let r=this.loginForm.get("email");r.setValue(t),r.markAsDirty(),r.markAsTouched();}}initDestination(e){if(e.startsWith("/")){window.location.hash&&(e+=window.location.hash);let t={url:e,context:null,isV1Url:!0};
1this.store$.dispatch(u.setRedirect({redirect:t}));}}handleSubmit(){this.formSubmitted$.next(!0);}reset(){this.store$.dispatch(u.loginResetValidatedEmail()),this.loginForm.reset(),this.store$.dispatch(u.loginClearLastLoginEmail());}validateEmail(){this.store$.dispatch(u.loginValidateEmail({email:this.loginForm.get("email").value}));}doLogin(){let e={username:this.loginForm.value.email,password:this.loginForm.value.password};this.store$.dispatch(u.login({auth:e}));}generatePasswordValidators(e=!1){let t=[U.minLength(2)];return e&&t.unshift(U.required),t;}handleIsEmailValidatedChange(e){let t=e?this.passwordInput.nativeElement:this.emailInput.nativeElement,o=this.loginForm.get("password");this.resetFormSubmitted.emit(!1),o.setValidators(this.generatePasswordValidators(e)),o.updateValueAndValidity(),e&&this.store$.dispatch(ue({label:"Login - Password Entry"})),setTimeout(()=>t.focus(),100);}static{this.ɵfac=function(t){return new(t||i)();};}static{this.ɵcmp=L({type:i,selectors:[["auth-login-page"]],viewQuery:function(t,o){if(t&1&&(q(Ve,5),q(Xe,5)),t&2){let r;Y(r=W())&&(o.emailInput=r.first),Y(r=W())&&(o.passwordInput=r.first);}},decls:5,vars:3,consts:()=>{let e;e="Login to Your Account";let t;t="Hi, "+"\uFFFD0\uFFFD"+"";let o;o=" Not you? "+"\uFFFD#5\uFFFD"+"Log in as another user"+"\uFFFD/#5\uFFFD"+"";let r;r="Email Address";let M;M="Password";let A;A=""+"\uFFFD*16:1\uFFFD"+" Log in "+"[\uFFFD/*16:1\uFFFD|\uFFFD/*17:2\uFFFD]"+""+"\uFFFD*17:2\uFFFD"+" Continue "+"[\uFFFD/*16:1\uFFFD|\uFFFD/*17:2\uFFFD]"+"",A=K(A);let T;T="By logging in, you agree to the "+"\uFFFD#21\uFFFD"+"Terms of Service"+"[\uFFFD/#21\uFFFD|\uFFFD/#22\uFFFD|\uFFFD/#23\uFFFD]"+" and "+"\uFFFD#22\uFFFD"+"Privacy Policy"+"[\uFFFD/#21\uFFFD|\uFFFD/#22\uFFFD|\uFFFD/#23\uFFFD]"+". To find out more about Greenfly, send us a "+"\uFFFD#23\uFFFD"+"message"+"[\uFFFD/#21\uFFFD|\uFFFD/#22\uFFFD|\uFFFD/#23\uFFFD]"+".",T=K(T);let E;return E="Forgot your password?",[["emailInput",""],["passwordInput",""],e,t,o,r,M,A,T,E,["src","assets/img/greenfly-logos/gf-logo-green-vertical.svg","alt","Greenfly\xAE",1,"splash-layout-logo"],[1,"text-center"],[1,"text-center","mb-4"],[1,"alert","alert-danger"],["novalidate","",3,"formGroup"],[1,"fs-lg","mb-0"],[1,"text-muted"],["tabindex","","gfClickTrack","Login - Reset",3,"click"],["novalidate","",3,"ngSubmit","formGroup"],[3,"hidden"],["for","login-email",1,"form-label"],["type","email","id","login-email","formControlName","email",1,"form-control"],["for","login-password",1,"form-label"],["type","password","id","login-password","formControlName","password",1,"form-control"],[1,"d-flex","justify-content-between"],["gfTrackLink","Login - Forgot Password",3,"href"],["type","submit","gfSubmitButton","",1,"btn","btn-primary","ml-3","login-submit-button",3,"ngClass","setSubmitted"],[1,"mt-4"],["href","/termsofservice"],["href","/privacypolicy"],["href","mailto:[email protected]"]];},template:function(t,o){if(t&1&&(O(0,"img",10),l(1,"h2",11),a(2,2),s(),g(3,We,3,3),J(4,"async")),t&2){let r;n(3),p((r=ee(4,1,o.state$))?3:-1,r);}},dependencies:[Te,Fe,pe,fe,Ee,Se,Ce,he,B,De,ye,Me,ge],styles:[".login-submit-button[_ngcontent-%COMP%]{min-width:8rem}"],changeDetection:0});}}return i;})();var xe=(()=>{class i{constructor(){this.store$=c(h);}canActivate(){return this.store$.pipe(D(Re),re(e=>!e.initialized),w(1),ne(e=>e.isAuthenticated?(this.store$.dispatch(u.indexRedirect()),!1):!0));}static{this.ɵfac=function(t){return new(t||i)();};}static{this.ɵprov=N({token:i,factory:i.ɵfac,providedIn:"root"});}}return i;})();var we=(()=>{class i{constructor(){this.store$=c(h),this.newContextSelected=F(!1);}handleContextChange(){this.newContextSelected.set(!0);}logout(){this.store$.dispatch(u.logout());}static{this.ɵfac=function(t){return new(t||i)();};}static{this.ɵcmp=L({type:i,selectors:[["auth-select-page"]],decls:7,vars:2,consts:()=>{let e;return e="Log Out",[e,["src","assets/img/greenfly-logos/gf-logo-green-vertical.svg","alt","Greenfly\xAE",1,"splash-layout-logo"],[3,"ngClass"],[3,"contextChange","inline"],[1,"text-right","mt-4"],["type","button",1,"btn","btn-sm","btn-secondary",3,"click"]];},template:function(t,o){t&1&&(O(0,"img",1),l(1,"div",2)(2,"div")(3,"auth-context-select",3),$("contextChange",function(){return o.handleContextChange();}),s()(),l(4,"div",4)(5,"button",5),$("click",function(){return o.logout();}),a(6,0),s()()()),t&2&&(n(),C("ngClass",o.newContextSelected()?"pe-none":""),n(2),C("inline",!0));},dependencies:[B,Ge],encapsulation:2,changeDetection:0});}}return i;})();var He=(()=>{class i{constructor(){this.http=c(Ie),this.baseUrl="/ajax/oauth/authorize",this.errorContext=new Pe().set($e,!0);}getDetails(e){return this.http.get(this.baseUrl,{params:this.toHttpParams(e),context:this.errorContext});}submitDecision(e,t){let o=this.toHttpParams(t).set("action",e);return this.http.post(`${this.baseUrl}/decision`,o,{context:this.errorContext});}toHttpParams(e){let t=Object.fromEntries(Object.entries(e).filter(([,o])=>o!=null));return new Oe({fromObject:t,encoder:new ve()});}static{this.ɵfac=function(t){return new(t||i)();};}static{this.ɵprov=N({token:i,factory:i.ɵfac,providedIn:"root"});}}return i;})();var ke=(()=>{class i{redirect(e){window.location.href=e;}static{this.ɵfac=function(t){return new(t||i)();};}static{this.ɵprov=N({token:i,factory:i.ɵfac,providedIn:"root"});}}return i;})();function Je(i,d){if(i&1&&(m(0,"li"),v(1),f()),i&2){let e=d.$implicit,t=_(3);n(),G(t.scopeDescription(e));}}function et(i,d){if(i&1&&(m(0,"p"),a(1,4),f(),m(2,"ul",11),ce(3,Je,2,1,"li",null,_e),f()),i&2){let e,t=_(2);n(3),de((e=t.details())==null?null:e.scopes);}}function tt(i,d){if(i&1){let e=y();m(0,"div",7)(1,"h4"),a(2,0),f(),m(3,"p")(4,"span"),a(5,1),f()(),g(6,et,5,0),m(7,"div",8)(8,"button",9),Q("click",function(){R(e);let o=_();return b(o.deny());}),m(9,"span"),a(10,2),f()(),m(11,"button",10),Q("click",function(){R(e);let o=_();return b(o.allow());}),m(12,"span"),a(13,3),f()()()();}if(i&2){let e,t,o=_();n(5),V((e=o.details())==null?null:e.clientName),X(5),n(),p(!((t=o.details())==null||t.scopes==null)&&t.scopes.length?6:-1),n(2),j("disabled",o.submitting()),n(3),j("disabled",o.submitting());}}function it(i,d){if(i&1&&(m(0,"div",7)(1,"h4"),a(2,5),f(),m(3,"p"),v(4),f()()),i&2){let e=_();n(4),G(e.errorMessage());}}function ot(i,d){i&1&&(m(0,"div",7)(1,"p"),a(2,6),f()());}
1var nt={openid:"Confirm your identity",profile:"See your name",email:"See your email address",channels:"See which channels you can access"},ze=(()=>{class i{constructor(){this.store$=c(h),this.oidcAuthorizeService=c(He),this.redirectService=c(ke),this.destroyRef=c(H),this.queryParams=this.store$.selectSignal(Z),this.view=F("loading"),this.details=F(null),this.errorMessage=F(null),this.submitting=F(!1);}ngOnInit(){this.params=this.queryParams(),this.loadDetails();}allow(){this.submitDecision("approve");}deny(){this.submitDecision("deny");}scopeDescription(e){return nt[e]??e;}loadDetails(){this.oidcAuthorizeService.getDetails(this.params).pipe(P(this.destroyRef)).subscribe({next:e=>{if(e.status==="auto_approve"){this.submitDecision("approve");return;}if(e.status==="redirect"&&e.redirectUri){this.redirectService.redirect(e.redirectUri);return;}this.details.set(e),this.view.set("consent");},error:e=>this.handleError(e)});}submitDecision(e){this.submitting.set(!0),this.oidcAuthorizeService.submitDecision(e,this.params).pipe(P(this.destroyRef)).subscribe({next:({redirectUri:t})=>this.redirectService.redirect(t),error:t=>this.handleError(t)});}handleError(e){this.submitting.set(!1),this.errorMessage.set(this.messageFor(e?.error)),this.view.set("error");}messageFor(e){return e?.error==="no_channels"?"Your Greenfly account doesn't have access to any channels, so it can't be used to sign in here. Contact your Greenfly administrator to get access.":e?.message||"Something went wrong. Please try again.";}static{this.ɵfac=function(t){return new(t||i)();};}static{this.ɵcmp=L({type:i,selectors:[["auth-oidc-authorize"]],decls:3,vars:1,consts:()=>{let e;e="Authorize access";let t;t=""+"\uFFFD0\uFFFD"+" is requesting access to your Greenfly account.";let o;o="Deny";let r;r="Allow";let M;M="This will allow it to:";let A;A="Authorization failed";let T;return T="Loading\u2026",[e,t,o,r,M,A,T,[1,"oidc-authorize","d-flex","flex-column","gap-3"],[1,"d-flex","justify-content-end","gap-2"],["type","button",1,"btn","btn-secondary",3,"click","disabled"],["type","button",1,"btn","btn-primary",3,"click","disabled"],[1,"m-0","ps-4"]];},template:function(t,o){if(t&1&&g(0,tt,14,4,"div",7)(1,it,5,1,"div",7)(2,ot,3,0,"div",7),t&2){let r;p((r=o.view())==="consent"?0:r==="error"?1:2);}},encapsulation:2,changeDetection:0});}}return i;})();var li=[{path:"",providers:[],children:[{path:I.login.path,component:Ue,pathMatch:"full",data:I.login,canActivate:[xe]},{path:I.select.path,component:we,pathMatch:"full",data:I.select,canActivate:[te]},{path:I.oauth.path,component:ze,pathMatch:"full",data:I.oauth,canActivate:[te]}]}];export{li as default};/**i18n:ac15957aa6da6a86431913d2efce29e69c3e1d7297e39982cd5b9590a3a9bcf9*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.