1import{a as f,d as m}from"./chunk-6XKI7R7X.js";import{Da as d,Ta as a,ya as g,yd as l}from"./chunk-74FNDDGM.js";var u=(()=>{class n{localStorage=d(m);windowRef=d(f);get length(){return this.localStorage.length}getItem(e){return this.localStorage.getItem(e)}setItem(e,o){let r=this.getItem(e);this.localStorage.setItem(e,o),this.notify(e,o,r)}removeItem(e){let o=this.getItem(e);this.localStorage.removeItem(e),this.notify(e,null,o)}clear(){this.localStorage.clear(),this.notify(null,null,null)}key(e){return this.localStorage.key(e)}notify(e,o,r){let c=new StorageEvent("storage",{key:e,newValue:o,oldValue:r,storageArea:this.localStorage,url:this.windowRef.location.href});this.windowRef.dispatchEvent(c)}static \u0275fac=function(o){return new(o||n)};static \u0275prov=g({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var s=class extends Error{};s.prototype.name="InvalidTokenError";function w(n){return decodeURIComponent(atob(n).replace(/(.)/g,(t,e)=>{let o=e.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function v(n){let t=n.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return w(t)}catch{return atob(t)}}function h(n,t){if(typeof n!="string")throw new s("Invalid token specified: must be a string");t||(t={});let e=t.header===!0?0:1,o=n.split(".")[e];if(typeof o!="string")throw new s(`Invalid token specified: missing part #${e+1}`);let r;try{r=v(o)}catch(c){throw new s(`Invalid token specified: invalid base64 for part #${e+1} (${c.message})`)}try{return JSON.parse(r)}catch(c){throw new s(`Invalid token specified: invalid json for part #${e+1} (${c.message})`)}}var i=class i{constructor(){this.storage=d(u);this.accessToken=a(null);this.refreshToken=a(null);this.isAuthenticated=a(!1);this.jwtPayload=l(()=>this.accessToken()?h(this.accessToken()):null);this.isAdmin=l(()=>{var t,e,o,r;return((t=this.jwtPayload())==null?void 0:t.role)==="Admin"||((e=this.jwtPayload())==null?void 0:e.role)==="SuperAdmin"||((o=this.jwtPayload())==null?void 0:o.role)==="Cms"||((r=this.jwtPayload())==null?void 0:r.role)==="Muhasip"});this.isPersonnel=l(()=>{var t;return((t=this.jwtPayload())==null?void 0:t.role)!=="Citizen"});this.isQrReader=l(()=>{var t;return((t=this.jwtPayload())==null?void 0:t.role)==="QrReader"||this.isAdmin()});this.userRole=l(()=>{var t;return(t=this.jwtPayload())==null?void 0:t.role});this.xProfile=a(null);this.xCompany=a(null);let t=this.storage.getItem("token");if(t)try{let r=JSON.parse(t);r.accessToken&&(this.accessToken.set(r.accessToken),this.refreshToken.set(r.refreshToken),this.isAuthenticated.set(!0),this.storage.setItem("token",JSON.stringify(r)))}catch{}let e=this.storage.getItem("xProfile")||null;e&&e!=="null"&&this.xProfile.set(e);let o=this.storage.getItem("xCompany")||null;o&&o!=="null"&&this.xCompany.set(o)}};i.\u0275fac=function(e){return new(e||i)},i.\u0275prov=g({token:i,factory:i.\u0275fac,providedIn:"root"});var p=i;export{u as a,p as b};
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.