1import{c as S,ra as u}from"./chunk-TPCL2XMH.js";import{n as l}from"./chunk-KSTBAVB4.js";import{Bd as m,D as c,Dd as p,U as n,Z as r,vd as v,wd as s,yd as f}from"./chunk-P2OBJROK.js";import{g as i}from"./chunk-6IZLXKZM.js";var y=(()=>{class t{constructor(){this.requestService=r(p),this.basketService=r(u)}copyAnonymousItemsToUser(e){return i(this,null,function*(){yield this.requestService.userCommand("CopyAnonymousItemsToCart",{userId:e}).toPromise(),yield this.basketService.retrieveBasketFromServer().pipe(c(1)).toPromise()})}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275prov=n({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var h="login.redirectKey",V=(()=>{class t{constructor(){this.userService=r(m),this.copyBasketOnLoginService=r(y),this.basketService=r(u),this.gtmService=r(S),this.router=r(l),this.oauthService=r(f)}static setRedirectUrl(e){s.hasStorage&&s.setItem(h,e)}static getRedirectUrl(){if(s.hasStorage){let e=s.getItem(h);return s.removeItem(h),e}return null}registerAutomaticRefresh(){return i(this,null,function*(){this.oauthService.setupAutomaticSilentRefresh()})}login(e){return i(this,null,function*(){return t.setRedirectUrl(e),yield this.oauthService.loadDiscoveryDocumentAndLogin().then(o=>!this.oauthService.hasValidIdToken()||!this.oauthService.hasValidAccessToken()?(this.basketService.getUserBasket().pipe(c(1)).subscribe(a=>{this.oauthService.initLoginFlow("",{products:JSON.stringify(this.gtmService.getBasketProducts(a))})}),!1):!0)})}logout(){return i(this,null,function*(){yield this.oauthService.loadDiscoveryDocument().then(e=>this.oauthService.logOut())})}completeAuthentication(){return i(this,null,function*(){try{if(!((yield this.oauthService.loadDiscoveryDocumentAndTryLogin())&&this.oauthService.hasValidAccessToken()))return!1;let o=yield this.oauthService.loadUserProfile();this.userService.setUser(o?.info??null),yield this.copyBasketOnLoginService.copyAnonymousItemsToUser(m.getLocalUserId());let a=t.getRedirectUrl();return a?(this.router.navigateByUrl(a),!0):!1}catch(e){return!1}})}getChangePasswordUrl(e){return`${v.clientSettings.authority.replace(/\/$/,"")}/account/myaccount?ReturnUrl=${e}`}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275prov=n({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();export{V as a};
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.