1var f=Object.defineProperty;var g=(e,t,r)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var o=(e,t,r)=>g(e,typeof t!="symbol"?t+"":t,r);const n={PRODUCTION:"production",QA:"qa"},l={storageKey:"br_auth_state",tokenRefreshThresholdMs:300*1e3,silentRenewalTimeoutMs:1e4,tugboatCacheDurationSeconds:86400,defaultSessionDurationSeconds:3600,crossTabValidationIntervalMs:60*1e3},d={exactMatches:["bankrate.com"],suffixes:[".bankrate.com"]},S={exactMatches:["bankrate.com","fantasia.test"],suffixes:[".bankrate.com",".tugboatqa.com"]},O={login:"/member/auth/login",logout:"/member/auth/logout",return:"/auth/return",silentCallback:"/silent-callback"},b={STATE_CHANGED:"authStateChanged",TOKEN_RENEWED:"tokenRenewed",TOKEN_EXPIRED:"tokenExpired",LOGOUT:"logout"},h=e=>e==="tugboatqa.com"||e.endsWith(".tugboatqa.com"),i=e=>typeof e!="string"||e===""?null:h(e)||e==="qa.bankrate.com"||e.endsWith(".qa.bankrate.com")?n.QA:e==="bankrate.com"||e.endsWith(".bankrate.com")?n.PRODUCTION:null,a=()=>{var t;if(typeof window>"u")return"";const e=(t=window.location)==null?void 0:t.hostname;return typeof e=="string"?e:""},p=()=>{var t;if(typeof window>"u")return"";const e=(t=window.location)==null?void 0:t.origin;return typeof e=="string"?e:""},A=()=>c()?n.QA:i(a())??n.QA,y=()=>A()===n.PRODUCTION?d:S,E=()=>h(a()),c=()=>{const e=a();return e==="localhost"||e==="127.0.0.1"||e==="fantasia.test"},u="https://qa.bankrate.com",T=()=>{const e=a();return e===""?"":E()||c()||i(e)===null?u:p()},s={local:"http://localhost:3000",qa:"https://auth-callback-proxy.qa.bankrate.com",prod:"https://auth-callback-proxy.bankrate.com"},D="/api/auth/passwordless",w=()=>{if(typeof window>"u")return null;if(c())return s.local;const e=i(a());return e===null?null:e===n.PRODUCTION?s.prod:s.qa};class k{constructor(t=l.storageKey){o(this,"storageKey");o(this,"tokenRefreshThreshold");o(this,"hasStorage");this.storageKey=t,this.tokenRefreshThreshold=l.tokenRefreshThresholdMs,this.hasStorage=typeof localStorage<"u"}cache(t){if(!this.hasStorage)return!1;try{const r={user:t.user||null,profile:t.profile||null,expiresAt:Date.now()+t.expiresIn*1e3,cachedAt:Date.now()};return localStorage.setItem(this.storageKey,JSON.stringify(r)),!0}catch(r){return console.warn("[Auth SDK] Failed to cache auth state:",r),!1}}get(){if(!this.hasStorage)return null;try{const t=localStorage.getItem(this.storageKey);if(!t)return null;const r=JSON.parse(t);return r.expiresAt?r:null}catch(t){return console.warn("[Auth SDK] Failed to read auth cache:",t),null}}isValid(){const t=this.get();return t?Date.now()<t.expiresAt:!1}shouldRefresh(){const t=this.get();if(!t)return!1;const r=t.expiresAt-Date.now();return r>0&&r<this.tokenRefreshThreshold}updateExpiration(t){if(!this.hasStorage)return!1;try{const r=this.get();return r?(r.expiresAt=Date.now()+t*1e3,localStorage.setItem(this.storageKey,JSON.stringify(r)),!0):!1}catch(r){return console.warn("[Auth SDK] Failed to update expiration:",r),!1}}clear(){if(this.hasStorage)try{localStorage.removeItem(this.storageKey)}catch(t){console.warn("[Auth SDK] Failed to clear auth cache:",t)}}getUser(){const t=this.get();return(t==null?void 0:t.user)||null}getProfile(){const t=this.get();return(t==null?void 0:t.profile)||null}}export{k as A,l as C,D as P,T as a,O as b,b as c,A as d,c as e,y as g,E as i,w as r};
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.