@blinkk/root-cms 2.5.3 → 2.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ui/signin.js CHANGED
@@ -12,4 +12,4 @@
12
12
  <clipPath id="clip0_6083_34804">
13
13
  <rect width="24" height="24" fill="white"/>
14
14
  </clipPath>
15
- </defs>`,g.innerText="Preview backend running in this workspace."),g.setAttribute("id",f)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",l):l()}function S(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function ir(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(S())}function sr(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function or(){let t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function ar(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function cr(){let t=S();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function ur(){try{return typeof indexedDB=="object"}catch{return!1}}function lr(){return new Promise((t,e)=>{try{let n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{e(i.error?.message||"")}}catch(n){e(n)}})}var us="FirebaseError",P=class t extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=us,Object.setPrototypeOf(this,t.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,V.prototype.create)}},V=class{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){let r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?ls(s,r):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new P(i,a,r)}};function ls(t,e){return t.replace(ds,(n,r)=>{let i=e[r];return i!=null?String(i):`<${r}?>`})}var ds=/\{\$([^}]+)}/g;function dr(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function z(t,e){if(t===e)return!0;let n=Object.keys(t),r=Object.keys(e);for(let i of n){if(!r.includes(i))return!1;let s=t[i],o=e[i];if(Qn(s)&&Qn(o)){if(!z(s,o))return!1}else if(s!==o)return!1}for(let i of r)if(!n.includes(i))return!1;return!0}function Qn(t){return t!==null&&typeof t=="object"}function ce(t){let e=[];for(let[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function ue(t){let e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){let[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function le(t){let e=t.indexOf("?");if(!e)return"";let n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function hr(t,e){let n=new Ft(t,e);return n.subscribe.bind(n)}var Ft=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");hs(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=Ut),i.error===void 0&&(i.error=Ut),i.complete===void 0&&(i.complete=Ut);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}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 n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(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 hs(t,e){if(typeof t!="object"||t===null)return!1;for(let n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function Ut(){}var Rc=14400*1e3;function j(t){return t&&t._delegate?t._delegate:t}var M=class{constructor(e,n,r){this.name=e,this.instanceFactory=n,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}};var Y="[DEFAULT]";var $t=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let r=new ze;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){let n=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}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(ps(e))try{this.getOrInitializeService({instanceIdentifier:Y})}catch{}for(let[n,r]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=Y){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=Y){return this.instances.has(e)}getOptions(e=Y){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=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`);let i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);r===a&&o.resolve(i)}return i}onInit(e,n){let r=this.normalizeInstanceIdentifier(n),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);let s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,n){let r=this.onInitCallbacks.get(n);if(r)for(let i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:fs(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=Y){return this.component?this.component.multipleInstances?e:Y:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function fs(t){return t===Y?void 0:t}function ps(t){return t.instantiationMode==="EAGER"}var qe=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.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);let n=new $t(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var _s=[],E;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(E||(E={}));var ms={debug:E.DEBUG,verbose:E.VERBOSE,info:E.INFO,warn:E.WARN,error:E.ERROR,silent:E.SILENT},gs=E.INFO,Is={[E.DEBUG]:"log",[E.VERBOSE]:"log",[E.INFO]:"info",[E.WARN]:"warn",[E.ERROR]:"error"},Es=(t,e,...n)=>{if(e<t.logLevel)return;let r=new Date().toISOString(),i=Is[e];if(i)console[i](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},de=class{constructor(e){this.name=e,this._logLevel=gs,this._logHandler=Es,this._userLogHandler=null,_s.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in E))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?ms[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,E.DEBUG,...e),this._logHandler(this,E.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,E.VERBOSE,...e),this._logHandler(this,E.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,E.INFO,...e),this._logHandler(this,E.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,E.WARN,...e),this._logHandler(this,E.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,E.ERROR,...e),this._logHandler(this,E.ERROR,...e)}};var ys=(t,e)=>e.some(n=>t instanceof n),fr,pr;function vs(){return fr||(fr=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ws(){return pr||(pr=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var _r=new WeakMap,jt=new WeakMap,mr=new WeakMap,zt=new WeakMap,Gt=new WeakMap;function Ts(t){let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(U(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&_r.set(n,t)}).catch(()=>{}),Gt.set(e,t),e}function bs(t){if(jt.has(t))return;let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});jt.set(t,e)}var qt={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return jt.get(t);if(e==="objectStoreNames")return t.objectStoreNames||mr.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return U(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function gr(t){qt=t(qt)}function As(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let r=t.call(Ge(this),e,...n);return mr.set(r,e.sort?e.sort():[e]),U(r)}:ws().includes(t)?function(...e){return t.apply(Ge(this),e),U(_r.get(this))}:function(...e){return U(t.apply(Ge(this),e))}}function Ss(t){return typeof t=="function"?As(t):(t instanceof IDBTransaction&&bs(t),ys(t,vs())?new Proxy(t,qt):t)}function U(t){if(t instanceof IDBRequest)return Ts(t);if(zt.has(t))return zt.get(t);let e=Ss(t);return e!==t&&(zt.set(t,e),Gt.set(e,t)),e}var Ge=t=>Gt.get(t);function Er(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){let o=indexedDB.open(t,e),a=U(o);return r&&o.addEventListener("upgradeneeded",u=>{r(U(o.result),u.oldVersion,u.newVersion,U(o.transaction),u)}),n&&o.addEventListener("blocked",u=>n(u.oldVersion,u.newVersion,u)),a.then(u=>{s&&u.addEventListener("close",()=>s()),i&&u.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}var ks=["get","getKey","getAll","getAllKeys","count"],Cs=["put","add","delete","clear"],Kt=new Map;function Ir(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Kt.get(e))return Kt.get(e);let n=e.replace(/FromIndex$/,""),r=e!==n,i=Cs.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||ks.includes(n)))return;let s=async function(o,...a){let u=this.transaction(o,i?"readwrite":"readonly"),c=u.store;return r&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),i&&u.done]))[0]};return Kt.set(e,s),s}gr(t=>({...t,get:(e,n,r)=>Ir(e,n)||t.get(e,n,r),has:(e,n)=>!!Ir(e,n)||t.has(e,n)}));var Yt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(Rs(n)){let r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}};function Rs(t){return t.getComponent()?.type==="VERSION"}var Xt="@firebase/app",yr="0.14.2";var H=new de("@firebase/app"),Ps="@firebase/app-compat",Ns="@firebase/analytics-compat",Os="@firebase/analytics",Ds="@firebase/app-check-compat",Ls="@firebase/app-check",Ms="@firebase/auth",Us="@firebase/auth-compat",xs="@firebase/database",Fs="@firebase/data-connect",Vs="@firebase/database-compat",Hs="@firebase/functions",Ws="@firebase/functions-compat",Bs="@firebase/installations",$s="@firebase/installations-compat",zs="@firebase/messaging",js="@firebase/messaging-compat",qs="@firebase/performance",Gs="@firebase/performance-compat",Ks="@firebase/remote-config",Js="@firebase/remote-config-compat",Ys="@firebase/storage",Xs="@firebase/storage-compat",Qs="@firebase/firestore",Zs="@firebase/ai",eo="@firebase/firestore-compat",to="firebase",no="12.2.0";var Qt="[DEFAULT]",ro={[Xt]:"fire-core",[Ps]:"fire-core-compat",[Os]:"fire-analytics",[Ns]:"fire-analytics-compat",[Ls]:"fire-app-check",[Ds]:"fire-app-check-compat",[Ms]:"fire-auth",[Us]:"fire-auth-compat",[xs]:"fire-rtdb",[Fs]:"fire-data-connect",[Vs]:"fire-rtdb-compat",[Hs]:"fire-fn",[Ws]:"fire-fn-compat",[Bs]:"fire-iid",[$s]:"fire-iid-compat",[zs]:"fire-fcm",[js]:"fire-fcm-compat",[qs]:"fire-perf",[Gs]:"fire-perf-compat",[Ks]:"fire-rc",[Js]:"fire-rc-compat",[Ys]:"fire-gcs",[Xs]:"fire-gcs-compat",[Qs]:"fire-fst",[eo]:"fire-fst-compat",[Zs]:"fire-vertex","fire-js":"fire-js",[to]:"fire-js-all"};var Ke=new Map,io=new Map,Zt=new Map;function vr(t,e){try{t.container.addComponent(e)}catch(n){H.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function he(t){let e=t.name;if(Zt.has(e))return H.debug(`There were multiple attempts to register component ${e}.`),!1;Zt.set(e,t);for(let n of Ke.values())vr(n,t);for(let n of io.values())vr(n,t);return!0}function rn(t,e){let n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function N(t){return t==null?!1:t.settings!==void 0}var so={"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.","invalid-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."},q=new V("app","Firebase",so);var en=class{constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new M("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 q.create("app-deleted",{appName:this._name})}};var fe=no;function sn(t,e={}){let n=t;typeof e!="object"&&(e={name:e});let r={name:Qt,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw q.create("bad-app-name",{appName:String(i)});if(n||(n=Wt()),!n)throw q.create("no-options");let s=Ke.get(i);if(s){if(z(n,s.options)&&z(r,s.config))return s;throw q.create("duplicate-app",{appName:i})}let o=new qe(i);for(let u of Zt.values())o.addComponent(u);let a=new en(n,r,o);return Ke.set(i,a),a}function Ar(t=Qt){let e=Ke.get(t);if(!e&&t===Qt&&Wt())return sn();if(!e)throw q.create("no-app",{appName:t});return e}function G(t,e,n){let r=ro[t]??t;n&&(r+=`-${n}`);let i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){let o=[`Unable to register library "${r}" with version "${e}":`];i&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&o.push("and"),s&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),H.warn(o.join(" "));return}he(new M(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}var oo="firebase-heartbeat-database",ao=1,we="firebase-heartbeat-store",Jt=null;function Sr(){return Jt||(Jt=Er(oo,ao,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(we)}catch(n){console.warn(n)}}}}).catch(t=>{throw q.create("idb-open",{originalErrorMessage:t.message})})),Jt}async function co(t){try{let n=(await Sr()).transaction(we),r=await n.objectStore(we).get(kr(t));return await n.done,r}catch(e){if(e instanceof P)H.warn(e.message);else{let n=q.create("idb-get",{originalErrorMessage:e?.message});H.warn(n.message)}}}async function wr(t,e){try{let r=(await Sr()).transaction(we,"readwrite");await r.objectStore(we).put(e,kr(t)),await r.done}catch(n){if(n instanceof P)H.warn(n.message);else{let r=q.create("idb-set",{originalErrorMessage:n?.message});H.warn(r.message)}}}function kr(t){return`${t.name}!${t.options.appId}`}var uo=1024,lo=30,tn=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new nn(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){try{let n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=Tr();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats.length>lo){let i=fo(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){H.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=Tr(),{heartbeatsToSend:n,unsentEntries:r}=ho(this._heartbeatsCache.heartbeats),i=Vt(JSON.stringify({version:2,heartbeats:n}));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)),i}catch(e){return H.warn(e),""}}};function Tr(){return new Date().toISOString().substring(0,10)}function ho(t,e=uo){let n=[],r=t.slice();for(let i of t){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),br(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),br(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}var nn=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return ur()?lr().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await co(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let r=await this.read();return wr(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){let r=await this.read();return wr(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}};function br(t){return Vt(JSON.stringify({version:2,heartbeats:t})).length}function fo(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;r<t.length;r++)t[r].date<n&&(n=t[r].date,e=r);return e}function po(t){he(new M("platform-logger",e=>new Yt(e),"PRIVATE")),he(new M("heartbeat",e=>new tn(e),"PRIVATE")),G(Xt,yr,t),G(Xt,yr,"esm2020"),G("fire-js","")}po("");var _o="firebase",mo="12.2.1";G(_o,mo,"app");function qr(){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."}}var Gr=qr,Kr=new V("auth","Firebase",qr());var tt=new de("@firebase/auth");function go(t,...e){tt.logLevel<=E.WARN&&tt.warn(`Auth (${fe}): ${t}`,...e)}function Ye(t,...e){tt.logLevel<=E.ERROR&&tt.error(`Auth (${fe}): ${t}`,...e)}function R(t,...e){throw Pn(t,...e)}function O(t,...e){return Pn(t,...e)}function Rn(t,e,n){let r={...Gr(),[e]:n};return new V("auth","Firebase",r).create(e,{appName:t.name})}function X(t){return Rn(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Io(t,e,n){let r=n;if(!(e instanceof r))throw r.name!==e.constructor.name&&R(t,"argument-error"),Rn(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Pn(t,...e){if(typeof t!="string"){let n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return Kr.create(t,...e)}function p(t,e,...n){if(!t)throw Pn(e,...n)}function x(t){let e="INTERNAL ASSERTION FAILED: "+t;throw Ye(e),new Error(e)}function B(t,e){t||x(e)}function dn(){return typeof self<"u"&&self.location?.href||""}function Eo(){return Cr()==="http:"||Cr()==="https:"}function Cr(){return typeof self<"u"&&self.location?.protocol||null}function yo(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Eo()||or()||"connection"in navigator)?navigator.onLine:!0}function vo(){if(typeof navigator>"u")return null;let t=navigator;return t.languages&&t.languages[0]||t.language||null}var Q=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,B(n>e,"Short delay should be less than long delay!"),this.isMobile=ir()||ar()}get(){return yo()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Nn(t,e){B(t.emulator,"Emulator should always be set here");let{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var nt=class{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),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;x("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;x("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;x("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var wo={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-recaptcha-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"};var To=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],bo=new Q(3e4,6e4);function b(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function k(t,e,n,r,i={}){return Jr(t,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});let a=ce({key:t.config.apiKey,...o}).slice(1),u=await t._getAdditionalHeaders();u["Content-Type"]="application/json",t.languageCode&&(u["X-Firebase-Locale"]=t.languageCode);let c={method:e,headers:u,...s};return sr()||(c.referrerPolicy="no-referrer"),t.emulatorConfig&&ve(t.emulatorConfig.host)&&(c.credentials="include"),nt.fetch()(await Yr(t,t.config.apiHost,n,a),c)})}async function Jr(t,e,n){t._canInitEmulator=!1;let r={...wo,...e};try{let i=new hn(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw be(t,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[u,c]=a.split(" : ");if(u==="FEDERATED_USER_ID_ALREADY_LINKED")throw be(t,"credential-already-in-use",o);if(u==="EMAIL_EXISTS")throw be(t,"email-already-in-use",o);if(u==="USER_DISABLED")throw be(t,"user-disabled",o);let h=r[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw Rn(t,h,c);R(t,h)}}catch(i){if(i instanceof P)throw i;R(t,"network-request-failed",{message:String(i)})}}async function ie(t,e,n,r,i={}){let s=await k(t,e,n,r,i);return"mfaPendingCredential"in s&&R(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function Yr(t,e,n,r){let i=`${e}${n}?${r}`,s=t,o=s.config.emulator?Nn(t.config,i):`${t.config.apiScheme}://${i}`;return To.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}function Ao(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var hn=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(O(this.auth,"network-request-failed")),bo.get())})}};function be(t,e,n){let r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);let i=O(t,e,r);return i.customData._tokenResponse=n,i}function Rr(t){return t!==void 0&&t.enterprise!==void 0}var rt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return Ao(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}};async function Xr(t,e){return k(t,"GET","/v2/recaptchaConfig",b(t,e))}async function So(t,e){return k(t,"POST","/v1/accounts:delete",e)}async function it(t,e){return k(t,"POST","/v1/accounts:lookup",e)}function Ae(t){if(t)try{let e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Qr(t,e=!1){let n=j(t),r=await n.getIdToken(e),i=On(r);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:r,authTime:Ae(on(i.auth_time)),issuedAtTime:Ae(on(i.iat)),expirationTime:Ae(on(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function on(t){return Number(t)*1e3}function On(t){let[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return Ye("JWT malformed, contained fewer than 3 sections"),null;try{let i=je(n);return i?JSON.parse(i):(Ye("Failed to decode base64 JWT payload"),null)}catch(i){return Ye("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Pr(t){let e=On(t);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function Re(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof P&&ko(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function ko({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}var fn=class{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){let n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;let r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var Pe=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Ae(this.lastLoginAt),this.creationTime=Ae(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function st(t){let e=t.auth,n=await t.getIdToken(),r=await Re(t,it(e,{idToken:n}));p(r?.users.length,e,"internal-error");let i=r.users[0];t._notifyReloadListener(i);let s=i.providerUserInfo?.length?ei(i.providerUserInfo):[],o=Co(t.providerData,s),a=t.isAnonymous,u=!(t.email&&i.passwordHash)&&!o?.length,c=a?u:!1,h={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:o,metadata:new Pe(i.createdAt,i.lastLoginAt),isAnonymous:c};Object.assign(t,h)}async function Zr(t){let e=j(t);await st(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Co(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function ei(t){return t.map(({providerId:e,...n})=>({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}async function Ro(t,e){let n=await Jr(t,{},async()=>{let r=ce({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,o=await Yr(t,i,"/v1/token",`key=${s}`),a=await t._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";let u={method:"POST",headers:a,body:r};return t.emulatorConfig&&ve(t.emulatorConfig.host)&&(u.credentials="include"),nt.fetch()(o,u)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function Po(t,e){return k(t,"POST","/v2/accounts:revokeToken",b(t,e))}var Se=class t{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Pr(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Pr(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:r,refreshToken:i,expiresIn:s}=await Ro(e,n);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){let{refreshToken:r,accessToken:i,expirationTime:s}=n,o=new t;return r&&(p(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),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 t,this.toJSON())}_performRefresh(){return x("not implemented")}};function K(t,e){p(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}var J=class t{constructor({uid:e,auth:n,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new fn(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new Pe(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){let n=await Re(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return Qr(this,e)}reload(){return Zr(this)}_assign(e){this!==e&&(p(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(n=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new t({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){p(!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,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await st(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(N(this.auth.app))return Promise.reject(X(this.auth));let e=await this.getIdToken();return await Re(this,So(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,isAnonymous: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,n){let r=n.displayName??void 0,i=n.email??void 0,s=n.phoneNumber??void 0,o=n.photoURL??void 0,a=n.tenantId??void 0,u=n._redirectEventId??void 0,c=n.createdAt??void 0,h=n.lastLoginAt??void 0,{uid:l,emailVerified:d,isAnonymous:f,providerData:g,stsTokenManager:A}=n;p(l&&A,e,"internal-error");let y=Se.fromJSON(this.name,A);p(typeof l=="string",e,"internal-error"),K(r,e.name),K(i,e.name),p(typeof d=="boolean",e,"internal-error"),p(typeof f=="boolean",e,"internal-error"),K(s,e.name),K(o,e.name),K(a,e.name),K(u,e.name),K(c,e.name),K(h,e.name);let _=new t({uid:l,auth:e,email:i,emailVerified:d,displayName:r,isAnonymous:f,photoURL:o,phoneNumber:s,tenantId:a,stsTokenManager:y,createdAt:c,lastLoginAt:h});return g&&Array.isArray(g)&&(_.providerData=g.map(m=>({...m}))),u&&(_._redirectEventId=u),_}static async _fromIdTokenResponse(e,n,r=!1){let i=new Se;i.updateFromServerResponse(n);let s=new t({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await st(s),s}static async _fromGetAccountInfoResponse(e,n,r){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?ei(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new Se;a.updateFromIdToken(r);let u=new t({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),c={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new Pe(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(u,c),u}};var Nr=new Map;function W(t){B(t instanceof Function,"Expected a class definition");let e=Nr.get(t);return e?(B(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,Nr.set(t,e),e)}var ot=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};ot.type="NONE";var pn=ot;function Xe(t,e,n){return`firebase:${t}:${e}:${n}`}var at=class t{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;let{config:i,name:s}=this.auth;this.fullUserKey=Xe(this.userKey,i.apiKey,s),this.fullPersistenceKey=Xe("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){let n=await it(this.auth,{idToken:e}).catch(()=>{});return n?J._fromGetAccountInfoResponse(this.auth,n,e):null}return J._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;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new t(W(pn),e,r);let i=(await Promise.all(n.map(async c=>{if(await c._isAvailable())return c}))).filter(c=>c),s=i[0]||W(pn),o=Xe(r,e.config.apiKey,e.name),a=null;for(let c of n)try{let h=await c._get(o);if(h){let l;if(typeof h=="string"){let d=await it(e,{idToken:h}).catch(()=>{});if(!d)break;l=await J._fromGetAccountInfoResponse(e,d,h)}else l=J._fromJSON(e,h);c!==s&&(a=l),s=c;break}}catch{}let u=i.filter(c=>c._shouldAllowMigration);return!s._shouldAllowMigration||!u.length?new t(s,e,r):(s=u[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async c=>{if(c!==s)try{await c._remove(o)}catch{}})),new t(s,e,r))}};function Or(t){let e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(ii(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(ti(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(oi(e))return"Blackberry";if(ai(e))return"Webos";if(ni(e))return"Safari";if((e.includes("chrome/")||ri(e))&&!e.includes("edge/"))return"Chrome";if(si(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if(r?.length===2)return r[1]}return"Other"}function ti(t=S()){return/firefox\//i.test(t)}function ni(t=S()){let e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function ri(t=S()){return/crios\//i.test(t)}function ii(t=S()){return/iemobile/i.test(t)}function si(t=S()){return/android/i.test(t)}function oi(t=S()){return/blackberry/i.test(t)}function ai(t=S()){return/webos/i.test(t)}function Dn(t=S()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function No(t=S()){return Dn(t)&&!!window.navigator?.standalone}function Oo(){return cr()&&document.documentMode===10}function ci(t=S()){return Dn(t)||si(t)||ai(t)||oi(t)||/windows phone/i.test(t)||ii(t)}function ui(t,e=[]){let n;switch(t){case"Browser":n=Or(S());break;case"Worker":n=`${Or(S())}-${t}`;break;default:n=t}let r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${fe}/${r}`}var _n=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let r=s=>new Promise((o,a)=>{try{let u=e(s);o(u)}catch(u){a(u)}});r.onAbort=n,this.queue.push(r);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}}};async function Do(t,e={}){return k(t,"GET","/v2/passwordPolicy",b(t,e))}var Lo=6,mn=class{constructor(e){let n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??Lo,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.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){let n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){let r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var gn=class{constructor(e,n,r,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new ct(this),this.idTokenSubscription=new ct(this),this.beforeStateQueue=new _n(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=Kr,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=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=W(n)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await at.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=this.currentUser?.uid||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let 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{let n=await it(this,{idToken:e}),r=await J._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(N(this.app)){let s=this.app.settings.authIdToken;return s?new Promise(o=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(o,o))}):this.directlySetCurrentUser(null)}let n=await this.assertedPersistence.getCurrentUser(),r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let s=this.redirectUser?._redirectEventId,o=r?._redirectEventId,a=await this.tryRedirectSignIn(e);(!s||s===o)&&a?.user&&(r=a.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(s){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(s))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return p(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 n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await st(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=vo()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(N(this.app))return Promise.reject(X(this));let n=e?j(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return N(this.app)?Promise.reject(X(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return N(this.app)?Promise.reject(X(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(W(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await Do(this),n=new mn(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new V("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await Po(this,r)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,n){let r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&W(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await at.create(this,[W(n._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);let e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let u=e.addObserver(n,r,i);return()=>{o=!0,u()}}else{let u=e.addObserver(n);return()=>{o=!0,u()}}}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 p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=ui(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){let e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);let n=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();n&&(e["X-Firebase-Client"]=n);let r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){if(N(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&go(`Error while retrieving App Check token: ${e.error}`),e?.token}};function se(t){return j(t)}var ct=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=hr(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var St={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Mo(t){St=t}function li(t){return St.loadJS(t)}function Uo(){return St.recaptchaEnterpriseScript}function xo(){return St.gapiScript}function di(t){return`__${t}${Math.floor(Math.random()*1e6)}`}var In=class{constructor(){this.enterprise=new En}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}},En=class{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}};var Fo="recaptcha-enterprise",ke="NO_RECAPTCHA",ut=class{constructor(e){this.type=Fo,this.auth=se(e)}async verify(e="verify",n=!1){async function r(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{Xr(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(u=>{if(u.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let c=new rt(u);return s.tenantId==null?s._agentRecaptchaConfig=c:s._tenantRecaptchaConfigs[s.tenantId]=c,o(c.siteKey)}}).catch(u=>{a(u)})})}function i(s,o,a){let u=window.grecaptcha;Rr(u)?u.enterprise.ready(()=>{u.enterprise.execute(s,{action:e}).then(c=>{o(c)}).catch(()=>{o(ke)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new In().execute("siteKey",{action:"verify"}):new Promise((s,o)=>{r(this.auth).then(a=>{if(!n&&Rr(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let u=Uo();u.length!==0&&(u+=a),li(u).then(()=>{i(a,s,o)}).catch(c=>{o(c)})}}).catch(a=>{o(a)})})}};async function Te(t,e,n,r=!1,i=!1){let s=new ut(t),o;if(i)o=ke;else try{o=await s.verify(n)}catch{o=await s.verify(n,!0)}let a={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in a){let u=a.phoneEnrollmentInfo.phoneNumber,c=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:u,recaptchaToken:c,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){let u=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:u,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return r?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function Ce(t,e,n,r,i){if(i==="EMAIL_PASSWORD_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Te(t,e,n,n==="getOobCode");return r(t,s)}else return r(t,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Te(t,e,n,n==="getOobCode");return r(t,o)}else return Promise.reject(s)});else if(i==="PHONE_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let s=await Te(t,e,n);return r(t,s).catch(async o=>{if(t._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&(o.code==="auth/missing-recaptcha-token"||o.code==="auth/invalid-app-credential")){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${n} flow.`);let a=await Te(t,e,n,!1,!0);return r(t,a)}return Promise.reject(o)})}else{let s=await Te(t,e,n,!1,!0);return r(t,s)}else return Promise.reject(i+" provider is not supported.")}async function Vo(t){let e=se(t),n=await Xr(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),r=new rt(n);e.tenantId==null?e._agentRecaptchaConfig=r:e._tenantRecaptchaConfigs[e.tenantId]=r,r.isAnyProviderEnabled()&&new ut(e).verify()}function hi(t,e){let n=rn(t,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(z(s,e??{}))return i;R(i,"already-initialized")}return n.initialize({options:e})}function Ho(t,e){let n=e?.persistence||[],r=(Array.isArray(n)?n:[n]).map(W);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e?.popupRedirectResolver)}function fi(t,e,n){let r=se(t);p(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=pi(e),{host:o,port:a}=Wo(e),u=a===null?"":`:${a}`,c={url:`${s}//${o}${u}/`},h=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){p(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),p(z(c,r.config.emulator)&&z(h,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=c,r.emulatorConfig=h,r.settings.appVerificationDisabledForTesting=!0,ve(o)?(nr(`${s}//${o}${u}`),rr("Auth",!0)):i||Bo()}function pi(t){let e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Wo(t){let e=pi(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};let r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){let s=i[1];return{host:s,port:Dr(r.substr(s.length+1))}}else{let[s,o]=r.split(":");return{host:s,port:Dr(o)}}}function Dr(t){if(!t)return null;let e=Number(t);return isNaN(e)?null:e}function Bo(){function t(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.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",t):t())}var Z=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return x("not implemented")}_getIdTokenResponse(e){return x("not implemented")}_linkToIdToken(e,n){return x("not implemented")}_getReauthenticationResolver(e){return x("not implemented")}};async function $o(t,e){return k(t,"POST","/v1/accounts:signUp",e)}async function zo(t,e){return ie(t,"POST","/v1/accounts:signInWithPassword",b(t,e))}async function jo(t,e){return ie(t,"POST","/v1/accounts:signInWithEmailLink",b(t,e))}async function qo(t,e){return ie(t,"POST","/v1/accounts:signInWithEmailLink",b(t,e))}var Ne=class t extends Z{constructor(e,n,r,i=null){super("password",r),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new t(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new t(e,n,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Ce(e,n,"signInWithPassword",zo,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return jo(e,{email:this._email,oobCode:this._password});default:R(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let r={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Ce(e,r,"signUpPassword",$o,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return qo(e,{idToken:n,email:this._email,oobCode:this._password});default:R(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function pe(t,e){return ie(t,"POST","/v1/accounts:signInWithIdp",b(t,e))}var Go="http://localhost",ee=class t extends Z{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new t(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):R("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,...s}=n;if(!r||!i)return null;let o=new t(r,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return pe(e,n)}_linkToIdToken(e,n){let r=this.buildRequest();return r.idToken=n,pe(e,r)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,pe(e,n)}buildRequest(){let e={requestUri:Go,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=ce(n)}return e}};async function Lr(t,e){return k(t,"POST","/v1/accounts:sendVerificationCode",b(t,e))}async function Ko(t,e){return ie(t,"POST","/v1/accounts:signInWithPhoneNumber",b(t,e))}async function Jo(t,e){let n=await ie(t,"POST","/v1/accounts:signInWithPhoneNumber",b(t,e));if(n.temporaryProof)throw be(t,"account-exists-with-different-credential",n);return n}var Yo={USER_NOT_FOUND:"user-not-found"};async function Xo(t,e){let n={...e,operation:"REAUTH"};return ie(t,"POST","/v1/accounts:signInWithPhoneNumber",b(t,n),Yo)}var Oe=class t extends Z{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new t({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new t({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return Ko(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Jo(e,{idToken:n,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return Xo(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:r,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:r,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:r,phoneNumber:i,temporaryProof:s}=e;return!r&&!n&&!i&&!s?null:new t({verificationId:n,verificationCode:r,phoneNumber:i,temporaryProof:s})}};function Qo(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Zo(t){let e=ue(le(t)).link,n=e?ue(le(e)).deep_link_id:null,r=ue(le(t)).deep_link_id;return(r?ue(le(r)).link:null)||r||n||e||t}var lt=class t{constructor(e){let n=ue(le(e)),r=n.apiKey??null,i=n.oobCode??null,s=Qo(n.mode??null);p(r&&i&&s,"argument-error"),this.apiKey=r,this.operation=s,this.code=i,this.continueUrl=n.continueUrl??null,this.languageCode=n.lang??null,this.tenantId=n.tenantId??null}static parseLink(e){let n=Zo(e);try{return new t(n)}catch{return null}}};var _e=class t{constructor(){this.providerId=t.PROVIDER_ID}static credential(e,n){return Ne._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let r=lt.parseLink(n);return p(r,"argument-error"),Ne._fromEmailAndCode(e,r.code,r.tenantId)}};_e.PROVIDER_ID="password";_e.EMAIL_PASSWORD_SIGN_IN_METHOD="password";_e.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var De=class{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}};var te=class extends De{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var Le=class t extends te{constructor(){super("facebook.com")}static credential(e){return ee._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return t.credential(e.oauthAccessToken)}catch{return null}}};Le.FACEBOOK_SIGN_IN_METHOD="facebook.com";Le.PROVIDER_ID="facebook.com";var ne=class t extends te{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return ee._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return t.credential(n,r)}catch{return null}}};ne.GOOGLE_SIGN_IN_METHOD="google.com";ne.PROVIDER_ID="google.com";var Me=class t extends te{constructor(){super("github.com")}static credential(e){return ee._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return t.credential(e.oauthAccessToken)}catch{return null}}};Me.GITHUB_SIGN_IN_METHOD="github.com";Me.PROVIDER_ID="github.com";var Ue=class t extends te{constructor(){super("twitter.com")}static credential(e,n){return ee._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return t.credential(n,r)}catch{return null}}};Ue.TWITTER_SIGN_IN_METHOD="twitter.com";Ue.PROVIDER_ID="twitter.com";var xe=class t{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,i=!1){let s=await J._fromIdTokenResponse(e,r,i),o=Mr(r);return new t({user:s,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);let i=Mr(r);return new t({user:e,providerId:i,_tokenResponse:r,operationType:n})}};function Mr(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}var yn=class t extends P{constructor(e,n,r,i){super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,t.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,i){return new t(e,n,r,i)}};function _i(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?yn._fromErrorAndOperation(t,s,e,r):s})}async function ea(t,e,n=!1){let r=await Re(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return xe._forOperation(t,"link",r)}async function ta(t,e,n=!1){let{auth:r}=t;if(N(r.app))return Promise.reject(X(r));let i="reauthenticate";try{let s=await Re(t,_i(r,i,e,t),n);p(s.idToken,r,"internal-error");let o=On(s.idToken);p(o,r,"internal-error");let{sub:a}=o;return p(t.uid===a,r,"user-mismatch"),xe._forOperation(t,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&R(r,"user-mismatch"),s}}async function na(t,e,n=!1){if(N(t.app))return Promise.reject(X(t));let r="signIn",i=await _i(t,r,e),s=await xe._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}function mi(t,e,n,r){return j(t).onIdTokenChanged(e,n,r)}function gi(t,e,n){return j(t).beforeAuthStateChanged(e,n)}function Ur(t,e){return k(t,"POST","/v2/accounts/mfaEnrollment:start",b(t,e))}function ra(t,e){return k(t,"POST","/v2/accounts/mfaEnrollment:finalize",b(t,e))}function ia(t,e){return k(t,"POST","/v2/accounts/mfaEnrollment:start",b(t,e))}function sa(t,e){return k(t,"POST","/v2/accounts/mfaEnrollment:finalize",b(t,e))}var dt="__sak";var ht=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(dt,"1"),this.storage.removeItem(dt),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var oa=1e3,aa=10,ft=class extends ht{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=ci(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let r=this.storage.getItem(n),i=this.localCache[n];r!==i&&e(n,i,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,u)=>{this.notifyListeners(o,u)});return}let r=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},s=this.storage.getItem(r);Oo()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,aa):i()}notifyListeners(e,n){this.localCache[e]=n;let r=this.listeners[e];if(r)for(let i of Array.from(r))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},oa)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){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(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};ft.type="LOCAL";var Ii=ft;var ca=1e3;function an(t){let e=t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),n=RegExp(`${e}=([^;]+)`);return document.cookie.match(n)?.[1]??null}function cn(t){return`${window.location.protocol==="http:"?"__dev_":"__HOST-"}FIREBASE_${t.split(":")[3]}`}var vn=class{constructor(){this.type="COOKIE",this.listenerUnsubscribes=new Map}_getFinalTarget(e){if(typeof window===void 0)return e;let n=new URL(`${window.location.origin}/__cookies__`);return n.searchParams.set("finalTarget",e),n}async _isAvailable(){return typeof isSecureContext=="boolean"&&!isSecureContext||typeof navigator>"u"||typeof document>"u"?!1:navigator.cookieEnabled??!0}async _set(e,n){}async _get(e){if(!this._isAvailable())return null;let n=cn(e);return window.cookieStore?(await window.cookieStore.get(n))?.value:an(n)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let r=cn(e);document.cookie=`${r}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`,await fetch("/__cookies__",{method:"DELETE"}).catch(()=>{})}_addListener(e,n){if(!this._isAvailable())return;let r=cn(e);if(window.cookieStore){let a=(c=>{let h=c.changed.find(d=>d.name===r);h&&n(h.value),c.deleted.find(d=>d.name===r)&&n(null)}),u=()=>window.cookieStore.removeEventListener("change",a);return this.listenerUnsubscribes.set(n,u),window.cookieStore.addEventListener("change",a)}let i=an(r),s=setInterval(()=>{let a=an(r);a!==i&&(n(a),i=a)},ca),o=()=>clearInterval(s);this.listenerUnsubscribes.set(n,o)}_removeListener(e,n){let r=this.listenerUnsubscribes.get(n);r&&(r(),this.listenerUnsubscribes.delete(n))}};vn.type="COOKIE";var pt=class extends ht{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};pt.type="SESSION";var Ln=pt;function ua(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var _t=class t{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let r=new t(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:r,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});let a=Array.from(o).map(async c=>c(n.origin,s)),u=await ua(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:u})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};_t.receivers=[];function Mn(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}var wn=class{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,n,r=50){let i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,o;return new Promise((a,u)=>{let c=Mn("",20);i.port1.start();let h=setTimeout(()=>{u(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(l){let d=l;if(d.data.eventId===c)switch(d.data.status){case"ack":clearTimeout(h),s=setTimeout(()=>{u(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(d.data.response);break;default:clearTimeout(h),clearTimeout(s),u(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:c,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function F(){return window}function la(t){F().location.href=t}function Ei(){return typeof F().WorkerGlobalScope<"u"&&typeof F().importScripts=="function"}async function da(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function ha(){return navigator?.serviceWorker?.controller||null}function fa(){return Ei()?self:null}var yi="firebaseLocalStorageDb",pa=1,mt="firebaseLocalStorage",vi="fbase_key",re=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function kt(t,e){return t.transaction([mt],e?"readwrite":"readonly").objectStore(mt)}function _a(){let t=indexedDB.deleteDatabase(yi);return new re(t).toPromise()}function Tn(){let t=indexedDB.open(yi,pa);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{let r=t.result;try{r.createObjectStore(mt,{keyPath:vi})}catch(i){n(i)}}),t.addEventListener("success",async()=>{let r=t.result;r.objectStoreNames.contains(mt)?e(r):(r.close(),await _a(),e(await Tn()))})})}async function xr(t,e,n){let r=kt(t,!0).put({[vi]:e,value:n});return new re(r).toPromise()}async function ma(t,e){let n=kt(t,!1).get(e),r=await new re(n).toPromise();return r===void 0?null:r.value}function Fr(t,e){let n=kt(t,!0).delete(e);return new re(n).toPromise()}var ga=800,Ia=3,gt=class{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 Tn(),this.db)}async _withRetries(e){let n=0;for(;;)try{let r=await this._openDb();return await e(r)}catch(r){if(n++>Ia)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Ei()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=_t._getInstance(fa()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await da(),!this.activeServiceWorker)return;this.sender=new wn(this.activeServiceWorker);let 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||ha()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await Tn();return await xr(e,dt,"1"),await Fr(e,dt),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>xr(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(r=>ma(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Fr(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=kt(i,!1).getAll();return new re(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],r=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let r=this.listeners[e];if(r)for(let i of Array.from(r))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),ga)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};gt.type="LOCAL";var wi=gt;function Vr(t,e){return k(t,"POST","/v2/accounts/mfaSignIn:start",b(t,e))}function Ea(t,e){return k(t,"POST","/v2/accounts/mfaSignIn:finalize",b(t,e))}function ya(t,e){return k(t,"POST","/v2/accounts/mfaSignIn:finalize",b(t,e))}var tu=di("rcb"),nu=new Q(3e4,6e4);var Qe="recaptcha";async function va(t,e,n){if(!t._getRecaptchaConfig())try{await Vo(t)}catch{console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let r;if(typeof e=="string"?r={phoneNumber:e}:r=e,"session"in r){let i=r.session;if("phoneNumber"in r){p(i.type==="enroll",t,"internal-error");let s={idToken:i.credential,phoneEnrollmentInfo:{phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await Ce(t,s,"mfaSmsEnrollment",async(c,h)=>{if(h.phoneEnrollmentInfo.captchaResponse===ke){p(n?.type===Qe,c,"argument-error");let l=await un(c,h,n);return Ur(c,l)}return Ur(c,h)},"PHONE_PROVIDER").catch(c=>Promise.reject(c))).phoneSessionInfo.sessionInfo}else{p(i.type==="signin",t,"internal-error");let s=r.multiFactorHint?.uid||r.multiFactorUid;p(s,t,"missing-multi-factor-info");let o={mfaPendingCredential:i.credential,mfaEnrollmentId:s,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await Ce(t,o,"mfaSmsSignIn",async(h,l)=>{if(l.phoneSignInInfo.captchaResponse===ke){p(n?.type===Qe,h,"argument-error");let d=await un(h,l,n);return Vr(h,d)}return Vr(h,l)},"PHONE_PROVIDER").catch(h=>Promise.reject(h))).phoneResponseInfo.sessionInfo}}else{let i={phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await Ce(t,i,"sendVerificationCode",async(u,c)=>{if(c.captchaResponse===ke){p(n?.type===Qe,u,"argument-error");let h=await un(u,c,n);return Lr(u,h)}return Lr(u,c)},"PHONE_PROVIDER").catch(u=>Promise.reject(u))).sessionInfo}}finally{n?._reset()}}async function un(t,e,n){p(n.type===Qe,t,"argument-error");let r=await n.verify();p(typeof r=="string",t,"argument-error");let i={...e};if("phoneEnrollmentInfo"in i){let s=i.phoneEnrollmentInfo.phoneNumber,o=i.phoneEnrollmentInfo.captchaResponse,a=i.phoneEnrollmentInfo.clientType,u=i.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(i,{phoneEnrollmentInfo:{phoneNumber:s,recaptchaToken:r,captchaResponse:o,clientType:a,recaptchaVersion:u}}),i}else if("phoneSignInInfo"in i){let s=i.phoneSignInInfo.captchaResponse,o=i.phoneSignInInfo.clientType,a=i.phoneSignInInfo.recaptchaVersion;return Object.assign(i,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:s,clientType:o,recaptchaVersion:a}}),i}else return Object.assign(i,{recaptchaToken:r}),i}var Fe=class t{constructor(e){this.providerId=t.PROVIDER_ID,this.auth=se(e)}verifyPhoneNumber(e,n){return va(this.auth,e,j(n))}static credential(e,n){return Oe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return t.credentialFromTaggedObject(n)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:r}=e;return n&&r?Oe._fromTokenResponse(n,r):null}};Fe.PROVIDER_ID="phone";Fe.PHONE_SIGN_IN_METHOD="phone";function Ti(t,e){return e?W(e):(p(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}var Ve=class extends Z{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return pe(e,this._buildIdpRequest())}_linkToIdToken(e,n){return pe(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return pe(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={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&&(n.idToken=e),n}};function wa(t){return na(t.auth,new Ve(t),t.bypassAuthState)}function Ta(t){let{auth:e,user:n}=t;return p(n,e,"internal-error"),ta(n,new Ve(t),t.bypassAuthState)}async function ba(t){let{auth:e,user:n}=t;return p(n,e,"internal-error"),ea(n,new Ve(t),t.bypassAuthState)}var It=class{constructor(e,n,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:r,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let u={auth:this.auth,requestUri:n,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(u))}catch(c){this.reject(c)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return wa;case"linkViaPopup":case"linkViaRedirect":return ba;case"reauthViaPopup":case"reauthViaRedirect":return Ta;default:R(this.auth,"internal-error")}}resolve(e){B(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){B(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()}};var Aa=new Q(2e3,1e4);async function Un(t,e,n){if(N(t.app))return Promise.reject(O(t,"operation-not-supported-in-this-environment"));let r=se(t);Io(t,e,De);let i=Ti(r,n);return new Et(r,"signInViaPopup",e,i).executeNotNull()}var Et=class t extends It{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,t.currentPopupAction&&t.currentPopupAction.cancel(),t.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){B(this.filter.length===1,"Popup operations only handle one event");let e=Mn();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(O(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(O(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,t.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(O(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,Aa.get())};e()}};Et.currentPopupAction=null;var Sa="pendingRedirect",Ze=new Map,bn=class extends It{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=Ze.get(this.auth._key());if(!e){try{let r=await ka(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}Ze.set(this.auth._key(),e)}return this.bypassAuthState||Ze.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function ka(t,e){let n=Pa(e),r=Ra(t);if(!await r._isAvailable())return!1;let i=await r._get(n)==="true";return await r._remove(n),i}function Ca(t,e){Ze.set(t._key(),e)}function Ra(t){return W(t._redirectPersistence)}function Pa(t){return Xe(Sa,t.config.apiKey,t.name)}async function Na(t,e,n=!1){if(N(t.app))return Promise.reject(X(t));let r=se(t),i=Ti(r,e),o=await new bn(r,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}var Oa=600*1e3,An=class{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 n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!Da(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){if(e.error&&!bi(e)){let r=e.error.code?.split("auth/")[1]||"internal-error";n.onError(O(this.auth,r))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=Oa&&this.cachedEventUids.clear(),this.cachedEventUids.has(Hr(e))}saveEventToCache(e){this.cachedEventUids.add(Hr(e)),this.lastProcessedEventTime=Date.now()}};function Hr(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function bi({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function Da(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return bi(t);default:return!1}}async function La(t,e={}){return k(t,"GET","/v1/projects",e)}var Ma=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ua=/^https?/;async function xa(t){if(t.config.emulator)return;let{authorizedDomains:e}=await La(t);for(let n of e)try{if(Fa(n))return}catch{}R(t,"unauthorized-domain")}function Fa(t){let e=dn(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){let o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!Ua.test(n))return!1;if(Ma.test(t))return r===t;let i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}var Va=new Q(3e4,6e4);function Wr(){let t=F().___jsl;if(t?.H){for(let e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n<t.CP.length;n++)t.CP[n]=null}}function Ha(t){return new Promise((e,n)=>{function r(){Wr(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Wr(),n(O(t,"network-request-failed"))},timeout:Va.get()})}if(F().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(F().gapi?.load)r();else{let i=di("iframefcb");return F()[i]=()=>{gapi.load?r():n(O(t,"network-request-failed"))},li(`${xo()}?onload=${i}`).catch(s=>n(s))}}).catch(e=>{throw et=null,e})}var et=null;function Wa(t){return et=et||Ha(t),et}var Ba=new Q(5e3,15e3),$a="__/auth/iframe",za="emulator/auth/iframe",ja={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},qa=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Ga(t){let e=t.config;p(e.authDomain,t,"auth-domain-config-required");let n=e.emulator?Nn(e,za):`https://${t.config.authDomain}/${$a}`,r={apiKey:e.apiKey,appName:t.name,v:fe},i=qa.get(t.config.apiHost);i&&(r.eid=i);let s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${ce(r).slice(1)}`}async function Ka(t){let e=await Wa(t),n=F().gapi;return p(n,t,"internal-error"),e.open({where:document.body,url:Ga(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:ja,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});let o=O(t,"network-request-failed"),a=F().setTimeout(()=>{s(o)},Ba.get());function u(){F().clearTimeout(a),i(r)}r.ping(u).then(u,()=>{s(o)})}))}var Ja={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Ya=500,Xa=600,Qa="_blank",Za="http://localhost",yt=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function ec(t,e,n,r=Ya,i=Xa){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString(),a="",u={...Ja,width:r.toString(),height:i.toString(),top:s,left:o},c=S().toLowerCase();n&&(a=ri(c)?Qa:n),ti(c)&&(e=e||Za,u.scrollbars="yes");let h=Object.entries(u).reduce((d,[f,g])=>`${d}${f}=${g},`,"");if(No(c)&&a!=="_self")return tc(e||"",a),new yt(null);let l=window.open(e||"",a,h);p(l,t,"popup-blocked");try{l.focus()}catch{}return new yt(l)}function tc(t,e){let n=document.createElement("a");n.href=t,n.target=e;let r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}var nc="__/auth/handler",rc="emulator/auth/handler",ic=encodeURIComponent("fac");async function Br(t,e,n,r,i,s){p(t.config.authDomain,t,"auth-domain-config-required"),p(t.config.apiKey,t,"invalid-api-key");let o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:fe,eventId:i};if(e instanceof De){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",dr(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[h,l]of Object.entries(s||{}))o[h]=l}if(e instanceof te){let h=e.getScopes().filter(l=>l!=="");h.length>0&&(o.scopes=h.join(","))}t.tenantId&&(o.tid=t.tenantId);let a=o;for(let h of Object.keys(a))a[h]===void 0&&delete a[h];let u=await t._getAppCheckToken(),c=u?`#${ic}=${encodeURIComponent(u)}`:"";return`${sc(t)}?${ce(a).slice(1)}${c}`}function sc({config:t}){return t.emulator?Nn(t,rc):`https://${t.authDomain}/${nc}`}var ln="webStorageSupport",Sn=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Ln,this._completeRedirectFn=Na,this._overrideRedirectResult=Ca}async _openPopup(e,n,r,i){B(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");let s=await Br(e,n,r,dn(),i);return ec(e,s,Mn())}async _openRedirect(e,n,r,i){await this._originValidation(e);let s=await Br(e,n,r,dn(),i);return la(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(B(s,"If manager is not set, promise should be"),s)}let r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){let n=await Ka(e),r=new An(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(ln,{type:ln},i=>{let s=i?.[0]?.[ln];s!==void 0&&n(!!s),R(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=xa(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return ci()||ni()||Dn()}},Ai=Sn,vt=class{constructor(e){this.factorId=e}_process(e,n,r){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,r);case"signin":return this._finalizeSignIn(e,n.credential);default:return x("unexpected MultiFactorSessionType")}}},kn=class t extends vt{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new t(e)}_finalizeEnroll(e,n,r){return ra(e,{idToken:n,displayName:r,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return Ea(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},wt=class{constructor(){}static assertion(e){return kn._fromCredential(e)}};wt.FACTOR_ID="phone";var Tt=class{static assertionForEnrollment(e,n){return bt._fromSecret(e,n)}static assertionForSignIn(e,n){return bt._fromEnrollmentId(e,n)}static async generateSecret(e){let n=e;p(typeof n.user?.auth<"u","internal-error");let r=await ia(n.user.auth,{idToken:n.credential,totpEnrollmentInfo:{}});return At._fromStartTotpMfaEnrollmentResponse(r,n.user.auth)}};Tt.FACTOR_ID="totp";var bt=class t extends vt{constructor(e,n,r){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=r}static _fromSecret(e,n){return new t(n,void 0,e)}static _fromEnrollmentId(e,n){return new t(n,e)}async _finalizeEnroll(e,n,r){return p(typeof this.secret<"u",e,"argument-error"),sa(e,{idToken:n,displayName:r,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let r={verificationCode:this.otp};return ya(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:r})}},At=class t{constructor(e,n,r,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=r,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new t(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){let r=!1;return(Je(e)||Je(n))&&(r=!0),r&&(Je(e)&&(e=this.auth.currentUser?.email||"unknownuser"),Je(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Je(t){return typeof t>"u"||t?.length===0}var $r="@firebase/auth",zr="1.11.0";var Cn=class{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;let n=this.auth.onIdTokenChanged(r=>{e(r?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function oc(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function ac(t){he(new M("auth",(e,{options:n})=>{let r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});let u={apiKey:o,authDomain:a,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ui(t)},c=new gn(r,i,s,u);return Ho(c,n),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),he(new M("auth-internal",e=>{let n=se(e.getProvider("auth").getImmediate());return(r=>new Cn(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),G($r,zr,oc(t)),G($r,zr,"esm2020")}var cc=300,uc=Bt("authIdTokenMaxAge")||cc,jr=null,lc=t=>async e=>{let n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>uc)return;let i=n?.token;jr!==i&&(jr=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function xn(t=Ar()){let e=rn(t,"auth");if(e.isInitialized())return e.getImmediate();let n=hi(t,{popupRedirectResolver:Ai,persistence:[wi,Ii,Ln]}),r=Bt("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(r,location.origin);if(location.origin===s.origin){let o=lc(s.toString());gi(n,o,()=>o(n.currentUser)),mi(n,a=>o(a))}}let i=tr("auth");return i&&fi(n,`http://${i}`),n}function dc(){return document.getElementsByTagName("head")?.[0]??document}Mo({loadJS(t){return new Promise((e,n)=>{let r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{let s=O("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",dc().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="});ac("Browser");var Ot,I,Pi,hc,oe,Si,Ni,Oi,Di,Wn,Fn,Vn,fc,He={},Li=[],pc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Dt=Array.isArray;function $(t,e){for(var n in e)t[n]=e[n];return t}function Bn(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function _c(t,e,n){var r,i,s,o={};for(s in e)s=="key"?r=e[s]:s=="ref"?i=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?Ot.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return Rt(t,o,r,i,null)}function Rt(t,e,n,r,i){var s={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Pi,__i:-1,__u:0};return i==null&&I.vnode!=null&&I.vnode(s),s}function ge(t){return t.children}function Pt(t,e){this.props=t,this.context=e}function me(t,e){if(e==null)return t.__?me(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?me(t):null}function Mi(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return Mi(t)}}function ki(t){(!t.__d&&(t.__d=!0)&&oe.push(t)&&!Nt.__r++||Si!=I.debounceRendering)&&((Si=I.debounceRendering)||Ni)(Nt)}function Nt(){for(var t,e,n,r,i,s,o,a=1;oe.length;)oe.length>a&&oe.sort(Oi),t=oe.shift(),a=oe.length,t.__d&&(n=void 0,i=(r=(e=t).__v).__e,s=[],o=[],e.__P&&((n=$({},r)).__v=r.__v+1,I.vnode&&I.vnode(n),$n(e.__P,n,r,e.__n,e.__P.namespaceURI,32&r.__u?[i]:null,s,i??me(r),!!(32&r.__u),o),n.__v=r.__v,n.__.__k[n.__i]=n,Fi(s,n,o),n.__e!=i&&Mi(n)));Nt.__r=0}function Ui(t,e,n,r,i,s,o,a,u,c,h){var l,d,f,g,A,y,_,m=r&&r.__k||Li,C=e.length;for(u=mc(n,e,m,u,C),l=0;l<C;l++)(f=n.__k[l])!=null&&(d=f.__i==-1?He:m[f.__i]||He,f.__i=l,y=$n(t,f,d,i,s,o,a,u,c,h),g=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&zn(d.ref,null,f),h.push(f.ref,f.__c||g,f)),A==null&&g!=null&&(A=g),(_=!!(4&f.__u))||d.__k===f.__k?u=xi(f,u,t,_):typeof f.type=="function"&&y!==void 0?u=y:g&&(u=g.nextSibling),f.__u&=-7);return n.__e=A,u}function mc(t,e,n,r,i){var s,o,a,u,c,h=n.length,l=h,d=0;for(t.__k=new Array(i),s=0;s<i;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(u=s+d,(o=t.__k[s]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Rt(null,o,null,null,null):Dt(o)?Rt(ge,{children:o},null,null,null):o.constructor==null&&o.__b>0?Rt(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,a=null,(c=o.__i=gc(o,n,u,l))!=-1&&(l--,(a=n[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(i>h?d--:i<h&&d++),typeof o.type!="function"&&(o.__u|=4)):c!=u&&(c==u-1?d--:c==u+1?d++:(c>u?d--:d++,o.__u|=4))):t.__k[s]=null;if(l)for(s=0;s<h;s++)(a=n[s])!=null&&(2&a.__u)==0&&(a.__e==r&&(r=me(a)),Hi(a,a));return r}function xi(t,e,n,r){var i,s;if(typeof t.type=="function"){for(i=t.__k,s=0;i&&s<i.length;s++)i[s]&&(i[s].__=t,e=xi(i[s],e,n,r));return e}t.__e!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=me(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function gc(t,e,n,r){var i,s,o,a=t.key,u=t.type,c=e[n],h=c!=null&&(2&c.__u)==0;if(c===null&&t.key==null||h&&a==c.key&&u==c.type)return n;if(r>(h?1:0)){for(i=n-1,s=n+1;i>=0||s<e.length;)if((c=e[o=i>=0?i--:s++])!=null&&(2&c.__u)==0&&a==c.key&&u==c.type)return o}return-1}function Ci(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||pc.test(e)?n:n+"px"}function Ct(t,e,n,r,i){var s,o;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||Ci(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||Ci(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Di,"$1")),o=e.toLowerCase(),e=o in t||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=n,n?r?n.u=r.u:(n.u=Wn,t.addEventListener(e,s?Vn:Fn,s)):t.removeEventListener(e,s?Vn:Fn,s);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function Ri(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e.t==null)e.t=Wn++;else if(e.t<n.u)return;return n(I.event?I.event(e):e)}}}function $n(t,e,n,r,i,s,o,a,u,c){var h,l,d,f,g,A,y,_,m,C,D,Be,Ie,Jn,$e,Ee,Mt,L=e.type;if(e.constructor!=null)return null;128&n.__u&&(u=!!(32&n.__u),s=[a=e.__e=n.__e]),(h=I.__b)&&h(e);e:if(typeof L=="function")try{if(_=e.props,m="prototype"in L&&L.prototype.render,C=(h=L.contextType)&&r[h.__c],D=h?C?C.props.value:h.__:r,n.__c?y=(l=e.__c=n.__c).__=l.__E:(m?e.__c=l=new L(_,D):(e.__c=l=new Pt(_,D),l.constructor=L,l.render=Ec),C&&C.sub(l),l.props=_,l.state||(l.state={}),l.context=D,l.__n=r,d=l.__d=!0,l.__h=[],l._sb=[]),m&&l.__s==null&&(l.__s=l.state),m&&L.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=$({},l.__s)),$(l.__s,L.getDerivedStateFromProps(_,l.__s))),f=l.props,g=l.state,l.__v=e,d)m&&L.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),m&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(m&&L.getDerivedStateFromProps==null&&_!==f&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(_,D),!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(_,l.__s,D)===!1||e.__v==n.__v){for(e.__v!=n.__v&&(l.props=_,l.state=l.__s,l.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(ae){ae&&(ae.__=e)}),Be=0;Be<l._sb.length;Be++)l.__h.push(l._sb[Be]);l._sb=[],l.__h.length&&o.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(_,l.__s,D),m&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(f,g,A)})}if(l.context=D,l.props=_,l.__P=t,l.__e=!1,Ie=I.__r,Jn=0,m){for(l.state=l.__s,l.__d=!1,Ie&&Ie(e),h=l.render(l.props,l.state,l.context),$e=0;$e<l._sb.length;$e++)l.__h.push(l._sb[$e]);l._sb=[]}else do l.__d=!1,Ie&&Ie(e),h=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++Jn<25);l.state=l.__s,l.getChildContext!=null&&(r=$($({},r),l.getChildContext())),m&&!d&&l.getSnapshotBeforeUpdate!=null&&(A=l.getSnapshotBeforeUpdate(f,g)),Ee=h,h!=null&&h.type===ge&&h.key==null&&(Ee=Vi(h.props.children)),a=Ui(t,Dt(Ee)?Ee:[Ee],e,n,r,i,s,o,a,u,c),l.base=e.__e,e.__u&=-161,l.__h.length&&o.push(l),y&&(l.__E=l.__=null)}catch(ae){if(e.__v=null,u||s!=null)if(ae.then){for(e.__u|=u?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s[s.indexOf(a)]=null,e.__e=a}else{for(Mt=s.length;Mt--;)Bn(s[Mt]);Hn(e)}else e.__e=n.__e,e.__k=n.__k,ae.then||Hn(e);I.__e(ae,e,n)}else s==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):a=e.__e=Ic(n.__e,e,n,r,i,s,o,u,c);return(h=I.diffed)&&h(e),128&e.__u?void 0:a}function Hn(t){t&&t.__c&&(t.__c.__e=!0),t&&t.__k&&t.__k.forEach(Hn)}function Fi(t,e,n){for(var r=0;r<n.length;r++)zn(n[r],n[++r],n[++r]);I.__c&&I.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(s){s.call(i)})}catch(s){I.__e(s,i.__v)}})}function Vi(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:Dt(t)?t.map(Vi):$({},t)}function Ic(t,e,n,r,i,s,o,a,u){var c,h,l,d,f,g,A,y=n.props,_=e.props,m=e.type;if(m=="svg"?i="http://www.w3.org/2000/svg":m=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(c=0;c<s.length;c++)if((f=s[c])&&"setAttribute"in f==!!m&&(m?f.localName==m:f.nodeType==3)){t=f,s[c]=null;break}}if(t==null){if(m==null)return document.createTextNode(_);t=document.createElementNS(i,m,_.is&&_),a&&(I.__m&&I.__m(e,s),a=!1),s=null}if(m==null)y===_||a&&t.data==_||(t.data=_);else{if(s=s&&Ot.call(t.childNodes),y=n.props||He,!a&&s!=null)for(y={},c=0;c<t.attributes.length;c++)y[(f=t.attributes[c]).name]=f.value;for(c in y)if(f=y[c],c!="children"){if(c=="dangerouslySetInnerHTML")l=f;else if(!(c in _)){if(c=="value"&&"defaultValue"in _||c=="checked"&&"defaultChecked"in _)continue;Ct(t,c,null,f,i)}}for(c in _)f=_[c],c=="children"?d=f:c=="dangerouslySetInnerHTML"?h=f:c=="value"?g=f:c=="checked"?A=f:a&&typeof f!="function"||y[c]===f||Ct(t,c,f,y[c],i);if(h)a||l&&(h.__html==l.__html||h.__html==t.innerHTML)||(t.innerHTML=h.__html),e.__k=[];else if(l&&(t.innerHTML=""),Ui(e.type=="template"?t.content:t,Dt(d)?d:[d],e,n,r,m=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:n.__k&&me(n,0),a,u),s!=null)for(c=s.length;c--;)Bn(s[c]);a||(c="value",m=="progress"&&g==null?t.removeAttribute("value"):g!=null&&(g!==t[c]||m=="progress"&&!g||m=="option"&&g!=y[c])&&Ct(t,c,g,y[c],i),c="checked",A!=null&&A!=t[c]&&Ct(t,c,A,y[c],i))}return t}function zn(t,e,n){try{if(typeof t=="function"){var r=typeof t.__u=="function";r&&t.__u(),r&&e==null||(t.__u=t(e))}else t.current=e}catch(i){I.__e(i,n)}}function Hi(t,e,n){var r,i;if(I.unmount&&I.unmount(t),(r=t.ref)&&(r.current&&r.current!=t.__e||zn(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){I.__e(s,e)}r.base=r.__P=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&Hi(r[i],e,n||typeof t.type!="function");n||Bn(t.__e),t.__c=t.__=t.__e=void 0}function Ec(t,e,n){return this.constructor(t,n)}function Wi(t,e,n){var r,i,s,o;e==document&&(e=document.documentElement),I.__&&I.__(t,e),i=(r=typeof n=="function")?null:n&&n.__k||e.__k,s=[],o=[],$n(e,t=(!r&&n||e).__k=_c(ge,null,[t]),i||He,He,e.namespaceURI,!r&&n?[n]:i?null:e.firstChild?Ot.call(e.childNodes):null,s,!r&&n?n:i?i.__e:e.firstChild,r,o),Fi(s,t,o)}Ot=Li.slice,I={__e:function(t,e,n,r){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,r||{}),o=i.__d),o)return i.__E=i}catch(a){t=a}throw t}},Pi=0,hc=function(t){return t!=null&&t.constructor==null},Pt.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$({},this.state),typeof t=="function"&&(t=t($({},n),this.props)),t&&$(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),ki(this))},Pt.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ki(this))},Pt.prototype.render=ge,oe=[],Ni=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Oi=function(t,e){return t.__v.__b-e.__v.__b},Nt.__r=0,Di=/(PointerCapture)$|Capture$/i,Wn=0,Fn=Ri(!1),Vn=Ri(!0),fc=0;var qn,v,jn,Bi,Gn=0,Yi=[],T=I,$i=T.__b,zi=T.__r,ji=T.diffed,qi=T.__c,Gi=T.unmount,Ki=T.__;function yc(t,e){T.__h&&T.__h(v,t,Gn||e),Gn=0;var n=v.__H||(v.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function Xi(t){return Gn=1,vc(Qi,t)}function vc(t,e,n){var r=yc(qn++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):Qi(void 0,e),function(a){var u=r.__N?r.__N[0]:r.__[0],c=r.t(u,a);u!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=v,!v.__f)){var i=function(a,u,c){if(!r.__c.__H)return!0;var h=r.__c.__H.__.filter(function(d){return!!d.__c});if(h.every(function(d){return!d.__N}))return!s||s.call(this,a,u,c);var l=r.__c.props!==a;return h.forEach(function(d){if(d.__N){var f=d.__[0];d.__=d.__N,d.__N=void 0,f!==d.__[0]&&(l=!0)}}),s&&s.call(this,a,u,c)||l};v.__f=!0;var s=v.shouldComponentUpdate,o=v.componentWillUpdate;v.componentWillUpdate=function(a,u,c){if(this.__e){var h=s;s=void 0,i(a,u,c),s=h}o&&o.call(this,a,u,c)},v.shouldComponentUpdate=i}return r.__N||r.__}function wc(){for(var t;t=Yi.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Lt),t.__H.__h.forEach(Kn),t.__H.__h=[]}catch(e){t.__H.__h=[],T.__e(e,t.__v)}}T.__b=function(t){v=null,$i&&$i(t)},T.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Ki&&Ki(t,e)},T.__r=function(t){zi&&zi(t),qn=0;var e=(v=t.__c).__H;e&&(jn===v?(e.__h=[],v.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.forEach(Lt),e.__h.forEach(Kn),e.__h=[],qn=0)),jn=v},T.diffed=function(t){ji&&ji(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Yi.push(e)!==1&&Bi===T.requestAnimationFrame||((Bi=T.requestAnimationFrame)||Tc)(wc)),e.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),jn=v=null},T.__c=function(t,e){e.some(function(n){try{n.__h.forEach(Lt),n.__h=n.__h.filter(function(r){return!r.__||Kn(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],T.__e(r,n.__v)}}),qi&&qi(t,e)},T.unmount=function(t){Gi&&Gi(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Lt(r)}catch(i){e=i}}),n.__H=void 0,e&&T.__e(e,n.__v))};var Ji=typeof requestAnimationFrame=="function";function Tc(t){var e,n=function(){clearTimeout(r),Ji&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);Ji&&(e=requestAnimationFrame(n))}function Lt(t){var e=v,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),v=e}function Kn(t){var e=v;t.__c=t.__(),v=e}function Qi(t,e){return typeof e=="function"?e(t):e}var bc=0,Tl=Array.isArray;function w(t,e,n,r,i,s){e||(e={});var o,a,u=e;if("ref"in u)for(a in u={},e)a=="ref"?o=e[a]:u[a]=e[a];var c={type:t,props:u,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--bc,__i:-1,__u:0,__source:i,__self:s};if(typeof t=="function"&&(o=t.defaultProps))for(a in o)u[a]===void 0&&(u[a]=o[a]);return I.vnode&&I.vnode(c),c}function We(){let[t,e]=Xi(""),n=window.__ROOT_CTX.name;function r(i){e(i)}return w("div",{className:"signin",children:[w("div",{className:"signin__headline",children:[n&&w("h1",{className:"signin__headline__title",children:n}),w("p",{className:"signin__headline__body",children:n?`Sign in to continue to ${n}`:"Sign in to continue"})]}),w(We.Button,{onError:r}),t&&w("p",{className:"signin__error",children:t})]})}We.Button=t=>{async function e(r){try{return await r.json()}catch(i){console.error(i)}return{}}async function n(){let r=new ne;r.addScope("profile"),r.addScope("email");let s=(await Un(window.firebase.auth,r)).user,o=await s.getIdToken(),a=await fetch("/cms/login",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({idToken:o})}),u=await e(a);if(a.status===401){let c=s?.email||"(no email)";u.reason?t.onError(`Login failed for: ${c}. Reason: ${u.reason}. If you believe this is a mistake, please contact a developer to help resolve the issue.`):t.onError(`Login failed for: ${c}. If you believe this is a mistake, please contact a developer to help resolve the issue.`);return}if(a.status!==200){console.error("login failed"),console.log(a.status,u),t.onError("An unknown error has occurred.");return}if(!u.success){console.error("login failed"),console.log(a.status,u),u.reason?t.onError(`Login failed. Reason: ${u.reason}`):t.onError("Login failed.");return}Ac()}return w("button",{className:"signin__button",onClick:n,children:[w("div",{className:"signin__button__icon",children:w(We.GLogo,{})}),w("div",{className:"signin__button__label",children:"Sign in with Google"})]})};We.GLogo=()=>w("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48",children:w("g",{children:[w("path",{fill:"#EA4335",d:"M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"}),w("path",{fill:"#4285F4",d:"M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"}),w("path",{fill:"#FBBC05",d:"M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"}),w("path",{fill:"#34A853",d:"M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"}),w("path",{fill:"none",d:"M0 0h48v48H0z"})]})});function Ac(){let e=new URLSearchParams(window.location.search).get("continue");(!e||!e.startsWith("/")||e.startsWith("/cms/login"))&&(e="/cms"),window.location.replace(e)}var Zi=sn(window.__ROOT_CTX.firebaseConfig),Sc=xn(Zi);window.firebase={app:Zi,auth:Sc};var es=document.getElementById("root");es.innerHTML="";Wi(w(We,{}),es);})();
15
+ </defs>`,g.innerText="Preview backend running in this workspace."),g.setAttribute("id",f)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",l):l()}function S(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function ir(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(S())}function sr(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function or(){let t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function ar(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function cr(){let t=S();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function ur(){try{return typeof indexedDB=="object"}catch{return!1}}function lr(){return new Promise((t,e)=>{try{let n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{e(i.error?.message||"")}}catch(n){e(n)}})}var us="FirebaseError",P=class t extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=us,Object.setPrototypeOf(this,t.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,V.prototype.create)}},V=class{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){let r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?ls(s,r):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new P(i,a,r)}};function ls(t,e){return t.replace(ds,(n,r)=>{let i=e[r];return i!=null?String(i):`<${r}?>`})}var ds=/\{\$([^}]+)}/g;function dr(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function z(t,e){if(t===e)return!0;let n=Object.keys(t),r=Object.keys(e);for(let i of n){if(!r.includes(i))return!1;let s=t[i],o=e[i];if(Qn(s)&&Qn(o)){if(!z(s,o))return!1}else if(s!==o)return!1}for(let i of r)if(!n.includes(i))return!1;return!0}function Qn(t){return t!==null&&typeof t=="object"}function ce(t){let e=[];for(let[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function ue(t){let e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){let[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function le(t){let e=t.indexOf("?");if(!e)return"";let n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function hr(t,e){let n=new Ft(t,e);return n.subscribe.bind(n)}var Ft=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");hs(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=Ut),i.error===void 0&&(i.error=Ut),i.complete===void 0&&(i.complete=Ut);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}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 n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(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 hs(t,e){if(typeof t!="object"||t===null)return!1;for(let n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function Ut(){}var Rc=14400*1e3;function j(t){return t&&t._delegate?t._delegate:t}var M=class{constructor(e,n,r){this.name=e,this.instanceFactory=n,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}};var Y="[DEFAULT]";var $t=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let r=new ze;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){let n=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}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(ps(e))try{this.getOrInitializeService({instanceIdentifier:Y})}catch{}for(let[n,r]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=Y){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=Y){return this.instances.has(e)}getOptions(e=Y){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=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`);let i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);r===a&&o.resolve(i)}return i}onInit(e,n){let r=this.normalizeInstanceIdentifier(n),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);let s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,n){let r=this.onInitCallbacks.get(n);if(r)for(let i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:fs(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=Y){return this.component?this.component.multipleInstances?e:Y:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function fs(t){return t===Y?void 0:t}function ps(t){return t.instantiationMode==="EAGER"}var qe=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.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);let n=new $t(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}};var _s=[],E;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(E||(E={}));var ms={debug:E.DEBUG,verbose:E.VERBOSE,info:E.INFO,warn:E.WARN,error:E.ERROR,silent:E.SILENT},gs=E.INFO,Is={[E.DEBUG]:"log",[E.VERBOSE]:"log",[E.INFO]:"info",[E.WARN]:"warn",[E.ERROR]:"error"},Es=(t,e,...n)=>{if(e<t.logLevel)return;let r=new Date().toISOString(),i=Is[e];if(i)console[i](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},de=class{constructor(e){this.name=e,this._logLevel=gs,this._logHandler=Es,this._userLogHandler=null,_s.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in E))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?ms[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,E.DEBUG,...e),this._logHandler(this,E.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,E.VERBOSE,...e),this._logHandler(this,E.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,E.INFO,...e),this._logHandler(this,E.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,E.WARN,...e),this._logHandler(this,E.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,E.ERROR,...e),this._logHandler(this,E.ERROR,...e)}};var ys=(t,e)=>e.some(n=>t instanceof n),fr,pr;function vs(){return fr||(fr=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ws(){return pr||(pr=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var _r=new WeakMap,jt=new WeakMap,mr=new WeakMap,zt=new WeakMap,Gt=new WeakMap;function Ts(t){let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(U(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&_r.set(n,t)}).catch(()=>{}),Gt.set(e,t),e}function bs(t){if(jt.has(t))return;let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});jt.set(t,e)}var qt={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return jt.get(t);if(e==="objectStoreNames")return t.objectStoreNames||mr.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return U(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function gr(t){qt=t(qt)}function As(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let r=t.call(Ge(this),e,...n);return mr.set(r,e.sort?e.sort():[e]),U(r)}:ws().includes(t)?function(...e){return t.apply(Ge(this),e),U(_r.get(this))}:function(...e){return U(t.apply(Ge(this),e))}}function Ss(t){return typeof t=="function"?As(t):(t instanceof IDBTransaction&&bs(t),ys(t,vs())?new Proxy(t,qt):t)}function U(t){if(t instanceof IDBRequest)return Ts(t);if(zt.has(t))return zt.get(t);let e=Ss(t);return e!==t&&(zt.set(t,e),Gt.set(e,t)),e}var Ge=t=>Gt.get(t);function Er(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){let o=indexedDB.open(t,e),a=U(o);return r&&o.addEventListener("upgradeneeded",u=>{r(U(o.result),u.oldVersion,u.newVersion,U(o.transaction),u)}),n&&o.addEventListener("blocked",u=>n(u.oldVersion,u.newVersion,u)),a.then(u=>{s&&u.addEventListener("close",()=>s()),i&&u.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}var ks=["get","getKey","getAll","getAllKeys","count"],Cs=["put","add","delete","clear"],Kt=new Map;function Ir(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Kt.get(e))return Kt.get(e);let n=e.replace(/FromIndex$/,""),r=e!==n,i=Cs.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||ks.includes(n)))return;let s=async function(o,...a){let u=this.transaction(o,i?"readwrite":"readonly"),c=u.store;return r&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),i&&u.done]))[0]};return Kt.set(e,s),s}gr(t=>({...t,get:(e,n,r)=>Ir(e,n)||t.get(e,n,r),has:(e,n)=>!!Ir(e,n)||t.has(e,n)}));var Yt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(Rs(n)){let r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}};function Rs(t){return t.getComponent()?.type==="VERSION"}var Xt="@firebase/app",yr="0.14.2";var H=new de("@firebase/app"),Ps="@firebase/app-compat",Ns="@firebase/analytics-compat",Os="@firebase/analytics",Ds="@firebase/app-check-compat",Ls="@firebase/app-check",Ms="@firebase/auth",Us="@firebase/auth-compat",xs="@firebase/database",Fs="@firebase/data-connect",Vs="@firebase/database-compat",Hs="@firebase/functions",Ws="@firebase/functions-compat",Bs="@firebase/installations",$s="@firebase/installations-compat",zs="@firebase/messaging",js="@firebase/messaging-compat",qs="@firebase/performance",Gs="@firebase/performance-compat",Ks="@firebase/remote-config",Js="@firebase/remote-config-compat",Ys="@firebase/storage",Xs="@firebase/storage-compat",Qs="@firebase/firestore",Zs="@firebase/ai",eo="@firebase/firestore-compat",to="firebase",no="12.2.0";var Qt="[DEFAULT]",ro={[Xt]:"fire-core",[Ps]:"fire-core-compat",[Os]:"fire-analytics",[Ns]:"fire-analytics-compat",[Ls]:"fire-app-check",[Ds]:"fire-app-check-compat",[Ms]:"fire-auth",[Us]:"fire-auth-compat",[xs]:"fire-rtdb",[Fs]:"fire-data-connect",[Vs]:"fire-rtdb-compat",[Hs]:"fire-fn",[Ws]:"fire-fn-compat",[Bs]:"fire-iid",[$s]:"fire-iid-compat",[zs]:"fire-fcm",[js]:"fire-fcm-compat",[qs]:"fire-perf",[Gs]:"fire-perf-compat",[Ks]:"fire-rc",[Js]:"fire-rc-compat",[Ys]:"fire-gcs",[Xs]:"fire-gcs-compat",[Qs]:"fire-fst",[eo]:"fire-fst-compat",[Zs]:"fire-vertex","fire-js":"fire-js",[to]:"fire-js-all"};var Ke=new Map,io=new Map,Zt=new Map;function vr(t,e){try{t.container.addComponent(e)}catch(n){H.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function he(t){let e=t.name;if(Zt.has(e))return H.debug(`There were multiple attempts to register component ${e}.`),!1;Zt.set(e,t);for(let n of Ke.values())vr(n,t);for(let n of io.values())vr(n,t);return!0}function rn(t,e){let n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function N(t){return t==null?!1:t.settings!==void 0}var so={"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.","invalid-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."},q=new V("app","Firebase",so);var en=class{constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new M("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 q.create("app-deleted",{appName:this._name})}};var fe=no;function sn(t,e={}){let n=t;typeof e!="object"&&(e={name:e});let r={name:Qt,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw q.create("bad-app-name",{appName:String(i)});if(n||(n=Wt()),!n)throw q.create("no-options");let s=Ke.get(i);if(s){if(z(n,s.options)&&z(r,s.config))return s;throw q.create("duplicate-app",{appName:i})}let o=new qe(i);for(let u of Zt.values())o.addComponent(u);let a=new en(n,r,o);return Ke.set(i,a),a}function Ar(t=Qt){let e=Ke.get(t);if(!e&&t===Qt&&Wt())return sn();if(!e)throw q.create("no-app",{appName:t});return e}function G(t,e,n){let r=ro[t]??t;n&&(r+=`-${n}`);let i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){let o=[`Unable to register library "${r}" with version "${e}":`];i&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&o.push("and"),s&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),H.warn(o.join(" "));return}he(new M(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}var oo="firebase-heartbeat-database",ao=1,we="firebase-heartbeat-store",Jt=null;function Sr(){return Jt||(Jt=Er(oo,ao,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(we)}catch(n){console.warn(n)}}}}).catch(t=>{throw q.create("idb-open",{originalErrorMessage:t.message})})),Jt}async function co(t){try{let n=(await Sr()).transaction(we),r=await n.objectStore(we).get(kr(t));return await n.done,r}catch(e){if(e instanceof P)H.warn(e.message);else{let n=q.create("idb-get",{originalErrorMessage:e?.message});H.warn(n.message)}}}async function wr(t,e){try{let r=(await Sr()).transaction(we,"readwrite");await r.objectStore(we).put(e,kr(t)),await r.done}catch(n){if(n instanceof P)H.warn(n.message);else{let r=q.create("idb-set",{originalErrorMessage:n?.message});H.warn(r.message)}}}function kr(t){return`${t.name}!${t.options.appId}`}var uo=1024,lo=30,tn=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new nn(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){try{let n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=Tr();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats.length>lo){let i=fo(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){H.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=Tr(),{heartbeatsToSend:n,unsentEntries:r}=ho(this._heartbeatsCache.heartbeats),i=Vt(JSON.stringify({version:2,heartbeats:n}));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)),i}catch(e){return H.warn(e),""}}};function Tr(){return new Date().toISOString().substring(0,10)}function ho(t,e=uo){let n=[],r=t.slice();for(let i of t){let s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),br(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),br(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}var nn=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return ur()?lr().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await co(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let r=await this.read();return wr(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){let r=await this.read();return wr(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}};function br(t){return Vt(JSON.stringify({version:2,heartbeats:t})).length}function fo(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;r<t.length;r++)t[r].date<n&&(n=t[r].date,e=r);return e}function po(t){he(new M("platform-logger",e=>new Yt(e),"PRIVATE")),he(new M("heartbeat",e=>new tn(e),"PRIVATE")),G(Xt,yr,t),G(Xt,yr,"esm2020"),G("fire-js","")}po("");var _o="firebase",mo="12.2.1";G(_o,mo,"app");function qr(){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."}}var Gr=qr,Kr=new V("auth","Firebase",qr());var tt=new de("@firebase/auth");function go(t,...e){tt.logLevel<=E.WARN&&tt.warn(`Auth (${fe}): ${t}`,...e)}function Ye(t,...e){tt.logLevel<=E.ERROR&&tt.error(`Auth (${fe}): ${t}`,...e)}function R(t,...e){throw Pn(t,...e)}function O(t,...e){return Pn(t,...e)}function Rn(t,e,n){let r={...Gr(),[e]:n};return new V("auth","Firebase",r).create(e,{appName:t.name})}function X(t){return Rn(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Io(t,e,n){let r=n;if(!(e instanceof r))throw r.name!==e.constructor.name&&R(t,"argument-error"),Rn(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Pn(t,...e){if(typeof t!="string"){let n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return Kr.create(t,...e)}function p(t,e,...n){if(!t)throw Pn(e,...n)}function x(t){let e="INTERNAL ASSERTION FAILED: "+t;throw Ye(e),new Error(e)}function B(t,e){t||x(e)}function dn(){return typeof self<"u"&&self.location?.href||""}function Eo(){return Cr()==="http:"||Cr()==="https:"}function Cr(){return typeof self<"u"&&self.location?.protocol||null}function yo(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Eo()||or()||"connection"in navigator)?navigator.onLine:!0}function vo(){if(typeof navigator>"u")return null;let t=navigator;return t.languages&&t.languages[0]||t.language||null}var Q=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,B(n>e,"Short delay should be less than long delay!"),this.isMobile=ir()||ar()}get(){return yo()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function Nn(t,e){B(t.emulator,"Emulator should always be set here");let{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}var nt=class{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),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;x("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;x("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;x("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};var wo={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-recaptcha-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"};var To=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],bo=new Q(3e4,6e4);function b(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function k(t,e,n,r,i={}){return Jr(t,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});let a=ce({key:t.config.apiKey,...o}).slice(1),u=await t._getAdditionalHeaders();u["Content-Type"]="application/json",t.languageCode&&(u["X-Firebase-Locale"]=t.languageCode);let c={method:e,headers:u,...s};return sr()||(c.referrerPolicy="no-referrer"),t.emulatorConfig&&ve(t.emulatorConfig.host)&&(c.credentials="include"),nt.fetch()(await Yr(t,t.config.apiHost,n,a),c)})}async function Jr(t,e,n){t._canInitEmulator=!1;let r={...wo,...e};try{let i=new hn(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw be(t,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let a=s.ok?o.errorMessage:o.error.message,[u,c]=a.split(" : ");if(u==="FEDERATED_USER_ID_ALREADY_LINKED")throw be(t,"credential-already-in-use",o);if(u==="EMAIL_EXISTS")throw be(t,"email-already-in-use",o);if(u==="USER_DISABLED")throw be(t,"user-disabled",o);let h=r[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw Rn(t,h,c);R(t,h)}}catch(i){if(i instanceof P)throw i;R(t,"network-request-failed",{message:String(i)})}}async function ie(t,e,n,r,i={}){let s=await k(t,e,n,r,i);return"mfaPendingCredential"in s&&R(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function Yr(t,e,n,r){let i=`${e}${n}?${r}`,s=t,o=s.config.emulator?Nn(t.config,i):`${t.config.apiScheme}://${i}`;return To.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}function Ao(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var hn=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(O(this.auth,"network-request-failed")),bo.get())})}};function be(t,e,n){let r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);let i=O(t,e,r);return i.customData._tokenResponse=n,i}function Rr(t){return t!==void 0&&t.enterprise!==void 0}var rt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return Ao(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}};async function Xr(t,e){return k(t,"GET","/v2/recaptchaConfig",b(t,e))}async function So(t,e){return k(t,"POST","/v1/accounts:delete",e)}async function it(t,e){return k(t,"POST","/v1/accounts:lookup",e)}function Ae(t){if(t)try{let e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Qr(t,e=!1){let n=j(t),r=await n.getIdToken(e),i=On(r);p(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,o=s?.sign_in_provider;return{claims:i,token:r,authTime:Ae(on(i.auth_time)),issuedAtTime:Ae(on(i.iat)),expirationTime:Ae(on(i.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function on(t){return Number(t)*1e3}function On(t){let[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return Ye("JWT malformed, contained fewer than 3 sections"),null;try{let i=je(n);return i?JSON.parse(i):(Ye("Failed to decode base64 JWT payload"),null)}catch(i){return Ye("Caught error parsing JWT payload as JSON",i?.toString()),null}}function Pr(t){let e=On(t);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function Re(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof P&&ko(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function ko({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}var fn=class{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){let n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;let r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};var Pe=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Ae(this.lastLoginAt),this.creationTime=Ae(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function st(t){let e=t.auth,n=await t.getIdToken(),r=await Re(t,it(e,{idToken:n}));p(r?.users.length,e,"internal-error");let i=r.users[0];t._notifyReloadListener(i);let s=i.providerUserInfo?.length?ei(i.providerUserInfo):[],o=Co(t.providerData,s),a=t.isAnonymous,u=!(t.email&&i.passwordHash)&&!o?.length,c=a?u:!1,h={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:o,metadata:new Pe(i.createdAt,i.lastLoginAt),isAnonymous:c};Object.assign(t,h)}async function Zr(t){let e=j(t);await st(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Co(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function ei(t){return t.map(({providerId:e,...n})=>({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}async function Ro(t,e){let n=await Jr(t,{},async()=>{let r=ce({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,o=await Yr(t,i,"/v1/token",`key=${s}`),a=await t._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";let u={method:"POST",headers:a,body:r};return t.emulatorConfig&&ve(t.emulatorConfig.host)&&(u.credentials="include"),nt.fetch()(o,u)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function Po(t,e){return k(t,"POST","/v2/accounts:revokeToken",b(t,e))}var Se=class t{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Pr(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){p(e.length!==0,"internal-error");let n=Pr(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:r,refreshToken:i,expiresIn:s}=await Ro(e,n);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){let{refreshToken:r,accessToken:i,expirationTime:s}=n,o=new t;return r&&(p(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),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 t,this.toJSON())}_performRefresh(){return x("not implemented")}};function K(t,e){p(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}var J=class t{constructor({uid:e,auth:n,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new fn(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new Pe(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){let n=await Re(this,this.stsTokenManager.getToken(this.auth,e));return p(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return Qr(this,e)}reload(){return Zr(this)}_assign(e){this!==e&&(p(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(n=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new t({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){p(!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,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await st(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(N(this.auth.app))return Promise.reject(X(this.auth));let e=await this.getIdToken();return await Re(this,So(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,isAnonymous: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,n){let r=n.displayName??void 0,i=n.email??void 0,s=n.phoneNumber??void 0,o=n.photoURL??void 0,a=n.tenantId??void 0,u=n._redirectEventId??void 0,c=n.createdAt??void 0,h=n.lastLoginAt??void 0,{uid:l,emailVerified:d,isAnonymous:f,providerData:g,stsTokenManager:A}=n;p(l&&A,e,"internal-error");let y=Se.fromJSON(this.name,A);p(typeof l=="string",e,"internal-error"),K(r,e.name),K(i,e.name),p(typeof d=="boolean",e,"internal-error"),p(typeof f=="boolean",e,"internal-error"),K(s,e.name),K(o,e.name),K(a,e.name),K(u,e.name),K(c,e.name),K(h,e.name);let _=new t({uid:l,auth:e,email:i,emailVerified:d,displayName:r,isAnonymous:f,photoURL:o,phoneNumber:s,tenantId:a,stsTokenManager:y,createdAt:c,lastLoginAt:h});return g&&Array.isArray(g)&&(_.providerData=g.map(m=>({...m}))),u&&(_._redirectEventId=u),_}static async _fromIdTokenResponse(e,n,r=!1){let i=new Se;i.updateFromServerResponse(n);let s=new t({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await st(s),s}static async _fromGetAccountInfoResponse(e,n,r){let i=n.users[0];p(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?ei(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!s?.length,a=new Se;a.updateFromIdToken(r);let u=new t({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),c={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new Pe(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(u,c),u}};var Nr=new Map;function W(t){B(t instanceof Function,"Expected a class definition");let e=Nr.get(t);return e?(B(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,Nr.set(t,e),e)}var ot=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};ot.type="NONE";var pn=ot;function Xe(t,e,n){return`firebase:${t}:${e}:${n}`}var at=class t{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;let{config:i,name:s}=this.auth;this.fullUserKey=Xe(this.userKey,i.apiKey,s),this.fullPersistenceKey=Xe("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){let n=await it(this.auth,{idToken:e}).catch(()=>{});return n?J._fromGetAccountInfoResponse(this.auth,n,e):null}return J._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;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new t(W(pn),e,r);let i=(await Promise.all(n.map(async c=>{if(await c._isAvailable())return c}))).filter(c=>c),s=i[0]||W(pn),o=Xe(r,e.config.apiKey,e.name),a=null;for(let c of n)try{let h=await c._get(o);if(h){let l;if(typeof h=="string"){let d=await it(e,{idToken:h}).catch(()=>{});if(!d)break;l=await J._fromGetAccountInfoResponse(e,d,h)}else l=J._fromJSON(e,h);c!==s&&(a=l),s=c;break}}catch{}let u=i.filter(c=>c._shouldAllowMigration);return!s._shouldAllowMigration||!u.length?new t(s,e,r):(s=u[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async c=>{if(c!==s)try{await c._remove(o)}catch{}})),new t(s,e,r))}};function Or(t){let e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(ii(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(ti(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(oi(e))return"Blackberry";if(ai(e))return"Webos";if(ni(e))return"Safari";if((e.includes("chrome/")||ri(e))&&!e.includes("edge/"))return"Chrome";if(si(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if(r?.length===2)return r[1]}return"Other"}function ti(t=S()){return/firefox\//i.test(t)}function ni(t=S()){let e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function ri(t=S()){return/crios\//i.test(t)}function ii(t=S()){return/iemobile/i.test(t)}function si(t=S()){return/android/i.test(t)}function oi(t=S()){return/blackberry/i.test(t)}function ai(t=S()){return/webos/i.test(t)}function Dn(t=S()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function No(t=S()){return Dn(t)&&!!window.navigator?.standalone}function Oo(){return cr()&&document.documentMode===10}function ci(t=S()){return Dn(t)||si(t)||ai(t)||oi(t)||/windows phone/i.test(t)||ii(t)}function ui(t,e=[]){let n;switch(t){case"Browser":n=Or(S());break;case"Worker":n=`${Or(S())}-${t}`;break;default:n=t}let r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${fe}/${r}`}var _n=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let r=s=>new Promise((o,a)=>{try{let u=e(s);o(u)}catch(u){a(u)}});r.onAbort=n,this.queue.push(r);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}}};async function Do(t,e={}){return k(t,"GET","/v2/passwordPolicy",b(t,e))}var Lo=6,mn=class{constructor(e){let n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??Lo,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.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){let n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){let r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};var gn=class{constructor(e,n,r,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new ct(this),this.idTokenSubscription=new ct(this),this.beforeStateQueue=new _n(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=Kr,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=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=W(n)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await at.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=this.currentUser?.uid||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let 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{let n=await it(this,{idToken:e}),r=await J._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(N(this.app)){let s=this.app.settings.authIdToken;return s?new Promise(o=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(o,o))}):this.directlySetCurrentUser(null)}let n=await this.assertedPersistence.getCurrentUser(),r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let s=this.redirectUser?._redirectEventId,o=r?._redirectEventId,a=await this.tryRedirectSignIn(e);(!s||s===o)&&a?.user&&(r=a.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(s){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(s))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return p(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 n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await st(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=vo()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(N(this.app))return Promise.reject(X(this));let n=e?j(e):null;return n&&p(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&p(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return N(this.app)?Promise.reject(X(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return N(this.app)?Promise.reject(X(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(W(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await Do(this),n=new mn(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new V("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await Po(this,r)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,n){let r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&W(e)||this._popupRedirectResolver;p(n,this,"argument-error"),this.redirectPersistenceManager=await at.create(this,[W(n._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);let e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),o=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){let u=e.addObserver(n,r,i);return()=>{o=!0,u()}}else{let u=e.addObserver(n);return()=>{o=!0,u()}}}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 p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=ui(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){let e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);let n=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();n&&(e["X-Firebase-Client"]=n);let r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){if(N(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&go(`Error while retrieving App Check token: ${e.error}`),e?.token}};function se(t){return j(t)}var ct=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=hr(n=>this.observer=n)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};var St={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Mo(t){St=t}function li(t){return St.loadJS(t)}function Uo(){return St.recaptchaEnterpriseScript}function xo(){return St.gapiScript}function di(t){return`__${t}${Math.floor(Math.random()*1e6)}`}var In=class{constructor(){this.enterprise=new En}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}},En=class{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}};var Fo="recaptcha-enterprise",ke="NO_RECAPTCHA",ut=class{constructor(e){this.type=Fo,this.auth=se(e)}async verify(e="verify",n=!1){async function r(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{Xr(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(u=>{if(u.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{let c=new rt(u);return s.tenantId==null?s._agentRecaptchaConfig=c:s._tenantRecaptchaConfigs[s.tenantId]=c,o(c.siteKey)}}).catch(u=>{a(u)})})}function i(s,o,a){let u=window.grecaptcha;Rr(u)?u.enterprise.ready(()=>{u.enterprise.execute(s,{action:e}).then(c=>{o(c)}).catch(()=>{o(ke)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new In().execute("siteKey",{action:"verify"}):new Promise((s,o)=>{r(this.auth).then(a=>{if(!n&&Rr(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let u=Uo();u.length!==0&&(u+=a),li(u).then(()=>{i(a,s,o)}).catch(c=>{o(c)})}}).catch(a=>{o(a)})})}};async function Te(t,e,n,r=!1,i=!1){let s=new ut(t),o;if(i)o=ke;else try{o=await s.verify(n)}catch{o=await s.verify(n,!0)}let a={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in a){let u=a.phoneEnrollmentInfo.phoneNumber,c=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:u,recaptchaToken:c,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){let u=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:u,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return r?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function Ce(t,e,n,r,i){if(i==="EMAIL_PASSWORD_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Te(t,e,n,n==="getOobCode");return r(t,s)}else return r(t,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Te(t,e,n,n==="getOobCode");return r(t,o)}else return Promise.reject(s)});else if(i==="PHONE_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let s=await Te(t,e,n);return r(t,s).catch(async o=>{if(t._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&(o.code==="auth/missing-recaptcha-token"||o.code==="auth/invalid-app-credential")){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${n} flow.`);let a=await Te(t,e,n,!1,!0);return r(t,a)}return Promise.reject(o)})}else{let s=await Te(t,e,n,!1,!0);return r(t,s)}else return Promise.reject(i+" provider is not supported.")}async function Vo(t){let e=se(t),n=await Xr(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),r=new rt(n);e.tenantId==null?e._agentRecaptchaConfig=r:e._tenantRecaptchaConfigs[e.tenantId]=r,r.isAnyProviderEnabled()&&new ut(e).verify()}function hi(t,e){let n=rn(t,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(z(s,e??{}))return i;R(i,"already-initialized")}return n.initialize({options:e})}function Ho(t,e){let n=e?.persistence||[],r=(Array.isArray(n)?n:[n]).map(W);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e?.popupRedirectResolver)}function fi(t,e,n){let r=se(t);p(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=pi(e),{host:o,port:a}=Wo(e),u=a===null?"":`:${a}`,c={url:`${s}//${o}${u}/`},h=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){p(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),p(z(c,r.config.emulator)&&z(h,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=c,r.emulatorConfig=h,r.settings.appVerificationDisabledForTesting=!0,ve(o)?(nr(`${s}//${o}${u}`),rr("Auth",!0)):i||Bo()}function pi(t){let e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Wo(t){let e=pi(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};let r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){let s=i[1];return{host:s,port:Dr(r.substr(s.length+1))}}else{let[s,o]=r.split(":");return{host:s,port:Dr(o)}}}function Dr(t){if(!t)return null;let e=Number(t);return isNaN(e)?null:e}function Bo(){function t(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.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",t):t())}var Z=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return x("not implemented")}_getIdTokenResponse(e){return x("not implemented")}_linkToIdToken(e,n){return x("not implemented")}_getReauthenticationResolver(e){return x("not implemented")}};async function $o(t,e){return k(t,"POST","/v1/accounts:signUp",e)}async function zo(t,e){return ie(t,"POST","/v1/accounts:signInWithPassword",b(t,e))}async function jo(t,e){return ie(t,"POST","/v1/accounts:signInWithEmailLink",b(t,e))}async function qo(t,e){return ie(t,"POST","/v1/accounts:signInWithEmailLink",b(t,e))}var Ne=class t extends Z{constructor(e,n,r,i=null){super("password",r),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new t(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new t(e,n,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Ce(e,n,"signInWithPassword",zo,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return jo(e,{email:this._email,oobCode:this._password});default:R(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let r={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Ce(e,r,"signUpPassword",$o,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return qo(e,{idToken:n,email:this._email,oobCode:this._password});default:R(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function pe(t,e){return ie(t,"POST","/v1/accounts:signInWithIdp",b(t,e))}var Go="http://localhost",ee=class t extends Z{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new t(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):R("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,...s}=n;if(!r||!i)return null;let o=new t(r,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let n=this.buildRequest();return pe(e,n)}_linkToIdToken(e,n){let r=this.buildRequest();return r.idToken=n,pe(e,r)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,pe(e,n)}buildRequest(){let e={requestUri:Go,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=ce(n)}return e}};async function Lr(t,e){return k(t,"POST","/v1/accounts:sendVerificationCode",b(t,e))}async function Ko(t,e){return ie(t,"POST","/v1/accounts:signInWithPhoneNumber",b(t,e))}async function Jo(t,e){let n=await ie(t,"POST","/v1/accounts:signInWithPhoneNumber",b(t,e));if(n.temporaryProof)throw be(t,"account-exists-with-different-credential",n);return n}var Yo={USER_NOT_FOUND:"user-not-found"};async function Xo(t,e){let n={...e,operation:"REAUTH"};return ie(t,"POST","/v1/accounts:signInWithPhoneNumber",b(t,n),Yo)}var Oe=class t extends Z{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new t({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new t({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return Ko(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Jo(e,{idToken:n,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return Xo(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:r,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:r,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:r,phoneNumber:i,temporaryProof:s}=e;return!r&&!n&&!i&&!s?null:new t({verificationId:n,verificationCode:r,phoneNumber:i,temporaryProof:s})}};function Qo(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Zo(t){let e=ue(le(t)).link,n=e?ue(le(e)).deep_link_id:null,r=ue(le(t)).deep_link_id;return(r?ue(le(r)).link:null)||r||n||e||t}var lt=class t{constructor(e){let n=ue(le(e)),r=n.apiKey??null,i=n.oobCode??null,s=Qo(n.mode??null);p(r&&i&&s,"argument-error"),this.apiKey=r,this.operation=s,this.code=i,this.continueUrl=n.continueUrl??null,this.languageCode=n.lang??null,this.tenantId=n.tenantId??null}static parseLink(e){let n=Zo(e);try{return new t(n)}catch{return null}}};var _e=class t{constructor(){this.providerId=t.PROVIDER_ID}static credential(e,n){return Ne._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let r=lt.parseLink(n);return p(r,"argument-error"),Ne._fromEmailAndCode(e,r.code,r.tenantId)}};_e.PROVIDER_ID="password";_e.EMAIL_PASSWORD_SIGN_IN_METHOD="password";_e.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var De=class{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}};var te=class extends De{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}};var Le=class t extends te{constructor(){super("facebook.com")}static credential(e){return ee._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return t.credential(e.oauthAccessToken)}catch{return null}}};Le.FACEBOOK_SIGN_IN_METHOD="facebook.com";Le.PROVIDER_ID="facebook.com";var ne=class t extends te{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return ee._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return t.credential(n,r)}catch{return null}}};ne.GOOGLE_SIGN_IN_METHOD="google.com";ne.PROVIDER_ID="google.com";var Me=class t extends te{constructor(){super("github.com")}static credential(e){return ee._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return t.credential(e.oauthAccessToken)}catch{return null}}};Me.GITHUB_SIGN_IN_METHOD="github.com";Me.PROVIDER_ID="github.com";var Ue=class t extends te{constructor(){super("twitter.com")}static credential(e,n){return ee._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return t.credential(n,r)}catch{return null}}};Ue.TWITTER_SIGN_IN_METHOD="twitter.com";Ue.PROVIDER_ID="twitter.com";var xe=class t{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,i=!1){let s=await J._fromIdTokenResponse(e,r,i),o=Mr(r);return new t({user:s,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);let i=Mr(r);return new t({user:e,providerId:i,_tokenResponse:r,operationType:n})}};function Mr(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}var yn=class t extends P{constructor(e,n,r,i){super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,t.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,i){return new t(e,n,r,i)}};function _i(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?yn._fromErrorAndOperation(t,s,e,r):s})}async function ea(t,e,n=!1){let r=await Re(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return xe._forOperation(t,"link",r)}async function ta(t,e,n=!1){let{auth:r}=t;if(N(r.app))return Promise.reject(X(r));let i="reauthenticate";try{let s=await Re(t,_i(r,i,e,t),n);p(s.idToken,r,"internal-error");let o=On(s.idToken);p(o,r,"internal-error");let{sub:a}=o;return p(t.uid===a,r,"user-mismatch"),xe._forOperation(t,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&R(r,"user-mismatch"),s}}async function na(t,e,n=!1){if(N(t.app))return Promise.reject(X(t));let r="signIn",i=await _i(t,r,e),s=await xe._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}function mi(t,e,n,r){return j(t).onIdTokenChanged(e,n,r)}function gi(t,e,n){return j(t).beforeAuthStateChanged(e,n)}function Ur(t,e){return k(t,"POST","/v2/accounts/mfaEnrollment:start",b(t,e))}function ra(t,e){return k(t,"POST","/v2/accounts/mfaEnrollment:finalize",b(t,e))}function ia(t,e){return k(t,"POST","/v2/accounts/mfaEnrollment:start",b(t,e))}function sa(t,e){return k(t,"POST","/v2/accounts/mfaEnrollment:finalize",b(t,e))}var dt="__sak";var ht=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(dt,"1"),this.storage.removeItem(dt),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};var oa=1e3,aa=10,ft=class extends ht{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=ci(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let r=this.storage.getItem(n),i=this.localCache[n];r!==i&&e(n,i,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,u)=>{this.notifyListeners(o,u)});return}let r=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},s=this.storage.getItem(r);Oo()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,aa):i()}notifyListeners(e,n){this.localCache[e]=n;let r=this.listeners[e];if(r)for(let i of Array.from(r))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},oa)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){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(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};ft.type="LOCAL";var Ii=ft;var ca=1e3;function an(t){let e=t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),n=RegExp(`${e}=([^;]+)`);return document.cookie.match(n)?.[1]??null}function cn(t){return`${window.location.protocol==="http:"?"__dev_":"__HOST-"}FIREBASE_${t.split(":")[3]}`}var vn=class{constructor(){this.type="COOKIE",this.listenerUnsubscribes=new Map}_getFinalTarget(e){if(typeof window===void 0)return e;let n=new URL(`${window.location.origin}/__cookies__`);return n.searchParams.set("finalTarget",e),n}async _isAvailable(){return typeof isSecureContext=="boolean"&&!isSecureContext||typeof navigator>"u"||typeof document>"u"?!1:navigator.cookieEnabled??!0}async _set(e,n){}async _get(e){if(!this._isAvailable())return null;let n=cn(e);return window.cookieStore?(await window.cookieStore.get(n))?.value:an(n)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let r=cn(e);document.cookie=`${r}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`,await fetch("/__cookies__",{method:"DELETE"}).catch(()=>{})}_addListener(e,n){if(!this._isAvailable())return;let r=cn(e);if(window.cookieStore){let a=(c=>{let h=c.changed.find(d=>d.name===r);h&&n(h.value),c.deleted.find(d=>d.name===r)&&n(null)}),u=()=>window.cookieStore.removeEventListener("change",a);return this.listenerUnsubscribes.set(n,u),window.cookieStore.addEventListener("change",a)}let i=an(r),s=setInterval(()=>{let a=an(r);a!==i&&(n(a),i=a)},ca),o=()=>clearInterval(s);this.listenerUnsubscribes.set(n,o)}_removeListener(e,n){let r=this.listenerUnsubscribes.get(n);r&&(r(),this.listenerUnsubscribes.delete(n))}};vn.type="COOKIE";var pt=class extends ht{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};pt.type="SESSION";var Ln=pt;function ua(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}var _t=class t{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let r=new t(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:r,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!o?.size)return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});let a=Array.from(o).map(async c=>c(n.origin,s)),u=await ua(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:u})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};_t.receivers=[];function Mn(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}var wn=class{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,n,r=50){let i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,o;return new Promise((a,u)=>{let c=Mn("",20);i.port1.start();let h=setTimeout(()=>{u(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(l){let d=l;if(d.data.eventId===c)switch(d.data.status){case"ack":clearTimeout(h),s=setTimeout(()=>{u(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(d.data.response);break;default:clearTimeout(h),clearTimeout(s),u(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:c,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};function F(){return window}function la(t){F().location.href=t}function Ei(){return typeof F().WorkerGlobalScope<"u"&&typeof F().importScripts=="function"}async function da(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function ha(){return navigator?.serviceWorker?.controller||null}function fa(){return Ei()?self:null}var yi="firebaseLocalStorageDb",pa=1,mt="firebaseLocalStorage",vi="fbase_key",re=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};function kt(t,e){return t.transaction([mt],e?"readwrite":"readonly").objectStore(mt)}function _a(){let t=indexedDB.deleteDatabase(yi);return new re(t).toPromise()}function Tn(){let t=indexedDB.open(yi,pa);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{let r=t.result;try{r.createObjectStore(mt,{keyPath:vi})}catch(i){n(i)}}),t.addEventListener("success",async()=>{let r=t.result;r.objectStoreNames.contains(mt)?e(r):(r.close(),await _a(),e(await Tn()))})})}async function xr(t,e,n){let r=kt(t,!0).put({[vi]:e,value:n});return new re(r).toPromise()}async function ma(t,e){let n=kt(t,!1).get(e),r=await new re(n).toPromise();return r===void 0?null:r.value}function Fr(t,e){let n=kt(t,!0).delete(e);return new re(n).toPromise()}var ga=800,Ia=3,gt=class{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 Tn(),this.db)}async _withRetries(e){let n=0;for(;;)try{let r=await this._openDb();return await e(r)}catch(r){if(n++>Ia)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Ei()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=_t._getInstance(fa()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await da(),!this.activeServiceWorker)return;this.sender=new wn(this.activeServiceWorker);let 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||ha()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await Tn();return await xr(e,dt,"1"),await Fr(e,dt),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>xr(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(r=>ma(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Fr(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=kt(i,!1).getAll();return new re(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],r=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let r=this.listeners[e];if(r)for(let i of Array.from(r))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),ga)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};gt.type="LOCAL";var wi=gt;function Vr(t,e){return k(t,"POST","/v2/accounts/mfaSignIn:start",b(t,e))}function Ea(t,e){return k(t,"POST","/v2/accounts/mfaSignIn:finalize",b(t,e))}function ya(t,e){return k(t,"POST","/v2/accounts/mfaSignIn:finalize",b(t,e))}var tu=di("rcb"),nu=new Q(3e4,6e4);var Qe="recaptcha";async function va(t,e,n){if(!t._getRecaptchaConfig())try{await Vo(t)}catch{console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let r;if(typeof e=="string"?r={phoneNumber:e}:r=e,"session"in r){let i=r.session;if("phoneNumber"in r){p(i.type==="enroll",t,"internal-error");let s={idToken:i.credential,phoneEnrollmentInfo:{phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await Ce(t,s,"mfaSmsEnrollment",async(c,h)=>{if(h.phoneEnrollmentInfo.captchaResponse===ke){p(n?.type===Qe,c,"argument-error");let l=await un(c,h,n);return Ur(c,l)}return Ur(c,h)},"PHONE_PROVIDER").catch(c=>Promise.reject(c))).phoneSessionInfo.sessionInfo}else{p(i.type==="signin",t,"internal-error");let s=r.multiFactorHint?.uid||r.multiFactorUid;p(s,t,"missing-multi-factor-info");let o={mfaPendingCredential:i.credential,mfaEnrollmentId:s,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await Ce(t,o,"mfaSmsSignIn",async(h,l)=>{if(l.phoneSignInInfo.captchaResponse===ke){p(n?.type===Qe,h,"argument-error");let d=await un(h,l,n);return Vr(h,d)}return Vr(h,l)},"PHONE_PROVIDER").catch(h=>Promise.reject(h))).phoneResponseInfo.sessionInfo}}else{let i={phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await Ce(t,i,"sendVerificationCode",async(u,c)=>{if(c.captchaResponse===ke){p(n?.type===Qe,u,"argument-error");let h=await un(u,c,n);return Lr(u,h)}return Lr(u,c)},"PHONE_PROVIDER").catch(u=>Promise.reject(u))).sessionInfo}}finally{n?._reset()}}async function un(t,e,n){p(n.type===Qe,t,"argument-error");let r=await n.verify();p(typeof r=="string",t,"argument-error");let i={...e};if("phoneEnrollmentInfo"in i){let s=i.phoneEnrollmentInfo.phoneNumber,o=i.phoneEnrollmentInfo.captchaResponse,a=i.phoneEnrollmentInfo.clientType,u=i.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(i,{phoneEnrollmentInfo:{phoneNumber:s,recaptchaToken:r,captchaResponse:o,clientType:a,recaptchaVersion:u}}),i}else if("phoneSignInInfo"in i){let s=i.phoneSignInInfo.captchaResponse,o=i.phoneSignInInfo.clientType,a=i.phoneSignInInfo.recaptchaVersion;return Object.assign(i,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:s,clientType:o,recaptchaVersion:a}}),i}else return Object.assign(i,{recaptchaToken:r}),i}var Fe=class t{constructor(e){this.providerId=t.PROVIDER_ID,this.auth=se(e)}verifyPhoneNumber(e,n){return va(this.auth,e,j(n))}static credential(e,n){return Oe._fromVerification(e,n)}static credentialFromResult(e){let n=e;return t.credentialFromTaggedObject(n)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:r}=e;return n&&r?Oe._fromTokenResponse(n,r):null}};Fe.PROVIDER_ID="phone";Fe.PHONE_SIGN_IN_METHOD="phone";function Ti(t,e){return e?W(e):(p(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}var Ve=class extends Z{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return pe(e,this._buildIdpRequest())}_linkToIdToken(e,n){return pe(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return pe(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={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&&(n.idToken=e),n}};function wa(t){return na(t.auth,new Ve(t),t.bypassAuthState)}function Ta(t){let{auth:e,user:n}=t;return p(n,e,"internal-error"),ta(n,new Ve(t),t.bypassAuthState)}async function ba(t){let{auth:e,user:n}=t;return p(n,e,"internal-error"),ea(n,new Ve(t),t.bypassAuthState)}var It=class{constructor(e,n,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:r,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}let u={auth:this.auth,requestUri:n,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(u))}catch(c){this.reject(c)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return wa;case"linkViaPopup":case"linkViaRedirect":return ba;case"reauthViaPopup":case"reauthViaRedirect":return Ta;default:R(this.auth,"internal-error")}}resolve(e){B(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){B(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()}};var Aa=new Q(2e3,1e4);async function Un(t,e,n){if(N(t.app))return Promise.reject(O(t,"operation-not-supported-in-this-environment"));let r=se(t);Io(t,e,De);let i=Ti(r,n);return new Et(r,"signInViaPopup",e,i).executeNotNull()}var Et=class t extends It{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,t.currentPopupAction&&t.currentPopupAction.cancel(),t.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){B(this.filter.length===1,"Popup operations only handle one event");let e=Mn();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(O(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(O(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,t.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(O(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,Aa.get())};e()}};Et.currentPopupAction=null;var Sa="pendingRedirect",Ze=new Map,bn=class extends It{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=Ze.get(this.auth._key());if(!e){try{let r=await ka(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}Ze.set(this.auth._key(),e)}return this.bypassAuthState||Ze.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function ka(t,e){let n=Pa(e),r=Ra(t);if(!await r._isAvailable())return!1;let i=await r._get(n)==="true";return await r._remove(n),i}function Ca(t,e){Ze.set(t._key(),e)}function Ra(t){return W(t._redirectPersistence)}function Pa(t){return Xe(Sa,t.config.apiKey,t.name)}async function Na(t,e,n=!1){if(N(t.app))return Promise.reject(X(t));let r=se(t),i=Ti(r,e),o=await new bn(r,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}var Oa=600*1e3,An=class{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 n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!Da(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){if(e.error&&!bi(e)){let r=e.error.code?.split("auth/")[1]||"internal-error";n.onError(O(this.auth,r))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=Oa&&this.cachedEventUids.clear(),this.cachedEventUids.has(Hr(e))}saveEventToCache(e){this.cachedEventUids.add(Hr(e)),this.lastProcessedEventTime=Date.now()}};function Hr(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function bi({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function Da(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return bi(t);default:return!1}}async function La(t,e={}){return k(t,"GET","/v1/projects",e)}var Ma=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ua=/^https?/;async function xa(t){if(t.config.emulator)return;let{authorizedDomains:e}=await La(t);for(let n of e)try{if(Fa(n))return}catch{}R(t,"unauthorized-domain")}function Fa(t){let e=dn(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){let o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!Ua.test(n))return!1;if(Ma.test(t))return r===t;let i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}var Va=new Q(3e4,6e4);function Wr(){let t=F().___jsl;if(t?.H){for(let e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n<t.CP.length;n++)t.CP[n]=null}}function Ha(t){return new Promise((e,n)=>{function r(){Wr(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Wr(),n(O(t,"network-request-failed"))},timeout:Va.get()})}if(F().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(F().gapi?.load)r();else{let i=di("iframefcb");return F()[i]=()=>{gapi.load?r():n(O(t,"network-request-failed"))},li(`${xo()}?onload=${i}`).catch(s=>n(s))}}).catch(e=>{throw et=null,e})}var et=null;function Wa(t){return et=et||Ha(t),et}var Ba=new Q(5e3,15e3),$a="__/auth/iframe",za="emulator/auth/iframe",ja={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},qa=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Ga(t){let e=t.config;p(e.authDomain,t,"auth-domain-config-required");let n=e.emulator?Nn(e,za):`https://${t.config.authDomain}/${$a}`,r={apiKey:e.apiKey,appName:t.name,v:fe},i=qa.get(t.config.apiHost);i&&(r.eid=i);let s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${ce(r).slice(1)}`}async function Ka(t){let e=await Wa(t),n=F().gapi;return p(n,t,"internal-error"),e.open({where:document.body,url:Ga(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:ja,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});let o=O(t,"network-request-failed"),a=F().setTimeout(()=>{s(o)},Ba.get());function u(){F().clearTimeout(a),i(r)}r.ping(u).then(u,()=>{s(o)})}))}var Ja={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Ya=500,Xa=600,Qa="_blank",Za="http://localhost",yt=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function ec(t,e,n,r=Ya,i=Xa){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString(),a="",u={...Ja,width:r.toString(),height:i.toString(),top:s,left:o},c=S().toLowerCase();n&&(a=ri(c)?Qa:n),ti(c)&&(e=e||Za,u.scrollbars="yes");let h=Object.entries(u).reduce((d,[f,g])=>`${d}${f}=${g},`,"");if(No(c)&&a!=="_self")return tc(e||"",a),new yt(null);let l=window.open(e||"",a,h);p(l,t,"popup-blocked");try{l.focus()}catch{}return new yt(l)}function tc(t,e){let n=document.createElement("a");n.href=t,n.target=e;let r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}var nc="__/auth/handler",rc="emulator/auth/handler",ic=encodeURIComponent("fac");async function Br(t,e,n,r,i,s){p(t.config.authDomain,t,"auth-domain-config-required"),p(t.config.apiKey,t,"invalid-api-key");let o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:fe,eventId:i};if(e instanceof De){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",dr(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[h,l]of Object.entries(s||{}))o[h]=l}if(e instanceof te){let h=e.getScopes().filter(l=>l!=="");h.length>0&&(o.scopes=h.join(","))}t.tenantId&&(o.tid=t.tenantId);let a=o;for(let h of Object.keys(a))a[h]===void 0&&delete a[h];let u=await t._getAppCheckToken(),c=u?`#${ic}=${encodeURIComponent(u)}`:"";return`${sc(t)}?${ce(a).slice(1)}${c}`}function sc({config:t}){return t.emulator?Nn(t,rc):`https://${t.authDomain}/${nc}`}var ln="webStorageSupport",Sn=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Ln,this._completeRedirectFn=Na,this._overrideRedirectResult=Ca}async _openPopup(e,n,r,i){B(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");let s=await Br(e,n,r,dn(),i);return ec(e,s,Mn())}async _openRedirect(e,n,r,i){await this._originValidation(e);let s=await Br(e,n,r,dn(),i);return la(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(B(s,"If manager is not set, promise should be"),s)}let r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){let n=await Ka(e),r=new An(e);return n.register("authEvent",i=>(p(i?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(ln,{type:ln},i=>{let s=i?.[0]?.[ln];s!==void 0&&n(!!s),R(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=xa(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return ci()||ni()||Dn()}},Ai=Sn,vt=class{constructor(e){this.factorId=e}_process(e,n,r){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,r);case"signin":return this._finalizeSignIn(e,n.credential);default:return x("unexpected MultiFactorSessionType")}}},kn=class t extends vt{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new t(e)}_finalizeEnroll(e,n,r){return ra(e,{idToken:n,displayName:r,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return Ea(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},wt=class{constructor(){}static assertion(e){return kn._fromCredential(e)}};wt.FACTOR_ID="phone";var Tt=class{static assertionForEnrollment(e,n){return bt._fromSecret(e,n)}static assertionForSignIn(e,n){return bt._fromEnrollmentId(e,n)}static async generateSecret(e){let n=e;p(typeof n.user?.auth<"u","internal-error");let r=await ia(n.user.auth,{idToken:n.credential,totpEnrollmentInfo:{}});return At._fromStartTotpMfaEnrollmentResponse(r,n.user.auth)}};Tt.FACTOR_ID="totp";var bt=class t extends vt{constructor(e,n,r){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=r}static _fromSecret(e,n){return new t(n,void 0,e)}static _fromEnrollmentId(e,n){return new t(n,e)}async _finalizeEnroll(e,n,r){return p(typeof this.secret<"u",e,"argument-error"),sa(e,{idToken:n,displayName:r,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){p(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let r={verificationCode:this.otp};return ya(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:r})}},At=class t{constructor(e,n,r,i,s,o,a){this.sessionInfo=o,this.auth=a,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=r,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new t(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){let r=!1;return(Je(e)||Je(n))&&(r=!0),r&&(Je(e)&&(e=this.auth.currentUser?.email||"unknownuser"),Je(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Je(t){return typeof t>"u"||t?.length===0}var $r="@firebase/auth",zr="1.11.0";var Cn=class{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;let n=this.auth.onIdTokenChanged(r=>{e(r?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function oc(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function ac(t){he(new M("auth",(e,{options:n})=>{let r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});let u={apiKey:o,authDomain:a,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ui(t)},c=new gn(r,i,s,u);return Ho(c,n),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),he(new M("auth-internal",e=>{let n=se(e.getProvider("auth").getImmediate());return(r=>new Cn(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),G($r,zr,oc(t)),G($r,zr,"esm2020")}var cc=300,uc=Bt("authIdTokenMaxAge")||cc,jr=null,lc=t=>async e=>{let n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>uc)return;let i=n?.token;jr!==i&&(jr=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function xn(t=Ar()){let e=rn(t,"auth");if(e.isInitialized())return e.getImmediate();let n=hi(t,{popupRedirectResolver:Ai,persistence:[wi,Ii,Ln]}),r=Bt("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(r,location.origin);if(location.origin===s.origin){let o=lc(s.toString());gi(n,o,()=>o(n.currentUser)),mi(n,a=>o(a))}}let i=tr("auth");return i&&fi(n,`http://${i}`),n}function dc(){return document.getElementsByTagName("head")?.[0]??document}Mo({loadJS(t){return new Promise((e,n)=>{let r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{let s=O("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",dc().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="});ac("Browser");var Ot,I,Pi,hc,oe,Si,Ni,Oi,Di,Wn,Fn,Vn,fc,He={},Li=[],pc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Dt=Array.isArray;function $(t,e){for(var n in e)t[n]=e[n];return t}function Bn(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function _c(t,e,n){var r,i,s,o={};for(s in e)s=="key"?r=e[s]:s=="ref"?i=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?Ot.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return Rt(t,o,r,i,null)}function Rt(t,e,n,r,i){var s={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Pi,__i:-1,__u:0};return i==null&&I.vnode!=null&&I.vnode(s),s}function ge(t){return t.children}function Pt(t,e){this.props=t,this.context=e}function me(t,e){if(e==null)return t.__?me(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?me(t):null}function Mi(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return Mi(t)}}function ki(t){(!t.__d&&(t.__d=!0)&&oe.push(t)&&!Nt.__r++||Si!=I.debounceRendering)&&((Si=I.debounceRendering)||Ni)(Nt)}function Nt(){for(var t,e,n,r,i,s,o,a=1;oe.length;)oe.length>a&&oe.sort(Oi),t=oe.shift(),a=oe.length,t.__d&&(n=void 0,i=(r=(e=t).__v).__e,s=[],o=[],e.__P&&((n=$({},r)).__v=r.__v+1,I.vnode&&I.vnode(n),$n(e.__P,n,r,e.__n,e.__P.namespaceURI,32&r.__u?[i]:null,s,i??me(r),!!(32&r.__u),o),n.__v=r.__v,n.__.__k[n.__i]=n,Fi(s,n,o),n.__e!=i&&Mi(n)));Nt.__r=0}function Ui(t,e,n,r,i,s,o,a,u,c,h){var l,d,f,g,A,y,_,m=r&&r.__k||Li,C=e.length;for(u=mc(n,e,m,u,C),l=0;l<C;l++)(f=n.__k[l])!=null&&(d=f.__i==-1?He:m[f.__i]||He,f.__i=l,y=$n(t,f,d,i,s,o,a,u,c,h),g=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&zn(d.ref,null,f),h.push(f.ref,f.__c||g,f)),A==null&&g!=null&&(A=g),(_=!!(4&f.__u))||d.__k===f.__k?u=xi(f,u,t,_):typeof f.type=="function"&&y!==void 0?u=y:g&&(u=g.nextSibling),f.__u&=-7);return n.__e=A,u}function mc(t,e,n,r,i){var s,o,a,u,c,h=n.length,l=h,d=0;for(t.__k=new Array(i),s=0;s<i;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(u=s+d,(o=t.__k[s]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Rt(null,o,null,null,null):Dt(o)?Rt(ge,{children:o},null,null,null):o.constructor==null&&o.__b>0?Rt(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,a=null,(c=o.__i=gc(o,n,u,l))!=-1&&(l--,(a=n[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(i>h?d--:i<h&&d++),typeof o.type!="function"&&(o.__u|=4)):c!=u&&(c==u-1?d--:c==u+1?d++:(c>u?d--:d++,o.__u|=4))):t.__k[s]=null;if(l)for(s=0;s<h;s++)(a=n[s])!=null&&(2&a.__u)==0&&(a.__e==r&&(r=me(a)),Hi(a,a));return r}function xi(t,e,n,r){var i,s;if(typeof t.type=="function"){for(i=t.__k,s=0;i&&s<i.length;s++)i[s]&&(i[s].__=t,e=xi(i[s],e,n,r));return e}t.__e!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=me(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function gc(t,e,n,r){var i,s,o,a=t.key,u=t.type,c=e[n],h=c!=null&&(2&c.__u)==0;if(c===null&&t.key==null||h&&a==c.key&&u==c.type)return n;if(r>(h?1:0)){for(i=n-1,s=n+1;i>=0||s<e.length;)if((c=e[o=i>=0?i--:s++])!=null&&(2&c.__u)==0&&a==c.key&&u==c.type)return o}return-1}function Ci(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||pc.test(e)?n:n+"px"}function Ct(t,e,n,r,i){var s,o;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||Ci(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||Ci(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Di,"$1")),o=e.toLowerCase(),e=o in t||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=n,n?r?n.u=r.u:(n.u=Wn,t.addEventListener(e,s?Vn:Fn,s)):t.removeEventListener(e,s?Vn:Fn,s);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function Ri(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e.t==null)e.t=Wn++;else if(e.t<n.u)return;return n(I.event?I.event(e):e)}}}function $n(t,e,n,r,i,s,o,a,u,c){var h,l,d,f,g,A,y,_,m,C,D,Be,Ie,Jn,$e,Ee,Mt,L=e.type;if(e.constructor!=null)return null;128&n.__u&&(u=!!(32&n.__u),s=[a=e.__e=n.__e]),(h=I.__b)&&h(e);e:if(typeof L=="function")try{if(_=e.props,m="prototype"in L&&L.prototype.render,C=(h=L.contextType)&&r[h.__c],D=h?C?C.props.value:h.__:r,n.__c?y=(l=e.__c=n.__c).__=l.__E:(m?e.__c=l=new L(_,D):(e.__c=l=new Pt(_,D),l.constructor=L,l.render=Ec),C&&C.sub(l),l.props=_,l.state||(l.state={}),l.context=D,l.__n=r,d=l.__d=!0,l.__h=[],l._sb=[]),m&&l.__s==null&&(l.__s=l.state),m&&L.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=$({},l.__s)),$(l.__s,L.getDerivedStateFromProps(_,l.__s))),f=l.props,g=l.state,l.__v=e,d)m&&L.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),m&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(m&&L.getDerivedStateFromProps==null&&_!==f&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(_,D),!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(_,l.__s,D)===!1||e.__v==n.__v){for(e.__v!=n.__v&&(l.props=_,l.state=l.__s,l.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(ae){ae&&(ae.__=e)}),Be=0;Be<l._sb.length;Be++)l.__h.push(l._sb[Be]);l._sb=[],l.__h.length&&o.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(_,l.__s,D),m&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(f,g,A)})}if(l.context=D,l.props=_,l.__P=t,l.__e=!1,Ie=I.__r,Jn=0,m){for(l.state=l.__s,l.__d=!1,Ie&&Ie(e),h=l.render(l.props,l.state,l.context),$e=0;$e<l._sb.length;$e++)l.__h.push(l._sb[$e]);l._sb=[]}else do l.__d=!1,Ie&&Ie(e),h=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++Jn<25);l.state=l.__s,l.getChildContext!=null&&(r=$($({},r),l.getChildContext())),m&&!d&&l.getSnapshotBeforeUpdate!=null&&(A=l.getSnapshotBeforeUpdate(f,g)),Ee=h,h!=null&&h.type===ge&&h.key==null&&(Ee=Vi(h.props.children)),a=Ui(t,Dt(Ee)?Ee:[Ee],e,n,r,i,s,o,a,u,c),l.base=e.__e,e.__u&=-161,l.__h.length&&o.push(l),y&&(l.__E=l.__=null)}catch(ae){if(e.__v=null,u||s!=null)if(ae.then){for(e.__u|=u?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s[s.indexOf(a)]=null,e.__e=a}else{for(Mt=s.length;Mt--;)Bn(s[Mt]);Hn(e)}else e.__e=n.__e,e.__k=n.__k,ae.then||Hn(e);I.__e(ae,e,n)}else s==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):a=e.__e=Ic(n.__e,e,n,r,i,s,o,u,c);return(h=I.diffed)&&h(e),128&e.__u?void 0:a}function Hn(t){t&&t.__c&&(t.__c.__e=!0),t&&t.__k&&t.__k.forEach(Hn)}function Fi(t,e,n){for(var r=0;r<n.length;r++)zn(n[r],n[++r],n[++r]);I.__c&&I.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(s){s.call(i)})}catch(s){I.__e(s,i.__v)}})}function Vi(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:Dt(t)?t.map(Vi):$({},t)}function Ic(t,e,n,r,i,s,o,a,u){var c,h,l,d,f,g,A,y=n.props,_=e.props,m=e.type;if(m=="svg"?i="http://www.w3.org/2000/svg":m=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(c=0;c<s.length;c++)if((f=s[c])&&"setAttribute"in f==!!m&&(m?f.localName==m:f.nodeType==3)){t=f,s[c]=null;break}}if(t==null){if(m==null)return document.createTextNode(_);t=document.createElementNS(i,m,_.is&&_),a&&(I.__m&&I.__m(e,s),a=!1),s=null}if(m==null)y===_||a&&t.data==_||(t.data=_);else{if(s=s&&Ot.call(t.childNodes),y=n.props||He,!a&&s!=null)for(y={},c=0;c<t.attributes.length;c++)y[(f=t.attributes[c]).name]=f.value;for(c in y)if(f=y[c],c!="children"){if(c=="dangerouslySetInnerHTML")l=f;else if(!(c in _)){if(c=="value"&&"defaultValue"in _||c=="checked"&&"defaultChecked"in _)continue;Ct(t,c,null,f,i)}}for(c in _)f=_[c],c=="children"?d=f:c=="dangerouslySetInnerHTML"?h=f:c=="value"?g=f:c=="checked"?A=f:a&&typeof f!="function"||y[c]===f||Ct(t,c,f,y[c],i);if(h)a||l&&(h.__html==l.__html||h.__html==t.innerHTML)||(t.innerHTML=h.__html),e.__k=[];else if(l&&(t.innerHTML=""),Ui(e.type=="template"?t.content:t,Dt(d)?d:[d],e,n,r,m=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:n.__k&&me(n,0),a,u),s!=null)for(c=s.length;c--;)Bn(s[c]);a||(c="value",m=="progress"&&g==null?t.removeAttribute("value"):g!=null&&(g!==t[c]||m=="progress"&&!g||m=="option"&&g!=y[c])&&Ct(t,c,g,y[c],i),c="checked",A!=null&&A!=t[c]&&Ct(t,c,A,y[c],i))}return t}function zn(t,e,n){try{if(typeof t=="function"){var r=typeof t.__u=="function";r&&t.__u(),r&&e==null||(t.__u=t(e))}else t.current=e}catch(i){I.__e(i,n)}}function Hi(t,e,n){var r,i;if(I.unmount&&I.unmount(t),(r=t.ref)&&(r.current&&r.current!=t.__e||zn(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){I.__e(s,e)}r.base=r.__P=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&Hi(r[i],e,n||typeof t.type!="function");n||Bn(t.__e),t.__c=t.__=t.__e=void 0}function Ec(t,e,n){return this.constructor(t,n)}function Wi(t,e,n){var r,i,s,o;e==document&&(e=document.documentElement),I.__&&I.__(t,e),i=(r=typeof n=="function")?null:n&&n.__k||e.__k,s=[],o=[],$n(e,t=(!r&&n||e).__k=_c(ge,null,[t]),i||He,He,e.namespaceURI,!r&&n?[n]:i?null:e.firstChild?Ot.call(e.childNodes):null,s,!r&&n?n:i?i.__e:e.firstChild,r,o),Fi(s,t,o)}Ot=Li.slice,I={__e:function(t,e,n,r){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,r||{}),o=i.__d),o)return i.__E=i}catch(a){t=a}throw t}},Pi=0,hc=function(t){return t!=null&&t.constructor==null},Pt.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$({},this.state),typeof t=="function"&&(t=t($({},n),this.props)),t&&$(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),ki(this))},Pt.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ki(this))},Pt.prototype.render=ge,oe=[],Ni=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Oi=function(t,e){return t.__v.__b-e.__v.__b},Nt.__r=0,Di=/(PointerCapture)$|Capture$/i,Wn=0,Fn=Ri(!1),Vn=Ri(!0),fc=0;var qn,w,jn,Bi,Gn=0,Yi=[],T=I,$i=T.__b,zi=T.__r,ji=T.diffed,qi=T.__c,Gi=T.unmount,Ki=T.__;function yc(t,e){T.__h&&T.__h(w,t,Gn||e),Gn=0;var n=w.__H||(w.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function Xi(t){return Gn=1,vc(Qi,t)}function vc(t,e,n){var r=yc(qn++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):Qi(void 0,e),function(a){var u=r.__N?r.__N[0]:r.__[0],c=r.t(u,a);u!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=w,!w.__f)){var i=function(a,u,c){if(!r.__c.__H)return!0;var h=r.__c.__H.__.filter(function(d){return!!d.__c});if(h.every(function(d){return!d.__N}))return!s||s.call(this,a,u,c);var l=r.__c.props!==a;return h.forEach(function(d){if(d.__N){var f=d.__[0];d.__=d.__N,d.__N=void 0,f!==d.__[0]&&(l=!0)}}),s&&s.call(this,a,u,c)||l};w.__f=!0;var s=w.shouldComponentUpdate,o=w.componentWillUpdate;w.componentWillUpdate=function(a,u,c){if(this.__e){var h=s;s=void 0,i(a,u,c),s=h}o&&o.call(this,a,u,c)},w.shouldComponentUpdate=i}return r.__N||r.__}function wc(){for(var t;t=Yi.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Lt),t.__H.__h.forEach(Kn),t.__H.__h=[]}catch(e){t.__H.__h=[],T.__e(e,t.__v)}}T.__b=function(t){w=null,$i&&$i(t)},T.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Ki&&Ki(t,e)},T.__r=function(t){zi&&zi(t),qn=0;var e=(w=t.__c).__H;e&&(jn===w?(e.__h=[],w.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.forEach(Lt),e.__h.forEach(Kn),e.__h=[],qn=0)),jn=w},T.diffed=function(t){ji&&ji(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Yi.push(e)!==1&&Bi===T.requestAnimationFrame||((Bi=T.requestAnimationFrame)||Tc)(wc)),e.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),jn=w=null},T.__c=function(t,e){e.some(function(n){try{n.__h.forEach(Lt),n.__h=n.__h.filter(function(r){return!r.__||Kn(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],T.__e(r,n.__v)}}),qi&&qi(t,e)},T.unmount=function(t){Gi&&Gi(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Lt(r)}catch(i){e=i}}),n.__H=void 0,e&&T.__e(e,n.__v))};var Ji=typeof requestAnimationFrame=="function";function Tc(t){var e,n=function(){clearTimeout(r),Ji&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);Ji&&(e=requestAnimationFrame(n))}function Lt(t){var e=w,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),w=e}function Kn(t){var e=w;t.__c=t.__(),w=e}function Qi(t,e){return typeof e=="function"?e(t):e}var bc=0,Tl=Array.isArray;function v(t,e,n,r,i,s){e||(e={});var o,a,u=e;if("ref"in u)for(a in u={},e)a=="ref"?o=e[a]:u[a]=e[a];var c={type:t,props:u,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--bc,__i:-1,__u:0,__source:i,__self:s};if(typeof t=="function"&&(o=t.defaultProps))for(a in o)u[a]===void 0&&(u[a]=o[a]);return I.vnode&&I.vnode(c),c}function We(){let[t,e]=Xi(""),n=window.__ROOT_CTX.name,r=window.__ROOT_CTX.warning;function i(s){e(s)}return v("div",{className:"signin",children:[v("div",{className:"signin__headline",children:[n&&v("h1",{className:"signin__headline__title",children:n}),v("p",{className:"signin__headline__body",children:n?`Sign in to continue to ${n}`:"Sign in to continue"})]}),r&&v("div",{className:"signin__warning",children:r}),v(We.Button,{onError:i}),t&&v("p",{className:"signin__error",children:t})]})}We.Button=t=>{async function e(r){try{return await r.json()}catch(i){console.error(i)}return{}}async function n(){let r=new ne;r.addScope("profile"),r.addScope("email");let s=(await Un(window.firebase.auth,r)).user,o=await s.getIdToken(),a=await fetch("/cms/login",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({idToken:o})}),u=await e(a);if(a.status===401){let c=s?.email||"(no email)";u.reason?t.onError(`Login failed for: ${c}. Reason: ${u.reason}. If you believe this is a mistake, please contact a developer to help resolve the issue.`):t.onError(`Login failed for: ${c}. If you believe this is a mistake, please contact a developer to help resolve the issue.`);return}if(a.status!==200){console.error("login failed"),console.log(a.status,u),t.onError("An unknown error has occurred.");return}if(!u.success){console.error("login failed"),console.log(a.status,u),u.reason?t.onError(`Login failed. Reason: ${u.reason}`):t.onError("Login failed.");return}Ac()}return v("button",{className:"signin__button",onClick:n,children:[v("div",{className:"signin__button__icon",children:v(We.GLogo,{})}),v("div",{className:"signin__button__label",children:"Sign in with Google"})]})};We.GLogo=()=>v("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48",children:v("g",{children:[v("path",{fill:"#EA4335",d:"M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"}),v("path",{fill:"#4285F4",d:"M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"}),v("path",{fill:"#FBBC05",d:"M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"}),v("path",{fill:"#34A853",d:"M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"}),v("path",{fill:"none",d:"M0 0h48v48H0z"})]})});function Ac(){let e=new URLSearchParams(window.location.search).get("continue");(!e||!e.startsWith("/")||e.startsWith("/cms/login"))&&(e="/cms"),window.location.replace(e)}var Zi=sn(window.__ROOT_CTX.firebaseConfig),Sc=xn(Zi);window.firebase={app:Zi,auth:Sc};var es=document.getElementById("root");es.innerHTML="";Wi(v(We,{}),es);})();