1import{_ as Rn}from"./BRQ0Yd_Y.js";import{_ as On}from"./B4ngKFOR.js";import{M as Dn,e as Nn,J as Ln,c as K,a as p,b as se,w as q,p as ct,m as lt,v as Mn,k as y,N as Un,n as xn,d as k,l as ut,I as Bn,s as ye,o as V,t as Fn,O as Hn,_ as $n}from"./CWLuMS24.js";import{_ as Vn}from"./CsUbRxdX.js";import{u as Wn}from"./Z6O4pv7c.js";import{u as jn}from"./CTGAvxzj.js";import"./eyKebtth.js";const zn=Dn("/assets/images/goog.png"),Gn=()=>{};var dt={};const Ht=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128)}return e},Kn=function(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=n[t++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=n[t++],o=n[t++],c=n[t++],a=((s&7)<<18|(i&63)<<12|(o&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(a>>10)),e[r++]=String.fromCharCode(56320+(a&1023))}else{const i=n[t++],o=n[t++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|o&63)}}return e.join("")},$t={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<n.length;s+=3){const i=n[s],o=s+1<n.length,c=o?n[s+1]:0,a=s+2<n.length,d=a?n[s+2]:0,f=i>>2,m=(i&3)<<4|c>>4;let l=(c&15)<<2|d>>6,u=d&63;a||(u=64,o||(l=64)),r.push(t[f],t[m],t[l],t[u])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Ht(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):Kn(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<n.length;){const i=t[n.charAt(s++)],c=s<n.length?t[n.charAt(s)]:0;++s;const d=s<n.length?t[n.charAt(s)]:64;++s;const m=s<n.length?t[n.charAt(s)]:64;if(++s,i==null||c==null||d==null||m==null)throw new qn;const l=i<<2|c>>4;if(r.push(l),d!==64){const u=c<<4&240|d>>2;if(r.push(u),m!==64){const _=d<<6&192|m;r.push(_)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}};class qn extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Jn=function(n){const e=Ht(n);return $t.encodeByteArray(e,!0)},Vt=function(n){return Jn(n).replace(/\./g,"")},Wt=function(n){try{return $t.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Yn(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}const Xn=()=>Yn().__FIREBASE_DEFAULTS__,Zn=()=>{if(typeof process>"u"||typeof dt>"u")return;const n=dt.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Qn=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&Wt(n[1]);return e&&JSON.parse(e)},Ye=()=>{try{return Gn()||Xn()||Zn()||Qn()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},er=n=>Ye()?.emulatorHosts?.[n],jt=()=>Ye()?.config,zt=n=>Ye()?.[`_${n}`];class tr{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>
1{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}}function Oe(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}async function nr(n){return(await fetch(n,{credentials:"include"})).ok}const ie={};function rr(){const n={prod:[],emulator:[]};for(const e of Object.keys(ie))ie[e]?n.emulator.push(e):n.prod.push(e);return n}function sr(n){let e=document.getElementById(n),t=!1;return e||(e=document.createElement("div"),e.setAttribute("id",n),t=!0),{created:t,element:e}}let ht=!1;function ir(n,e){if(typeof window>"u"||typeof document>"u"||!Oe(window.location.host)||ie[n]===e||ie[n]||ht)return;ie[n]=e;function t(l){return`__firebase__banner__${l}`}const r="__firebase__banner",i=rr().prod.length>0;function o(){const l=document.getElementById(r);l&&l.remove()}function c(l){l.style.display="flex",l.style.background="#7faaf0",l.style.position="fixed",l.style.bottom="5px",l.style.left="5px",l.style.padding=".5em",l.style.borderRadius="5px",l.style.alignItems="center"}function a(l,u){l.setAttribute("width","24"),l.setAttribute("id",u),l.setAttribute("height","24"),l.setAttribute("viewBox","0 0 24 24"),l.setAttribute("fill","none"),l.style.marginLeft="-6px"}function d(){const l=document.createElement("span");return l.style.cursor="pointer",l.style.marginLeft="16px",l.style.fontSize="24px",l.innerHTML=" ×",l.onclick=()=>{ht=!0,o()},l}function f(l,u){l.setAttribute("id",u),l.innerText="Learn more",l.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",l.setAttribute("target","__blank"),l.style.paddingLeft="5px",l.style.textDecoration="underline"}function m(){const l=sr(r),u=t("text"),_=document.getElementById(u)||document.createElement("span"),C=t("learnmore"),w=document.getElementById(C)||document.createElement("a"),$=t("preprendIcon"),N=document.getElementById($)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(l.created){const _e=l.element;c(_e),f(w,C);const Ie=d();a(N,$),_e.append(N,_,w,Ie),document.body.appendChild(_e)}i?(_.innerText="Preview backend disconnected.",N.innerHTML=`<g clip-path="url(#clip0_6013_33858)"> 2<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/> 3</g> 4<defs> 5<clipPath id="clip0_6013_33858"> 6<rect width="24" height="24" fill="white"/> 7</clipPath> 8</defs>`):(N.innerHTML=`<g clip-path="url(#clip0_6083_34804)"> 9<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/> 10</g> 11<defs> 12<clipPath id="clip0_6083_34804"> 13<rect width="24" height="24" fill="white"/> 14</clipPath> 15</defs>`,_.innerText="Preview backend running in this workspace."),_.setAttribute("id",u)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",m):m()}function I(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function or(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(I())}function ar(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function cr(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function lr(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function ur(){const n=I();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function dr(){try{return typeof indexedDB=="object"}catch{return!1}}function hr(){return new Promise((n,e)=>{try{let t=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},s.onupgradeneeded=()=>{t=!1},s.onerror=()=>{e(s.error?.message||"")}}catch(t){e(t)}})}const fr="FirebaseError";
15class H extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=fr,Object.setPrototypeOf(this,H.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,de.prototype.create)}}class de{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},s=`${this.service}/${e}`,i=this.errors[e],o=i?pr(i,r):"Error",c=`${this.serviceName}: ${o} (${s}).`;return new H(s,c,r)}}function pr(n,e){return n.replace(mr,(t,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const mr=/\{\$([^}]+)}/g;function gr(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function Q(n,e){if(n===e)return!0;const t=Object.keys(n),r=Object.keys(e);for(const s of t){if(!r.includes(s))return!1;const i=n[s],o=e[s];if(ft(i)&&ft(o)){if(!Q(i,o))return!1}else if(i!==o)return!1}for(const s of r)if(!t.includes(s))return!1;return!0}function ft(n){return n!==null&&typeof n=="object"}function he(n){const e=[];for(const[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function _r(n,e){const t=new Ir(n,e);return t.subscribe.bind(t)}class Ir{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let s;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");yr(e,["next","error","complete"])?s=e:s={next:e,error:t,complete:r},s.next===void 0&&(s.next=Me),s.error===void 0&&(s.error=Me),s.complete===void 0&&(s.complete=Me);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function yr(n,e){if(typeof n!="object"||n===null)return!1;for(const t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function Me(){}function ne(n){return n&&n._delegate?n._delegate:n}class ee{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const W="[DEFAULT]";class wr{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const r=new tr;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:t});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){const t=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(r)return null;throw s}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(vr(e))try{this.getOrInitializeService({instanceIdentifier:W})}catch{}for(const[t,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(t);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=W){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=W){return this.instances.has(e)}getOptions(e=W){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[i,o]of this.instancesDeferred.entries()){const c=this.normalizeInstanceIdentifier(i);r===c&&o.resolve(s)}return s}onInit(e,t){const r=this.normalizeInstanceIdentifier(t),s=this.onInitCallbacks.get(r)??new Set;s.add(e),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&e(i,r),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const s of r)try{s(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:br(e),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=W){return this.component?this.component.multipleInstances?e:W:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function br(n){return n===W?void 0:n}function vr(n){return n.instantiationMode==="EAGER"}class Er{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new wr(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}var g;(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(g||(g={}));const Tr={debug:g.DEBUG,verbose:g.VERBOSE,info:g.INFO,warn:g.WARN,error:g.ERROR,silent:g.SILENT},Sr=g.INFO,Cr={[g.DEBUG]:"log",[g.VERBOSE]:"log",[g.INFO]:"info",[g.WARN]:"warn",[g.ERROR]:"error"},kr=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),s=Cr[e];if(s)console[s](`[${r}] ${n.name}:`,...t);
15else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class Gt{constructor(e){this.name=e,this._logLevel=Sr,this._logHandler=kr,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in g))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Tr[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,g.DEBUG,...e),this._logHandler(this,g.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,g.VERBOSE,...e),this._logHandler(this,g.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,g.INFO,...e),this._logHandler(this,g.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,g.WARN,...e),this._logHandler(this,g.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,g.ERROR,...e),this._logHandler(this,g.ERROR,...e)}}const Ar=(n,e)=>e.some(t=>n instanceof t);let pt,mt;function Pr(){return pt||(pt=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Rr(){return mt||(mt=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}
15const Kt=new WeakMap,Ve=new WeakMap,qt=new WeakMap,Ue=new WeakMap,Xe=new WeakMap;function Or(n){const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("success",i),n.removeEventListener("error",o)},i=()=>{t(B(n.result)),s()},o=()=>{r(n.error),s()};n.addEventListener("success",i),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&Kt.set(t,n)}).catch(()=>{}),Xe.set(e,n),e}function Dr(n){if(Ve.has(n))return;const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("complete",i),n.removeEventListener("error",o),n.removeEventListener("abort",o)},i=()=>{t(),s()},o=()=>{r(n.error||new DOMException("AbortError","AbortError")),s()};n.addEventListener("complete",i),n.addEventListener("error",o),n.addEventListener("abort",o)});Ve.set(n,e)}let We={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return Ve.get(n);if(e==="objectStoreNames")return n.objectStoreNames||qt.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return B(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function Nr(n){We=n(We)}function Lr(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=n.call(xe(this),e,...t);return qt.set(r,e.sort?e.sort():[e]),B(r)}:Rr().includes(n)?function(...e){return n.apply(xe(this),e),B(Kt.get(this))}:function(...e){return B(n.apply(xe(this),e))}}function Mr(n){return typeof n=="function"?Lr(n):(n instanceof IDBTransaction&&Dr(n),Ar(n,Pr())?new Proxy(n,We):n)}function B(n){if(n instanceof IDBRequest)return Or(n);if(Ue.has(n))return Ue.get(n);const e=Mr(n);return e!==n&&(Ue.set(n,e),Xe.set(e,n)),e}const xe=n=>Xe.get(n);function Ur(n,e,{blocked:t,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(n,e),c=B(o);return r&&o.addEventListener("upgradeneeded",a=>{r(B(o.result),a.oldVersion,a.newVersion,B(o.transaction),a)}),t&&o.addEventListener("blocked",a=>t(a.oldVersion,a.newVersion,a)),c.then(a=>{i&&a.addEventListener("close",()=>i()),s&&a.addEventListener("versionchange",d=>s(d.oldVersion,d.newVersion,d))}).catch(()=>{}),c}const xr=["get","getKey","getAll","getAllKeys","count"],Br=["put","add","delete","clear"],Be=new Map;function gt(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(Be.get(e))return Be.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,s=Br.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(s||xr.includes(t)))return;const i=async function(o,...c){const a=this.transaction(o,s?"readwrite":"readonly");let d=a.store;return r&&(d=d.index(c.shift())),(await Promise.all([d[t](...c),s&&a.done]))[0]};return Be.set(e,i),i}Nr(n=>({...n,get:(e,t,r)=>gt(e,t)||n.get(e,t,r),has:(e,t)=>!!gt(e,t)||n.has(e,t)}));class Fr{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Hr(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function Hr(n){return n.getComponent()?.type==="VERSION"}const je="@firebase/app",_t="0.14.8";const O=new Gt("@firebase/app"),$r="@firebase/app-compat",Vr="@firebase/analytics-compat",Wr="@firebase/analytics",jr="@firebase/app-check-compat",zr="@firebase/app-check",Gr="@firebase/auth",Kr="@firebase/auth-compat",qr="@firebase/database",Jr="@firebase/data-connect",Yr="@firebase/database-compat",Xr="@firebase/functions",Zr="@firebase/functions-compat",Qr="@firebase/installations",es="@firebase/installations-compat",ts="@firebase/messaging",ns="@firebase/messaging-compat",rs="@firebase/performance",ss="@firebase/performance-compat",is="@firebase/remote-config",os="@firebase/remote-config-compat",as="@firebase/storage",cs="@firebase/storage-compat",ls="@firebase/firestore",us="@firebase/ai",ds="@firebase/firestore-compat",hs="firebase",fs="12.9.0";const ze="[DEFAULT]",ps={[je]:"fire-core",[$r]:"fire-core-compat",[Wr]:"fire-analytics",[Vr]:"fire-analytics-compat",[zr]:"fire-app-check",[jr]:"fire-app-check-compat",[Gr]:"fire-auth",[Kr]:"fire-auth-compat",[qr]:"fire-rtdb",[Jr]:"fire-data-connect",[Yr]:"fire-rtdb-compat",[Xr]:"fire-fn",[Zr]:"fire-fn-compat",[Qr]:"fire-iid",[es]:"fire-iid-compat",[ts]:"fire-fcm",[ns]:"fire-fcm-compat",[rs]:"fire-perf",[ss]:"fire-perf-compat",[is]:"fire-rc",[os]:"fire-rc-compat",[as]:"fire-g
15cs",[cs]:"fire-gcs-compat",[ls]:"fire-fst",[ds]:"fire-fst-compat",[us]:"fire-vertex","fire-js":"fire-js",[hs]:"fire-js-all"};const ae=new Map,ms=new Map,Ge=new Map;function It(n,e){try{n.container.addComponent(e)}catch(t){O.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function ce(n){const e=n.name;if(Ge.has(e))return O.debug(`There were multiple attempts to register component ${e}.`),!1;Ge.set(e,n);for(const t of ae.values())It(t,n);for(const t of ms.values())It(t,n);return!0}function Jt(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function E(n){return n==null?!1:n.settings!==void 0}const gs={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invali
15d-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},F=new de("app","Firebase",gs);class _s{constructor(e,t,r){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new ee("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw F.create("app-deleted",{appName:this._name})}}const fe=fs;function Yt(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r={name:ze,automaticDataCollectionEnabled:!0,...e},s=r.name;if(typeof s!="string"||!s)throw F.create("bad-app-name",{appName:String(s)});if(t||(t=jt()),!t)throw F.create("no-options");const i=ae.get(s);if(i){if(Q(t,i.options)&&Q(r,i.config))return i;throw F.create("duplicate-app",{appName:s})}const o=new Er(s);for(const a of Ge.values())o.addComponent(a);const c=new _s(t,r,o);return ae.set(s,c),c}function Is(n=ze){const e=ae.get(n);if(!e&&n===ze&&jt())return Yt();if(!e)throw F.create("no-app",{appName:n});return e}function yt(){return Array.from(ae.values())}function J(n,e,t){let r=ps[n]??n;t&&(r+=`-${t}`);const s=r.match(/\s|\//),i=e.match(/\s|\//);if(s||i){const o=[`Unable to register library "${r}" with version "${e}":`];s&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&i&&o.push("and"),i&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),O.warn(o.join(" "));return}ce(new ee(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}const ys="firebase-heartbeat-database",ws=1,le="firebase-heartbeat-store";let Fe=null;function Xt(){return Fe||(Fe=Ur(ys,ws,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(le)}catch(t){console.warn(t)}}}}).catch(n=>{throw F.create("idb-open",{originalErrorMessage:n.message})})),Fe}async function bs(n){try{const t=(await Xt()).transaction(le),r=await t.objectStore(le).get(Zt(n));return await t.done,r}catch(e){if(e instanceof H)O.warn(e.message);else{const t=F.create("idb-get",{originalErrorMessage:e?.message});O.warn(t.message)}}}async function wt(n,e){try{const r=(await Xt()).transaction(le,"readwrite");await r.objectStore(le).put(e,Zt(n)),await r.done}catch(t){if(t instanceof H)O.warn(t.message);else{const r=F.create("idb-set",{originalErrorMessage:t?.message});O.warn(r.message)}}}function Zt(n){return`${n.name}!${n.options.appId}`}const vs=1024,Es=30;class Ts{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Cs(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){try{const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=bt();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(s=>s.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:t}),this._heartbeatsCache.heartbeats.length>Es){const s=ks(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(s,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){O.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";const e=bt(),{heartbeatsToSend:t,unsentEntries:r}=Ss(this._heartbeatsCache.heartbeats),s=Vt(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(e){return O.warn(e),""}}}function bt(){return new Date().toISOString().substring(0,10)}function Ss(n,e=vs){const t=[];let r=n.slice();for(const s of n){const i=t.find(o=>o.agent===s.agent);if(i){if(i.dates.push(s.date),vt(t)>e){i.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),vt(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class Cs{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return dr()?hr().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await bs(this.app);return t?.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return wt(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return wt(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function vt(n){return Vt(JSON.stringify({version:2,heartbeats:n})).length}function ks(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let r=1;r<n.length;r++)n[r].date<t&&(t=n[r].date,e=r);return e}function As(n){ce(new ee("platform-logger",e=>new Fr(e),"PRIVATE")),ce(new ee("heartbeat",e=>new Ts(e),"PRIVATE")),J(je,_t,n),J(je,_t,"esm2020"),J("fire-js","")}As("");var Ps="firebase",Rs="12.9.0";J(Ps,Rs,"app");function Qt(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const Os=Qt,en=new de("auth","Firebase",Qt());const Se=new Gt("@firebase/auth");function Ds(n,...e){Se.logLevel<=g.WARN&&Se.warn(`Auth (${fe}): ${n}`,...e)}function be(n,...e){Se.logLevel<=g.ERROR&&Se.error(`Auth (${fe}): ${n}`,...e)}function S(n,...e){throw Qe(n,...e)}function v(n,...e){return Qe(n,...e)}function Ze(n,e,t){const r={...Os(),[e]:t};return new de("auth","Firebase",r).create(e,{appName:n.name})}function z(n){return Ze(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Ns(n,e,t){const r=t;if(!(e instanceof r))throw r.name!==e.constructor.name&&S(n,"argument-error"),Ze(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}
15function Qe(n,...e){if(typeof n!="string"){const t=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=n.name),n._errorFactory.create(t,...r)}return en.create(n,...e)}function h(n,e,...t){if(!n)throw Qe(e,...t)}function P(n){const e="INTERNAL ASSERTION FAILED: "+n;throw be(e),new Error(e)}function D(n,e){n||P(e)}function Ke(){return typeof self<"u"&&self.location?.href||""}function Ls(){return Et()==="http:"||Et()==="https:"}function Et(){return typeof self<"u"&&self.location?.protocol||null}function Ms(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Ls()||cr()||"connection"in navigator)?navigator.onLine:!0}function Us(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}class pe{constructor(e,t){this.shortDelay=e,this.longDelay=t,D(t>e,"Short delay should be less than long delay!"),this.isMobile=or()||lr()}get(){return Ms()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function et(n,e){D(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}class tn{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;P("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;P("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;P("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const xs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-rec
15aptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};const Bs=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Fs=new pe(3e4,6e4);function tt(n,e){return n.tenantId&&!e.tenantId?{...e,tenantId:n.tenantId}:e}async function re(n,e,t,r,s={}){return nn(n,s,async()=>{let i={},o={};r&&(e==="GET"?o=r:i={body:JSON.stringify(r)});const c=he({key:n.config.apiKey,...o}).slice(1),a=await n._getAdditionalHeaders();a["Content-Type"]="application/json",n.languageCode&&(a["X-Firebase-Locale"]=n.languageCode);const d={method:e,headers:a,...i};return ar()||(d.referrerPolicy="no-referrer"),n.emulatorConfig&&Oe(n.emulatorConfig.host)&&(d.credentials="include"),tn.fetch()(await rn(n,n.config.apiHost,t,c),d)})}async function nn(n,e,t){n._canInitEmulator=!1;const r={...xs,...e};try{const s=new $s(n),i=await Promise.race([t(),s.promise]);s.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw we(n,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const c=i.ok?o.errorMessage:o.error.message,[a,d]=c.split(" : ");if(a==="FEDERATED_USER_ID_ALREADY_LINKED")throw we(n,"credential-already-in-use",o);if(a==="EMAIL_EXISTS")throw we(n,"email-already-in-use",o);if(a==="USER_DISABLED")throw we(n,"user-disabled",o);const f=r[a]||a.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw Ze(n,f,d);S(n,f)}}catch(s){if(s instanceof H)throw s;S(n,"network-request-failed",{message:String(s)})}}async function Hs(n,e,t,r,s={}){const i=await re(n,e,t,r,s);return"mfaPendingCredential"in i&&S(n,"multi-factor-auth-required",{_serverResponse:i}),i}async function rn(n,e,t,r){const s=`${e}${t}?${r}`,i=n,o=i.config.emulator?et(n.config,s):`${n.config.apiScheme}://${s}`;return Bs.includes(t)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?i._getPersistence()._getFinalTarget(o).toString():o}class $s{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(v(this.auth,"network-request-failed")),Fs.get())})}}function we(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const s=v(n,e,r);return s.customData._tokenResponse=t,s}async function Vs(n,e){return re(n,"POST","/v1/accounts:delete",e)}async function Ce(n,e){return re(n,"POST","/v1/accounts:lookup",e)}function oe(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Ws(n,e=!1){const t=ne(n),r=await t.getIdToken(e),s=nt(r);h(s&&s.exp&&s.auth_time&&s.iat,t.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,o=i?.sign_in_provider;return{claims:s,token:r,authTime:oe(He(s.auth_time)),issuedAtTime:oe(He(s.iat)),expirationTime:oe(He(s.exp)),signInProvider:o||null,signInSecondFactor:i?.sign_in_second_factor||null}}function He(n){return Number(n)*1e3}function nt(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return be("JWT malformed, contained fewer than 3 sections"),null;try{const s=Wt(t);return s?JSON.parse(s):(be("Failed to decode base64 JWT payload"),null)}catch(s){return be("Caught error parsing JWT payload as JSON",s?.toString()),null}}function Tt(n){const e=nt(n);return h(e,"internal-error"),h(typeof e.exp<"u","internal-error"),h(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ue(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof H&&js(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function js({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}class zs{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}class qe{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=oe(this.lastLoginAt),this.creationTime=oe(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function ke(n){const e=n.auth,t=await n.getIdToken(),r=await ue(n,Ce(e,{idToken:t}));h(r?.users.length,e,"internal-error");const s=r.users[0];n._notifyReloadListener(s);const i=s.providerUserInfo?.length?sn(s.providerUserInfo):[],o=Ks(n.providerData,i),c=n.isAnonymous,a=!(n.email&&s.passwordHash)&&!o?.length,d=c?a:!1,f={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new qe(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(n,f)}async function Gs(n){const e=ne(n);await ke(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Ks(n,e){return[...n.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function sn(n){return n.map(({providerId:e,...t})=>
15({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}async function qs(n,e){const t=await nn(n,{},async()=>{const r=he({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=n.config,o=await rn(n,s,"/v1/token",`key=${i}`),c=await n._getAdditionalHeaders();c["Content-Type"]="application/x-www-form-urlencoded";const a={method:"POST",headers:c,body:r};return n.emulatorConfig&&Oe(n.emulatorConfig.host)&&(a.credentials="include"),tn.fetch()(o,a)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function Js(n,e){return re(n,"POST","/v2/accounts:revokeToken",tt(n,e))}class Y{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){h(e.idToken,"internal-error"),h(typeof e.idToken<"u","internal-error"),h(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Tt(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){h(e.length!==0,"internal-error");const t=Tt(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(h(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:r,refreshToken:s,expiresIn:i}=await qs(e,t);this.updateTokensAndExpiration(r,s,Number(i))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,t){const{refreshToken:r,accessToken:s,expirationTime:i}=t,o=new Y;return r&&(h(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),s&&(h(typeof s=="string","internal-error",{appName:e}),o.accessToken=s),i&&(h(typeof i=="number","internal-error",{appName:e}),o.expirationTime=i),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Y,this.toJSON())}_performRefresh(){return P("not implemented")}}function L(n,e){h(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class b{constructor({uid:e,auth:t,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new zs(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new qe(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await ue(this,this.stsTokenManager.getToken(this.auth,e));return h(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return Ws(this,e)}reload(){return Gs(this)}_assign(e){this!==e&&(h(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(t=>({...t})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new b({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){h(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await ke(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(E(this.auth.app))return Promise.reject(z(this.auth));const e=await this.getIdToken();return await ue(this,Vs(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isA
15nonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){const r=t.displayName??void 0,s=t.email??void 0,i=t.phoneNumber??void 0,o=t.photoURL??void 0,c=t.tenantId??void 0,a=t._redirectEventId??void 0,d=t.createdAt??void 0,f=t.lastLoginAt??void 0,{uid:m,emailVerified:l,isAnonymous:u,providerData:_,stsTokenManager:C}=t;h(m&&C,e,"internal-error");const w=Y.fromJSON(this.name,C);h(typeof m=="string",e,"internal-error"),L(r,e.name),L(s,e.name),h(typeof l=="boolean",e,"internal-error"),h(typeof u=="boolean",e,"internal-error"),L(i,e.name),L(o,e.name),L(c,e.name),L(a,e.name),L(d,e.name),L(f,e.name);const $=new b({uid:m,auth:e,email:s,emailVerified:l,displayName:r,isAnonymous:u,photoURL:o,phoneNumber:i,tenantId:c,stsTokenManager:w,createdAt:d,lastLoginAt:f});return _&&Array.isArray(_)&&($.providerData=_.map(N=>({...N}))),a&&($._redirectEventId=a),$}static async _fromIdTokenResponse(e,t,r=!1){const s=new Y;s.updateFromServerResponse(t);const i=new b({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await ke(i),i}static async _fromGetAccountInfoResponse(e,t,r){const s=t.users[0];h(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?sn(s.providerUserInfo):[],o=!(s.email&&s.passwordHash)&&!i?.length,c=new Y;c.updateFromIdToken(r);const a=new b({uid:s.localId,auth:e,stsTokenManager:c,isAnonymous:o}),d={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new qe(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!i?.length};return Object.assign(a,d),a}}const St=new Map;function R(n){D(n instanceof Function,"Expected a class definition");let e=St.get(n);return e?(D(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,St.set(n,e),e)}class on{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}on.type="NONE";const Ct=on;function ve(n,e,t){return`firebase:${n}:${e}:${t}`}class X{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=ve(this.userKey,s.apiKey,i),this.fullPersistenceKey=ve("persistence",s.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const t=await Ce(this.auth,{idToken:e}).catch(()=>{});return t?b._fromGetAccountInfoResponse(this.auth,t,e):null}return b._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new X(R(Ct),e,r);const s=(await Promise.all(t.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let i=s[0]||R(Ct);const o=ve(r,e.config.apiKey,e.name);let c=null;for(const d of t)try{const f=await d._get(o);if(f){let m;if(typeof f=="string"){const l=await Ce(e,{idToken:f}).catch(()=>{});if(!l)break;m=await b._fromGetAccountInfoResponse(e,l,f)}else m=b._fromJSON(e,f);d!==i&&(c=m),i=d;break}}catch{}const a=s.filter(d=>d._shouldAllowMigration);return!i._shouldAllowMigration||!a.length?new X(i,e,r):(i=a[0],c&&await i._set(o,c.toJSON()),await Promise.all(t.map(async d=>{if(d!==i)try{await d._remove(o)}catch{}})),new X(i,e,r))}}function kt(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(un(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(an(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(hn(e))return"Blackberry";if(fn(e))return"Webos";if(cn(e))return"Safari";if((e.includes("chrome/")||ln(e))&&!e.includes("edge/"))return"Chrome";
15if(dn(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=n.match(t);if(r?.length===2)return r[1]}return"Other"}function an(n=I()){return/firefox\//i.test(n)}function cn(n=I()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function ln(n=I()){return/crios\//i.test(n)}function un(n=I()){return/iemobile/i.test(n)}function dn(n=I()){return/android/i.test(n)}function hn(n=I()){return/blackberry/i.test(n)}function fn(n=I()){return/webos/i.test(n)}function rt(n=I()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function Ys(n=I()){return rt(n)&&!!window.navigator?.standalone}function Xs(){return ur()&&document.documentMode===10}function pn(n=I()){return rt(n)||dn(n)||fn(n)||hn(n)||/windows phone/i.test(n)||un(n)}function mn(n,e=[]){let t;switch(n){case"Browser":t=kt(I());break;case"Worker":t=`${kt(I())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${fe}/${r}`}class Zs{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=i=>new Promise((o,c)=>{try{const a=e(i);o(a)}catch(a){c(a)}});r.onAbort=t,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(r){t.reverse();for(const s of t)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}}}async function Qs(n,e={}){return re(n,"GET","/v2/passwordPolicy",tt(n,e))}const ei=6;class ti{constructor(e){const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??ei,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),t.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),t.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),t.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),t.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),s&&(t.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let r;for(let s=0;s<e.length;s++)r=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}class ni{constructor(e,t,r,s){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new At(this),this.idTokenSubscription=new At(this),this.beforeStateQueue=new Zs(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=en,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=R(t)),this._initializationPromise=this.queue(async()=>
15{if(!this._deleted&&(this.persistenceManager=await X.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=this.currentUser?.uid||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const t=await Ce(this,{idToken:e}),r=await b._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(E(this.app)){const i=this.app.settings.authIdToken;return i?new Promise(o=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(i).then(o,o))}):this.directlySetCurrentUser(null)}const t=await this.assertedPersistence.getCurrentUser();let r=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const i=this.redirectUser?._redirectEventId,o=r?._redirectEventId,c=await this.tryRedirectSignIn(e);(!i||i===o)&&c?.user&&(r=c.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(i){r=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(i))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return h(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await ke(e)}catch(t){if(t?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=Us()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(E(this.app))return Promise.reject(z(this));const t=e?ne(e):null;return t&&h(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&h(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return E(this.app)?Promise.reject(z(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return E(this.app)?Promise.reject(z(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(R(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await Qs(this),t=new ti(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new de("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((e,t)=>
15{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(r.tenantId=this.tenantId),await Js(this,r)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){const r=await this.getOrInitRedirectPersistenceManager(t);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&R(e)||this._popupRedirectResolver;h(t,this,"argument-error"),this.redirectPersistenceManager=await X.create(this,[R(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._redirectEventId===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,s){if(this._deleted)return()=>{};const i=typeof t=="function"?t:t.next.bind(t);let o=!1;const c=this._isInitialized?Promise.resolve():this._initializationPromise;if(h(c,this,"internal-error"),c.then(()=>{o||i(this.currentUser)}),typeof t=="function"){const a=e.addObserver(t,r,s);return()=>{o=!0,a()}}else{const a=e.addObserver(t);return()=>{o=!0,a()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return h(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=mn(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const t=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();t&&(e["X-Firebase-Client"]=t);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){if(E(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&Ds(`Error while retrieving App Check token: ${e.error}`),e?.token}}function De(n){return ne(n)}class At{constructor(e){this.auth=e,this.observer=null,this.addObserver=_r(t=>this.observer=t)}get next(){return h(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let st={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function ri(n){st=n}function si(n){return st.loadJS(n)}function ii(){return st.gapiScript}function oi(n){return`__${n}${Math.floor(Math.random()*1e6)}`}function ai(n,e){const t=Jt(n,"auth");if(t.isInitialized()){const s=t.getImmediate(),i=t.getOptions();if(Q(i,e??{}))return s;S(s,"already-initialized")}return t.initialize({options:e})}function ci(n,e){const t=e?.persistence||[],r=(Array.isArray(t)?t:[t]).map(R);e?.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e?.popupRedirectResolver)}function li(n,e,t){const r=De(n);
15h(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!1,i=gn(e),{host:o,port:c}=ui(e),a=c===null?"":`:${c}`,d={url:`${i}//${o}${a}/`},f=Object.freeze({host:o,port:c,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){h(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),h(Q(d,r.config.emulator)&&Q(f,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=d,r.emulatorConfig=f,r.settings.appVerificationDisabledForTesting=!0,Oe(o)?(nr(`${i}//${o}${a}`),ir("Auth",!0)):di()}function gn(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function ui(n){const e=gn(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const r=t[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const i=s[1];return{host:i,port:Pt(r.substr(i.length+1))}}else{const[i,o]=r.split(":");return{host:i,port:Pt(o)}}}function Pt(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function di(){function n(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}class _n{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return P("not implemented")}_getIdTokenResponse(e){return P("not implemented")}_linkToIdToken(e,t){return P("not implemented")}_getReauthenticationResolver(e){return P("not implemented")}}async function Z(n,e){return Hs(n,"POST","/v1/accounts:signInWithIdp",tt(n,e))}const hi="http://localhost";class G extends _n{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new G(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):S("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
15once:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:s,...i}=t;if(!r||!s)return null;const o=new G(r,s);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){const t=this.buildRequest();return Z(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,Z(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Z(e,t)}buildRequest(){const e={requestUri:hi,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=he(t)}return e}}class it{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class me extends it{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class M extends me{constructor(){super("facebook.com")}static credential(e){return G._fromParams({providerId:M.PROVIDER_ID,signInMethod:M.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return M.credentialFromTaggedObject(e)}static credentialFromError(e){return M.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return M.credential(e.oauthAccessToken)}catch{return null}}}M.FACEBOOK_SIGN_IN_METHOD="facebook.com";M.PROVIDER_ID="facebook.com";class A extends me{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return G._fromParams({providerId:A.PROVIDER_ID,signInMethod:A.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return A.credentialFromTaggedObject(e)}static credentialFromError(e){return A.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return A.credential(t,r)}catch{return null}}}A.GOOGLE_SIGN_IN_METHOD="google.com";A.PROVIDER_ID="google.com";class U extends me{constructor(){super("github.com")}static credential(e){return G._fromParams({providerId:U.PROVIDER_ID,signInMethod:U.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return U.credentialFromTaggedObject(e)}static credentialFromError(e){return U.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return U.credential(e.oauthAccessToken)}catch{return null}}}U.GITHUB_SIGN_IN_METHOD="github.com";U.PROVIDER_ID="github.com";class x extends me{constructor(){super("twitter.com")}static credential(e,t){return G._fromParams({providerId:x.PROVIDER_ID,signInMethod:x.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return x.credentialFromTaggedObject(e)}static credentialFromError(e){return x.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return x.credential(t,r)}catch{return null}}}x.TWITTER_SIGN_IN_METHOD="twitter.com";x.PROVIDER_ID="twitter.com";class te{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,s=!1){const i=await b._fromIdTokenResponse(e,r,s),o=Rt(r);return new te({user:i,providerId:o,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const s=Rt(r);return new te({user:e,providerId:s,_tokenResponse:r,operationType:t})}}function Rt(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}class Ae extends H{constructor(e,t,r,s){super(t.code,t.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,Ae.prototype),this.customData={appName:e.n
15ame,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,s){return new Ae(e,t,r,s)}}function In(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?Ae._fromErrorAndOperation(n,i,e,r):i})}async function fi(n,e,t=!1){const r=await ue(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return te._forOperation(n,"link",r)}async function pi(n,e,t=!1){const{auth:r}=n;if(E(r.app))return Promise.reject(z(r));const s="reauthenticate";try{const i=await ue(n,In(r,s,e,n),t);h(i.idToken,r,"internal-error");const o=nt(i.idToken);h(o,r,"internal-error");const{sub:c}=o;return h(n.uid===c,r,"user-mismatch"),te._forOperation(n,s,i)}catch(i){throw i?.code==="auth/user-not-found"&&S(r,"user-mismatch"),i}}async function mi(n,e,t=!1){if(E(n.app))return Promise.reject(z(n));const r="signIn",s=await In(n,r,e),i=await te._fromIdTokenResponse(n,r,s);return t||await n._updateCurrentUser(i.user),i}function gi(n,e,t,r){return ne(n).onIdTokenChanged(e,t,r)}function _i(n,e,t){return ne(n).beforeAuthStateChanged(e,t)}const Pe="__sak";class yn{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Pe,"1"),this.storage.removeItem(Pe),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}const Ii=1e3,yi=10;class wn extends yn{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=pn(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),s=this.localCache[t];r!==s&&e(t,s,r)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,c,a)=>{this.notifyListeners(o,a)});return}const r=e.key;t?this.detachListener():this.stopPolling();const s=()=>{const o=this.storage.getItem(r);!t&&this.localCache[r]===o||this.notifyListeners(r,o)},i=this.storage.getItem(r);Xs()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,yi):s()}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},Ii)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Ob
15ject.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}wn.type="LOCAL";const wi=wn;class bn extends yn{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}bn.type="SESSION";const vn=bn;function bi(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}class Ne{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(s=>s.isListeningto(e));if(t)return t;const r=new Ne(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:s,data:i}=t.data,o=this.handlersMap[s];if(!o?.size)return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const c=Array.from(o).map(async d=>d(t.origin,i)),a=await bi(c);t.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:a})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Ne.receivers=[];function ot(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}class vi{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let i,o;return new Promise((c,a)=>{const d=ot("",20);s.port1.start();const f=setTimeout(()=>{a(new Error("unsupported_event"))},r);o={messageChannel:s,onMessage(m){const l=m;if(l.data.eventId===d)switch(l.data.status){case"ack":clearTimeout(f),i=setTimeout(()=>{a(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),c(l.data.response);break;default:clearTimeout(f),clearTimeout(i),a(new Error("invalid_response"));break}}},this.handlers.add(o),s.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:d,data:t},[s.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}function T(){return window}function Ei(n){T().location.href=n}function En(){return typeof T().WorkerGlobalScope<"u"&&typeof T().importScripts=="function"}async function Ti(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Si(){return navigator?.serviceWorker?.controller||null}function Ci(){return En()?self:null}const Tn="firebaseLocalStorageDb",ki=1,Re="firebaseLocalStorage",Sn="fbase_key";class ge{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function Le(n,e){return n.transaction([Re],e?"readwrite":"readonly").objectStore(Re)}function Ai(){const n=indexedDB.deleteDatabase(Tn);return new ge(n).toPromise()}function Je(){const n=indexedDB.open(Tn,ki);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(Re,{keyPath:Sn})}catch(s){t(s)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(Re)?e(r):(r.close(),await Ai(),e(await Je()))})})}async function Ot(n,e,t){const r=Le(n,!0).put({[Sn]:e,value:t});return new ge(r).toPromise()}async function Pi(n,e){const t=Le(n,!1).get(e),r=await new ge(t).toProm
15ise();return r===void 0?null:r.value}function Dt(n,e){const t=Le(n,!0).delete(e);return new ge(t).toPromise()}const Ri=800,Oi=3;class Cn{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await Je(),this.db)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>Oi)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return En()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ne._getInstance(Ci()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await Ti(),!this.activeServiceWorker)return;this.sender=new vi(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Si()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Je();return await Ot(e,Pe,"1"),await Dt(e,Pe),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(r=>Ot(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>Pi(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Dt(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=Le(s,!1).getAll();return new ge(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],r=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),t.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),t.push(s));return t}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Ri)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Ob
15ject.keys(this.listeners).length===0&&this.stopPolling()}}Cn.type="LOCAL";const Di=Cn;new pe(3e4,6e4);function kn(n,e){return e?R(e):(h(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}class at extends _n{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Z(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Z(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Z(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function Ni(n){return mi(n.auth,new at(n),n.bypassAuthState)}function Li(n){const{auth:e,user:t}=n;return h(t,e,"internal-error"),pi(t,new at(n),n.bypassAuthState)}async function Mi(n){const{auth:e,user:t}=n;return h(t,e,"internal-error"),fi(t,new at(n),n.bypassAuthState)}class An{constructor(e,t,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:r,postBody:s,tenantId:i,error:o,type:c}=e;if(o){this.reject(o);return}const a={auth:this.auth,requestUri:t,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(a))}catch(d){this.reject(d)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Ni;case"linkViaPopup":case"linkViaRedirect":return Mi;case"reauthViaPopup":case"reauthViaRedirect":return Li;default:S(this.auth,"internal-error")}}resolve(e){D(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){D(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const Ui=new pe(2e3,1e4);async function xi(n,e,t){if(E(n.app))return Promise.reject(v(n,"operation-not-supported-in-this-environment"));const r=De(n);Ns(n,e,it);const s=kn(r,t);return new j(r,"signInViaPopup",e,s).executeNotNull()}class j extends An{constructor(e,t,r,s,i){super(e,t,s,i),this.provider=r,this.authWindow=null,this.pollId=null,j.currentPopupAction&&j.currentPopupAction.cancel(),j.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return h(e,this.auth,"internal-error"),e}async onExecution(){D(this.filter.length===1,"Popup operations only handle one event");const e=ot();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(v(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(v(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,j.currentPopupAction=null}pollUserCancellation(){const e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(v(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,Ui.get())};e()}}j.currentPopupAction=null;const Bi="pendingRedirect",Ee=new Map;class Fi extends An{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=Ee.get(this.auth._key());if(!e){try{const r=await Hi(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}Ee.set(this.auth._key(),e)}return this.bypassAuthState||Ee.set(this.auth._key(),()=>Promise.resolve(null)),e()}
15async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function Hi(n,e){const t=Wi(e),r=Vi(n);if(!await r._isAvailable())return!1;const s=await r._get(t)==="true";return await r._remove(t),s}function $i(n,e){Ee.set(n._key(),e)}function Vi(n){return R(n._redirectPersistence)}function Wi(n){return ve(Bi,n.config.apiKey,n.name)}async function ji(n,e,t=!1){if(E(n.app))return Promise.reject(z(n));const r=De(n),s=kn(r,e),o=await new Fi(r,s,t).execute();return o&&!t&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}const zi=600*1e3;class Gi{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!Ki(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!Pn(e)){const r=e.error.code?.split("auth/")[1]||"internal-error";t.onError(v(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const r=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=zi&&this.cachedEventUids.clear(),this.cachedEventUids.has(Nt(e))}saveEventToCache(e){this.cachedEventUids.add(Nt(e)),this.lastProcessedEventTime=Date.now()}}function Nt(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function Pn({type:n,error:e}){return n==="unknown"&&e?.code==="auth/no-auth-event"}function Ki(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Pn(n);default:return!1}}async function qi(n,e={}){return re(n,"GET","/v1/projects",e)}const Ji=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Yi=/^https?/;async function Xi(n){if(n.config.emulator)return;const{authorizedDomains:e}=await qi(n);for(const t of e)try{if(Zi(t))return}catch{}S(n,"unauthorized-domain")}function Zi(n){const e=Ke(),{protocol:t,hostname:r}=new URL(e);if(n.startsWith("chrome-extension://")){const o=new URL(n);return o.hostname===""&&r===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===r}if(!Yi.test(t))return!1;if(Ji.test(n))return r===n;const s=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}const Qi=new pe(3e4,6e4);function Lt(){const n=T().___jsl;if(n?.H){for(const e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function eo(n){return new Promise((e,t)=>{function r(){Lt(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Lt(),t(v(n,"network-request-failed"))},timeout:Qi.get()})}if(T().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(T().gapi?.load)r();else{const s=oi("iframefcb");return T()[s]=()=>{gapi.load?r():t(v(n,"network-request-failed"))},si(`${ii()}?onload=${s}`).catch(i=>t(i))}}).catch(e=>{throw Te=null,e})}let Te=null;function to(n){return Te=Te||eo(n),Te}const no=new pe(5e3,15e3),ro="__/auth/iframe",so="emulator/auth/iframe",io={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},oo=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function ao(n){const e=n.config;h(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?et(e,so):`https://${n.config.authDomain}/${ro}`,r={apiKey:e.apiKey,appName:n.name,v:fe},s=oo.get(n.config.apiHost);s&&(r.eid=s);const i=n._getFrameworks();return i.length&&(r.fw=i.join(",")),`${t}?${he(r).slice(1)}`}async function co(n){const e=await to(n),t=T().gapi;return h(t,n,"internal-error"),e.open({where:document.body,url:ao(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:io,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const o=v(n,"network-request-failed"),c=T().setTimeout(()=>{i(o)},no.get());function a(){T().clearTimeout(c),s(r)}r.ping(a).then(a,()=>{i(o)})}))}const lo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},uo=500,ho=600,fo="_blank",po="http://localhost";class Mt{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function mo(n,e,t,r=uo,s=ho){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWi
15dth-r)/2,0).toString();let c="";const a={...lo,width:r.toString(),height:s.toString(),top:i,left:o},d=I().toLowerCase();t&&(c=ln(d)?fo:t),an(d)&&(e=e||po,a.scrollbars="yes");const f=Object.entries(a).reduce((l,[u,_])=>`${l}${u}=${_},`,"");if(Ys(d)&&c!=="_self")return go(e||"",c),new Mt(null);const m=window.open(e||"",c,f);h(m,n,"popup-blocked");try{m.focus()}catch{}return new Mt(m)}function go(n,e){const t=document.createElement("a");t.href=n,t.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}const _o="__/auth/handler",Io="emulator/auth/handler",yo=encodeURIComponent("fac");async function Ut(n,e,t,r,s,i){h(n.config.authDomain,n,"auth-domain-config-required"),h(n.config.apiKey,n,"invalid-api-key");const o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:fe,eventId:s};if(e instanceof it){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",gr(e.getCustomParameters())||(o.customParameters=JSON.str
15ingify(e.getCustomParameters()));for(const[f,m]of Object.entries({}))o[f]=m}if(e instanceof me){const f=e.getScopes().filter(m=>m!=="");f.length>0&&(o.scopes=f.join(","))}n.tenantId&&(o.tid=n.tenantId);const c=o;for(const f of Object.keys(c))c[f]===void 0&&delete c[f];const a=await n._getAppCheckToken(),d=a?`#${yo}=${encodeURIComponent(a)}`:"";return`${wo(n)}?${he(c).slice(1)}${d}`}function wo({config:n}){return n.emulator?et(n,Io):`https://${n.authDomain}/${_o}`}const $e="webStorageSupport";class bo{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=vn,this._completeRedirectFn=ji,this._overrideRedirectResult=$i}async _openPopup(e,t,r,s){D(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");const i=await Ut(e,t,r,Ke(),s);return mo(e,i,ot())}async _openRedirect(e,t,r,s){await this._originValidation(e);const i=await Ut(e,t,r,Ke(),s);return Ei(i),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:s,promise:i}=this.eventManagers[t];return s?Promise.resolve(s):(D(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){const t=await co(e),r=new Gi(e);return t.register("authEvent",s=>(h(s?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send($e,{type:$e},s=>{const i=s?.[0]?.[$e];i!==void 0&&t(!!i),S(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Xi(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return pn()||cn()||rt()}}const vo=bo;var xt="@firebase/auth",Bt="1.12.0";class Eo{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(r=>{e(r?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){h(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}function To(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function So(n){ce(new ee("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:o,authDomain:c}=r.options;h(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const a={apiKey:o,authDomain:c,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:mn(n)},d=new ni(r,s,i,a);return ci(d,t),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),ce(new ee("auth-internal",e=>{const t=De(e.getProvider("auth").getImmediate());return(r=>new Eo(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),J(xt,Bt,To(n)),J(xt,Bt,"esm2020")}const Co=300,ko=zt("authIdTokenMaxAge")||Co;let Ft=null;const Ao=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>ko)return;const s=t?.token;Ft!==s&&(Ft=s,await fetch(n,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function Po(n=Is()){const e=Jt(n,"auth");if(e.isInitialized())return e.getImmediate();const t=ai(n,{popupRedirectResolver:vo,persistence:[Di,wi,vn]}
15),r=zt("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const o=Ao(i.toString());_i(t,o,()=>o(t.currentUser)),gi(t,c=>o(c))}}const s=er("auth");return s&&li(t,`http://${s}`),t}function Ro(){return document.getElementsByTagName("head")?.[0]??document}ri({loadJS(n){return new Promise((e,t)=>{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=s=>{const i=v("internal-error");i.customData=s,t(i)},r.type="text/javascript",r.charset="UTF-8",Ro().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});So("Browser");const Oo={class:"login-page"},Do={class:"container-fluid"},No={class:"row min-vh-100 align-items-center justify-content-center"},Lo={class:"col-12 col-sm-10 col-md-8 col-lg-6 col-xl-4"},Mo={class:"login-card"},Uo={class:"text-center mb-4"},xo={class:"form-floating mb-3"},Bo={class:"form-floating mb-3"},Fo=["type"],Ho=["disabled"],$o={key:0},Vo={key:1},Wo=["disabled"],jo={key:0,width:"20",alt:"Google sign-in",src:zn,class:"me-2"},zo={key:1},Go={key:2},Ko={class:"text-center"},qo={class:"mb-1"},Jo={class:"register-text"},Yo={class:"mt-4 pt-3 border-top"},Xo={class:"small text-muted mb-0"},Zo=Nn({__name:"login",setup(n){const e=Ln(),t=Wn(),r=jn(),s=Hn({email:"",password:""}),i=ye(!1),o=ye(!1),c=ye(!1),a=ye(""),d=async()=>{o.value=!0,a.value="";try{const l=await t.login({email:s.email,password:s.password}),u=l.user||l.data?.user||null,_=u?.role||u?.level||null;r.success("Login berhasil! Selamat datang..."),e.push("/dashboard")}catch(l){a.value=l?.data?.message||"Login gagal",r.error(a.value),s.password=""}finally{o.value=!1}},f=()=>{const l=navigator.userAgent;let u="unknown";return l.indexOf("Opera")!==-1||l.indexOf("OPR")!==-1?u="opera":l.indexOf("Edg")!==-1?u="edge":l.indexOf("Chrome")!==-1?u="chrome":l.indexOf("Safari")!==-1?u="safari":l.indexOf("Firefox")!==-1&&(u="firefox"),u},m=async()=>{const l=f();l!=="chrome"&&l!=="firefox"&&l!=="safari"&&alert("Mohon gunakan browser Chrome, Firefox, atau Safari jika terjadi error saat login via Google!"),c.value=!0,a.value="";try{const u={apiKey:"AIzaSyCeeyUXMX5I0YpB09UPTPxRxvyhKiCszus",authDomain:"infocpns-2b892.firebaseapp.com",projectId:"infocpns-2b892",storageBucket:"infocpns-2b892.appspot.com",messagingSenderId:"368352106323",appId:"1:368352106323:web:14ddb8237a312e2a15f3a6",measurementId:"G-DT5T5712FJ"},_=yt().length?yt()[0]:Yt(u),C=Po(_),w=new A,N=await(await xi(C,w)).user.getIdToken(),Ie=(await t.loginGoogle({id_token:N})).user,Qo=Ie?.role||Ie?.level||null;r.success("Login berhasil! Selamat datang..."),e.push("/dashboard")}catch(u){console.error("Google login error:",u),a.value=u?.data?.message||"Login dengan Google gagal",r.error(a.value)}finally{c.value=!1}};return(l,u)=>{const _=Rn,C=On;return V(),K("div",Oo,[p("div",Do,[p("div",No,[p("div",Lo,[p("div",Mo,[p("div",Uo,[se(_,{to:"/",class:"logo-link"},{default:q(()=>[...u[3]||(u[3]=[p("img",{src:Vn,alt:"InfoCPNS Logo",class:"logo-img"},null,-1)])]),_:1}),u[4]||(u[4]=p("h1",{class:"login-title mt-3"},"Selamat Datang",-1)),u[5]||(u[5]=p("p",{class:"login-subtitle"},"Masuk ke akun Anda untuk melanjutkan",-1))]),p("form",{onSubmit:ct(d,["prevent"]),class:"login-form"},[p("div",xo,[lt(p("input",{id:"emailaddress",type:"email",class:"form-control form-control-modern","onUpdate:modelValue":u[0]||(u[0]=w=>y(s).email=w),required:"",placeholder:"Masukkan email Anda"},null,512),[[Mn,y(s).email]]),u[6]||(u[6]=p("label",{for:"emailaddress",class:"form-label-modern"},"Email",-1))]),p("div",Bo,[lt(p("input",{type:y(i)?"text":"password",id:"password",class:"form-control form-control-modern","onUpdate:modelValue":u[1]||(u[1]=w=>y(s).password=w),required:"",placeholder:"Masukkan password Anda"},null,8,Fo),[[Un,y(s).password]]),u[7]||(u[7]=p("label",{for:"password",class:"form-label-modern"},"Password",-1)),p("button",{type:"button",class:"password-toggle",onClick:u[2]||(u[2]=w=>i.value=!y(i)),tabindex:"-1"},[p("i",{class:xn(y(i)?"fas fa-eye-slash":"fas fa-eye")},null,2)])]),u[17]||(u[17]=p("div",{class:"form-check mb-3"},[p("input",{type:"checkbox",class:"form-check-input",id:"checkbox-signin",checked:""}),p("label",{class:"form-check-label",for:"checkbox-signin"},"Ingat saya")],-1)),p("button",{class:"btn btn-primary-modern w-100 mb-3",type:"submit",disabled:y(o)},[y(o)?(V(),K("span",Vo,[...u[9]||(u[9]=[p("i",{class:"fas fa-spinner fa-spin me-2"},null,-1),k("Mengirim... ",-1)])])):(V(),K("span",$o,[...u[8]||(u[8]=[p("i",{class:"fas fa-sign-in-alt me-2"},null,-1),k("Masuk ",-1)])]))],8,Ho),u[18]||(u[18]=p("div",{class:"divider mb-3"},[p("span",null,"atau")],-1)),p("button",{type:"button",class:"btn btn-google w-100 mb-3",onClick:ct(m,["prevent"]),disabled:y(c)},[y(c)?ut("",!0):(V(),K("img",jo)),y(c)?(V(),K("span",Go,[...u[10]||(u[10]=[p("i",{class:"fas fa-spinner fa-spin me-2"},null,-1),k("Memproses... ",-1)])])):(V(),K("span",zo,"Masuk dengan Google"))],8,Wo),p("div",Ko,[p("p",qo,[se(_,{to:"/reset-password",class:"forgot-link"},{default:q(()=>[...u[11]||(u[11]=[p("i",{class:"fas fa-lock me-1"},null,-1),k("Lupa Password? ",-1)])]),_:1})]),p("p",Jo,[u[13]||(u[13]=k(" Belum punya akun? ",-1)),se(_,{to:"/register",class:"register-link"},{default:q(()=>[...u[12]||(u[12]=[k("Daftar Sekarang",-1)])]),_:1})]),p("div",Yo,[p("p",Xo,[se(_,{to:"/terms",class:"text-muted text-decoration-none"},{default:q(()=>[...u[14]||(u[14]=[k("Syarat & Ketentuan",-1)])]),_:1}),u[16]||(u[16]=p("span",{class:"mx-2"},"â¢",-1)),se(_,{to:"/privacy",class:"text-muted text-decoration-none"},{default:q(()=>[...u[15]||(u[15]=[k("Kebijakan Privasi",-1)])]),_:1})])])])],32),y(a)?(V(),Bn(C,{key:0,tone:"danger",class:"mt-3 error-toast"},{default:q(()=>[k(Fn(y(a)),1)]),_:1})):ut("",!0)])])])])])}}}),aa=$n(Zo,[["__scopeId","data-v-08f3c0a9"]]);export{aa as default};
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.