import{ka as r}from"./chunk-UNHECMG2.js";var c="uiCulture",i="CLX.LoginToken",d="CLX.RefreshToken",g="CLX.TokenExpire",f=(()=>{class o{getLanguage(){return this.getValue(c)}getAccessToken(){let t=this.getValue(i);return t?t.replace(/^"+|"+$/g,""):null}getRefreshToken(){return this.getValue(d)}getTokenExpire(){return this.getValue(g)}getPayload(){let t=this.getAccessToken();if(!t)return null;let e=this.parseTokenPayload(t);return e.roles="holder_roles"in e&&typeof e.holder_roles=="string"?e.holder_roles:e.roles,e.id_person="holder_id"in e&&typeof e.holder_id=="string"&&e.holder_id.length>0?e.holder_id:e.id_person,e}getValue(t){return sessionStorage.getItem(t)||localStorage.getItem(t)}parseTokenPayload(t){let e=t.split(".");if(e.length!==3)throw new Error("Invalid JWT token format");let n=e[1].replace(/-/g,"+").replace(/_/g,"/"),s=atob(n),a=new TextDecoder("utf-8").decode(Uint8Array.from(s,l=>l.charCodeAt(0)));return JSON.parse(a)}static{this.\u0275fac=function(e){return new(e||o)}}static{this.\u0275prov=r({token:o,factory:o.\u0275fac,providedIn:"root"})}}return o})();export{f as a};
