{"version":3,"sources":["../src/utils/tokenStore.ts"],"names":["TokenStore","key","value","tokenStore"],"mappings":";AAaO,IAAMA,EAAN,KAAkD,CACtC,MAEjB,aAAc,CACZ,KAAK,MAAQ,CACX,YAAa,GACb,aAAc,EAChB,CACF,CAEO,QAAQC,EAAkC,CAC/C,OAAO,KAAK,MAAMA,CAAG,GAAK,IAC5B,CAEO,QAAQA,EAAmBC,EAAqB,CACrD,KAAK,MAAMD,CAAG,EAAIC,CACpB,CAEO,OAAQ,CACb,MAAO,CAAC,CAAC,KAAK,MAAM,aAAe,CAAC,CAAC,KAAK,MAAM,YAClD,CAEO,WAAWD,EAAyB,CACzC,OAAO,KAAK,MAAMA,CAAG,CACvB,CAEO,OAAc,CACnB,KAAK,MAAM,YAAc,GACzB,KAAK,MAAM,aAAe,EAC5B,CACF,EAEaE,EAAa,IAAIH","sourcesContent":["export type Storage<T> = {\n  getItem: (key: T) => string | null;\n  setItem: (key: T, value: string) => void;\n  removeItem: (key: T) => void;\n};\n\nexport type AuthTokens = {\n  accessToken?: string;\n  refreshToken?: string;\n};\n\ntype AuthStoreKey = keyof AuthTokens;\n\nexport class TokenStore implements Storage<AuthStoreKey> {\n  private readonly store: AuthTokens;\n\n  constructor() {\n    this.store = {\n      accessToken: '',\n      refreshToken: '',\n    };\n  }\n\n  public getItem(key: AuthStoreKey): string | null {\n    return this.store[key] || null;\n  }\n\n  public setItem(key: AuthStoreKey, value: string): void {\n    this.store[key] = value;\n  }\n\n  public isSet() {\n    return !!this.store.accessToken && !!this.store.refreshToken;\n  }\n\n  public removeItem(key: AuthStoreKey): void {\n    delete this.store[key];\n  }\n\n  public clear(): void {\n    this.store.accessToken = '';\n    this.store.refreshToken = '';\n  }\n}\n\nexport const tokenStore = new TokenStore();\n"]}