1import{Ac as d,P as m,S as i,ec as g,ma as h,zc as S}from"./chunk-ECFZ5EN4.js";var n=class{constructor(f,t,e){this.visitorKey=null,this.rls=[],this.username=f,this.accessToken=t,this.accessTokenExpirationDatetime=e}};var N=(()=>{class o{get isAuthenticated(){return!!this._userData.accessToken}get accountAccessToken(){return this._userData&&this.isAuthenticated?this._userData.accessToken:null}get accountUsername(){return this._userData&&this.isAuthenticated?this._userData.username:null}get isAdmOrWmak(){return!this.isAuthenticated||!Array.isArray(this._userData.rls)?!1:this._userData.rls.some(e=>e.rl==="ZQcm6Jf3Ck"||e.rl==="qXVfIWNGE0")}get visitorKey(){return this._userData.visitorKey||this.handleVisitorKeyMissing(),this._userData.visitorKey||""}get isWebsiteOnline(){return this.commonSrv.websiteIsActive}constructor(t,e,r,a){this.platformId=t,this.http=e,this.apiConfigSrv=r,this.commonSrv=a,this.localStorageUserItemName="user",this.localStorageShippingCountryItemName="scc",this.localStorageLegalAgeItemName="legalAge",this.localStorageLegalAgeServerReqDoneItemName="legalAgeServerReqDone",this._userData=new n(null,null,null),this.readUserDataFromLocalStorage()}handleAuthSuccess(t,e=!0){this._userData=t;let r=!e;this.saveUserDataInLocalStorage(t,r),this.loadCartData()}logoutUser(){this._userData.accessToken=null,this._userData.username=null,this._userData=new n(null,null,null),this.removeUserDataFromLocalStorage(),this.handleVisitorKeyMissing(),this.loadCartData()}loadAccountData(){if(!this.isWebsiteOnline)return;let t=this.apiConfigSrv.findAccountReqUrl();this.http.get(t,{observe:"response"}).subscribe(e=>{if(e.status!==200)return;let r=e.body?e.body:null;if((r?r.code:null)!==2e4)return;let s=r?r.data:null;this.commonSrv.accountData=s},e=>{})}loadCartData(){if(!this.isWebsiteOnline)return;let t=this.apiConfigSrv.findCartReqUrl();this.http.get(t,{observe:"response"}).subscribe(e=>{if(e.status!==200)return;let r=e.body?e.body:null;if((r?r.code:null)!==2e4)return;let s=r?r.data:null;this.commonSrv.cartData=s,this.loadCartProducts()},e=>{})}loadCartProducts(){let t=this.commonSrv.findCartItemsProductIds();if(t.length===0)return;let e=this.apiConfigSrv.findProductsByIdsReqUrl(t);this.http.get(e,{observe:"response"}).subscribe(r=>{if(r.status!==200)return;let a=r.body?r.body:null;if((a?a.code:null)!==2e4)return;let l=a?a.data:null,D=l&&Array.isArray(l.items)?l.items:[],c=new Map;D.forEach(u=>{c.set(u.id,u)}),this.commonSrv.cartProductsMap=c},r=>{})}saveUserDataInLocalStorage(t,e=!1){if(this.commonSrv.isSsrDisplay)return;let r=e?sessionStorage:localStorage,a=JSON.stringify(t);sessionStorage&&this.removeUserDataFromLocalStorage(),r.setItem(this.localStorageUserItemName,a)}saveLegalAgeConfirmationInLocalStorage(){localStorage.setItem(this.localStorageLegalAgeItemName,"true")}readLegalAgeConfirmationFromLocalStorage(){return localStorage.getItem(this.localStorageLegalAgeItemName)=="true"}checkLegalAgeConfirmationOnServer(){return localStorage.getItem(this.localStorageLegalAgeServerReqDoneItemName)=="true"}saveLegalAgeConfirmationOnServer(){let t=this.apiConfigSrv.setAcceptedLegalAgeReqUrl();this.http.put(t,null,{observe:"response"}).subscribe(e=>{e.status===200&&localStorage.setItem(this.localStorageLegalAgeServerReqDoneItemName,"true")},e=>{})}saveCountryCodeInLocalStorage(t){this.commonSrv.isSsrDisplay||t&&localStorage.setItem(this.localStorageShippingCountryItemName,t)}readUserDataFromLocalStorage(){if(!this.commonSrv.isSsrDisplay){try{let t=sessionStorage.getItem(this.localStorageUserItemName),e=localStorage.getItem(this.localStorageUserItemName);if(!e&&!t){this.handleVisitorKeyMissing();return}let r=t?JSON.parse(t):null,a=e?JSON.parse(e):null,s=r||a;if(!this.checkIfAccessTokenValid(s.accessTokenExpirationDatetime)){this.removeUserDataFromLocalStorage(),this.handleVisitorKeyMissing();return}this._userData=s}catch{}try{let t=localStorage.getItem(this.localStorageShippingCountryItemName);t&&t.length===2&&(this.commonSrv.shippingCountryCode=t)}catch{}}}handleVisitorKeyMissing(){try{let t=Math.floor(Math.random()*1e4),e=Math.floor(Math.random()*1e4);this._userData.visitorKey=`${t}-${e}-${Date.now()}`,this.saveUserDataInLocalStorage(this._userData)}catch{}}removeUserDataFromLocalStorage(){if(!this.commonSrv.isSsrDisplay)try{localStorage.removeItem(this.localStorageUserItemName),sessionStorage.removeItem(this.localStorageUserItemName)}catch{}}
1checkIfAccessTokenValid(t){if(!t)return!0;try{let e=t-6e5;return Date.now()<e}catch{return!0}}static{this.\u0275fac=function(e){return new(e||o)(i(h),i(g),i(S),i(d))}}static{this.\u0275prov=m({token:o,factory:o.\u0275fac,providedIn:"root"})}}return o})();export{n as a,N as b}; 2/**i18n:c268d6aa763701f7bb01344751edc96989c72bead18435ad51f3b240f2aab54b*/
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.