ozmoz 0.1.45 → 0.1.48
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/README.md +59 -163
- package/dist/cli.cjs +47 -47
- package/dist/index.js +1 -1
- package/dist/ozmoz-mcp.js +14 -14
- package/dist/ozmoz.iife.js +1 -1
- package/package.json +2 -1
- package/scripts/setup-lib.cjs +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Aa=Object.defineProperty;var B=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var bi=(t,e)=>{for(var n in e)Aa(t,n,{get:e[n],enumerable:!0})};var Ei,wi=B(()=>{Ei=()=>{}});function Pa(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}function O(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function ki(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(O())}function Pi(){return typeof window<"u"||Fn()}function Fn(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Ri(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Ci(){let t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function Oi(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Ni(){let t=O();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function Di(){try{return typeof indexedDB=="object"}catch{return!1}}function Li(){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)}})}function Da(t,e){return t.replace(La,(n,r)=>{let i=e[r];return i!=null?String(i):`<${r}?>`})}function Mi(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function he(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],a=e[i];if(Ti(s)&&Ti(a)){if(!he(s,a))return!1}else if(s!==a)return!1}for(let i of r)if(!n.includes(i))return!1;return!0}function Ti(t){return t!==null&&typeof t=="object"}function be(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 Le(t){let e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){let[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Me(t){let e=t.indexOf("?");if(!e)return"";let n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function Ui(t,e){let n=new Dn(t,e);return n.subscribe.bind(n)}function Ma(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 On(){}function p(t){return t&&t._delegate?t._delegate:t}function St(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Fi(t){return(await fetch(t,{credentials:"include"})).ok}var vi,Sa,Ai,Nn,ka,Ln,Xe,Ra,Ca,Oa,Mn,Si,At,Un,De,Na,H,Q,La,Dn,_d,Ue=B(()=>{wi();vi=function(t){let e=[],n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},Sa=function(t){let e=[],n=0,r=0;for(;n<t.length;){let i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){let s=t[n++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=t[n++],a=t[n++],c=t[n++],l=((i&7)<<18|(s&63)<<12|(a&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{let s=t[n++],a=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|a&63)}}return e.join("")},Ai={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<t.length;i+=3){let s=t[i],a=i+1<t.length,c=a?t[i+1]:0,l=i+2<t.length,o=l?t[i+2]:0,u=s>>2,f=(s&3)<<4|c>>4,h=(c&15)<<2|o>>6,m=o&63;l||(m=64,a||(h=64)),r.push(n[u],n[f],n[h],n[m])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(vi(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):Sa(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<t.length;){let s=n[t.charAt(i++)],c=i<t.length?n[t.charAt(i)]:0;++i;let o=i<t.length?n[t.charAt(i)]:64;++i;let f=i<t.length?n[t.charAt(i)]:64;if(++i,s==null||c==null||o==null||f==null)throw new Nn;let h=s<<2|c>>4;if(r.push(h),o!==64){let m=c<<4&240|o>>2;if(r.push(m),f!==64){let w=o<<6&192|f;r.push(w)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},Nn=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},ka=function(t){let e=vi(t);return Ai.encodeByteArray(e,!0)},Ln=function(t){return ka(t).replace(/\./g,"")},Xe=function(t){try{return Ai.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};Ra=()=>Pa().__FIREBASE_DEFAULTS__,Ca=()=>{if(typeof process>"u"||typeof process.env>"u")return;let t=process.env.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},Oa=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=t&&Xe(t[1]);return e&&JSON.parse(e)},Mn=()=>{try{return Ei()||Ra()||Ca()||Oa()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},Si=t=>Mn()?.emulatorHosts?.[t],At=()=>Mn()?.config,Un=t=>Mn()?.[`_${t}`];De=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}};Na="FirebaseError",H=class t extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=Na,Object.setPrototypeOf(this,t.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Q.prototype.create)}},Q=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],a=s?Da(s,r):"Error",c=`${this.serviceName}: ${a} (${i}).`;return new H(i,c,r)}};La=/\{\$([^}]+)}/g;Dn=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.");Ma(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=On),i.error===void 0&&(i.error=On),i.complete===void 0&&(i.complete=On);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}))}};_d=14400*1e3;});function Ua(t){return t===Ee?void 0:t}function Fa(t){return t.instantiationMode==="EAGER"}var q,Ee,xn,Qe,kt=B(()=>{Ue();q=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}};Ee="[DEFAULT]";xn=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 De;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(Fa(e))try{this.getOrInitializeService({instanceIdentifier:Ee})}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=Ee){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=Ee){return this.instances.has(e)}getOptions(e=Ee){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,a]of this.instancesDeferred.entries()){let c=this.normalizeInstanceIdentifier(s);r===c&&a.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:Ua(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=Ee){return this.component?this.component.multipleInstances?e:Ee:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};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 xn(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}});function Vi(t){Vn.forEach(e=>{e.setLogLevel(t)})}function Wi(t,e){for(let n of Vn){let r=null;e&&e.level&&(r=xi[e.level]),t===null?n.userLogHandler=null:n.userLogHandler=(i,s,...a)=>{let c=a.map(l=>{if(l==null)return null;if(typeof l=="string")return l;if(typeof l=="number"||typeof l=="boolean")return l.toString();if(l instanceof Error)return l.message;try{return JSON.stringify(l)}catch{return null}}).filter(l=>l).join(" ");s>=(r??i.logLevel)&&t({level:g[s].toLowerCase(),message:c,args:a,type:i.name})}}}var Vn,g,xi,xa,Va,Wa,Fe,Pt=B(()=>{Vn=[];(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"})(g||(g={}));xi={debug:g.DEBUG,verbose:g.VERBOSE,info:g.INFO,warn:g.WARN,error:g.ERROR,silent:g.SILENT},xa=g.INFO,Va={[g.DEBUG]:"log",[g.VERBOSE]:"log",[g.INFO]:"info",[g.WARN]:"warn",[g.ERROR]:"error"},Wa=(t,e,...n)=>{if(e<t.logLevel)return;let r=new Date().toISOString(),i=Va[e];if(i)console[i](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},Fe=class{constructor(e){this.name=e,this._logLevel=xa,this._logHandler=Wa,this._userLogHandler=null,Vn.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in g))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?xi[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,g.DEBUG,...e),this._logHandler(this,g.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,g.VERBOSE,...e),this._logHandler(this,g.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,g.INFO,...e),this._logHandler(this,g.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,g.WARN,...e),this._logHandler(this,g.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,g.ERROR,...e),this._logHandler(this,g.ERROR,...e)}}});function za(){return Hi||(Hi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Ba(){return zi||(zi=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}function $a(t){let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",a)},s=()=>{n(K(t.result)),i()},a=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",a)});return e.then(n=>{n instanceof IDBCursor&&Bi.set(n,t)}).catch(()=>{}),Bn.set(e,t),e}function ja(t){if(Hn.has(t))return;let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",a),t.removeEventListener("abort",a)},s=()=>{n(),i()},a=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",a),t.addEventListener("abort",a)});Hn.set(t,e)}function ji(t){zn=t(zn)}function Ga(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let r=t.call(Rt(this),e,...n);return $i.set(r,e.sort?e.sort():[e]),K(r)}:Ba().includes(t)?function(...e){return t.apply(Rt(this),e),K(Bi.get(this))}:function(...e){return K(t.apply(Rt(this),e))}}function qa(t){return typeof t=="function"?Ga(t):(t instanceof IDBTransaction&&ja(t),Ha(t,za())?new Proxy(t,zn):t)}function K(t){if(t instanceof IDBRequest)return $a(t);if(Wn.has(t))return Wn.get(t);let e=qa(t);return e!==t&&(Wn.set(t,e),Bn.set(e,t)),e}var Ha,Hi,zi,Bi,Hn,$i,Wn,Bn,zn,Rt,$n=B(()=>{Ha=(t,e)=>e.some(n=>t instanceof n);Bi=new WeakMap,Hn=new WeakMap,$i=new WeakMap,Wn=new WeakMap,Bn=new WeakMap;zn={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Hn.get(t);if(e==="objectStoreNames")return t.objectStoreNames||$i.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return K(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}};Rt=t=>Bn.get(t)});function qi(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){let a=indexedDB.open(t,e),c=K(a);return r&&a.addEventListener("upgradeneeded",l=>{r(K(a.result),l.oldVersion,l.newVersion,K(a.transaction),l)}),n&&a.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),c.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",o=>i(o.oldVersion,o.newVersion,o))}).catch(()=>{}),c}function Gi(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(jn.get(e))return jn.get(e);let n=e.replace(/FromIndex$/,""),r=e!==n,i=Ja.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||Ka.includes(n)))return;let s=async function(a,...c){let l=this.transaction(a,i?"readwrite":"readonly"),o=l.store;return r&&(o=o.index(c.shift())),(await Promise.all([o[n](...c),i&&l.done]))[0]};return jn.set(e,s),s}var Ka,Ja,jn,Ki=B(()=>{$n();$n();Ka=["get","getKey","getAll","getAllKeys","count"],Ja=["put","add","delete","clear"],jn=new Map;ji(t=>({...t,get:(e,n,r)=>Gi(e,n)||t.get(e,n,r),has:(e,n)=>!!Gi(e,n)||t.has(e,n)}))});function Ya(t){return t.getComponent()?.type==="VERSION"}function Jn(t,e){try{t.container.addComponent(e)}catch(n){ee.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Ac(t,e){t.container.addOrOverwriteComponent(e)}function we(t){let e=t.name;if(Ve.has(e))return ee.debug(`There were multiple attempts to register component ${e}.`),!1;Ve.set(e,t);for(let n of fe.values())Jn(n,t);for(let n of xe.values())Jn(n,t);return!0}function nt(t,e){let n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Sc(t,e,n=et){nt(t,e).clearInstance(n)}function Qn(t){return t.options!==void 0}function Qi(t){return Qn(t)?!1:"authIdToken"in t||"appCheckToken"in t||"releaseOnDeref"in t||"automaticDataCollectionEnabled"in t}function E(t){return t==null?!1:t.settings!==void 0}function kc(){Ve.clear()}function Ji(t,e){let n=Xe(t.split(".")[1]);if(n===null){console.error(`FirebaseServerApp ${e} is invalid: second part could not be parsed.`);return}if(JSON.parse(n).exp===void 0){console.error(`FirebaseServerApp ${e} is invalid: expiration claim could not be parsed`);return}let i=JSON.parse(n).exp*1e3,s=new Date().getTime();i-s<=0&&console.error(`FirebaseServerApp ${e} is invalid: the token has expired.`)}function es(t,e={}){let n=t;typeof e!="object"&&(e={name:e});let r={name:et,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw V.create("bad-app-name",{appName:String(i)});if(n||(n=At()),!n)throw V.create("no-options");let s=fe.get(i);if(s){if(he(n,s.options)&&he(r,s.config))return s;throw V.create("duplicate-app",{appName:i})}let a=new Qe(i);for(let l of Ve.values())a.addComponent(l);let c=new Ot(n,r,a);return fe.set(i,c),c}function Rc(t,e={}){if(Pi()&&!Fn())throw V.create("invalid-server-app-environment");let n,r=e||{};if(t&&(Qn(t)?n=t.options:Qi(t)?r=t:n=t),r.automaticDataCollectionEnabled===void 0&&(r.automaticDataCollectionEnabled=!0),n||(n=At()),!n)throw V.create("no-options");let i={...r,...n};i.releaseOnDeref!==void 0&&delete i.releaseOnDeref;let s=u=>[...u].reduce((f,h)=>Math.imul(31,f)+h.charCodeAt(0)|0,0);if(r.releaseOnDeref!==void 0&&typeof FinalizationRegistry>"u")throw V.create("finalization-registry-not-supported",{});let a=""+s(JSON.stringify(i)),c=xe.get(a);if(c)return c.incRefCount(r.releaseOnDeref),c;let l=new Qe(a);for(let u of Ve.values())l.addComponent(u);let o=new Yn(n,r,a,l);return xe.set(a,o),o}function er(t=et){let e=fe.get(t);if(!e&&t===et&&At())return es();if(!e)throw V.create("no-app",{appName:t});return e}function Cc(){return Array.from(fe.values())}async function ts(t){let e=!1,n=t.name;fe.has(n)?(e=!0,fe.delete(n)):xe.has(n)&&t.decRefCount()<=0&&(xe.delete(n),e=!0),e&&(await Promise.all(t.container.getProviders().map(r=>r.delete())),t.isDeleted=!0)}function J(t,e,n){let r=vc[t]??t;n&&(r+=`-${n}`);let i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){let a=[`Unable to register library "${r}" with version "${e}":`];i&&a.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&a.push("and"),s&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),ee.warn(a.join(" "));return}we(new q(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}function Oc(t,e){if(t!==null&&typeof t!="function")throw V.create("invalid-log-argument");Wi(t,e)}function Nc(t){Vi(t)}function ns(){return Gn||(Gn=qi(Dc,Lc,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(tt)}catch(n){console.warn(n)}}}}).catch(t=>{throw V.create("idb-open",{originalErrorMessage:t.message})})),Gn}async function Mc(t){try{let n=(await ns()).transaction(tt),r=await n.objectStore(tt).get(rs(t));return await n.done,r}catch(e){if(e instanceof H)ee.warn(e.message);else{let n=V.create("idb-get",{originalErrorMessage:e?.message});ee.warn(n.message)}}}async function Yi(t,e){try{let r=(await ns()).transaction(tt,"readwrite");await r.objectStore(tt).put(e,rs(t)),await r.done}catch(n){if(n instanceof H)ee.warn(n.message);else{let r=V.create("idb-set",{originalErrorMessage:n?.message});ee.warn(r.message)}}}function rs(t){return`${t.name}!${t.options.appId}`}function Zi(){return new Date().toISOString().substring(0,10)}function xc(t,e=Uc){let n=[],r=t.slice();for(let i of t){let s=n.find(a=>a.agent===i.agent);if(s){if(s.dates.push(i.date),Xi(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Xi(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}function Xi(t){return Ln(JSON.stringify({version:2,heartbeats:t})).length}function Vc(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 Wc(t){we(new q("platform-logger",e=>new qn(e),"PRIVATE")),we(new q("heartbeat",e=>new Zn(e),"PRIVATE")),J(Ct,Kn,t),J(Ct,Kn,"esm2020"),J("fire-js","")}var qn,Ct,Kn,ee,Za,Xa,Qa,ec,tc,nc,rc,ic,sc,oc,ac,cc,lc,uc,dc,hc,fc,pc,mc,gc,_c,Ic,yc,bc,Ec,wc,Tc,et,vc,fe,xe,Ve,Pc,V,Ot,Yn,Te,Dc,Lc,tt,Gn,Uc,Fc,Zn,Xn,rt=B(()=>{kt();Pt();Ue();Ue();Ki();qn=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(Ya(n)){let r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}};Ct="@firebase/app",Kn="0.15.1";ee=new Fe("@firebase/app"),Za="@firebase/app-compat",Xa="@firebase/analytics-compat",Qa="@firebase/analytics",ec="@firebase/app-check-compat",tc="@firebase/app-check",nc="@firebase/auth",rc="@firebase/auth-compat",ic="@firebase/database",sc="@firebase/data-connect",oc="@firebase/database-compat",ac="@firebase/functions",cc="@firebase/functions-compat",lc="@firebase/installations",uc="@firebase/installations-compat",dc="@firebase/messaging",hc="@firebase/messaging-compat",fc="@firebase/performance",pc="@firebase/performance-compat",mc="@firebase/remote-config",gc="@firebase/remote-config-compat",_c="@firebase/storage",Ic="@firebase/storage-compat",yc="@firebase/firestore",bc="@firebase/ai",Ec="@firebase/firestore-compat",wc="firebase",Tc="12.16.0";et="[DEFAULT]",vc={[Ct]:"fire-core",[Za]:"fire-core-compat",[Qa]:"fire-analytics",[Xa]:"fire-analytics-compat",[tc]:"fire-app-check",[ec]:"fire-app-check-compat",[nc]:"fire-auth",[rc]:"fire-auth-compat",[ic]:"fire-rtdb",[sc]:"fire-data-connect",[oc]:"fire-rtdb-compat",[ac]:"fire-fn",[cc]:"fire-fn-compat",[lc]:"fire-iid",[uc]:"fire-iid-compat",[dc]:"fire-fcm",[hc]:"fire-fcm-compat",[fc]:"fire-perf",[pc]:"fire-perf-compat",[mc]:"fire-rc",[gc]:"fire-rc-compat",[_c]:"fire-gcs",[Ic]:"fire-gcs-compat",[yc]:"fire-fst",[Ec]:"fire-fst-compat",[bc]:"fire-vertex","fire-js":"fire-js",[wc]:"fire-js-all"};fe=new Map,xe=new Map,Ve=new Map;Pc={"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."},V=new Q("app","Firebase",Pc);Ot=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 q("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 V.create("app-deleted",{appName:this._name})}};Yn=class extends Ot{constructor(e,n,r,i){let s=n.automaticDataCollectionEnabled!==void 0?n.automaticDataCollectionEnabled:!0,a={name:r,automaticDataCollectionEnabled:s};if(e.apiKey!==void 0)super(e,a,i);else{let c=e;super(c.options,a,i)}this._serverConfig={automaticDataCollectionEnabled:s,...n},this._serverConfig.authIdToken&&Ji(this._serverConfig.authIdToken,"authIdToken"),this._serverConfig.appCheckToken&&Ji(this._serverConfig.appCheckToken,"appCheckToken"),this._finalizationRegistry=null,typeof FinalizationRegistry<"u"&&(this._finalizationRegistry=new FinalizationRegistry(()=>{this.automaticCleanup()})),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=void 0,n.releaseOnDeref=void 0,J(Ct,Kn,"serverapp")}toJSON(){}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,e!==void 0&&this._finalizationRegistry!==null&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){ts(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw V.create("server-app-deleted")}};Te=Tc;Dc="firebase-heartbeat-database",Lc=1,tt="firebase-heartbeat-store",Gn=null;Uc=1024,Fc=30,Zn=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Xn(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=Zi();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>Fc){let i=Vc(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){ee.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=Zi(),{heartbeatsToSend:n,unsentEntries:r}=xc(this._heartbeatsCache.heartbeats),i=Ln(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 ee.warn(e),""}}};Xn=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Di()?Li().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await Mc(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let r=await this.read();return Yi(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 Yi(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}};Wc("")});var is={};bi(is,{FirebaseError:()=>H,SDK_VERSION:()=>Te,_DEFAULT_ENTRY_NAME:()=>et,_addComponent:()=>Jn,_addOrOverwriteComponent:()=>Ac,_apps:()=>fe,_clearComponents:()=>kc,_components:()=>Ve,_getProvider:()=>nt,_isFirebaseApp:()=>Qn,_isFirebaseServerApp:()=>E,_isFirebaseServerAppSettings:()=>Qi,_registerComponent:()=>we,_removeServiceInstance:()=>Sc,_serverApps:()=>xe,deleteApp:()=>ts,getApp:()=>er,getApps:()=>Cc,initializeApp:()=>es,initializeServerApp:()=>Rc,onLog:()=>Oc,registerVersion:()=>J,setLogLevel:()=>Nc});var Hc,zc,ss=B(()=>{rt();rt();Hc="firebase",zc="12.16.0";J(Hc,zc,"app")});function Bc(){return{"admin-restricted-operation":"This operation is restricted to administrators only.","argument-error":"","app-not-authorized":"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.","app-not-installed":"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.","captcha-check-failed":"The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","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.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-change-needs-verification":"Multi-factor users must always have a verified email.","email-already-in-use":"The email address is already in use by another account.","emulator-config-failed":'Auth instance has already been used to make a network call. Auth can no longer be configured to use the emulator. Try calling "connectAuthEmulator()" sooner.',"expired-action-code":"The action code has expired.","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal AuthError has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registered for the current project.","invalid-user-token":"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.","invalid-auth-event":"An internal AuthError has occurred.","invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure to use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-emulator-scheme":"Emulator URL must start with a valid scheme (http:// or https://).","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is incorrect, malformed or has expired.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].","invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.","login-blocked":"Login blocked by user-provided method: {$originalMessage}","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal AuthError has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-or-invalid-nonce":"The request does not contain a valid nonce. This can occur if the SHA-256 hash of the provided raw nonce does not match the hashed nonce in the ID token payload.","missing-password":"A non-empty password must be provided","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal AuthError has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.","rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled.","already-initialized":"initializeAuth() has already been called with different options. To avoid this error, call initializeAuth() with the same options as when it was originally called, or call getAuth() to return the already initialized instance.","missing-recaptcha-token":"The reCAPTCHA token is missing when sending request to the backend.","invalid-recaptcha-token":"The reCAPTCHA token is invalid when sending request to the backend.","invalid-recaptcha-action":"The reCAPTCHA action is invalid when sending request to the backend.","recaptcha-not-enabled":"reCAPTCHA Enterprise integration is not enabled for this project.","missing-client-type":"The reCAPTCHA client type is missing when sending request to the backend.","missing-recaptcha-version":"The reCAPTCHA version is missing when sending request to the backend.","invalid-req-type":"Invalid request parameters.","invalid-recaptcha-version":"The reCAPTCHA version is invalid when sending request to the backend.","unsupported-password-policy-schema-version":"The password policy received from the backend uses a schema version that is not supported by this version of the Firebase SDK.","password-does-not-meet-requirements":"The password does not meet the requirements.","invalid-hosting-link-domain":"The provided Hosting link domain is not configured in Firebase Hosting or is not owned by the current project. This cannot be a default Hosting domain (`web.app` or `firebaseapp.com`)."}}function Os(){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."}}function $c(t,...e){xt.logLevel<=g.WARN&&xt.warn(`Auth (${Te}): ${t}`,...e)}function Lt(t,...e){xt.logLevel<=g.ERROR&&xt.error(`Auth (${Te}): ${t}`,...e)}function U(t,...e){throw Ur(t,...e)}function D(t,...e){return Ur(t,...e)}function Mr(t,e,n){let r={...Lr(),[e]:n};return new Q("auth","Firebase",r).create(e,{appName:t.name})}function P(t){return Mr(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function qe(t,e,n){let r=n;if(!(e instanceof r))throw r.name!==e.constructor.name&&U(t,"argument-error"),Mr(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Ur(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 Ds.create(t,...e)}function d(t,e,...n){if(!t)throw Ur(e,...n)}function Y(t){let e="INTERNAL ASSERTION FAILED: "+t;throw Lt(e),new Error(e)}function re(t,e){t||Y(e)}function ut(){return typeof self<"u"&&self.location?.href||""}function Fr(){return os()==="http:"||os()==="https:"}function os(){return typeof self<"u"&&self.location?.protocol||null}function jc(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Fr()||Ci()||"connection"in navigator)?navigator.onLine:!0}function Gc(){if(typeof navigator>"u")return null;let t=navigator;return t.languages&&t.languages[0]||t.language||null}function xr(t,e){re(t.emulator,"Emulator should always be set here");let{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}function y(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function b(t,e,n,r,i={}){return Ms(t,i,async()=>{let s={},a={};r&&(e==="GET"?a=r:s={body:JSON.stringify(r)});let c=be({...a,key:t.config.apiKey}).slice(1),l=await t._getAdditionalHeaders();l["Content-Type"]="application/json",t.languageCode&&(l["X-Firebase-Locale"]=t.languageCode);let o={method:e,headers:l,...s};return Ri()||(o.referrerPolicy="strict-origin-when-cross-origin"),t.emulatorConfig&&St(t.emulatorConfig.host)&&(o.credentials="include"),Vt.fetch()(await Us(t,t.config.apiHost,n,c),o)})}async function Ms(t,e,n){t._canInitEmulator=!1;let r={...qc,...e};try{let i=new cr(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let a=await s.json();if("needConfirmation"in a)throw st(t,"account-exists-with-different-credential",a);if(s.ok&&!("errorMessage"in a))return a;{let c=s.ok?a.errorMessage:a.error.message,[l,o]=c.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw st(t,"credential-already-in-use",a);if(l==="EMAIL_EXISTS")throw st(t,"email-already-in-use",a);if(l==="USER_DISABLED")throw st(t,"user-disabled",a);let u=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Mr(t,u,o);U(t,u)}}catch(i){if(i instanceof H)throw i;U(t,"network-request-failed",{message:String(i)})}}async function ae(t,e,n,r,i={}){let s=await b(t,e,n,r,i);return"mfaPendingCredential"in s&&U(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function Us(t,e,n,r){let i=`${e}${n}?${r}`,s=t,a=s.config.emulator?xr(t.config,i):`${t.config.apiScheme}://${i}`;return Kc.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(a).toString():a}function Yc(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}function st(t,e,n){let r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);let i=D(t,e,r);return i.customData._tokenResponse=n,i}function as(t){return t!==void 0&&t.getResponse!==void 0}function cs(t){return t!==void 0&&t.enterprise!==void 0}async function Zc(t){return(await b(t,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function Fs(t,e){return b(t,"GET","/v2/recaptchaConfig",y(t,e))}async function Xc(t,e){return b(t,"POST","/v1/accounts:delete",e)}async function Qc(t,e){return b(t,"POST","/v1/accounts:update",e)}async function Ht(t,e){return b(t,"POST","/v1/accounts:lookup",e)}function ot(t){if(t)try{let e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}function xs(t,e=!1){return p(t).getIdToken(e)}async function Vr(t,e=!1){let n=p(t),r=await n.getIdToken(e),i=dn(r);d(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,a=s?.sign_in_provider;return{claims:i,token:r,authTime:ot(tr(i.auth_time)),issuedAtTime:ot(tr(i.iat)),expirationTime:ot(tr(i.exp)),signInProvider:a||null,signInSecondFactor:s?.sign_in_second_factor||null}}function tr(t){return Number(t)*1e3}function dn(t){let[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return Lt("JWT malformed, contained fewer than 3 sections"),null;try{let i=Xe(n);return i?JSON.parse(i):(Lt("Failed to decode base64 JWT payload"),null)}catch(i){return Lt("Caught error parsing JWT payload as JSON",i?.toString()),null}}function ls(t){let e=dn(t);return d(e,"internal-error"),d(typeof e.exp<"u","internal-error"),d(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ie(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof H&&el(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function el({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}async function ht(t){let e=t.auth,n=await t.getIdToken(),r=await ie(t,Ht(e,{idToken:n}));d(r?.users.length,e,"internal-error");let i=r.users[0];t._notifyReloadListener(i);let s=i.providerUserInfo?.length?Vs(i.providerUserInfo):[],a=tl(t.providerData,s),c=t.isAnonymous,l=!(t.email&&i.passwordHash)&&!a?.length,o=c?l:!1,u={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:a,metadata:new dt(i.createdAt,i.lastLoginAt),isAnonymous:o};Object.assign(t,u)}async function Wr(t){let e=p(t);await ht(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function tl(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function Vs(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 nl(t,e){let n=await Ms(t,{},async()=>{let r=be({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,a=await Us(t,i,"/v1/token",`key=${s}`),c=await t._getAdditionalHeaders();c["Content-Type"]="application/x-www-form-urlencoded";let l={method:"POST",headers:c,body:r};return t.emulatorConfig&&St(t.emulatorConfig.host)&&(l.credentials="include"),Vt.fetch()(a,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function rl(t,e){return b(t,"POST","/v2/accounts:revokeToken",y(t,e))}function pe(t,e){d(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}function te(t){re(t instanceof Function,"Expected a class definition");let e=us.get(t);return e?(re(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,us.set(t,e),e)}function Mt(t,e,n){return`firebase:${t}:${e}:${n}`}function ds(t){let e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Bs(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Ws(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(js(e))return"Blackberry";if(Gs(e))return"Webos";if(Hs(e))return"Safari";if((e.includes("chrome/")||zs(e))&&!e.includes("edge/"))return"Chrome";if($s(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 Ws(t=O()){return/firefox\//i.test(t)}function Hs(t=O()){let e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function zs(t=O()){return/crios\//i.test(t)}function Bs(t=O()){return/iemobile/i.test(t)}function $s(t=O()){return/android/i.test(t)}function js(t=O()){return/blackberry/i.test(t)}function Gs(t=O()){return/webos/i.test(t)}function Hr(t=O()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function il(t=O()){return Hr(t)&&!!window.navigator?.standalone}function sl(){return Ni()&&document.documentMode===10}function qs(t=O()){return Hr(t)||$s(t)||Gs(t)||js(t)||/windows phone/i.test(t)||Bs(t)}function Ks(t,e=[]){let n;switch(t){case"Browser":n=ds(O());break;case"Worker":n=`${ds(O())}-${t}`;break;default:n=t}let r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Te}/${r}`}async function ol(t,e={}){return b(t,"GET","/v2/passwordPolicy",y(t,e))}function S(t){return p(t)}function cl(t){yt=t}function zr(t){return yt.loadJS(t)}function ll(){return yt.recaptchaV2Script}function ul(){return yt.recaptchaEnterpriseScript}function dl(){return yt.gapiScript}function Js(t){return`__${t}${Math.floor(Math.random()*1e6)}`}function pl(t){let e=[],n="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let r=0;r<t;r++)e.push(n.charAt(Math.floor(Math.random()*n.length)));return e.join("")}async function it(t,e,n,r=!1,i=!1){let s=new ft(t),a;if(i)a=ct;else try{a=await s.verify(n)}catch{a=await s.verify(n,!0)}let c={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in c){let l=c.phoneEnrollmentInfo.phoneNumber,o=c.phoneEnrollmentInfo.recaptchaToken;Object.assign(c,{phoneEnrollmentInfo:{phoneNumber:l,recaptchaToken:o,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in c){let l=c.phoneSignInInfo.recaptchaToken;Object.assign(c,{phoneSignInInfo:{recaptchaToken:l,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return c}return r?Object.assign(c,{captchaResp:a}):Object.assign(c,{captchaResponse:a}),Object.assign(c,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(c,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),c}async function ge(t,e,n,r,i){if(i==="EMAIL_PASSWORD_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await it(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 a=await it(t,e,n,n==="getOobCode");return r(t,a)}else return Promise.reject(s)});else if(i==="PHONE_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let s=await it(t,e,n);return r(t,s).catch(async a=>{if(t._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&(a.code==="auth/missing-recaptcha-token"||a.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 c=await it(t,e,n,!1,!0);return r(t,c)}return Promise.reject(a)})}else{let s=await it(t,e,n,!1,!0);return r(t,s)}else return Promise.reject(i+" provider is not supported.")}async function Ys(t){let e=S(t),n=await Fs(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),r=new Wt(n);e.tenantId==null?e._agentRecaptchaConfig=r:e._tenantRecaptchaConfigs[e.tenantId]=r,r.isAnyProviderEnabled()&&new ft(e).verify()}function Br(t,e){let n=nt(t,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(he(s,e??{}))return i;U(i,"already-initialized")}return n.initialize({options:e})}function gl(t,e){let n=e?.persistence||[],r=(Array.isArray(n)?n:[n]).map(te);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e?.popupRedirectResolver)}function $r(t,e,n){let r=S(t);d(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Zs(e),{host:a,port:c}=_l(e),l=c===null?"":`:${c}`,o={url:`${s}//${a}${l}/`},u=Object.freeze({host:a,port:c,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){d(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),d(he(o,r.config.emulator)&&he(u,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=o,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,St(a)?Fi(`${s}//${a}${l}`):i||Il()}function Zs(t){let e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function _l(t){let e=Zs(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:fs(r.substr(s.length+1))}}else{let[s,a]=r.split(":");return{host:s,port:fs(a)}}}function fs(t){if(!t)return null;let e=Number(t);return isNaN(e)?null:e}function Il(){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())}async function Xs(t,e){return b(t,"POST","/v1/accounts:resetPassword",y(t,e))}async function yl(t,e){return b(t,"POST","/v1/accounts:update",e)}async function bl(t,e){return b(t,"POST","/v1/accounts:signUp",e)}async function El(t,e){return b(t,"POST","/v1/accounts:update",y(t,e))}async function wl(t,e){return ae(t,"POST","/v1/accounts:signInWithPassword",y(t,e))}async function hn(t,e){return b(t,"POST","/v1/accounts:sendOobCode",y(t,e))}async function Tl(t,e){return hn(t,e)}async function vl(t,e){return hn(t,e)}async function Al(t,e){return hn(t,e)}async function Sl(t,e){return hn(t,e)}async function kl(t,e){return ae(t,"POST","/v1/accounts:signInWithEmailLink",y(t,e))}async function Pl(t,e){return ae(t,"POST","/v1/accounts:signInWithEmailLink",y(t,e))}async function ne(t,e){return ae(t,"POST","/v1/accounts:signInWithIdp",y(t,e))}async function ps(t,e){return b(t,"POST","/v1/accounts:sendVerificationCode",y(t,e))}async function Cl(t,e){return ae(t,"POST","/v1/accounts:signInWithPhoneNumber",y(t,e))}async function Ol(t,e){let n=await ae(t,"POST","/v1/accounts:signInWithPhoneNumber",y(t,e));if(n.temporaryProof)throw st(t,"account-exists-with-different-credential",n);return n}async function Dl(t,e){let n={...e,operation:"REAUTH"};return ae(t,"POST","/v1/accounts:signInWithPhoneNumber",y(t,n),Nl)}function Ll(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 Ml(t){let e=Le(Me(t)).link,n=e?Le(Me(e)).deep_link_id:null,r=Le(Me(t)).deep_link_id;return(r?Le(Me(r)).link:null)||r||n||e||t}function Qs(t){return Se.parseLink(t)}async function eo(t,e){return ae(t,"POST","/v1/accounts:signUp",y(t,e))}function ms(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}async function to(t){if(E(t.app))return Promise.reject(P(t));let e=S(t);if(await e._initializationPromise,e.currentUser?.isAnonymous)return new j({user:e.currentUser,providerId:null,operationType:"signIn"});let n=await eo(e,{returnSecureToken:!0}),r=await j._fromIdTokenResponse(e,"signIn",n,!0);return await e._updateCurrentUser(r.user),r}function no(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?_r._fromErrorAndOperation(t,s,e,r):s})}function ro(t){return new Set(t.map(({providerId:e})=>e).filter(e=>!!e))}async function io(t,e){let n=p(t);await fn(!0,n,e);let{providerUserInfo:r}=await Qc(n.auth,{idToken:await n.getIdToken(),deleteProvider:[e]}),i=ro(r||[]);return n.providerData=n.providerData.filter(s=>i.has(s.providerId)),i.has("phone")||(n.phoneNumber=null),await n.auth._persistUserIfCurrent(n),n}async function jr(t,e,n=!1){let r=await ie(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return j._forOperation(t,"link",r)}async function fn(t,e,n){await ht(e);let r=ro(e.providerData),i=t===!1?"provider-already-linked":"no-such-provider";d(r.has(n)===t,e.auth,i)}async function so(t,e,n=!1){let{auth:r}=t;if(E(r.app))return Promise.reject(P(r));let i="reauthenticate";try{let s=await ie(t,no(r,i,e,t),n);d(s.idToken,r,"internal-error");let a=dn(s.idToken);d(a,r,"internal-error");let{sub:c}=a;return d(t.uid===c,r,"user-mismatch"),j._forOperation(t,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&U(r,"user-mismatch"),s}}async function oo(t,e,n=!1){if(E(t.app))return Promise.reject(P(t));let r="signIn",i=await no(t,r,e),s=await j._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}async function bt(t,e){return oo(S(t),e)}async function Gr(t,e){let n=p(t);return await fn(!1,n,e.providerId),jr(n,e)}async function qr(t,e){return so(p(t),e)}async function xl(t,e){return ae(t,"POST","/v1/accounts:signInWithCustomToken",y(t,e))}async function ao(t,e){if(E(t.app))return Promise.reject(P(t));let n=S(t),r=await xl(n,{token:e,returnSecureToken:!0}),i=await j._fromIdTokenResponse(n,"signIn",r);return await n._updateCurrentUser(i.user),i}function pn(t,e,n){d(n.url?.length>0,t,"invalid-continue-uri"),d(typeof n.dynamicLinkDomain>"u"||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),d(typeof n.linkDomain>"u"||n.linkDomain.length>0,t,"invalid-hosting-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.linkDomain=n.linkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(d(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(d(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}async function Kr(t){let e=S(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function co(t,e,n){let r=S(t),i={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&pn(r,i,n),await ge(r,i,"getOobCode",vl,"EMAIL_PASSWORD_PROVIDER")}async function lo(t,e,n){await Xs(p(t),{oobCode:e,newPassword:n}).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&Kr(t),r})}async function uo(t,e){await El(p(t),{oobCode:e})}async function Jr(t,e){let n=p(t),r=await Xs(n,{oobCode:e}),i=r.requestType;switch(d(i,n,"internal-error"),i){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":d(r.newEmail,n,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":d(r.mfaInfo,n,"internal-error");default:d(r.email,n,"internal-error")}let s=null;return r.mfaInfo&&(s=ke._fromServerResponse(S(n),r.mfaInfo)),{data:{email:(r.requestType==="VERIFY_AND_CHANGE_EMAIL"?r.newEmail:r.email)||null,previousEmail:(r.requestType==="VERIFY_AND_CHANGE_EMAIL"?r.email:r.newEmail)||null,multiFactorInfo:s},operation:i}}async function ho(t,e){let{data:n}=await Jr(p(t),e);return n.email}async function fo(t,e,n){if(E(t.app))return Promise.reject(P(t));let r=S(t),a=await ge(r,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",eo,"EMAIL_PASSWORD_PROVIDER").catch(l=>{throw l.code==="auth/password-does-not-meet-requirements"&&Kr(t),l}),c=await j._fromIdTokenResponse(r,"signIn",a);return await r._updateCurrentUser(c.user),c}function po(t,e,n){return E(t.app)?Promise.reject(P(t)):bt(p(t),oe.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&Kr(t),r})}async function mo(t,e,n){let r=S(t),i={requestType:"EMAIL_SIGNIN",email:e,clientType:"CLIENT_TYPE_WEB"};function s(a,c){d(c.handleCodeInApp,r,"argument-error"),c&&pn(r,a,c)}s(i,n),await ge(r,i,"getOobCode",Al,"EMAIL_PASSWORD_PROVIDER")}function go(t,e){return Se.parseLink(e)?.operation==="EMAIL_SIGNIN"}async function _o(t,e,n){if(E(t.app))return Promise.reject(P(t));let r=p(t),i=oe.credentialWithLink(e,n||ut());return d(i._tenantId===(r.tenantId||null),r,"tenant-id-mismatch"),bt(r,i)}async function Vl(t,e){return b(t,"POST","/v1/accounts:createAuthUri",y(t,e))}async function Io(t,e){let n=Fr()?ut():"http://localhost",r={identifier:e,continueUri:n},{signinMethods:i}=await Vl(p(t),r);return i||[]}async function yo(t,e){let n=p(t),i={requestType:"VERIFY_EMAIL",idToken:await t.getIdToken()};e&&pn(n.auth,i,e);let{email:s}=await Tl(n.auth,i);s!==t.email&&await t.reload()}async function bo(t,e,n){let r=p(t),s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await t.getIdToken(),newEmail:e};n&&pn(r.auth,s,n);let{email:a}=await Sl(r.auth,s);a!==t.email&&await t.reload()}async function Wl(t,e){return b(t,"POST","/v1/accounts:update",e)}async function Eo(t,{displayName:e,photoURL:n}){if(e===void 0&&n===void 0)return;let r=p(t),s={idToken:await r.getIdToken(),displayName:e,photoUrl:n,returnSecureToken:!0},a=await ie(r,Wl(r.auth,s));r.displayName=a.displayName||null,r.photoURL=a.photoUrl||null;let c=r.providerData.find(({providerId:l})=>l==="password");c&&(c.displayName=r.displayName,c.photoURL=r.photoURL),await r._updateTokensIfNecessary(a)}function wo(t,e){let n=p(t);return E(n.auth.app)?Promise.reject(P(n.auth)):vo(n,e,null)}function To(t,e){return vo(p(t),null,e)}async function vo(t,e,n){let{auth:r}=t,s={idToken:await t.getIdToken(),returnSecureToken:!0};e&&(s.email=e),n&&(s.password=n);let a=await ie(t,yl(r,s));await t._updateTokensIfNecessary(a,!0)}function Hl(t){if(!t)return null;let{providerId:e}=t,n=t.rawUserInfo?JSON.parse(t.rawUserInfo):{},r=t.isNewUser||t.kind==="identitytoolkit#SignupNewUserResponse";if(!e&&t?.idToken){let i=dn(t.idToken)?.firebase?.sign_in_provider;if(i){let s=i!=="anonymous"&&i!=="custom"?i:null;return new _e(r,s)}}if(!e)return null;switch(e){case"facebook.com":return new br(r,n);case"github.com":return new Er(r,n);case"google.com":return new wr(r,n);case"twitter.com":return new Tr(r,n,t.screenName||null);case"custom":case"anonymous":return new _e(r,null);default:return new _e(r,e,n)}}function Ao(t){let{user:e,_tokenResponse:n}=t;return e.isAnonymous&&!n?{providerId:null,isNewUser:!1,profile:null}:Hl(n)}function So(t,e){return p(t).setPersistence(e)}function ko(t){return Ys(t)}async function Po(t,e){return S(t).validatePassword(e)}function Yr(t,e,n,r){return p(t).onIdTokenChanged(e,n,r)}function Zr(t,e,n){return p(t).beforeAuthStateChanged(e,n)}function Ro(t,e,n,r){return p(t).onAuthStateChanged(e,n,r)}function Co(t){p(t).useDeviceLanguage()}function Oo(t,e){return p(t).updateCurrentUser(e)}function No(t){return p(t).signOut()}function Do(t,e){return S(t).revokeAccessToken(e)}async function Lo(t){return p(t).delete()}function Mo(t,e){let n=p(t),r=e;return d(e.customData.operationType,n,"argument-error"),d(r.customData._serverResponse?.mfaPendingCredential,n,"argument-error"),vr._fromError(n,r)}function gs(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:start",y(t,e))}function zl(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:finalize",y(t,e))}function Bl(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:start",y(t,e))}function $l(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:finalize",y(t,e))}function jl(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:withdraw",y(t,e))}function Uo(t){let e=p(t);return nr.has(e)||nr.set(e,Ar._fromUser(e)),nr.get(e)}function rr(t){let e=t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),n=RegExp(`${e}=([^;]+)`);return document.cookie.match(n)?.[1]??null}function ir(t){return`${window.location.protocol==="http:"?"__dev_":"__HOST-"}FIREBASE_${t.split(":")[3]}`}function Jl(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}function gn(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}function k(){return window}function Yl(t){k().location.href=t}function Qr(){return typeof k().WorkerGlobalScope<"u"&&typeof k().importScripts=="function"}async function Zl(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Xl(){return navigator?.serviceWorker?.controller||null}function Ql(){return Qr()?self:null}function _n(t,e){return t.transaction([rn],e?"readwrite":"readonly").objectStore(rn)}function tu(){let t=indexedDB.deleteDatabase(xo);return new Pe(t).toPromise()}function Wo(){let t=indexedDB.open(xo,eu);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{let r=t.result;try{r.createObjectStore(rn,{keyPath:Vo})}catch(i){n(i)}}),t.addEventListener("success",async()=>{let r=t.result;r.objectStoreNames.contains(rn)?e(r):(r.close(),await tu(),e(await Wo()))})})}async function _s(t,e,n){let r=_n(t,!0).put({[Vo]:e,value:n});return new Pe(r).toPromise()}async function nu(t,e){let n=_n(t,!1).get(e),r=await new Pe(n).toPromise();return r===void 0?null:r.value}function Is(t,e){let n=_n(t,!0).delete(e);return new Pe(n).toPromise()}function ys(t,e){return b(t,"POST","/v2/accounts/mfaSignIn:start",y(t,e))}function su(t,e){return b(t,"POST","/v2/accounts/mfaSignIn:finalize",y(t,e))}function ou(t,e){return b(t,"POST","/v2/accounts/mfaSignIn:finalize",y(t,e))}function cu(t){return t.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(t)}function uu(){let t=null;return new Promise(e=>{if(document.readyState==="complete"){e();return}t=()=>e(),window.addEventListener("load",t)}).catch(e=>{throw t&&window.removeEventListener("load",t),e})}async function Ho(t,e,n){if(E(t.app))return Promise.reject(P(t));let r=S(t),i=await In(r,e,p(n));return new pt(i,s=>bt(r,s))}async function zo(t,e,n){let r=p(t);await fn(!1,r,"phone");let i=await In(r.auth,e,p(n));return new pt(i,s=>Gr(r,s))}async function Bo(t,e,n){let r=p(t);if(E(r.auth.app))return Promise.reject(P(r.auth));let i=await In(r.auth,e,p(n));return new pt(i,s=>qr(r,s))}async function In(t,e,n){if(!t._getRecaptchaConfig())try{await Ys(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){d(i.type==="enroll",t,"internal-error");let s={idToken:i.credential,phoneEnrollmentInfo:{phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await ge(t,s,"mfaSmsEnrollment",async(o,u)=>{if(u.phoneEnrollmentInfo.captchaResponse===ct){d(n?.type===lt,o,"argument-error");let f=await or(o,u,n);return gs(o,f)}return gs(o,u)},"PHONE_PROVIDER").catch(o=>Promise.reject(o))).phoneSessionInfo.sessionInfo}else{d(i.type==="signin",t,"internal-error");let s=r.multiFactorHint?.uid||r.multiFactorUid;d(s,t,"missing-multi-factor-info");let a={mfaPendingCredential:i.credential,mfaEnrollmentId:s,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await ge(t,a,"mfaSmsSignIn",async(u,f)=>{if(f.phoneSignInInfo.captchaResponse===ct){d(n?.type===lt,u,"argument-error");let h=await or(u,f,n);return ys(u,h)}return ys(u,f)},"PHONE_PROVIDER").catch(u=>Promise.reject(u))).phoneResponseInfo.sessionInfo}}else{let i={phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await ge(t,i,"sendVerificationCode",async(l,o)=>{if(o.captchaResponse===ct){d(n?.type===lt,l,"argument-error");let u=await or(l,o,n);return ps(l,u)}return ps(l,o)},"PHONE_PROVIDER").catch(l=>Promise.reject(l))).sessionInfo}}finally{n?._reset()}}async function $o(t,e){let n=p(t);if(E(n.auth.app))return Promise.reject(P(n.auth));await jr(n,e)}async function or(t,e,n){d(n.type===lt,t,"argument-error");let r=await n.verify();d(typeof r=="string",t,"argument-error");let i={...e};if("phoneEnrollmentInfo"in i){let s=i.phoneEnrollmentInfo.phoneNumber,a=i.phoneEnrollmentInfo.captchaResponse,c=i.phoneEnrollmentInfo.clientType,l=i.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(i,{phoneEnrollmentInfo:{phoneNumber:s,recaptchaToken:r,captchaResponse:a,clientType:c,recaptchaVersion:l}}),i}else if("phoneSignInInfo"in i){let s=i.phoneSignInInfo.captchaResponse,a=i.phoneSignInInfo.clientType,c=i.phoneSignInInfo.recaptchaVersion;return Object.assign(i,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:s,clientType:a,recaptchaVersion:c}}),i}else return Object.assign(i,{recaptchaToken:r}),i}function Re(t,e){return e?te(e):(d(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}function du(t){return oo(t.auth,new mt(t),t.bypassAuthState)}function hu(t){let{auth:e,user:n}=t;return d(n,e,"internal-error"),so(n,new mt(t),t.bypassAuthState)}async function fu(t){let{auth:e,user:n}=t;return d(n,e,"internal-error"),jr(n,new mt(t),t.bypassAuthState)}async function jo(t,e,n){if(E(t.app))return Promise.reject(D(t,"operation-not-supported-in-this-environment"));let r=S(t);qe(t,e,$);let i=Re(r,n);return new Ge(r,"signInViaPopup",e,i).executeNotNull()}async function Go(t,e,n){let r=p(t);if(E(r.auth.app))return Promise.reject(D(r.auth,"operation-not-supported-in-this-environment"));qe(r.auth,e,$);let i=Re(r.auth,n);return new Ge(r.auth,"reauthViaPopup",e,i,r).executeNotNull()}async function qo(t,e,n){let r=p(t);qe(r.auth,e,$);let i=Re(r.auth,n);return new Ge(r.auth,"linkViaPopup",e,i,r).executeNotNull()}async function gu(t,e){let n=Jo(e),r=Ko(t);if(!await r._isAvailable())return!1;let i=await r._get(n)==="true";return await r._remove(n),i}async function ti(t,e){return Ko(t)._set(Jo(e),"true")}function _u(t,e){Ut.set(t._key(),e)}function Ko(t){return te(t._redirectPersistence)}function Jo(t){return Mt(mu,t.config.apiKey,t.name)}function Yo(t,e,n){return Iu(t,e,n)}async function Iu(t,e,n){if(E(t.app))return Promise.reject(P(t));let r=S(t);qe(t,e,$),await r._initializationPromise;let i=Re(r,n);return await ti(i,r),i._openRedirect(r,e,"signInViaRedirect")}function Zo(t,e,n){return yu(t,e,n)}async function yu(t,e,n){let r=p(t);if(qe(r.auth,e,$),E(r.auth.app))return Promise.reject(P(r.auth));await r.auth._initializationPromise;let i=Re(r.auth,n);await ti(i,r.auth);let s=await ta(r);return i._openRedirect(r.auth,e,"reauthViaRedirect",s)}function Xo(t,e,n){return bu(t,e,n)}async function bu(t,e,n){let r=p(t);qe(r.auth,e,$),await r.auth._initializationPromise;let i=Re(r.auth,n);await fn(!1,r,e.providerId),await ti(i,r.auth);let s=await ta(r);return i._openRedirect(r.auth,e,"linkViaRedirect",s)}async function Qo(t,e){return await S(t)._initializationPromise,ea(t,e,!1)}async function ea(t,e,n=!1){if(E(t.app))return Promise.reject(P(t));let r=S(t),i=Re(r,e),a=await new Rr(r,i,n).execute();return a&&!n&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),a}async function ta(t){let e=gn(`${t.uid}:::`);return t._redirectEventId=e,await t.auth._setRedirectUser(t),await t.auth._persistUserIfCurrent(t),e}function bs(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function na({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function wu(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return na(t);default:return!1}}async function Tu(t,e={}){return b(t,"GET","/v1/projects",e)}async function Su(t){if(t.config.emulator)return;let{authorizedDomains:e}=await Tu(t);for(let n of e)try{if(ku(n))return}catch{}U(t,"unauthorized-domain")}function ku(t){let e=ut(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){let a=new URL(t);return a.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&a.hostname===r}if(!Au.test(n))return!1;if(vu.test(t))return r===t;let i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}function Es(){let t=k().___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 Ru(t){return new Promise((e,n)=>{function r(){Es(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Es(),n(D(t,"network-request-failed"))},timeout:Pu.get()})}if(k().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(k().gapi?.load)r();else{let i=Js("iframefcb");return k()[i]=()=>{gapi.load?r():n(D(t,"network-request-failed"))},zr(`${dl()}?onload=${i}`).catch(s=>n(s))}}).catch(e=>{throw Ft=null,e})}function Cu(t){return Ft=Ft||Ru(t),Ft}function Uu(t){let e=t.config;d(e.authDomain,t,"auth-domain-config-required");let n=e.emulator?xr(e,Du):`https://${t.config.authDomain}/${Nu}`,r={apiKey:e.apiKey,appName:t.name,v:Te},i=Mu.get(t.config.apiHost);i&&(r.eid=i);let s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${be(r).slice(1)}`}async function Fu(t){let e=await Cu(t),n=k().gapi;return d(n,t,"internal-error"),e.open({where:document.body,url:Uu(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Lu,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});let a=D(t,"network-request-failed"),c=k().setTimeout(()=>{s(a)},Ou.get());function l(){k().clearTimeout(c),i(r)}r.ping(l).then(l,()=>{s(a)})}))}function Bu(t,e,n,r=Vu,i=Wu){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString(),c="",l={...xu,width:r.toString(),height:i.toString(),top:s,left:a},o=O().toLowerCase();n&&(c=zs(o)?Hu:n),Ws(o)&&(e=e||zu,l.scrollbars="yes");let u=Object.entries(l).reduce((h,[m,w])=>`${h}${m}=${w},`,"");if(il(o)&&c!=="_self")return $u(e||"",c),new cn(null);let f=window.open(e||"",c,u);d(f,t,"popup-blocked");try{f.focus()}catch{}return new cn(f)}function $u(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)}async function ws(t,e,n,r,i,s){d(t.config.authDomain,t,"auth-domain-config-required"),d(t.config.apiKey,t,"invalid-api-key");let a={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Te,eventId:i};if(e instanceof $){e.setDefaultLanguage(t.languageCode),a.providerId=e.providerId||"",Mi(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(let[u,f]of Object.entries(s||{}))a[u]=f}if(e instanceof Ie){let u=e.getScopes().filter(f=>f!=="");u.length>0&&(a.scopes=u.join(","))}t.tenantId&&(a.tid=t.tenantId);let c=a;for(let u of Object.keys(c))c[u]===void 0&&delete c[u];let l=await t._getAppCheckToken(),o=l?`#${qu}=${encodeURIComponent(l)}`:"";return`${Ku(t)}?${be(c).slice(1)}${o}`}function Ku({config:t}){return t.emulator?xr(t,Gu):`https://${t.authDomain}/${ju}`}function Dt(t){return typeof t>"u"||t?.length===0}function Ju(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 Yu(t){we(new q("auth",(e,{options:n})=>{let r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:a,authDomain:c}=r.options;d(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});let l={apiKey:a,authDomain:c,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ks(t)},o=new hr(r,i,s,l);return gl(o,n),o},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),we(new q("auth-internal",e=>{let n=S(e.getProvider("auth").getImmediate());return(r=>new Dr(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),J(Ts,vs,Ju(t)),J(Ts,vs,"esm2020")}function ra(t=er()){let e=nt(t,"auth");if(e.isInitialized())return e.getImmediate();let n=Br(t,{popupRedirectResolver:ni,persistence:[ei,Xr,mn]}),r=Un("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(r,location.origin);if(location.origin===s.origin){let a=Qu(s.toString());Zr(n,a,()=>a(n.currentUser)),Yr(n,c=>a(c))}}let i=Si("auth");return i&&$r(n,`http://${i}`),n}function ed(){return document.getElementsByTagName("head")?.[0]??document}var Ss,ks,Ps,Rs,Cs,Ns,Lr,Ds,Ls,xt,ve,Vt,qc,Kc,Jc,cr,Wt,lr,dt,at,me,us,zt,Bt,$t,ur,al,dr,hr,jt,yt,hl,fl,Nt,fr,pr,mr,gr,ml,ct,hs,ft,se,We,Rl,Z,Nl,Ae,Se,oe,$,Ie,Gt,He,ze,Be,Ul,qt,Fl,Kt,$e,j,_r,ke,Ir,yr,_e,Jt,br,Er,wr,Tr,Yt,vr,Ar,nr,Zt,Xt,Gl,ql,Qt,Xr,Kl,en,Fo,tn,mn,nn,Sr,xo,eu,rn,Vo,Pe,ru,iu,sn,ei,sr,au,kr,Pr,lt,lu,on,pt,je,mt,an,pu,Ge,mu,Ut,Rr,Eu,Cr,vu,Au,Pu,Ft,Ou,Nu,Du,Lu,Mu,xu,Vu,Wu,Hu,zu,cn,ju,Gu,qu,ar,Or,ni,ln,Nr,gt,_t,un,It,Ts,vs,Dr,Zu,Xu,As,Qu,ia=B(()=>{rt();Ue();Pt();kt();Ss={PHONE:"phone",TOTP:"totp"},ks={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},Ps={EMAIL_LINK:"emailLink",EMAIL_PASSWORD:"password",FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PHONE:"phone",TWITTER:"twitter.com"},Rs={LINK:"link",REAUTHENTICATE:"reauthenticate",SIGN_IN:"signIn"},Cs={EMAIL_SIGNIN:"EMAIL_SIGNIN",PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:"REVERT_SECOND_FACTOR_ADDITION",VERIFY_AND_CHANGE_EMAIL:"VERIFY_AND_CHANGE_EMAIL",VERIFY_EMAIL:"VERIFY_EMAIL"};Ns=Bc,Lr=Os,Ds=new Q("auth","Firebase",Os()),Ls={ADMIN_ONLY_OPERATION:"auth/admin-restricted-operation",ARGUMENT_ERROR:"auth/argument-error",APP_NOT_AUTHORIZED:"auth/app-not-authorized",APP_NOT_INSTALLED:"auth/app-not-installed",CAPTCHA_CHECK_FAILED:"auth/captcha-check-failed",CODE_EXPIRED:"auth/code-expired",CORDOVA_NOT_READY:"auth/cordova-not-ready",CORS_UNSUPPORTED:"auth/cors-unsupported",CREDENTIAL_ALREADY_IN_USE:"auth/credential-already-in-use",CREDENTIAL_MISMATCH:"auth/custom-token-mismatch",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"auth/requires-recent-login",DEPENDENT_SDK_INIT_BEFORE_AUTH:"auth/dependent-sdk-initialized-before-auth",DYNAMIC_LINK_NOT_ACTIVATED:"auth/dynamic-link-not-activated",EMAIL_CHANGE_NEEDS_VERIFICATION:"auth/email-change-needs-verification",EMAIL_EXISTS:"auth/email-already-in-use",EMULATOR_CONFIG_FAILED:"auth/emulator-config-failed",EXPIRED_OOB_CODE:"auth/expired-action-code",EXPIRED_POPUP_REQUEST:"auth/cancelled-popup-request",INTERNAL_ERROR:"auth/internal-error",INVALID_API_KEY:"auth/invalid-api-key",INVALID_APP_CREDENTIAL:"auth/invalid-app-credential",INVALID_APP_ID:"auth/invalid-app-id",INVALID_AUTH:"auth/invalid-user-token",INVALID_AUTH_EVENT:"auth/invalid-auth-event",INVALID_CERT_HASH:"auth/invalid-cert-hash",INVALID_CODE:"auth/invalid-verification-code",INVALID_CONTINUE_URI:"auth/invalid-continue-uri",INVALID_CORDOVA_CONFIGURATION:"auth/invalid-cordova-configuration",INVALID_CUSTOM_TOKEN:"auth/invalid-custom-token",INVALID_DYNAMIC_LINK_DOMAIN:"auth/invalid-dynamic-link-domain",INVALID_EMAIL:"auth/invalid-email",INVALID_EMULATOR_SCHEME:"auth/invalid-emulator-scheme",INVALID_IDP_RESPONSE:"auth/invalid-credential",INVALID_LOGIN_CREDENTIALS:"auth/invalid-credential",INVALID_MESSAGE_PAYLOAD:"auth/invalid-message-payload",INVALID_MFA_SESSION:"auth/invalid-multi-factor-session",INVALID_OAUTH_CLIENT_ID:"auth/invalid-oauth-client-id",INVALID_OAUTH_PROVIDER:"auth/invalid-oauth-provider",INVALID_OOB_CODE:"auth/invalid-action-code",INVALID_ORIGIN:"auth/unauthorized-domain",INVALID_PASSWORD:"auth/wrong-password",INVALID_PERSISTENCE:"auth/invalid-persistence-type",INVALID_PHONE_NUMBER:"auth/invalid-phone-number",INVALID_PROVIDER_ID:"auth/invalid-provider-id",INVALID_RECIPIENT_EMAIL:"auth/invalid-recipient-email",INVALID_SENDER:"auth/invalid-sender",INVALID_SESSION_INFO:"auth/invalid-verification-id",INVALID_TENANT_ID:"auth/invalid-tenant-id",MFA_INFO_NOT_FOUND:"auth/multi-factor-info-not-found",MFA_REQUIRED:"auth/multi-factor-auth-required",MISSING_ANDROID_PACKAGE_NAME:"auth/missing-android-pkg-name",MISSING_APP_CREDENTIAL:"auth/missing-app-credential",MISSING_AUTH_DOMAIN:"auth/auth-domain-config-required",MISSING_CODE:"auth/missing-verification-code",MISSING_CONTINUE_URI:"auth/missing-continue-uri",MISSING_IFRAME_START:"auth/missing-iframe-start",MISSING_IOS_BUNDLE_ID:"auth/missing-ios-bundle-id",MISSING_OR_INVALID_NONCE:"auth/missing-or-invalid-nonce",MISSING_MFA_INFO:"auth/missing-multi-factor-info",MISSING_MFA_SESSION:"auth/missing-multi-factor-session",MISSING_PHONE_NUMBER:"auth/missing-phone-number",MISSING_PASSWORD:"auth/missing-password",MISSING_SESSION_INFO:"auth/missing-verification-id",MODULE_DESTROYED:"auth/app-deleted",NEED_CONFIRMATION:"auth/account-exists-with-different-credential",NETWORK_REQUEST_FAILED:"auth/network-request-failed",NULL_USER:"auth/null-user",NO_AUTH_EVENT:"auth/no-auth-event",NO_SUCH_PROVIDER:"auth/no-such-provider",OPERATION_NOT_ALLOWED:"auth/operation-not-allowed",OPERATION_NOT_SUPPORTED:"auth/operation-not-supported-in-this-environment",POPUP_BLOCKED:"auth/popup-blocked",POPUP_CLOSED_BY_USER:"auth/popup-closed-by-user",PROVIDER_ALREADY_LINKED:"auth/provider-already-linked",QUOTA_EXCEEDED:"auth/quota-exceeded",REDIRECT_CANCELLED_BY_USER:"auth/redirect-cancelled-by-user",REDIRECT_OPERATION_PENDING:"auth/redirect-operation-pending",REJECTED_CREDENTIAL:"auth/rejected-credential",SECOND_FACTOR_ALREADY_ENROLLED:"auth/second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"auth/maximum-second-factor-count-exceeded",TENANT_ID_MISMATCH:"auth/tenant-id-mismatch",TIMEOUT:"auth/timeout",TOKEN_EXPIRED:"auth/user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"auth/too-many-requests",UNAUTHORIZED_DOMAIN:"auth/unauthorized-continue-uri",UNSUPPORTED_FIRST_FACTOR:"auth/unsupported-first-factor",UNSUPPORTED_PERSISTENCE:"auth/unsupported-persistence-type",UNSUPPORTED_TENANT_OPERATION:"auth/unsupported-tenant-operation",UNVERIFIED_EMAIL:"auth/unverified-email",USER_CANCELLED:"auth/user-cancelled",USER_DELETED:"auth/user-not-found",USER_DISABLED:"auth/user-disabled",USER_MISMATCH:"auth/user-mismatch",USER_SIGNED_OUT:"auth/user-signed-out",WEAK_PASSWORD:"auth/weak-password",WEB_STORAGE_UNSUPPORTED:"auth/web-storage-unsupported",ALREADY_INITIALIZED:"auth/already-initialized",RECAPTCHA_NOT_ENABLED:"auth/recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"auth/missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"auth/invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"auth/invalid-recaptcha-action",MISSING_CLIENT_TYPE:"auth/missing-client-type",MISSING_RECAPTCHA_VERSION:"auth/missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"auth/invalid-recaptcha-version",INVALID_REQ_TYPE:"auth/invalid-req-type",INVALID_HOSTING_LINK_DOMAIN:"auth/invalid-hosting-link-domain"};xt=new Fe("@firebase/auth");ve=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,re(n>e,"Short delay should be less than long delay!"),this.isMobile=ki()||Oi()}get(){return jc()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};Vt=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;Y("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;Y("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;Y("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};qc={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"};Kc=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Jc=new ve(3e4,6e4);cr=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(D(this.auth,"network-request-failed")),Jc.get())})}};Wt=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 Yc(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")}};lr=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()}};dt=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ot(this.lastLoginAt),this.creationTime=ot(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};at=class t{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){d(e.idToken,"internal-error"),d(typeof e.idToken<"u","internal-error"),d(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):ls(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){d(e.length!==0,"internal-error");let n=ls(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(d(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 nl(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,a=new t;return r&&(d(typeof r=="string","internal-error",{appName:e}),a.refreshToken=r),i&&(d(typeof i=="string","internal-error",{appName:e}),a.accessToken=i),s&&(d(typeof s=="number","internal-error",{appName:e}),a.expirationTime=s),a}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 Y("not implemented")}};me=class t{constructor({uid:e,auth:n,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new lr(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 dt(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){let n=await ie(this,this.stsTokenManager.getToken(this.auth,e));return d(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return Vr(this,e)}reload(){return Wr(this)}_assign(e){this!==e&&(d(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){d(!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 ht(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(E(this.auth.app))return Promise.reject(P(this.auth));let e=await this.getIdToken();return await ie(this,Xc(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,a=n.photoURL??void 0,c=n.tenantId??void 0,l=n._redirectEventId??void 0,o=n.createdAt??void 0,u=n.lastLoginAt??void 0,{uid:f,emailVerified:h,isAnonymous:m,providerData:w,stsTokenManager:T}=n;d(f&&T,e,"internal-error");let N=at.fromJSON(this.name,T);d(typeof f=="string",e,"internal-error"),pe(r,e.name),pe(i,e.name),d(typeof h=="boolean",e,"internal-error"),d(typeof m=="boolean",e,"internal-error"),pe(s,e.name),pe(a,e.name),pe(c,e.name),pe(l,e.name),pe(o,e.name),pe(u,e.name);let L=new t({uid:f,auth:e,email:i,emailVerified:h,displayName:r,isAnonymous:m,photoURL:a,phoneNumber:s,tenantId:c,stsTokenManager:N,createdAt:o,lastLoginAt:u});return w&&Array.isArray(w)&&(L.providerData=w.map(R=>({...R}))),l&&(L._redirectEventId=l),L}static async _fromIdTokenResponse(e,n,r=!1){let i=new at;i.updateFromServerResponse(n);let s=new t({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await ht(s),s}static async _fromGetAccountInfoResponse(e,n,r){let i=n.users[0];d(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?Vs(i.providerUserInfo):[],a=!(i.email&&i.passwordHash)&&!s?.length,c=new at;c.updateFromIdToken(r);let l=new t({uid:i.localId,auth:e,stsTokenManager:c,isAnonymous:a}),o={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 dt(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(l,o),l}};us=new Map;zt=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){}};zt.type="NONE";Bt=zt;$t=class t{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;let{config:i,name:s}=this.auth;this.fullUserKey=Mt(this.userKey,i.apiKey,s),this.fullPersistenceKey=Mt("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 Ht(this.auth,{idToken:e}).catch(()=>{});return n?me._fromGetAccountInfoResponse(this.auth,n,e):null}return me._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(te(Bt),e,r);let i=(await Promise.all(n.map(async o=>{if(await o._isAvailable())return o}))).filter(o=>o),s=i[0]||te(Bt),a=Mt(r,e.config.apiKey,e.name),c=null;for(let o of n)try{let u=await o._get(a);if(u){let f;if(typeof u=="string"){let h=await Ht(e,{idToken:u}).catch(()=>{});if(!h)break;f=await me._fromGetAccountInfoResponse(e,h,u)}else f=me._fromJSON(e,u);o!==s&&(c=f),s=o;break}}catch{}let l=i.filter(o=>o._shouldAllowMigration);return!s._shouldAllowMigration||!l.length?new t(s,e,r):(s=l[0],c&&await s._set(a,c.toJSON()),await Promise.all(n.map(async o=>{if(o!==s)try{await o._remove(a)}catch{}})),new t(s,e,r))}};ur=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let r=s=>new Promise((a,c)=>{try{let l=e(s);a(l)}catch(l){c(l)}});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})}}};al=6,dr=class{constructor(e){let n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??al,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))}};hr=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 jt(this),this.idTokenSubscription=new jt(this),this.beforeStateQueue=new ur(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=Ds,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=te(n)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await $t.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 Ht(this,{idToken:e}),r=await me._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(E(this.app)){let s=this.app.settings.authIdToken;return s?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(a,a))}):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,a=r?._redirectEventId,c=await this.tryRedirectSignIn(e);(!s||s===a)&&c?.user&&(r=c.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 d(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 ht(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=Gc()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(E(this.app))return Promise.reject(P(this));let n=e?p(e):null;return n&&d(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&&d(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 E(this.app)?Promise.reject(P(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return E(this.app)?Promise.reject(P(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(te(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 ol(this),n=new dr(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 Q("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 rl(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&&te(e)||this._popupRedirectResolver;d(n,this,"argument-error"),this.redirectPersistenceManager=await $t.create(this,[te(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),a=!1,c=this._isInitialized?Promise.resolve():this._initializationPromise;if(d(c,this,"internal-error"),c.then(()=>{a||s(this.currentUser)}),typeof n=="function"){let l=e.addObserver(n,r,i);return()=>{a=!0,l()}}else{let l=e.addObserver(n);return()=>{a=!0,l()}}}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 d(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Ks(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(E(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&$c(`Error while retrieving App Check token: ${e.error}`),e?.token}};jt=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=Ui(n=>this.observer=n)}get next(){return d(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};yt={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};hl=500,fl=6e4,Nt=1e12,fr=class{constructor(e){this.auth=e,this.counter=Nt,this._widgets=new Map}render(e,n){let r=this.counter;return this._widgets.set(r,new gr(e,this.auth.name,n||{})),this.counter++,r}reset(e){let n=e||Nt;this._widgets.get(n)?.delete(),this._widgets.delete(n)}getResponse(e){let n=e||Nt;return this._widgets.get(n)?.getResponse()||""}async execute(e){let n=e||Nt;return this._widgets.get(n)?.execute(),""}},pr=class{constructor(){this.enterprise=new mr}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}},mr=class{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}},gr=class{constructor(e,n,r){this.params=r,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};let i=typeof e=="string"?document.getElementById(e):e;d(i,"argument-error",{appName:n}),this.container=i,this.isVisible=this.params.size!=="invisible",this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){return this.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),!this.timerId&&(this.timerId=window.setTimeout(()=>{this.responseToken=pl(50);let{callback:e,"expired-callback":n}=this.params;if(e)try{e(this.responseToken)}catch{}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,n)try{n()}catch{}this.isVisible&&this.execute()},fl)},hl))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}};ml="recaptcha-enterprise",ct="NO_RECAPTCHA",hs="onFirebaseAuthREInstanceReady",ft=class t{constructor(e){this.type=ml,this.auth=S(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(a,c)=>{Fs(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)c(new Error("recaptcha Enterprise site key undefined"));else{let o=new Wt(l);return s.tenantId==null?s._agentRecaptchaConfig=o:s._tenantRecaptchaConfigs[s.tenantId]=o,a(o.siteKey)}}).catch(l=>{c(l)})})}function i(s,a,c){let l=window.grecaptcha;cs(l)?l.enterprise.ready(()=>{l.enterprise.execute(s,{action:e}).then(o=>{a(o)}).catch(()=>{a(ct)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new pr().execute("siteKey",{action:"verify"}):new Promise((s,a)=>{r(this.auth).then(async c=>{if(!n&&cs(window.grecaptcha)&&t.scriptInjectionDeferred)await t.scriptInjectionDeferred.promise,i(c,s,a);else{if(typeof window>"u"){a(new Error("RecaptchaVerifier is only supported in browser"));return}let l=ul();l.length!==0&&(l+=c+`&onload=${hs}`),t.scriptInjectionDeferred=new De,window[hs]=()=>{t.scriptInjectionDeferred?.resolve()},zr(l).then(()=>t.scriptInjectionDeferred?.promise).then(()=>{i(c,s,a)}).catch(o=>{a(o)})}}).catch(c=>{a(c)})})}};ft.scriptInjectionDeferred=null;se=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return Y("not implemented")}_getIdTokenResponse(e){return Y("not implemented")}_linkToIdToken(e,n){return Y("not implemented")}_getReauthenticationResolver(e){return Y("not implemented")}};We=class t extends se{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 ge(e,n,"signInWithPassword",wl,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return kl(e,{email:this._email,oobCode:this._password});default:U(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 ge(e,r,"signUpPassword",bl,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return Pl(e,{idToken:n,email:this._email,oobCode:this._password});default:U(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};Rl="http://localhost",Z=class t extends se{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):U("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 a=new t(r,i);return a.idToken=s.idToken||void 0,a.accessToken=s.accessToken||void 0,a.secret=s.secret,a.nonce=s.nonce,a.pendingToken=s.pendingToken||null,a}_getIdTokenResponse(e){let n=this.buildRequest();return ne(e,n)}_linkToIdToken(e,n){let r=this.buildRequest();return r.idToken=n,ne(e,r)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,ne(e,n)}buildRequest(){let e={requestUri:Rl,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=be(n)}return e}};Nl={USER_NOT_FOUND:"user-not-found"};Ae=class t extends se{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 Cl(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ol(e,{idToken:n,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return Dl(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})}};Se=class t{constructor(e){let n=Le(Me(e)),r=n.apiKey??null,i=n.oobCode??null,s=Ll(n.mode??null);d(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=Ml(e);try{return new t(n)}catch{return null}}};oe=class t{constructor(){this.providerId=t.PROVIDER_ID}static credential(e,n){return We._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let r=Se.parseLink(n);return d(r,"argument-error"),We._fromEmailAndCode(e,r.code,r.tenantId)}};oe.PROVIDER_ID="password";oe.EMAIL_PASSWORD_SIGN_IN_METHOD="password";oe.EMAIL_LINK_SIGN_IN_METHOD="emailLink";$=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}};Ie=class extends ${constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}},Gt=class t extends Ie{static credentialFromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;return d("providerId"in n&&"signInMethod"in n,"argument-error"),Z._fromParams(n)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return d(e.idToken||e.accessToken,"argument-error"),Z._fromParams({...e,providerId:this.providerId,signInMethod:this.providerId})}static credentialFromResult(e){return t.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return t.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:r,oauthTokenSecret:i,pendingToken:s,nonce:a,providerId:c}=e;if(!r&&!i&&!n&&!s||!c)return null;try{return new t(c)._credential({idToken:n,accessToken:r,nonce:a,pendingToken:s})}catch{return null}}};He=class t extends Ie{constructor(){super("facebook.com")}static credential(e){return Z._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}}};He.FACEBOOK_SIGN_IN_METHOD="facebook.com";He.PROVIDER_ID="facebook.com";ze=class t extends Ie{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return Z._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}}};ze.GOOGLE_SIGN_IN_METHOD="google.com";ze.PROVIDER_ID="google.com";Be=class t extends Ie{constructor(){super("github.com")}static credential(e){return Z._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}}};Be.GITHUB_SIGN_IN_METHOD="github.com";Be.PROVIDER_ID="github.com";Ul="http://localhost",qt=class t extends se{constructor(e,n){super(e,e),this.pendingToken=n}_getIdTokenResponse(e){let n=this.buildRequest();return ne(e,n)}_linkToIdToken(e,n){let r=this.buildRequest();return r.idToken=n,ne(e,r)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,ne(e,n)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,pendingToken:s}=n;return!r||!i||!s||r!==i?null:new t(r,s)}static _create(e,n){return new t(e,n)}buildRequest(){return{requestUri:Ul,returnSecureToken:!0,pendingToken:this.pendingToken}}};Fl="saml.",Kt=class t extends ${constructor(e){d(e.startsWith(Fl),"argument-error"),super(e)}static credentialFromResult(e){return t.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return t.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){let n=qt.fromJSON(e);return d(n,"argument-error"),n}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{pendingToken:n,providerId:r}=e;if(!n||!r)return null;try{return qt._create(r,n)}catch{return null}}};$e=class t extends Ie{constructor(){super("twitter.com")}static credential(e,n){return Z._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}}};$e.TWITTER_SIGN_IN_METHOD="twitter.com";$e.PROVIDER_ID="twitter.com";j=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 me._fromIdTokenResponse(e,r,i),a=ms(r);return new t({user:s,providerId:a,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);let i=ms(r);return new t({user:e,providerId:i,_tokenResponse:r,operationType:n})}};_r=class t extends H{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)}};ke=class{constructor(e,n){this.factorId=e,this.uid=n.mfaEnrollmentId,this.enrollmentTime=new Date(n.enrolledAt).toUTCString(),this.displayName=n.displayName}static _fromServerResponse(e,n){return"phoneInfo"in n?Ir._fromServerResponse(e,n):"totpInfo"in n?yr._fromServerResponse(e,n):U(e,"internal-error")}},Ir=class t extends ke{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,n){return new t(n)}},yr=class t extends ke{constructor(e){super("totp",e)}static _fromServerResponse(e,n){return new t(n)}};_e=class{constructor(e,n,r={}){this.isNewUser=e,this.providerId=n,this.profile=r}},Jt=class extends _e{constructor(e,n,r,i){super(e,n,r),this.username=i}},br=class extends _e{constructor(e,n){super(e,"facebook.com",n)}},Er=class extends Jt{constructor(e,n){super(e,"github.com",n,typeof n?.login=="string"?n?.login:null)}},wr=class extends _e{constructor(e,n){super(e,"google.com",n)}},Tr=class extends Jt{constructor(e,n,r){super(e,"twitter.com",n,r)}};Yt=class t{constructor(e,n,r){this.type=e,this.credential=n,this.user=r}static _fromIdtoken(e,n){return new t("enroll",e,n)}static _fromMfaPendingCredential(e){return new t("signin",e)}toJSON(){return{multiFactorSession:{[this.type==="enroll"?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){if(e?.multiFactorSession){if(e.multiFactorSession?.pendingCredential)return t._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(e.multiFactorSession?.idToken)return t._fromIdtoken(e.multiFactorSession.idToken)}return null}};vr=class t{constructor(e,n,r){this.session=e,this.hints=n,this.signInResolver=r}static _fromError(e,n){let r=S(e),i=n.customData._serverResponse,s=(i.mfaInfo||[]).map(c=>ke._fromServerResponse(r,c));d(i.mfaPendingCredential,r,"internal-error");let a=Yt._fromMfaPendingCredential(i.mfaPendingCredential);return new t(a,s,async c=>{let l=await c._process(r,a);delete i.mfaInfo,delete i.mfaPendingCredential;let o={...i,idToken:l.idToken,refreshToken:l.refreshToken};switch(n.operationType){case"signIn":let u=await j._fromIdTokenResponse(r,n.operationType,o);return await r._updateCurrentUser(u.user),u;case"reauthenticate":return d(n.user,r,"internal-error"),j._forOperation(n.user,n.operationType,o);default:U(r,"internal-error")}})}async resolveSignIn(e){let n=e;return this.signInResolver(n)}};Ar=class t{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload(n=>{n.mfaInfo&&(this.enrolledFactors=n.mfaInfo.map(r=>ke._fromServerResponse(e.auth,r)))})}static _fromUser(e){return new t(e)}async getSession(){return Yt._fromIdtoken(await this.user.getIdToken(),this.user)}async enroll(e,n){let r=e,i=await this.getSession(),s=await ie(this.user,r._process(this.user.auth,i,n));return await this.user._updateTokensIfNecessary(s),this.user.reload()}async unenroll(e){let n=typeof e=="string"?e:e.uid,r=await this.user.getIdToken();try{let i=await ie(this.user,jl(this.user.auth,{idToken:r,mfaEnrollmentId:n}));this.enrolledFactors=this.enrolledFactors.filter(({uid:s})=>s!==n),await this.user._updateTokensIfNecessary(i),await this.user.reload()}catch(i){throw i}}},nr=new WeakMap;Zt="__sak";Xt=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Zt,"1"),this.storage.removeItem(Zt),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()}};Gl=1e3,ql=10,Qt=class extends Xt{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=qs(),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((a,c,l)=>{this.notifyListeners(a,l)});return}let r=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let a=this.storage.getItem(r);!n&&this.localCache[r]===a||this.notifyListeners(r,a)},s=this.storage.getItem(r);sl()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,ql):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)})},Gl)}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]}};Qt.type="LOCAL";Xr=Qt;Kl=1e3;en=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=ir(e);return window.cookieStore?(await window.cookieStore.get(n))?.value:rr(n)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let r=ir(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=ir(e);if(window.cookieStore){let c=(o=>{let u=o.changed.find(h=>h.name===r);u&&n(u.value),o.deleted.find(h=>h.name===r)&&n(null)}),l=()=>window.cookieStore.removeEventListener("change",c);return this.listenerUnsubscribes.set(n,l),window.cookieStore.addEventListener("change",c)}let i=rr(r),s=setInterval(()=>{let c=rr(r);c!==i&&(n(c),i=c)},Kl),a=()=>clearInterval(s);this.listenerUnsubscribes.set(n,a)}_removeListener(e,n){let r=this.listenerUnsubscribes.get(n);r&&(r(),this.listenerUnsubscribes.delete(n))}};en.type="COOKIE";Fo=en;tn=class extends Xt{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};tn.type="SESSION";mn=tn;nn=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,a=this.handlersMap[i];if(!a?.size)return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});let c=Array.from(a).map(async o=>o(n.origin,s)),l=await Jl(c);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:l})}_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)}};nn.receivers=[];Sr=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,a;return new Promise((c,l)=>{let o=gn("",20);i.port1.start();let u=setTimeout(()=>{l(new Error("unsupported_event"))},r);a={messageChannel:i,onMessage(f){let h=f;if(h.data.eventId===o)switch(h.data.status){case"ack":clearTimeout(u),s=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),c(h.data.response);break;default:clearTimeout(u),clearTimeout(s),l(new Error("invalid_response"));break}}},this.handlers.add(a),i.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:o,data:n},[i.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}};xo="firebaseLocalStorageDb",eu=1,rn="firebaseLocalStorage",Vo="fbase_key",Pe=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)})})}};ru=800,iu=3,sn=class{constructor(){this.type="LOCAL",this.dbPromise=null,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.dbPromise?this.dbPromise:(this.dbPromise=Wo(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let n=0;for(;;)try{let r=await this._openDb();return await e(r)}catch(r){if(n++>iu)throw r;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return Qr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=nn._getInstance(Ql()),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 Zl(),!this.activeServiceWorker)return;this.sender=new Sr(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||Xl()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async e=>{await _s(e,Zt,"1"),await Is(e,Zt)}),!0):!1}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=>_s(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(r=>nu(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Is(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=_n(i,!1).getAll();return new Pe(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(),ru)}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()}};sn.type="LOCAL";ei=sn;sr=Js("rcb"),au=new ve(3e4,6e4),kr=class{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!k().grecaptcha?.render}load(e,n=""){return d(cu(n),e,"argument-error"),this.shouldResolveImmediately(n)&&as(k().grecaptcha)?Promise.resolve(k().grecaptcha):new Promise((r,i)=>{let s=k().setTimeout(()=>{i(D(e,"network-request-failed"))},au.get());k()[sr]=()=>{k().clearTimeout(s),delete k()[sr];let c=k().grecaptcha;if(!c||!as(c)){i(D(e,"internal-error"));return}let l=c.render;c.render=(o,u)=>{let f=l(o,u);return this.counter++,f},this.hostLanguage=n,r(c)};let a=`${ll()}?${be({onload:sr,render:"explicit",hl:n})}`;zr(a).catch(()=>{clearTimeout(s),i(D(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!k().grecaptcha?.render&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}};Pr=class{async load(e){return new fr(e)}clearedOneInstance(){}};lt="recaptcha",lu={theme:"light",type:"image"},on=class{constructor(e,n,r={...lu}){this.parameters=r,this.type=lt,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=S(e),this.isInvisible=this.parameters.size==="invisible",d(typeof document<"u",this.auth,"operation-not-supported-in-this-environment");let i=typeof n=="string"?document.getElementById(n):n;d(i,this.auth,"argument-error"),this.container=i,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new Pr:new kr,this.validateStartingState()}async verify(){this.assertNotDestroyed();let e=await this.render(),n=this.getAssertedRecaptcha(),r=n.getResponse(e);return r||new Promise(i=>{let s=a=>{a&&(this.tokenChangeListeners.delete(s),i(a))};this.tokenChangeListeners.add(s),this.isInvisible&&n.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise?this.renderPromise:(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e}),this.renderPromise)}_reset(){this.assertNotDestroyed(),this.widgetId!==null&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){d(!this.parameters.sitekey,this.auth,"argument-error"),d(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),d(typeof document<"u",this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return n=>{if(this.tokenChangeListeners.forEach(r=>r(n)),typeof e=="function")e(n);else if(typeof e=="string"){let r=k()[e];typeof r=="function"&&r(n)}}}assertNotDestroyed(){d(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){let n=document.createElement("div");e.appendChild(n),e=n}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){d(Fr()&&!Qr(),this.auth,"internal-error"),await uu(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);let e=await Zc(this.auth);d(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return d(this.recaptcha,this.auth,"internal-error"),this.recaptcha}};pt=class{constructor(e,n){this.verificationId=e,this.onConfirmation=n}confirm(e){let n=Ae._fromVerification(this.verificationId,e);return this.onConfirmation(n)}};je=class t{constructor(e){this.providerId=t.PROVIDER_ID,this.auth=S(e)}verifyPhoneNumber(e,n){return In(this.auth,e,p(n))}static credential(e,n){return Ae._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?Ae._fromTokenResponse(n,r):null}};je.PROVIDER_ID="phone";je.PHONE_SIGN_IN_METHOD="phone";mt=class extends se{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ne(e,this._buildIdpRequest())}_linkToIdToken(e,n){return ne(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return ne(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}};an=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:a,type:c}=e;if(a){this.reject(a);return}let l={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(c)(l))}catch(o){this.reject(o)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return du;case"linkViaPopup":case"linkViaRedirect":return fu;case"reauthViaPopup":case"reauthViaRedirect":return hu;default:U(this.auth,"internal-error")}}resolve(e){re(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){re(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()}};pu=new ve(2e3,1e4);Ge=class t extends an{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 d(e,this.auth,"internal-error"),e}async onExecution(){re(this.filter.length===1,"Popup operations only handle one event");let e=gn();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(D(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(D(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(D(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,pu.get())};e()}};Ge.currentPopupAction=null;mu="pendingRedirect",Ut=new Map,Rr=class extends an{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=Ut.get(this.auth._key());if(!e){try{let r=await gu(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}Ut.set(this.auth._key(),e)}return this.bypassAuthState||Ut.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(){}};Eu=600*1e3,Cr=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||!wu(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){if(e.error&&!na(e)){let r=e.error.code?.split("auth/")[1]||"internal-error";n.onError(D(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>=Eu&&this.cachedEventUids.clear(),this.cachedEventUids.has(bs(e))}saveEventToCache(e){this.cachedEventUids.add(bs(e)),this.lastProcessedEventTime=Date.now()}};vu=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Au=/^https?/;Pu=new ve(3e4,6e4);Ft=null;Ou=new ve(5e3,15e3),Nu="__/auth/iframe",Du="emulator/auth/iframe",Lu={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Mu=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);xu={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Vu=500,Wu=600,Hu="_blank",zu="http://localhost",cn=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};ju="__/auth/handler",Gu="emulator/auth/handler",qu=encodeURIComponent("fac");ar="webStorageSupport",Or=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=mn,this._completeRedirectFn=ea,this._overrideRedirectResult=_u}async _openPopup(e,n,r,i){re(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");let s=await ws(e,n,r,ut(),i);return Bu(e,s,gn())}async _openRedirect(e,n,r,i){await this._originValidation(e);let s=await ws(e,n,r,ut(),i);return Yl(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):(re(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 Fu(e),r=new Cr(e);return n.register("authEvent",i=>(d(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(ar,{type:ar},i=>{let s=i?.[0]?.[ar];s!==void 0&&n(!!s),U(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=Su(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return qs()||Hs()||Hr()}},ni=Or,ln=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 Y("unexpected MultiFactorSessionType")}}},Nr=class t extends ln{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new t(e)}_finalizeEnroll(e,n,r){return zl(e,{idToken:n,displayName:r,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return su(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},gt=class{constructor(){}static assertion(e){return Nr._fromCredential(e)}};gt.FACTOR_ID="phone";_t=class{static assertionForEnrollment(e,n){return un._fromSecret(e,n)}static assertionForSignIn(e,n){return un._fromEnrollmentId(e,n)}static async generateSecret(e){let n=e;d(typeof n.user?.auth<"u","internal-error");let r=await Bl(n.user.auth,{idToken:n.credential,totpEnrollmentInfo:{}});return It._fromStartTotpMfaEnrollmentResponse(r,n.user.auth)}};_t.FACTOR_ID="totp";un=class t extends ln{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 d(typeof this.secret<"u",e,"argument-error"),$l(e,{idToken:n,displayName:r,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){d(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let r={verificationCode:this.otp};return ou(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:r})}},It=class t{constructor(e,n,r,i,s,a,c){this.sessionInfo=a,this.auth=c,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(Dt(e)||Dt(n))&&(r=!0),r&&(Dt(e)&&(e=this.auth.currentUser?.email||"unknownuser"),Dt(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};Ts="@firebase/auth",vs="1.13.3";Dr=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(){d(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};Zu=300,Xu=Un("authIdTokenMaxAge")||Zu,As=null,Qu=t=>async e=>{let n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>Xu)return;let i=n?.token;As!==i&&(As=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};cl({loadJS(t){return new Promise((e,n)=>{let r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{let s=D("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",ed().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="});Yu("Browser")});var sa=B(()=>{ia();rt();Ue();Pt();kt()});var yn={};bi(yn,{ActionCodeOperation:()=>Cs,ActionCodeURL:()=>Se,AuthCredential:()=>se,AuthErrorCodes:()=>Ls,EmailAuthCredential:()=>We,EmailAuthProvider:()=>oe,FacebookAuthProvider:()=>He,FactorId:()=>Ss,GithubAuthProvider:()=>Be,GoogleAuthProvider:()=>ze,OAuthCredential:()=>Z,OAuthProvider:()=>Gt,OperationType:()=>Rs,PhoneAuthCredential:()=>Ae,PhoneAuthProvider:()=>je,PhoneMultiFactorGenerator:()=>gt,ProviderId:()=>ks,RecaptchaVerifier:()=>on,SAMLAuthProvider:()=>Kt,SignInMethod:()=>Ps,TotpMultiFactorGenerator:()=>_t,TotpSecret:()=>It,TwitterAuthProvider:()=>$e,applyActionCode:()=>uo,beforeAuthStateChanged:()=>Zr,browserCookiePersistence:()=>Fo,browserLocalPersistence:()=>Xr,browserPopupRedirectResolver:()=>ni,browserSessionPersistence:()=>mn,checkActionCode:()=>Jr,confirmPasswordReset:()=>lo,connectAuthEmulator:()=>$r,createUserWithEmailAndPassword:()=>fo,debugErrorMap:()=>Ns,deleteUser:()=>Lo,fetchSignInMethodsForEmail:()=>Io,getAdditionalUserInfo:()=>Ao,getAuth:()=>ra,getIdToken:()=>xs,getIdTokenResult:()=>Vr,getMultiFactorResolver:()=>Mo,getRedirectResult:()=>Qo,inMemoryPersistence:()=>Bt,indexedDBLocalPersistence:()=>ei,initializeAuth:()=>Br,initializeRecaptchaConfig:()=>ko,isSignInWithEmailLink:()=>go,linkWithCredential:()=>Gr,linkWithPhoneNumber:()=>zo,linkWithPopup:()=>qo,linkWithRedirect:()=>Xo,multiFactor:()=>Uo,onAuthStateChanged:()=>Ro,onIdTokenChanged:()=>Yr,parseActionCodeURL:()=>Qs,prodErrorMap:()=>Lr,reauthenticateWithCredential:()=>qr,reauthenticateWithPhoneNumber:()=>Bo,reauthenticateWithPopup:()=>Go,reauthenticateWithRedirect:()=>Zo,reload:()=>Wr,revokeAccessToken:()=>Do,sendEmailVerification:()=>yo,sendPasswordResetEmail:()=>co,sendSignInLinkToEmail:()=>mo,setPersistence:()=>So,signInAnonymously:()=>to,signInWithCredential:()=>bt,signInWithCustomToken:()=>ao,signInWithEmailAndPassword:()=>po,signInWithEmailLink:()=>_o,signInWithPhoneNumber:()=>Ho,signInWithPopup:()=>jo,signInWithRedirect:()=>Yo,signOut:()=>No,unlink:()=>io,updateCurrentUser:()=>Oo,updateEmail:()=>wo,updatePassword:()=>To,updatePhoneNumber:()=>$o,updateProfile:()=>Eo,useDeviceLanguage:()=>Co,validatePassword:()=>Po,verifyBeforeUpdateEmail:()=>bo,verifyPasswordResetCode:()=>ho});var bn=B(()=>{sa()});var td={apiKey:"AIzaSyAC5ROxI3bnIO1DyNflMhFRrtnR-45p4RE",authDomain:"myapp-259bf.firebaseapp.com",projectId:"myapp-259bf"},ri=null,En=null;async function Ce(){return typeof window>"u"?null:(ri||(ri=(async()=>{let{initializeApp:t,getApps:e}=await Promise.resolve().then(()=>(ss(),is)),{getAuth:n,signInAnonymously:r,onAuthStateChanged:i}=await Promise.resolve().then(()=>(bn(),yn)),s=e().length?e()[0]:t(td);if(En=n(s),!await new Promise(c=>{let l=i(En,o=>{l(),c(o)})}))try{await r(En)}catch{console.warn("[oZ Auth] Anonymous session unavailable (offline or delayed).")}return En})()),ri)}async function oa(){try{let t=await Ce();return!t||!t.currentUser?null:await t.currentUser.getIdToken()}catch{return console.error("[OZmoz Auth] Session check failed."),null}}async function wn(t){let e=await Ce(),{signInWithCustomToken:n}=await Promise.resolve().then(()=>(bn(),yn)),r;try{r=await n(e,t)}catch{throw new Error("Sign-in failed. Please try again.")}return{uid:r.user.uid,email:r.user.email,isAnonymous:r.user.isAnonymous}}async function aa(){let t=await Ce(),{signOut:e,signInAnonymously:n}=await Promise.resolve().then(()=>(bn(),yn));return await e(t),await n(t),!0}async function ca(){let t=await Ce();return!t||!t.currentUser?null:{uid:t.currentUser.uid,email:t.currentUser.email,isAnonymous:t.currentUser.isAnonymous}}async function la(t=!1){try{let e=await Ce();return!e||!e.currentUser?!1:(await e.currentUser.getIdTokenResult(t)).claims.elog===!0}catch(e){return console.error("[OZmoz Auth Debug]",e),!1}}var nd="oz_proto",ii="proto_user",vn=new Map,fa=(t,e)=>`${nd}:${t||"app"}:${e}`,W=t=>t===void 0?t:JSON.parse(JSON.stringify(t)),pa=()=>`proto_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`}`,ai=t=>{let e=t?._id??t?.id??t?.documentId;return e==null?null:String(e)},si=new Set;function ce(t,e){let n=fa(t,e);if(si.has(n))return W(vn.get(n));try{if(typeof localStorage<"u"){let r=localStorage.getItem(n);if(r!==null){let i=JSON.parse(r);if(Array.isArray(i))return i}}}catch{}return vn.has(n)?W(vn.get(n)):null}function Et(t,e,n){let r=fa(t,e);vn.set(r,W(n));try{if(typeof localStorage<"u"){localStorage.setItem(r,JSON.stringify(n)),si.delete(r);return}}catch{}si.add(r)}var oi=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return{}}return t&&typeof t=="object"?t:{}};function rd(t,e,n){let r=String(e).split("."),i=t;r.forEach((s,a)=>{a===r.length-1?i[s]=n:((typeof i[s]!="object"||i[s]===null)&&(i[s]={}),i=i[s])})}function id(t){let e={...W(oi(t))};return e._id=ai(e)||pa(),e}var Tn=(t,e)=>t.findIndex(n=>ai(n)===String(e)),ua=/^[A-Za-z][A-Za-z0-9_]{0,39}$/;function sd(t){let e={where:[],sort:null,limit:0};if(t==null)return{ok:e};if(typeof t!="object"||Array.isArray(t))return{error:"Invalid query options."};let{where:n,limit:r,sort:i}=t;if(n!=null){if(typeof n!="object"||Array.isArray(n))return{error:"This filter isn't supported."};let s=Object.keys(n);if(s.length>3)return{error:"Too many filter conditions."};for(let a of s){let c=n[a],l=typeof c=="string"||typeof c=="boolean"||typeof c=="number"&&Number.isFinite(c);if(!ua.test(a)||!l)return{error:"This filter isn't supported."};e.where.push([a,c])}}if(r!=null){if(!Number.isInteger(r)||r<1||r>200)return{error:"The limit must be a whole number from 1 to 200."};e.limit=r}if(i!=null){let s=typeof i=="object"&&!Array.isArray(i)?Object.keys(i):[];if(s.length!==1||!ua.test(s[0])||i[s[0]]!==1&&i[s[0]]!==-1)return{error:"This sort isn't supported."};e.sort={field:s[0],dir:i[s[0]]}}return{ok:e}}var da=t=>t==null?0:typeof t=="number"?1:typeof t=="string"?2:typeof t=="boolean"?3:4,ha=(t,e)=>{let n=da(t),r=da(e);return n!==r?n-r:n===0||n===4?0:t<e?-1:t>e?1:0};function od(t,e){let n=t;if(e.where.length&&(n=n.filter(r=>e.where.every(([i,s])=>r[i]===s))),e.sort){let{field:r,dir:i}=e.sort;n=n.slice().sort((s,a)=>i*(ha(s[r],a[r])||ha(String(s._id),String(a._id))))}return e.limit&&(n=n.slice(0,e.limit)),n}function ma(t,e,n){let r=ce(t,e);if(r!==null)return{success:!0,seeded:!1,isPrototype:!0,count:r.length};let i=(Array.isArray(n)?n:[]).map(id);return Et(t,e,i),{success:!0,seeded:!0,isPrototype:!0,count:i.length}}function ga(t,e,n){let r=e||{},i=r.fleetboTable;switch(t){case"getdocsg":case"getdocsu":{let s=sd(r.queryOptions);return s.error?{success:!1,error:s.error}:{success:!0,data:od(W(ce(n,i)||[]),s.ok)}}case"getdoc":{let s=ce(n,i)||[],a=s[Tn(s,r.id)];return a?{success:!0,data:W(a)}:{success:!1,notFound:!0,message:"Document not found."}}case"add":case"addwithmedia":{let s=ce(n,i)||[],a=oi(r.jsonData),c={...W(a),_id:ai(a)||pa(),userId:ii,createdAt:new Date().toISOString()};if(t==="addwithmedia"){let l=typeof r.fileBase64=="string"&&r.fileBase64||a.mediaUrl||a.image||"";c.mediaUrl=c.image=c.imageUrl=c.coverImage=l}return s.push(c),Et(n,i,s),t==="addwithmedia"?{success:!0,id:c._id,mediaUrl:c.mediaUrl,isPrototype:!0}:{success:!0,documentId:c._id,isPrototype:!0}}case"addwithuserid":case"addwithid":{let s=ce(n,i)||[],a=t==="addwithuserid"?ii:String(r.id),c=W(oi(r.jsonData)),l=Tn(s,a),o={...l>=0?s[l]:{createdAt:new Date().toISOString()},...c,_id:a,userId:ii,updatedAt:new Date().toISOString()};return l>=0?s[l]=o:s.push(o),Et(n,i,s),t==="addwithuserid"?{success:!0,documentId:a,isPrototype:!0}:{success:!0,id:a,isPrototype:!0}}case"update":{let s=ce(n,i)||[],a=Tn(s,r.id);if(a<0)return{success:!1,documentId:r.id,error:"Document not found."};let{fleetboTable:c,id:l,...o}=r,u=W(s[a]);for(let[f,h]of Object.entries(o))rd(u,f,W(h));return u.updatedAt=new Date().toISOString(),s[a]=u,Et(n,i,s),{success:!0,documentId:String(r.id),isPrototype:!0}}case"delete":{let s=ce(n,i)||[],a=Tn(s,r.id);return a>=0&&(s.splice(a,1),Et(n,i,s)),{success:!0,documentId:String(r.id),isPrototype:!0}}case"join":{let s=r.joinOptions?.innerJoin;if(!s||!s.collection||!Array.isArray(s.on)||s.on.length!==3)return{success:!1,error:"The 'on' clause must contain 3 elements."};let[a,,c]=s.on,l=s.as||"joinedData",o=ce(n,s.collection)||[],u=h=>{if(!Array.isArray(s.select)||s.select.length===0)return W(h);let m={_id:h._id};return s.select.forEach(w=>{w in h&&(m[w]=W(h[w]))}),m};return{success:!0,data:(ce(n,i)||[]).map(h=>{let m=h[a],w=o.filter(T=>{if(m==null)return!1;let N=c==="id"?T._id??T.id:T[c];return String(N)===String(m)});return{...W(h),[l]:w.map(u)}})}}default:return null}}var ad="https://api.ozmoz.io/",wt=()=>typeof globalThis<"u"&&globalThis.OZ_CONFIG?globalThis.OZ_CONFIG:typeof window<"u"&&window.OZ_CONFIG?window.OZ_CONFIG:{},ci=()=>!!(typeof import.meta<"u"&&import.meta.env&&import.meta.env.OZ_PROTOTYPE==="true"||typeof process<"u"&&process.env&&process.env.OZ_PROTOTYPE==="true"||wt().prototype===!0||wt().prototype==="true"),li=()=>(typeof import.meta<"u"&&import.meta.env?import.meta.env.OZ_DB_KEY:typeof process<"u"?process.env.OZ_DB_KEY:void 0)||wt().dbKey||"",cd=()=>(typeof import.meta<"u"&&import.meta.env?import.meta.env.OZ_ENTERPRISE_ID:typeof process<"u"?process.env.OZ_ENTERPRISE_ID:void 0)||wt().enterpriseId||"",ld=()=>!!(typeof import.meta<"u"&&import.meta.env&&import.meta.env.OZ_DEBUG==="true"||typeof process<"u"&&process.env&&process.env.OZ_DEBUG==="true"||wt().debug===!0),Tt=async(t,e=null)=>{try{let n=li(),r=cd(),i=ci(),s=String(t).replace(/^[a-z]+:\/\//,"").split("-")[0]||"add",a=e?.operation||s,c=s==="crud"?"crud":a;if(i){let C=ga(a.toLowerCase(),e,n);if(C!=null)return C}let l={"Content-Type":"application/json"};i&&(l["x-oz-prototype"]="true");let o=ld()?Date.now():0,u=await oa(),f=o?Date.now():0;u&&(l.Authorization=`Bearer ${u}`);let h=null;if(e?.jsonData!==void 0)h=e.jsonData;else if(a==="update"){let{fleetboTable:C,id:Ne,operation:le,...ue}=e||{};h=ue}let m={targetFunction:c,operation:a,enterpriseID:r,fleetboDB:n,fleetboTable:e?.fleetboTable||null,jsonData:h,_prototype:i,data:{fleetboDB:n,enterpriseID:r,operation:a,...e}},w=C=>{if(!C||typeof C!="object")return C;let{fleetboDB:Ne,fleetboTable:le,...ue}=C;return{...ue,...Ne!==void 0?{ozDB:Ne}:{},...le!==void 0?{ozTable:le}:{}}},T={...w(m),data:w(m.data)},N=await fetch(ad,{method:"POST",headers:l,body:JSON.stringify(T)}),L=await N.json(),R=L.result||L;if(o){let C=Date.now();console.debug(`[OZmoz] ${c}(${e?.fleetboTable||""}) ${C-o} ms : auth ${f-o} ms, cloud ${C-f} ms, HTTP ${N.status}`)}let z=R?.error||(N.ok?null:R?.message||`HTTP ${N.status}`),Ye=z&&typeof z=="object"?z.message||JSON.stringify(z):z?String(z):void 0;return{success:!!(N.ok&&!Ye),...R||{},error:Ye}}catch(n){return{success:!1,error:n?.message||String(n)}}},_a=Tt,Ia=Tt,ya=Tt;var v=Tt||_a||Ia||ya,Sn=ci||(()=>!1),ba=li||(()=>"");if(typeof window<"u"&&typeof customElements<"u"){class t extends HTMLElement{static get observedAttributes(){return["value","fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get fallback(){return this.getAttribute("fallback")}set fallback(o){o==null?this.removeAttribute("fallback"):this.setAttribute("fallback",String(o))}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("fallback")||"\u2014",f=o!=null&&o.trim()!==""&&o!=="null"&&o!=="undefined";this.textContent=f?o:u}}class e extends HTMLElement{static get observedAttributes(){return["value","invalid-fallback","currency"]}get value(){return this.getAttribute("value")}set value(o){o==null||o===""?this.removeAttribute("value"):this.setAttribute("value",String(o))}get currency(){return this.getAttribute("currency")}set currency(o){o==null?this.removeAttribute("currency"):this.setAttribute("currency",String(o))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("invalid-fallback")||"0";if(o==null||o===""||o==="null"||o==="undefined"){this.textContent=u;return}let f=Number(o);if(Number.isNaN(f)){this.textContent=u;return}let h=this.getAttribute("currency");if(h)try{this.textContent=new Intl.NumberFormat("en-US",{style:"currency",currency:h}).format(f)}catch{this.textContent=`${f} ${h}`}else this.textContent=String(f)}}class n extends HTMLElement{static get observedAttributes(){return["value","label-true","label-false","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get labelTrue(){return this.getAttribute("label-true")}set labelTrue(o){o==null?this.removeAttribute("label-true"):this.setAttribute("label-true",String(o))}get"label-true"(){return this.labelTrue}set"label-true"(o){this.labelTrue=o}get labelFalse(){return this.getAttribute("label-false")}set labelFalse(o){o==null?this.removeAttribute("label-false"):this.setAttribute("label-false",String(o))}get"label-false"(){return this.labelFalse}set"label-false"(o){this.labelFalse=o}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("label-true")||"Yes",f=this.getAttribute("label-false")||"No",h=this.getAttribute("invalid-fallback")||"Unknown";o==="true"||o==="1"?this.textContent=u:o==="false"||o==="0"?this.textContent=f:this.textContent=h}}class r extends HTMLElement{static get observedAttributes(){return["value","locale","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null||o===""?this.removeAttribute("value"):o&&typeof o=="object"&&typeof o.toISOString=="function"?this.setAttribute("value",o.toISOString()):this.setAttribute("value",String(o))}get locale(){return this.getAttribute("locale")}set locale(o){o==null?this.removeAttribute("locale"):this.setAttribute("locale",String(o))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("invalid-fallback")||"Invalid date",f=this.getAttribute("locale")||"en-US";if(!o||o==="null"||o==="undefined"||o===""){this.textContent=u;return}let h=new Date(o);if(Number.isNaN(h.getTime())){this.textContent=u;return}try{this.textContent=h.toLocaleDateString(f)}catch{this.textContent=h.toLocaleDateString("en-US")}}}class i extends HTMLElement{static get observedAttributes(){return["value","allowed","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get allowed(){return this.getAttribute("allowed")}set allowed(o){o==null?this.removeAttribute("allowed"):Array.isArray(o)?this.setAttribute("allowed",o.join(",")):this.setAttribute("allowed",String(o))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=(this.getAttribute("allowed")||"").split(",").map(h=>h.trim()).filter(Boolean),f=this.getAttribute("invalid-fallback")||"Not allowed";if(!o||o==="null"||o==="undefined"||!u.includes(o)){this.textContent=f;return}this.textContent=String(o)}}class s extends HTMLElement{static get observedAttributes(){return["value","alt","fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get alt(){return this.getAttribute("alt")}set alt(o){o==null?this.removeAttribute("alt"):this.setAttribute("alt",String(o))}get fallback(){return this.getAttribute("fallback")}set fallback(o){o==null?this.removeAttribute("fallback"):this.setAttribute("fallback",String(o))}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("fallback")||"",f=this.getAttribute("alt")||"Media";this.innerHTML="";let h=document.createElement("img"),m=o&&o!=="null"&&o!=="undefined"&&o.trim()!=="";h.src=m?o:u,h.alt=f,this.appendChild(h)}}class a extends HTMLElement{static get observedAttributes(){return["table","id","field","orphan-fallback","loading-fallback","malformed-fallback"]}get table(){return this.getAttribute("table")}set table(o){o==null?this.removeAttribute("table"):this.setAttribute("table",String(o))}get id(){return this.getAttribute("id")}set id(o){o==null?this.removeAttribute("id"):this.setAttribute("id",String(o))}get field(){return this.getAttribute("field")}set field(o){o==null?this.removeAttribute("field"):this.setAttribute("field",String(o))}get orphanFallback(){return this.getAttribute("orphan-fallback")}set orphanFallback(o){o==null?this.removeAttribute("orphan-fallback"):this.setAttribute("orphan-fallback",String(o))}get"orphan-fallback"(){return this.orphanFallback}set"orphan-fallback"(o){this.orphanFallback=o}get loadingFallback(){return this.getAttribute("loading-fallback")}set loadingFallback(o){o==null?this.removeAttribute("loading-fallback"):this.setAttribute("loading-fallback",String(o))}get"loading-fallback"(){return this.loadingFallback}set"loading-fallback"(o){this.loadingFallback=o}get malformedFallback(){return this.getAttribute("malformed-fallback")}set malformedFallback(o){o==null?this.removeAttribute("malformed-fallback"):this.setAttribute("malformed-fallback",String(o))}get"malformed-fallback"(){return this.malformedFallback}set"malformed-fallback"(o){this.malformedFallback=o}attributeChangedCallback(){this.fetchAndRender()}connectedCallback(){this.fetchAndRender()}async fetchAndRender(){let o=this.getAttribute("table"),u=this.getAttribute("id"),f=this.getAttribute("field")||"name",h=this.getAttribute("orphan-fallback")||"Deleted",m=this.getAttribute("loading-fallback")||"Loading...",w=this.getAttribute("malformed-fallback")||"Invalid ID";if(!u||typeof u!="string"||u.trim()===""||u==="null"||u==="undefined"){this.textContent=w;return}if(!o){this.textContent=w;return}this.textContent=m;try{let T=typeof window<"u"?window:null,N=typeof globalThis<"u"?globalThis:null,L=T&&T.oz||N&&N.oz;if(!L||typeof L.getDoc!="function"){this.textContent=h;return}let R=await L.getDoc(o,u);R&&R[f]!==void 0?this.textContent=String(R[f]):R?this.textContent=R.name||R.title||R.label||JSON.stringify(R):this.textContent=h}catch{this.textContent=h}}}let c=(l,o)=>{customElements.get(l)||customElements.define(l,o)};c("oz-text",t),c("oz-number",e),c("oz-toggle",n),c("oz-date",r),c("oz-enum",i),c("oz-media",s),c("oz-reference",a)}var hi={Text:"oz-text",Number:"oz-number",Toggle:"oz-toggle",Date:"oz-date",Enum:"oz-enum",Media:"oz-media",Reference:"oz-reference"};function Ke(t){typeof window>"u"&&typeof process<"u"&&process.env}var dd=()=>!!(typeof import.meta<"u"&&import.meta.env&&import.meta.env.DEV===!0||typeof process<"u"&&process.env&&!1),Ea=null;async function F(t){if(t&&t._schemaVersion&&t._schemaData){let e=t._schemaVersion,n=t._schemaData;typeof window<"u"?dd()&&String(e)!==Ea&&(Ea=String(e),fetch("/__ozmoz_sync_schema",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({schema:n,version:e})}).catch(()=>{})):typeof process<"u"&&process.env}return t}var A=t=>`oz://${t.toLowerCase()}`,An=(t,e,n)=>{if(!n||n.success!==!1||n.notFound)return;let r=n.error,i=(r&&typeof r=="object"?r.message||r.status:r)||n.message||"unknown error";console.error(`[OZmoz] ${t}('${e}') failed: ${i}`)};var Je=(t,e,n)=>{if(n&&n.success!==!1&&Sn()&&fd(e),!n||n.success!==!1)return n;let r=n.error,i=(r&&typeof r=="object"?r.message||r.status:r)||n.message||"unknown error";return console.error(`[OZmoz] ${t}('${e}') failed: ${i}`),n},Oe=null;function di(){if(typeof window>"u")return Promise.resolve(null);let t=window;return t.FB&&t.__ozmoz_fb_ready?Promise.resolve(t.FB):Oe||(Oe=new Promise((e,n)=>{let r=setTimeout(()=>{Oe=null,n(new Error("The Facebook service is not responding. Check your tracker blockers."))},8e3),i=typeof import.meta<"u"&&import.meta.env&&import.meta.env.OZ_FACEBOOK_APP_ID||typeof process<"u"&&process.env&&process.env.OZ_FACEBOOK_APP_ID||"1392432699758138",s=()=>{try{return t.__ozmoz_fb_ready?!0:!t.FB||typeof t.FB.init!="function"?!1:(t.FB.init({appId:String(i).trim(),cookie:!0,xfbml:!1,version:"v22.0"}),t.__ozmoz_fb_ready=!0,clearTimeout(r),e(t.FB),!0)}catch(l){return clearTimeout(r),Oe=null,n(l),!1}};if(t.FB&&typeof t.FB.init=="function"&&s())return;let a=t.fbAsyncInit;if(t.fbAsyncInit=function(){if(typeof a=="function")try{a()}catch{}s()},document.getElementById("facebook-jssdk"))return;let c=document.createElement("script");c.id="facebook-jssdk",c.src="https://connect.facebook.net/fr_FR/sdk.js",c.async=!0,c.defer=!0,c.crossOrigin="anonymous",c.onerror=()=>{clearTimeout(r),Oe=null,n(new Error("Could not load the Facebook script."))},document.head.appendChild(c)}),Oe)}typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{di()}):di());var hd=()=>new Proxy({},{get(t,e){let n=String(e);return async(r={})=>{let i=await v(A("call"),{functionName:n,payload:r});return F(i)}}}),G=t=>t&&(Array.isArray(t)?t.map(e=>e&&e._id&&!e.id?{...e,id:String(e._id)}:e):typeof t=="object"&&t._id&&!t.id?{...t,id:String(t._id)}:t);function ui(t){let{where:e,limit:n,sort:r}=t||{};return e===void 0&&n===void 0&&r===void 0?{}:{queryOptions:{where:e,limit:n,sort:r}}}var X=(t,e,n)=>{(!n||typeof n!="object"||!n.desc&&!n.guard&&!n.role)&&console.warn(`[OZmoz] ${t}('${e}') : no {desc, guard, role} metadata provided \u2014 'npx ozmoz sync' will require it.`)},kn=new Map,fd=t=>{[kn.get(t),kn.get("*")].forEach(e=>{e&&e.forEach(n=>{try{n()}catch{}})})},fi={...hi,call:hd(),getUser:ca,add:async(t,e,n={})=>{Ke(t),X("add",t,n);let r=await v(A("crud"),{operation:"add",fleetboTable:t,jsonData:e});return Je("add",t,await F(r))},addWithId:async(t,e,n,r={})=>{Ke(t),X("addWithId",t,r);let i=await v(A("crud"),{operation:"addWithId",fleetboTable:t,id:n,jsonData:e});return Je("addWithId",t,await F(i))},addWithUserId:async(t,e,n={})=>{Ke(t),X("addWithUserId",t,n);let r=await v(A("crud"),{operation:"addWithUserId",fleetboTable:t,jsonData:e});return Je("addWithUserId",t,await F(r))},addWithMedia:async(t,e,n,r,i={})=>{Ke(t),X("addWithMedia",t,i);let s=await v(A("crud"),{operation:"addWithMedia",fleetboTable:t,jsonData:e,fileBase64:n,fileName:r});return Je("addWithMedia",t,await F(s))},update:async(t,e,n,r={})=>{X("update",t,r);let i=await v(A("crud"),{operation:"update",fleetboTable:t,id:e,...n});return Je("update",t,await F(i))},delete:async(t,e,n={})=>{X("delete",t,n);let r=await v(A("crud"),{operation:"delete",fleetboTable:t,id:e});return Je("delete",t,await F(r))},getDocsG:async(t,e={})=>{X("getDocsG",t,e);let n=await v(A("crud"),{operation:"getDocsG",fleetboTable:t,...ui(e)}),r=await F(n);return An("getDocsG",t,r),Array.isArray(r)?G(r):r&&Array.isArray(r.data)?G(r.data):[]},getDocsU:async(t,e={})=>{X("getDocsU",t,e);let n=await v(A("crud"),{operation:"getDocsU",fleetboTable:t,...ui(e)}),r=await F(n);return An("getDocsU",t,r),Array.isArray(r)?G(r):r&&Array.isArray(r.data)?G(r.data):[]},getDoc:async(t,e,n={})=>{X("getDoc",t,n);let r=await v(A("crud"),{operation:"getDoc",fleetboTable:t,id:e}),i=await F(r);return An("getDoc",t,i),i?i.data!==void 0?G(i.data):i.success===!1?null:G(i):null},getAuthUser:async()=>{let t=await v(A("crud"),{operation:"getAuthUser"}),e=await F(t);return e?e.data!==void 0?G(e.data):e.success===!1?null:G(e):null},join:async(t,e)=>{Ke(t),e?.innerJoin?.collection&&Ke(e.innerJoin.collection);let n=await v(A("crud"),{operation:"join",fleetboTable:t,joinOptions:e}),r=await F(n);return An("join",t,r),Array.isArray(r)?G(r):r&&Array.isArray(r.data)?G(r.data):[]},watch:(t,e={},n,r)=>{let i=t&&typeof t=="object"?String(t.call||"").replace(/^\$/,""):"",s=i?"":String(t||""),a=i||s;if(!a)return console.error("[OZmoz] watch() needs a table name or { call: 'name' } as 1st argument."),()=>{};if(typeof n!="function")return console.error(`[OZmoz] watch('${a}') needs a callback as 3rd argument.`),()=>{};i||X("watch",s,e);let c=!i&&e&&e.scope==="user"?"user":"all",l=i?t.payload||{}:null,o=i?750:250,u=i?2e4:1e4,f=Sn(),h=!f&&typeof window<"u"&&typeof WebSocket<"u",m=!1,w=0,T=[],N=[],L="",R="",z=!1,Ye=!1,C=0,Ne=!1,le=null,ue=null,Pn=null,Ze=null,pi=_=>(_&&_.error&&typeof _.error=="object"?_.error.message:_&&_.error)||_&&_.message||"read failed",de=async()=>{let _=++w;try{if(i){let I=await F(await v(A("call"),{functionName:i,payload:l,watch:!0}));if(m||_!==w)return;if(!I||I.success===!1)throw new Error(pi(I));let{_live:M,...x}=I;N=M&&Array.isArray(M.u)?M.u:[],L=M&&M.k?String(M.k):"",n(x),h&&va()}else{let I=await F(await v(A("crud"),{operation:c==="user"?"getDocsU":"getDocsG",fleetboTable:s,...ui(e)}));if(m||_!==w)return;if(I&&I.success===!1)throw new Error(pi(I));let M=Array.isArray(I)?I:I&&Array.isArray(I.data)?I.data:[];n(G(M))}}catch(I){!m&&typeof r=="function"&&r(I)}},vt=()=>{clearTimeout(le),le=setTimeout(de,o)},wa=()=>{Ze||(Ze=setInterval(de,u))},mi=()=>{clearInterval(Ze),Ze=null};if(f){let _=i?"*":s,I=kn.get(_);I||(I=new Set,kn.set(_,I)),I.add(vt);let M=`oz_proto:${ba()||"app"}:`,x=ye=>{ye.key&&(i?ye.key.indexOf(M)===0:ye.key===M+s)&&vt()};return typeof window<"u"&&window.addEventListener("storage",x),de(),()=>{m=!0,clearTimeout(le),I.delete(vt),typeof window<"u"&&window.removeEventListener("storage",x)}}if(!h)return de(),()=>{m=!0};let Ta=()=>{clearInterval(Pn),Pn=setInterval(()=>T.forEach(_=>{try{_.send("ping")}catch{}}),3e4)},Rn=()=>{let _=T;T=[],clearInterval(Pn),_.forEach(I=>{I.onclose=null;try{I.close()}catch{}})},gi=()=>{m||Ze||(Ne||(Ne=!0,console.warn(`[OZmoz] watch('${a}'): live updates unavailable, refreshing every ${u/1e3} s.`)),wa())},_i=()=>{Rn(),gi(),Ye&&de(),!i&&!m&&C<6&&(clearTimeout(ue),ue=setTimeout(Cn,Math.min(6e4,2e3*2**C++)))},Ii=_=>{if(m||T.length||!_.length)return!1;let I=0;return _.forEach(M=>{let x;try{x=new WebSocket(M)}catch{return}T.push(x),x.onopen=()=>{++I===1&&(Ye=!0,C=0,mi(),Ta(),i||de())},x.onmessage=ye=>{ye.data!=="pong"&&vt()},x.onclose=()=>{T.indexOf(x)!==-1&&_i()},x.onerror=()=>{try{x.close()}catch{}}}),T.length>0},va=()=>{m||T.length&&L===R||(Rn(),R=L,Ii(N)||gi())},Cn=async()=>{if(!(m||z||T.length)){z=!0;try{let _=await v(A("getRealtimeTicket"),{fleetboTable:s});if(m)return;if(!_||_.success===!1||!_.url)throw new Error("ticket");if(!Ii([_.url]))throw new Error("open")}catch{_i()}finally{z=!1}}},yi=()=>{document.hidden||m||T.length||z||(clearTimeout(ue),C=0,i?de():Cn())};return typeof document<"u"&&document.addEventListener("visibilitychange",yi),de(),i||Cn(),()=>{m=!0,clearTimeout(le),clearTimeout(ue),mi(),Rn(),typeof document<"u"&&document.removeEventListener("visibilitychange",yi)}},seed:async(t,e)=>Sn()?ma(ba(),t,e):{success:!0,seeded:!1,isPrototype:!1},sendotpsvro:async t=>{let e=typeof t=="string"?{email:t}:t||{};return await v(A("sendOtpSvro"),e)},verifyotpsvro:async(t,e)=>{let n=await v(A("verifyOtpSvro"),{email:t,code:e});if(n.success&&n.customToken)try{return{success:!0,user:await wn(n.customToken)}}catch(r){return{success:!1,error:r.message}}return n},sendOtpByPhone:async t=>{let e=typeof t=="string"?{phoneNumber:t}:t||{};return await v(A("sendOtpByPhone"),e)},verifyOtpPhoneSvro:async(t,e)=>{let n=await v(A("verifyOtpPhoneSvro"),{phoneNumber:t,code:e});if(n.success&&n.customToken)try{return{success:!0,user:await wn(n.customToken)}}catch(r){return{success:!1,error:r.message}}return n},verifyFacebookAuth:(t={})=>new Promise(e=>{let n=typeof t=="string"?t:t?.accessToken,r=async c=>{try{let l=await v(A("verifyFacebookAuth"),{accessToken:c}),o=l.customToken||l.token;if(l.success&&o){let u=await wn(o);e({success:!0,user:u,profile:l.profile||null,projects:l.projects||[]})}else e(l)}catch(l){e({success:!1,error:l.message})}};if(n){r(n);return}if(typeof window>"u")return e({success:!1,error:"Not a browser environment."});let i=window;if(!i.FB||!i.__ozmoz_fb_ready||typeof i.FB.login!="function")return di(),e({success:!1,error:"The Meta service is starting up. Click the button again."});let s=setTimeout(()=>{e({success:!1,cancelled:!0,error:"Login timed out. The window was closed or blocked."})},12e4),a=t?.scope||"public_profile,email";try{i.FB.login(c=>{if(clearTimeout(s),!c||c.error)return e({success:!1,error:c?.error||"Window closed."});if(c.status==="unknown"||!c.authResponse?.accessToken)return e({success:!1,cancelled:!0,error:"Facebook sign-in cancelled."});r(c.authResponse.accessToken)},{scope:a,return_scopes:!0})}catch(c){clearTimeout(s),e({success:!1,error:c.message})}}),isAuthenticated:async(t=!1)=>await la(t),logout:async()=>{try{return await aa(),{success:!0}}catch(t){return{success:!1,error:t.message}}},acl:{grant:async(t,e,n,r="*")=>await v(A("grantAcl"),{targetUserId:t,action:e,resourceTable:n,resourceId:r}),revoke:async(t,e,n,r="*")=>await v(A("revokeAcl"),{targetUserId:t,action:e,resourceTable:n,resourceId:r}),can:async(t,e,n="*")=>{let r=await v(A("checkAcl"),{action:t,resourceTable:e,resourceId:n});return!!(r&&(r.allowed===!0||r.can===!0))}}},Xd=fi;typeof window<"u"&&(window.oz=fi,window.OzUI=hi);typeof globalThis<"u"&&(globalThis.oz=fi,globalThis.OzUI=hi);if(typeof window<"u"&&typeof document<"u"){let t=()=>setTimeout(()=>{Sn()||Ce().catch(()=>{})},400);document.readyState==="complete"?t():window.addEventListener("load",t,{once:!0})}export{hi as OzUI,Xd as default,fi as oz};
|
|
1
|
+
var Aa=Object.defineProperty;var B=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var bi=(t,e)=>{for(var n in e)Aa(t,n,{get:e[n],enumerable:!0})};var Ei,wi=B(()=>{Ei=()=>{}});function Pa(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}function O(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function ki(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(O())}function Pi(){return typeof window<"u"||Fn()}function Fn(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Ri(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Ci(){let t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function Oi(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Ni(){let t=O();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function Di(){try{return typeof indexedDB=="object"}catch{return!1}}function Li(){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)}})}function Da(t,e){return t.replace(La,(n,r)=>{let i=e[r];return i!=null?String(i):`<${r}?>`})}function Mi(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function he(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],a=e[i];if(Ti(s)&&Ti(a)){if(!he(s,a))return!1}else if(s!==a)return!1}for(let i of r)if(!n.includes(i))return!1;return!0}function Ti(t){return t!==null&&typeof t=="object"}function be(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 Le(t){let e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){let[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Me(t){let e=t.indexOf("?");if(!e)return"";let n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function Ui(t,e){let n=new Dn(t,e);return n.subscribe.bind(n)}function Ma(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 On(){}function p(t){return t&&t._delegate?t._delegate:t}function St(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Fi(t){return(await fetch(t,{credentials:"include"})).ok}var vi,Sa,Ai,Nn,ka,Ln,Xe,Ra,Ca,Oa,Mn,Si,At,Un,De,Na,H,Q,La,Dn,Id,Ue=B(()=>{wi();vi=function(t){let e=[],n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},Sa=function(t){let e=[],n=0,r=0;for(;n<t.length;){let i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){let s=t[n++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=t[n++],a=t[n++],c=t[n++],l=((i&7)<<18|(s&63)<<12|(a&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{let s=t[n++],a=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|a&63)}}return e.join("")},Ai={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<t.length;i+=3){let s=t[i],a=i+1<t.length,c=a?t[i+1]:0,l=i+2<t.length,o=l?t[i+2]:0,u=s>>2,f=(s&3)<<4|c>>4,h=(c&15)<<2|o>>6,m=o&63;l||(m=64,a||(h=64)),r.push(n[u],n[f],n[h],n[m])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(vi(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):Sa(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<t.length;){let s=n[t.charAt(i++)],c=i<t.length?n[t.charAt(i)]:0;++i;let o=i<t.length?n[t.charAt(i)]:64;++i;let f=i<t.length?n[t.charAt(i)]:64;if(++i,s==null||c==null||o==null||f==null)throw new Nn;let h=s<<2|c>>4;if(r.push(h),o!==64){let m=c<<4&240|o>>2;if(r.push(m),f!==64){let w=o<<6&192|f;r.push(w)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},Nn=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},ka=function(t){let e=vi(t);return Ai.encodeByteArray(e,!0)},Ln=function(t){return ka(t).replace(/\./g,"")},Xe=function(t){try{return Ai.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};Ra=()=>Pa().__FIREBASE_DEFAULTS__,Ca=()=>{if(typeof process>"u"||typeof process.env>"u")return;let t=process.env.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},Oa=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=t&&Xe(t[1]);return e&&JSON.parse(e)},Mn=()=>{try{return Ei()||Ra()||Ca()||Oa()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},Si=t=>Mn()?.emulatorHosts?.[t],At=()=>Mn()?.config,Un=t=>Mn()?.[`_${t}`];De=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}};Na="FirebaseError",H=class t extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=Na,Object.setPrototypeOf(this,t.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Q.prototype.create)}},Q=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],a=s?Da(s,r):"Error",c=`${this.serviceName}: ${a} (${i}).`;return new H(i,c,r)}};La=/\{\$([^}]+)}/g;Dn=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.");Ma(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=On),i.error===void 0&&(i.error=On),i.complete===void 0&&(i.complete=On);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}))}};Id=14400*1e3;});function Ua(t){return t===Ee?void 0:t}function Fa(t){return t.instantiationMode==="EAGER"}var q,Ee,xn,Qe,kt=B(()=>{Ue();q=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}};Ee="[DEFAULT]";xn=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 De;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(Fa(e))try{this.getOrInitializeService({instanceIdentifier:Ee})}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=Ee){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=Ee){return this.instances.has(e)}getOptions(e=Ee){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,a]of this.instancesDeferred.entries()){let c=this.normalizeInstanceIdentifier(s);r===c&&a.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:Ua(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=Ee){return this.component?this.component.multipleInstances?e:Ee:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};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 xn(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}});function Vi(t){Vn.forEach(e=>{e.setLogLevel(t)})}function Wi(t,e){for(let n of Vn){let r=null;e&&e.level&&(r=xi[e.level]),t===null?n.userLogHandler=null:n.userLogHandler=(i,s,...a)=>{let c=a.map(l=>{if(l==null)return null;if(typeof l=="string")return l;if(typeof l=="number"||typeof l=="boolean")return l.toString();if(l instanceof Error)return l.message;try{return JSON.stringify(l)}catch{return null}}).filter(l=>l).join(" ");s>=(r??i.logLevel)&&t({level:g[s].toLowerCase(),message:c,args:a,type:i.name})}}}var Vn,g,xi,xa,Va,Wa,Fe,Pt=B(()=>{Vn=[];(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"})(g||(g={}));xi={debug:g.DEBUG,verbose:g.VERBOSE,info:g.INFO,warn:g.WARN,error:g.ERROR,silent:g.SILENT},xa=g.INFO,Va={[g.DEBUG]:"log",[g.VERBOSE]:"log",[g.INFO]:"info",[g.WARN]:"warn",[g.ERROR]:"error"},Wa=(t,e,...n)=>{if(e<t.logLevel)return;let r=new Date().toISOString(),i=Va[e];if(i)console[i](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},Fe=class{constructor(e){this.name=e,this._logLevel=xa,this._logHandler=Wa,this._userLogHandler=null,Vn.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in g))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?xi[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,g.DEBUG,...e),this._logHandler(this,g.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,g.VERBOSE,...e),this._logHandler(this,g.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,g.INFO,...e),this._logHandler(this,g.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,g.WARN,...e),this._logHandler(this,g.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,g.ERROR,...e),this._logHandler(this,g.ERROR,...e)}}});function za(){return Hi||(Hi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Ba(){return zi||(zi=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}function $a(t){let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",a)},s=()=>{n(K(t.result)),i()},a=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",a)});return e.then(n=>{n instanceof IDBCursor&&Bi.set(n,t)}).catch(()=>{}),Bn.set(e,t),e}function ja(t){if(Hn.has(t))return;let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",a),t.removeEventListener("abort",a)},s=()=>{n(),i()},a=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",a),t.addEventListener("abort",a)});Hn.set(t,e)}function ji(t){zn=t(zn)}function Ga(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let r=t.call(Rt(this),e,...n);return $i.set(r,e.sort?e.sort():[e]),K(r)}:Ba().includes(t)?function(...e){return t.apply(Rt(this),e),K(Bi.get(this))}:function(...e){return K(t.apply(Rt(this),e))}}function qa(t){return typeof t=="function"?Ga(t):(t instanceof IDBTransaction&&ja(t),Ha(t,za())?new Proxy(t,zn):t)}function K(t){if(t instanceof IDBRequest)return $a(t);if(Wn.has(t))return Wn.get(t);let e=qa(t);return e!==t&&(Wn.set(t,e),Bn.set(e,t)),e}var Ha,Hi,zi,Bi,Hn,$i,Wn,Bn,zn,Rt,$n=B(()=>{Ha=(t,e)=>e.some(n=>t instanceof n);Bi=new WeakMap,Hn=new WeakMap,$i=new WeakMap,Wn=new WeakMap,Bn=new WeakMap;zn={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Hn.get(t);if(e==="objectStoreNames")return t.objectStoreNames||$i.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return K(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}};Rt=t=>Bn.get(t)});function qi(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){let a=indexedDB.open(t,e),c=K(a);return r&&a.addEventListener("upgradeneeded",l=>{r(K(a.result),l.oldVersion,l.newVersion,K(a.transaction),l)}),n&&a.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),c.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",o=>i(o.oldVersion,o.newVersion,o))}).catch(()=>{}),c}function Gi(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(jn.get(e))return jn.get(e);let n=e.replace(/FromIndex$/,""),r=e!==n,i=Ja.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||Ka.includes(n)))return;let s=async function(a,...c){let l=this.transaction(a,i?"readwrite":"readonly"),o=l.store;return r&&(o=o.index(c.shift())),(await Promise.all([o[n](...c),i&&l.done]))[0]};return jn.set(e,s),s}var Ka,Ja,jn,Ki=B(()=>{$n();$n();Ka=["get","getKey","getAll","getAllKeys","count"],Ja=["put","add","delete","clear"],jn=new Map;ji(t=>({...t,get:(e,n,r)=>Gi(e,n)||t.get(e,n,r),has:(e,n)=>!!Gi(e,n)||t.has(e,n)}))});function Ya(t){return t.getComponent()?.type==="VERSION"}function Jn(t,e){try{t.container.addComponent(e)}catch(n){ee.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Ac(t,e){t.container.addOrOverwriteComponent(e)}function we(t){let e=t.name;if(Ve.has(e))return ee.debug(`There were multiple attempts to register component ${e}.`),!1;Ve.set(e,t);for(let n of fe.values())Jn(n,t);for(let n of xe.values())Jn(n,t);return!0}function nt(t,e){let n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Sc(t,e,n=et){nt(t,e).clearInstance(n)}function Qn(t){return t.options!==void 0}function Qi(t){return Qn(t)?!1:"authIdToken"in t||"appCheckToken"in t||"releaseOnDeref"in t||"automaticDataCollectionEnabled"in t}function E(t){return t==null?!1:t.settings!==void 0}function kc(){Ve.clear()}function Ji(t,e){let n=Xe(t.split(".")[1]);if(n===null){console.error(`FirebaseServerApp ${e} is invalid: second part could not be parsed.`);return}if(JSON.parse(n).exp===void 0){console.error(`FirebaseServerApp ${e} is invalid: expiration claim could not be parsed`);return}let i=JSON.parse(n).exp*1e3,s=new Date().getTime();i-s<=0&&console.error(`FirebaseServerApp ${e} is invalid: the token has expired.`)}function es(t,e={}){let n=t;typeof e!="object"&&(e={name:e});let r={name:et,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw V.create("bad-app-name",{appName:String(i)});if(n||(n=At()),!n)throw V.create("no-options");let s=fe.get(i);if(s){if(he(n,s.options)&&he(r,s.config))return s;throw V.create("duplicate-app",{appName:i})}let a=new Qe(i);for(let l of Ve.values())a.addComponent(l);let c=new Ot(n,r,a);return fe.set(i,c),c}function Rc(t,e={}){if(Pi()&&!Fn())throw V.create("invalid-server-app-environment");let n,r=e||{};if(t&&(Qn(t)?n=t.options:Qi(t)?r=t:n=t),r.automaticDataCollectionEnabled===void 0&&(r.automaticDataCollectionEnabled=!0),n||(n=At()),!n)throw V.create("no-options");let i={...r,...n};i.releaseOnDeref!==void 0&&delete i.releaseOnDeref;let s=u=>[...u].reduce((f,h)=>Math.imul(31,f)+h.charCodeAt(0)|0,0);if(r.releaseOnDeref!==void 0&&typeof FinalizationRegistry>"u")throw V.create("finalization-registry-not-supported",{});let a=""+s(JSON.stringify(i)),c=xe.get(a);if(c)return c.incRefCount(r.releaseOnDeref),c;let l=new Qe(a);for(let u of Ve.values())l.addComponent(u);let o=new Yn(n,r,a,l);return xe.set(a,o),o}function er(t=et){let e=fe.get(t);if(!e&&t===et&&At())return es();if(!e)throw V.create("no-app",{appName:t});return e}function Cc(){return Array.from(fe.values())}async function ts(t){let e=!1,n=t.name;fe.has(n)?(e=!0,fe.delete(n)):xe.has(n)&&t.decRefCount()<=0&&(xe.delete(n),e=!0),e&&(await Promise.all(t.container.getProviders().map(r=>r.delete())),t.isDeleted=!0)}function J(t,e,n){let r=vc[t]??t;n&&(r+=`-${n}`);let i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){let a=[`Unable to register library "${r}" with version "${e}":`];i&&a.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&a.push("and"),s&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),ee.warn(a.join(" "));return}we(new q(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}function Oc(t,e){if(t!==null&&typeof t!="function")throw V.create("invalid-log-argument");Wi(t,e)}function Nc(t){Vi(t)}function ns(){return Gn||(Gn=qi(Dc,Lc,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(tt)}catch(n){console.warn(n)}}}}).catch(t=>{throw V.create("idb-open",{originalErrorMessage:t.message})})),Gn}async function Mc(t){try{let n=(await ns()).transaction(tt),r=await n.objectStore(tt).get(rs(t));return await n.done,r}catch(e){if(e instanceof H)ee.warn(e.message);else{let n=V.create("idb-get",{originalErrorMessage:e?.message});ee.warn(n.message)}}}async function Yi(t,e){try{let r=(await ns()).transaction(tt,"readwrite");await r.objectStore(tt).put(e,rs(t)),await r.done}catch(n){if(n instanceof H)ee.warn(n.message);else{let r=V.create("idb-set",{originalErrorMessage:n?.message});ee.warn(r.message)}}}function rs(t){return`${t.name}!${t.options.appId}`}function Zi(){return new Date().toISOString().substring(0,10)}function xc(t,e=Uc){let n=[],r=t.slice();for(let i of t){let s=n.find(a=>a.agent===i.agent);if(s){if(s.dates.push(i.date),Xi(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Xi(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}function Xi(t){return Ln(JSON.stringify({version:2,heartbeats:t})).length}function Vc(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 Wc(t){we(new q("platform-logger",e=>new qn(e),"PRIVATE")),we(new q("heartbeat",e=>new Zn(e),"PRIVATE")),J(Ct,Kn,t),J(Ct,Kn,"esm2020"),J("fire-js","")}var qn,Ct,Kn,ee,Za,Xa,Qa,ec,tc,nc,rc,ic,sc,oc,ac,cc,lc,uc,dc,hc,fc,pc,mc,gc,_c,Ic,yc,bc,Ec,wc,Tc,et,vc,fe,xe,Ve,Pc,V,Ot,Yn,Te,Dc,Lc,tt,Gn,Uc,Fc,Zn,Xn,rt=B(()=>{kt();Pt();Ue();Ue();Ki();qn=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(Ya(n)){let r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}};Ct="@firebase/app",Kn="0.15.1";ee=new Fe("@firebase/app"),Za="@firebase/app-compat",Xa="@firebase/analytics-compat",Qa="@firebase/analytics",ec="@firebase/app-check-compat",tc="@firebase/app-check",nc="@firebase/auth",rc="@firebase/auth-compat",ic="@firebase/database",sc="@firebase/data-connect",oc="@firebase/database-compat",ac="@firebase/functions",cc="@firebase/functions-compat",lc="@firebase/installations",uc="@firebase/installations-compat",dc="@firebase/messaging",hc="@firebase/messaging-compat",fc="@firebase/performance",pc="@firebase/performance-compat",mc="@firebase/remote-config",gc="@firebase/remote-config-compat",_c="@firebase/storage",Ic="@firebase/storage-compat",yc="@firebase/firestore",bc="@firebase/ai",Ec="@firebase/firestore-compat",wc="firebase",Tc="12.16.0";et="[DEFAULT]",vc={[Ct]:"fire-core",[Za]:"fire-core-compat",[Qa]:"fire-analytics",[Xa]:"fire-analytics-compat",[tc]:"fire-app-check",[ec]:"fire-app-check-compat",[nc]:"fire-auth",[rc]:"fire-auth-compat",[ic]:"fire-rtdb",[sc]:"fire-data-connect",[oc]:"fire-rtdb-compat",[ac]:"fire-fn",[cc]:"fire-fn-compat",[lc]:"fire-iid",[uc]:"fire-iid-compat",[dc]:"fire-fcm",[hc]:"fire-fcm-compat",[fc]:"fire-perf",[pc]:"fire-perf-compat",[mc]:"fire-rc",[gc]:"fire-rc-compat",[_c]:"fire-gcs",[Ic]:"fire-gcs-compat",[yc]:"fire-fst",[Ec]:"fire-fst-compat",[bc]:"fire-vertex","fire-js":"fire-js",[wc]:"fire-js-all"};fe=new Map,xe=new Map,Ve=new Map;Pc={"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."},V=new Q("app","Firebase",Pc);Ot=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 q("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 V.create("app-deleted",{appName:this._name})}};Yn=class extends Ot{constructor(e,n,r,i){let s=n.automaticDataCollectionEnabled!==void 0?n.automaticDataCollectionEnabled:!0,a={name:r,automaticDataCollectionEnabled:s};if(e.apiKey!==void 0)super(e,a,i);else{let c=e;super(c.options,a,i)}this._serverConfig={automaticDataCollectionEnabled:s,...n},this._serverConfig.authIdToken&&Ji(this._serverConfig.authIdToken,"authIdToken"),this._serverConfig.appCheckToken&&Ji(this._serverConfig.appCheckToken,"appCheckToken"),this._finalizationRegistry=null,typeof FinalizationRegistry<"u"&&(this._finalizationRegistry=new FinalizationRegistry(()=>{this.automaticCleanup()})),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=void 0,n.releaseOnDeref=void 0,J(Ct,Kn,"serverapp")}toJSON(){}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,e!==void 0&&this._finalizationRegistry!==null&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){ts(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw V.create("server-app-deleted")}};Te=Tc;Dc="firebase-heartbeat-database",Lc=1,tt="firebase-heartbeat-store",Gn=null;Uc=1024,Fc=30,Zn=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Xn(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=Zi();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>Fc){let i=Vc(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){ee.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=Zi(),{heartbeatsToSend:n,unsentEntries:r}=xc(this._heartbeatsCache.heartbeats),i=Ln(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 ee.warn(e),""}}};Xn=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Di()?Li().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await Mc(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let r=await this.read();return Yi(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 Yi(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}};Wc("")});var is={};bi(is,{FirebaseError:()=>H,SDK_VERSION:()=>Te,_DEFAULT_ENTRY_NAME:()=>et,_addComponent:()=>Jn,_addOrOverwriteComponent:()=>Ac,_apps:()=>fe,_clearComponents:()=>kc,_components:()=>Ve,_getProvider:()=>nt,_isFirebaseApp:()=>Qn,_isFirebaseServerApp:()=>E,_isFirebaseServerAppSettings:()=>Qi,_registerComponent:()=>we,_removeServiceInstance:()=>Sc,_serverApps:()=>xe,deleteApp:()=>ts,getApp:()=>er,getApps:()=>Cc,initializeApp:()=>es,initializeServerApp:()=>Rc,onLog:()=>Oc,registerVersion:()=>J,setLogLevel:()=>Nc});var Hc,zc,ss=B(()=>{rt();rt();Hc="firebase",zc="12.16.0";J(Hc,zc,"app")});function Bc(){return{"admin-restricted-operation":"This operation is restricted to administrators only.","argument-error":"","app-not-authorized":"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.","app-not-installed":"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.","captcha-check-failed":"The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","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.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-change-needs-verification":"Multi-factor users must always have a verified email.","email-already-in-use":"The email address is already in use by another account.","emulator-config-failed":'Auth instance has already been used to make a network call. Auth can no longer be configured to use the emulator. Try calling "connectAuthEmulator()" sooner.',"expired-action-code":"The action code has expired.","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal AuthError has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registered for the current project.","invalid-user-token":"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.","invalid-auth-event":"An internal AuthError has occurred.","invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure to use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-emulator-scheme":"Emulator URL must start with a valid scheme (http:// or https://).","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is incorrect, malformed or has expired.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].","invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.","login-blocked":"Login blocked by user-provided method: {$originalMessage}","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal AuthError has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-or-invalid-nonce":"The request does not contain a valid nonce. This can occur if the SHA-256 hash of the provided raw nonce does not match the hashed nonce in the ID token payload.","missing-password":"A non-empty password must be provided","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal AuthError has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.","rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled.","already-initialized":"initializeAuth() has already been called with different options. To avoid this error, call initializeAuth() with the same options as when it was originally called, or call getAuth() to return the already initialized instance.","missing-recaptcha-token":"The reCAPTCHA token is missing when sending request to the backend.","invalid-recaptcha-token":"The reCAPTCHA token is invalid when sending request to the backend.","invalid-recaptcha-action":"The reCAPTCHA action is invalid when sending request to the backend.","recaptcha-not-enabled":"reCAPTCHA Enterprise integration is not enabled for this project.","missing-client-type":"The reCAPTCHA client type is missing when sending request to the backend.","missing-recaptcha-version":"The reCAPTCHA version is missing when sending request to the backend.","invalid-req-type":"Invalid request parameters.","invalid-recaptcha-version":"The reCAPTCHA version is invalid when sending request to the backend.","unsupported-password-policy-schema-version":"The password policy received from the backend uses a schema version that is not supported by this version of the Firebase SDK.","password-does-not-meet-requirements":"The password does not meet the requirements.","invalid-hosting-link-domain":"The provided Hosting link domain is not configured in Firebase Hosting or is not owned by the current project. This cannot be a default Hosting domain (`web.app` or `firebaseapp.com`)."}}function Os(){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."}}function $c(t,...e){xt.logLevel<=g.WARN&&xt.warn(`Auth (${Te}): ${t}`,...e)}function Lt(t,...e){xt.logLevel<=g.ERROR&&xt.error(`Auth (${Te}): ${t}`,...e)}function U(t,...e){throw Ur(t,...e)}function D(t,...e){return Ur(t,...e)}function Mr(t,e,n){let r={...Lr(),[e]:n};return new Q("auth","Firebase",r).create(e,{appName:t.name})}function P(t){return Mr(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function qe(t,e,n){let r=n;if(!(e instanceof r))throw r.name!==e.constructor.name&&U(t,"argument-error"),Mr(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Ur(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 Ds.create(t,...e)}function d(t,e,...n){if(!t)throw Ur(e,...n)}function Y(t){let e="INTERNAL ASSERTION FAILED: "+t;throw Lt(e),new Error(e)}function re(t,e){t||Y(e)}function ut(){return typeof self<"u"&&self.location?.href||""}function Fr(){return os()==="http:"||os()==="https:"}function os(){return typeof self<"u"&&self.location?.protocol||null}function jc(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Fr()||Ci()||"connection"in navigator)?navigator.onLine:!0}function Gc(){if(typeof navigator>"u")return null;let t=navigator;return t.languages&&t.languages[0]||t.language||null}function xr(t,e){re(t.emulator,"Emulator should always be set here");let{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}function y(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function b(t,e,n,r,i={}){return Ms(t,i,async()=>{let s={},a={};r&&(e==="GET"?a=r:s={body:JSON.stringify(r)});let c=be({...a,key:t.config.apiKey}).slice(1),l=await t._getAdditionalHeaders();l["Content-Type"]="application/json",t.languageCode&&(l["X-Firebase-Locale"]=t.languageCode);let o={method:e,headers:l,...s};return Ri()||(o.referrerPolicy="strict-origin-when-cross-origin"),t.emulatorConfig&&St(t.emulatorConfig.host)&&(o.credentials="include"),Vt.fetch()(await Us(t,t.config.apiHost,n,c),o)})}async function Ms(t,e,n){t._canInitEmulator=!1;let r={...qc,...e};try{let i=new cr(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let a=await s.json();if("needConfirmation"in a)throw st(t,"account-exists-with-different-credential",a);if(s.ok&&!("errorMessage"in a))return a;{let c=s.ok?a.errorMessage:a.error.message,[l,o]=c.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw st(t,"credential-already-in-use",a);if(l==="EMAIL_EXISTS")throw st(t,"email-already-in-use",a);if(l==="USER_DISABLED")throw st(t,"user-disabled",a);let u=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Mr(t,u,o);U(t,u)}}catch(i){if(i instanceof H)throw i;U(t,"network-request-failed",{message:String(i)})}}async function ae(t,e,n,r,i={}){let s=await b(t,e,n,r,i);return"mfaPendingCredential"in s&&U(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function Us(t,e,n,r){let i=`${e}${n}?${r}`,s=t,a=s.config.emulator?xr(t.config,i):`${t.config.apiScheme}://${i}`;return Kc.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(a).toString():a}function Yc(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}function st(t,e,n){let r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);let i=D(t,e,r);return i.customData._tokenResponse=n,i}function as(t){return t!==void 0&&t.getResponse!==void 0}function cs(t){return t!==void 0&&t.enterprise!==void 0}async function Zc(t){return(await b(t,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function Fs(t,e){return b(t,"GET","/v2/recaptchaConfig",y(t,e))}async function Xc(t,e){return b(t,"POST","/v1/accounts:delete",e)}async function Qc(t,e){return b(t,"POST","/v1/accounts:update",e)}async function Ht(t,e){return b(t,"POST","/v1/accounts:lookup",e)}function ot(t){if(t)try{let e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}function xs(t,e=!1){return p(t).getIdToken(e)}async function Vr(t,e=!1){let n=p(t),r=await n.getIdToken(e),i=dn(r);d(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,a=s?.sign_in_provider;return{claims:i,token:r,authTime:ot(tr(i.auth_time)),issuedAtTime:ot(tr(i.iat)),expirationTime:ot(tr(i.exp)),signInProvider:a||null,signInSecondFactor:s?.sign_in_second_factor||null}}function tr(t){return Number(t)*1e3}function dn(t){let[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return Lt("JWT malformed, contained fewer than 3 sections"),null;try{let i=Xe(n);return i?JSON.parse(i):(Lt("Failed to decode base64 JWT payload"),null)}catch(i){return Lt("Caught error parsing JWT payload as JSON",i?.toString()),null}}function ls(t){let e=dn(t);return d(e,"internal-error"),d(typeof e.exp<"u","internal-error"),d(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ie(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof H&&el(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function el({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}async function ht(t){let e=t.auth,n=await t.getIdToken(),r=await ie(t,Ht(e,{idToken:n}));d(r?.users.length,e,"internal-error");let i=r.users[0];t._notifyReloadListener(i);let s=i.providerUserInfo?.length?Vs(i.providerUserInfo):[],a=tl(t.providerData,s),c=t.isAnonymous,l=!(t.email&&i.passwordHash)&&!a?.length,o=c?l:!1,u={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:a,metadata:new dt(i.createdAt,i.lastLoginAt),isAnonymous:o};Object.assign(t,u)}async function Wr(t){let e=p(t);await ht(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function tl(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function Vs(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 nl(t,e){let n=await Ms(t,{},async()=>{let r=be({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,a=await Us(t,i,"/v1/token",`key=${s}`),c=await t._getAdditionalHeaders();c["Content-Type"]="application/x-www-form-urlencoded";let l={method:"POST",headers:c,body:r};return t.emulatorConfig&&St(t.emulatorConfig.host)&&(l.credentials="include"),Vt.fetch()(a,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function rl(t,e){return b(t,"POST","/v2/accounts:revokeToken",y(t,e))}function pe(t,e){d(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}function te(t){re(t instanceof Function,"Expected a class definition");let e=us.get(t);return e?(re(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,us.set(t,e),e)}function Mt(t,e,n){return`firebase:${t}:${e}:${n}`}function ds(t){let e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Bs(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Ws(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(js(e))return"Blackberry";if(Gs(e))return"Webos";if(Hs(e))return"Safari";if((e.includes("chrome/")||zs(e))&&!e.includes("edge/"))return"Chrome";if($s(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 Ws(t=O()){return/firefox\//i.test(t)}function Hs(t=O()){let e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function zs(t=O()){return/crios\//i.test(t)}function Bs(t=O()){return/iemobile/i.test(t)}function $s(t=O()){return/android/i.test(t)}function js(t=O()){return/blackberry/i.test(t)}function Gs(t=O()){return/webos/i.test(t)}function Hr(t=O()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function il(t=O()){return Hr(t)&&!!window.navigator?.standalone}function sl(){return Ni()&&document.documentMode===10}function qs(t=O()){return Hr(t)||$s(t)||Gs(t)||js(t)||/windows phone/i.test(t)||Bs(t)}function Ks(t,e=[]){let n;switch(t){case"Browser":n=ds(O());break;case"Worker":n=`${ds(O())}-${t}`;break;default:n=t}let r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Te}/${r}`}async function ol(t,e={}){return b(t,"GET","/v2/passwordPolicy",y(t,e))}function S(t){return p(t)}function cl(t){yt=t}function zr(t){return yt.loadJS(t)}function ll(){return yt.recaptchaV2Script}function ul(){return yt.recaptchaEnterpriseScript}function dl(){return yt.gapiScript}function Js(t){return`__${t}${Math.floor(Math.random()*1e6)}`}function pl(t){let e=[],n="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let r=0;r<t;r++)e.push(n.charAt(Math.floor(Math.random()*n.length)));return e.join("")}async function it(t,e,n,r=!1,i=!1){let s=new ft(t),a;if(i)a=ct;else try{a=await s.verify(n)}catch{a=await s.verify(n,!0)}let c={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in c){let l=c.phoneEnrollmentInfo.phoneNumber,o=c.phoneEnrollmentInfo.recaptchaToken;Object.assign(c,{phoneEnrollmentInfo:{phoneNumber:l,recaptchaToken:o,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in c){let l=c.phoneSignInInfo.recaptchaToken;Object.assign(c,{phoneSignInInfo:{recaptchaToken:l,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return c}return r?Object.assign(c,{captchaResp:a}):Object.assign(c,{captchaResponse:a}),Object.assign(c,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(c,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),c}async function ge(t,e,n,r,i){if(i==="EMAIL_PASSWORD_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await it(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 a=await it(t,e,n,n==="getOobCode");return r(t,a)}else return Promise.reject(s)});else if(i==="PHONE_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let s=await it(t,e,n);return r(t,s).catch(async a=>{if(t._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&(a.code==="auth/missing-recaptcha-token"||a.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 c=await it(t,e,n,!1,!0);return r(t,c)}return Promise.reject(a)})}else{let s=await it(t,e,n,!1,!0);return r(t,s)}else return Promise.reject(i+" provider is not supported.")}async function Ys(t){let e=S(t),n=await Fs(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),r=new Wt(n);e.tenantId==null?e._agentRecaptchaConfig=r:e._tenantRecaptchaConfigs[e.tenantId]=r,r.isAnyProviderEnabled()&&new ft(e).verify()}function Br(t,e){let n=nt(t,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(he(s,e??{}))return i;U(i,"already-initialized")}return n.initialize({options:e})}function gl(t,e){let n=e?.persistence||[],r=(Array.isArray(n)?n:[n]).map(te);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e?.popupRedirectResolver)}function $r(t,e,n){let r=S(t);d(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Zs(e),{host:a,port:c}=_l(e),l=c===null?"":`:${c}`,o={url:`${s}//${a}${l}/`},u=Object.freeze({host:a,port:c,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){d(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),d(he(o,r.config.emulator)&&he(u,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=o,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,St(a)?Fi(`${s}//${a}${l}`):i||Il()}function Zs(t){let e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function _l(t){let e=Zs(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:fs(r.substr(s.length+1))}}else{let[s,a]=r.split(":");return{host:s,port:fs(a)}}}function fs(t){if(!t)return null;let e=Number(t);return isNaN(e)?null:e}function Il(){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())}async function Xs(t,e){return b(t,"POST","/v1/accounts:resetPassword",y(t,e))}async function yl(t,e){return b(t,"POST","/v1/accounts:update",e)}async function bl(t,e){return b(t,"POST","/v1/accounts:signUp",e)}async function El(t,e){return b(t,"POST","/v1/accounts:update",y(t,e))}async function wl(t,e){return ae(t,"POST","/v1/accounts:signInWithPassword",y(t,e))}async function hn(t,e){return b(t,"POST","/v1/accounts:sendOobCode",y(t,e))}async function Tl(t,e){return hn(t,e)}async function vl(t,e){return hn(t,e)}async function Al(t,e){return hn(t,e)}async function Sl(t,e){return hn(t,e)}async function kl(t,e){return ae(t,"POST","/v1/accounts:signInWithEmailLink",y(t,e))}async function Pl(t,e){return ae(t,"POST","/v1/accounts:signInWithEmailLink",y(t,e))}async function ne(t,e){return ae(t,"POST","/v1/accounts:signInWithIdp",y(t,e))}async function ps(t,e){return b(t,"POST","/v1/accounts:sendVerificationCode",y(t,e))}async function Cl(t,e){return ae(t,"POST","/v1/accounts:signInWithPhoneNumber",y(t,e))}async function Ol(t,e){let n=await ae(t,"POST","/v1/accounts:signInWithPhoneNumber",y(t,e));if(n.temporaryProof)throw st(t,"account-exists-with-different-credential",n);return n}async function Dl(t,e){let n={...e,operation:"REAUTH"};return ae(t,"POST","/v1/accounts:signInWithPhoneNumber",y(t,n),Nl)}function Ll(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 Ml(t){let e=Le(Me(t)).link,n=e?Le(Me(e)).deep_link_id:null,r=Le(Me(t)).deep_link_id;return(r?Le(Me(r)).link:null)||r||n||e||t}function Qs(t){return Se.parseLink(t)}async function eo(t,e){return ae(t,"POST","/v1/accounts:signUp",y(t,e))}function ms(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}async function to(t){if(E(t.app))return Promise.reject(P(t));let e=S(t);if(await e._initializationPromise,e.currentUser?.isAnonymous)return new j({user:e.currentUser,providerId:null,operationType:"signIn"});let n=await eo(e,{returnSecureToken:!0}),r=await j._fromIdTokenResponse(e,"signIn",n,!0);return await e._updateCurrentUser(r.user),r}function no(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?_r._fromErrorAndOperation(t,s,e,r):s})}function ro(t){return new Set(t.map(({providerId:e})=>e).filter(e=>!!e))}async function io(t,e){let n=p(t);await fn(!0,n,e);let{providerUserInfo:r}=await Qc(n.auth,{idToken:await n.getIdToken(),deleteProvider:[e]}),i=ro(r||[]);return n.providerData=n.providerData.filter(s=>i.has(s.providerId)),i.has("phone")||(n.phoneNumber=null),await n.auth._persistUserIfCurrent(n),n}async function jr(t,e,n=!1){let r=await ie(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return j._forOperation(t,"link",r)}async function fn(t,e,n){await ht(e);let r=ro(e.providerData),i=t===!1?"provider-already-linked":"no-such-provider";d(r.has(n)===t,e.auth,i)}async function so(t,e,n=!1){let{auth:r}=t;if(E(r.app))return Promise.reject(P(r));let i="reauthenticate";try{let s=await ie(t,no(r,i,e,t),n);d(s.idToken,r,"internal-error");let a=dn(s.idToken);d(a,r,"internal-error");let{sub:c}=a;return d(t.uid===c,r,"user-mismatch"),j._forOperation(t,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&U(r,"user-mismatch"),s}}async function oo(t,e,n=!1){if(E(t.app))return Promise.reject(P(t));let r="signIn",i=await no(t,r,e),s=await j._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}async function bt(t,e){return oo(S(t),e)}async function Gr(t,e){let n=p(t);return await fn(!1,n,e.providerId),jr(n,e)}async function qr(t,e){return so(p(t),e)}async function xl(t,e){return ae(t,"POST","/v1/accounts:signInWithCustomToken",y(t,e))}async function ao(t,e){if(E(t.app))return Promise.reject(P(t));let n=S(t),r=await xl(n,{token:e,returnSecureToken:!0}),i=await j._fromIdTokenResponse(n,"signIn",r);return await n._updateCurrentUser(i.user),i}function pn(t,e,n){d(n.url?.length>0,t,"invalid-continue-uri"),d(typeof n.dynamicLinkDomain>"u"||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),d(typeof n.linkDomain>"u"||n.linkDomain.length>0,t,"invalid-hosting-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.linkDomain=n.linkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(d(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(d(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}async function Kr(t){let e=S(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function co(t,e,n){let r=S(t),i={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&pn(r,i,n),await ge(r,i,"getOobCode",vl,"EMAIL_PASSWORD_PROVIDER")}async function lo(t,e,n){await Xs(p(t),{oobCode:e,newPassword:n}).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&Kr(t),r})}async function uo(t,e){await El(p(t),{oobCode:e})}async function Jr(t,e){let n=p(t),r=await Xs(n,{oobCode:e}),i=r.requestType;switch(d(i,n,"internal-error"),i){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":d(r.newEmail,n,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":d(r.mfaInfo,n,"internal-error");default:d(r.email,n,"internal-error")}let s=null;return r.mfaInfo&&(s=ke._fromServerResponse(S(n),r.mfaInfo)),{data:{email:(r.requestType==="VERIFY_AND_CHANGE_EMAIL"?r.newEmail:r.email)||null,previousEmail:(r.requestType==="VERIFY_AND_CHANGE_EMAIL"?r.email:r.newEmail)||null,multiFactorInfo:s},operation:i}}async function ho(t,e){let{data:n}=await Jr(p(t),e);return n.email}async function fo(t,e,n){if(E(t.app))return Promise.reject(P(t));let r=S(t),a=await ge(r,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",eo,"EMAIL_PASSWORD_PROVIDER").catch(l=>{throw l.code==="auth/password-does-not-meet-requirements"&&Kr(t),l}),c=await j._fromIdTokenResponse(r,"signIn",a);return await r._updateCurrentUser(c.user),c}function po(t,e,n){return E(t.app)?Promise.reject(P(t)):bt(p(t),oe.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&Kr(t),r})}async function mo(t,e,n){let r=S(t),i={requestType:"EMAIL_SIGNIN",email:e,clientType:"CLIENT_TYPE_WEB"};function s(a,c){d(c.handleCodeInApp,r,"argument-error"),c&&pn(r,a,c)}s(i,n),await ge(r,i,"getOobCode",Al,"EMAIL_PASSWORD_PROVIDER")}function go(t,e){return Se.parseLink(e)?.operation==="EMAIL_SIGNIN"}async function _o(t,e,n){if(E(t.app))return Promise.reject(P(t));let r=p(t),i=oe.credentialWithLink(e,n||ut());return d(i._tenantId===(r.tenantId||null),r,"tenant-id-mismatch"),bt(r,i)}async function Vl(t,e){return b(t,"POST","/v1/accounts:createAuthUri",y(t,e))}async function Io(t,e){let n=Fr()?ut():"http://localhost",r={identifier:e,continueUri:n},{signinMethods:i}=await Vl(p(t),r);return i||[]}async function yo(t,e){let n=p(t),i={requestType:"VERIFY_EMAIL",idToken:await t.getIdToken()};e&&pn(n.auth,i,e);let{email:s}=await Tl(n.auth,i);s!==t.email&&await t.reload()}async function bo(t,e,n){let r=p(t),s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await t.getIdToken(),newEmail:e};n&&pn(r.auth,s,n);let{email:a}=await Sl(r.auth,s);a!==t.email&&await t.reload()}async function Wl(t,e){return b(t,"POST","/v1/accounts:update",e)}async function Eo(t,{displayName:e,photoURL:n}){if(e===void 0&&n===void 0)return;let r=p(t),s={idToken:await r.getIdToken(),displayName:e,photoUrl:n,returnSecureToken:!0},a=await ie(r,Wl(r.auth,s));r.displayName=a.displayName||null,r.photoURL=a.photoUrl||null;let c=r.providerData.find(({providerId:l})=>l==="password");c&&(c.displayName=r.displayName,c.photoURL=r.photoURL),await r._updateTokensIfNecessary(a)}function wo(t,e){let n=p(t);return E(n.auth.app)?Promise.reject(P(n.auth)):vo(n,e,null)}function To(t,e){return vo(p(t),null,e)}async function vo(t,e,n){let{auth:r}=t,s={idToken:await t.getIdToken(),returnSecureToken:!0};e&&(s.email=e),n&&(s.password=n);let a=await ie(t,yl(r,s));await t._updateTokensIfNecessary(a,!0)}function Hl(t){if(!t)return null;let{providerId:e}=t,n=t.rawUserInfo?JSON.parse(t.rawUserInfo):{},r=t.isNewUser||t.kind==="identitytoolkit#SignupNewUserResponse";if(!e&&t?.idToken){let i=dn(t.idToken)?.firebase?.sign_in_provider;if(i){let s=i!=="anonymous"&&i!=="custom"?i:null;return new _e(r,s)}}if(!e)return null;switch(e){case"facebook.com":return new br(r,n);case"github.com":return new Er(r,n);case"google.com":return new wr(r,n);case"twitter.com":return new Tr(r,n,t.screenName||null);case"custom":case"anonymous":return new _e(r,null);default:return new _e(r,e,n)}}function Ao(t){let{user:e,_tokenResponse:n}=t;return e.isAnonymous&&!n?{providerId:null,isNewUser:!1,profile:null}:Hl(n)}function So(t,e){return p(t).setPersistence(e)}function ko(t){return Ys(t)}async function Po(t,e){return S(t).validatePassword(e)}function Yr(t,e,n,r){return p(t).onIdTokenChanged(e,n,r)}function Zr(t,e,n){return p(t).beforeAuthStateChanged(e,n)}function Ro(t,e,n,r){return p(t).onAuthStateChanged(e,n,r)}function Co(t){p(t).useDeviceLanguage()}function Oo(t,e){return p(t).updateCurrentUser(e)}function No(t){return p(t).signOut()}function Do(t,e){return S(t).revokeAccessToken(e)}async function Lo(t){return p(t).delete()}function Mo(t,e){let n=p(t),r=e;return d(e.customData.operationType,n,"argument-error"),d(r.customData._serverResponse?.mfaPendingCredential,n,"argument-error"),vr._fromError(n,r)}function gs(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:start",y(t,e))}function zl(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:finalize",y(t,e))}function Bl(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:start",y(t,e))}function $l(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:finalize",y(t,e))}function jl(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:withdraw",y(t,e))}function Uo(t){let e=p(t);return nr.has(e)||nr.set(e,Ar._fromUser(e)),nr.get(e)}function rr(t){let e=t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),n=RegExp(`${e}=([^;]+)`);return document.cookie.match(n)?.[1]??null}function ir(t){return`${window.location.protocol==="http:"?"__dev_":"__HOST-"}FIREBASE_${t.split(":")[3]}`}function Jl(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}function gn(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}function k(){return window}function Yl(t){k().location.href=t}function Qr(){return typeof k().WorkerGlobalScope<"u"&&typeof k().importScripts=="function"}async function Zl(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Xl(){return navigator?.serviceWorker?.controller||null}function Ql(){return Qr()?self:null}function _n(t,e){return t.transaction([rn],e?"readwrite":"readonly").objectStore(rn)}function tu(){let t=indexedDB.deleteDatabase(xo);return new Pe(t).toPromise()}function Wo(){let t=indexedDB.open(xo,eu);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{let r=t.result;try{r.createObjectStore(rn,{keyPath:Vo})}catch(i){n(i)}}),t.addEventListener("success",async()=>{let r=t.result;r.objectStoreNames.contains(rn)?e(r):(r.close(),await tu(),e(await Wo()))})})}async function _s(t,e,n){let r=_n(t,!0).put({[Vo]:e,value:n});return new Pe(r).toPromise()}async function nu(t,e){let n=_n(t,!1).get(e),r=await new Pe(n).toPromise();return r===void 0?null:r.value}function Is(t,e){let n=_n(t,!0).delete(e);return new Pe(n).toPromise()}function ys(t,e){return b(t,"POST","/v2/accounts/mfaSignIn:start",y(t,e))}function su(t,e){return b(t,"POST","/v2/accounts/mfaSignIn:finalize",y(t,e))}function ou(t,e){return b(t,"POST","/v2/accounts/mfaSignIn:finalize",y(t,e))}function cu(t){return t.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(t)}function uu(){let t=null;return new Promise(e=>{if(document.readyState==="complete"){e();return}t=()=>e(),window.addEventListener("load",t)}).catch(e=>{throw t&&window.removeEventListener("load",t),e})}async function Ho(t,e,n){if(E(t.app))return Promise.reject(P(t));let r=S(t),i=await In(r,e,p(n));return new pt(i,s=>bt(r,s))}async function zo(t,e,n){let r=p(t);await fn(!1,r,"phone");let i=await In(r.auth,e,p(n));return new pt(i,s=>Gr(r,s))}async function Bo(t,e,n){let r=p(t);if(E(r.auth.app))return Promise.reject(P(r.auth));let i=await In(r.auth,e,p(n));return new pt(i,s=>qr(r,s))}async function In(t,e,n){if(!t._getRecaptchaConfig())try{await Ys(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){d(i.type==="enroll",t,"internal-error");let s={idToken:i.credential,phoneEnrollmentInfo:{phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await ge(t,s,"mfaSmsEnrollment",async(o,u)=>{if(u.phoneEnrollmentInfo.captchaResponse===ct){d(n?.type===lt,o,"argument-error");let f=await or(o,u,n);return gs(o,f)}return gs(o,u)},"PHONE_PROVIDER").catch(o=>Promise.reject(o))).phoneSessionInfo.sessionInfo}else{d(i.type==="signin",t,"internal-error");let s=r.multiFactorHint?.uid||r.multiFactorUid;d(s,t,"missing-multi-factor-info");let a={mfaPendingCredential:i.credential,mfaEnrollmentId:s,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await ge(t,a,"mfaSmsSignIn",async(u,f)=>{if(f.phoneSignInInfo.captchaResponse===ct){d(n?.type===lt,u,"argument-error");let h=await or(u,f,n);return ys(u,h)}return ys(u,f)},"PHONE_PROVIDER").catch(u=>Promise.reject(u))).phoneResponseInfo.sessionInfo}}else{let i={phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await ge(t,i,"sendVerificationCode",async(l,o)=>{if(o.captchaResponse===ct){d(n?.type===lt,l,"argument-error");let u=await or(l,o,n);return ps(l,u)}return ps(l,o)},"PHONE_PROVIDER").catch(l=>Promise.reject(l))).sessionInfo}}finally{n?._reset()}}async function $o(t,e){let n=p(t);if(E(n.auth.app))return Promise.reject(P(n.auth));await jr(n,e)}async function or(t,e,n){d(n.type===lt,t,"argument-error");let r=await n.verify();d(typeof r=="string",t,"argument-error");let i={...e};if("phoneEnrollmentInfo"in i){let s=i.phoneEnrollmentInfo.phoneNumber,a=i.phoneEnrollmentInfo.captchaResponse,c=i.phoneEnrollmentInfo.clientType,l=i.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(i,{phoneEnrollmentInfo:{phoneNumber:s,recaptchaToken:r,captchaResponse:a,clientType:c,recaptchaVersion:l}}),i}else if("phoneSignInInfo"in i){let s=i.phoneSignInInfo.captchaResponse,a=i.phoneSignInInfo.clientType,c=i.phoneSignInInfo.recaptchaVersion;return Object.assign(i,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:s,clientType:a,recaptchaVersion:c}}),i}else return Object.assign(i,{recaptchaToken:r}),i}function Re(t,e){return e?te(e):(d(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}function du(t){return oo(t.auth,new mt(t),t.bypassAuthState)}function hu(t){let{auth:e,user:n}=t;return d(n,e,"internal-error"),so(n,new mt(t),t.bypassAuthState)}async function fu(t){let{auth:e,user:n}=t;return d(n,e,"internal-error"),jr(n,new mt(t),t.bypassAuthState)}async function jo(t,e,n){if(E(t.app))return Promise.reject(D(t,"operation-not-supported-in-this-environment"));let r=S(t);qe(t,e,$);let i=Re(r,n);return new Ge(r,"signInViaPopup",e,i).executeNotNull()}async function Go(t,e,n){let r=p(t);if(E(r.auth.app))return Promise.reject(D(r.auth,"operation-not-supported-in-this-environment"));qe(r.auth,e,$);let i=Re(r.auth,n);return new Ge(r.auth,"reauthViaPopup",e,i,r).executeNotNull()}async function qo(t,e,n){let r=p(t);qe(r.auth,e,$);let i=Re(r.auth,n);return new Ge(r.auth,"linkViaPopup",e,i,r).executeNotNull()}async function gu(t,e){let n=Jo(e),r=Ko(t);if(!await r._isAvailable())return!1;let i=await r._get(n)==="true";return await r._remove(n),i}async function ti(t,e){return Ko(t)._set(Jo(e),"true")}function _u(t,e){Ut.set(t._key(),e)}function Ko(t){return te(t._redirectPersistence)}function Jo(t){return Mt(mu,t.config.apiKey,t.name)}function Yo(t,e,n){return Iu(t,e,n)}async function Iu(t,e,n){if(E(t.app))return Promise.reject(P(t));let r=S(t);qe(t,e,$),await r._initializationPromise;let i=Re(r,n);return await ti(i,r),i._openRedirect(r,e,"signInViaRedirect")}function Zo(t,e,n){return yu(t,e,n)}async function yu(t,e,n){let r=p(t);if(qe(r.auth,e,$),E(r.auth.app))return Promise.reject(P(r.auth));await r.auth._initializationPromise;let i=Re(r.auth,n);await ti(i,r.auth);let s=await ta(r);return i._openRedirect(r.auth,e,"reauthViaRedirect",s)}function Xo(t,e,n){return bu(t,e,n)}async function bu(t,e,n){let r=p(t);qe(r.auth,e,$),await r.auth._initializationPromise;let i=Re(r.auth,n);await fn(!1,r,e.providerId),await ti(i,r.auth);let s=await ta(r);return i._openRedirect(r.auth,e,"linkViaRedirect",s)}async function Qo(t,e){return await S(t)._initializationPromise,ea(t,e,!1)}async function ea(t,e,n=!1){if(E(t.app))return Promise.reject(P(t));let r=S(t),i=Re(r,e),a=await new Rr(r,i,n).execute();return a&&!n&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),a}async function ta(t){let e=gn(`${t.uid}:::`);return t._redirectEventId=e,await t.auth._setRedirectUser(t),await t.auth._persistUserIfCurrent(t),e}function bs(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function na({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function wu(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return na(t);default:return!1}}async function Tu(t,e={}){return b(t,"GET","/v1/projects",e)}async function Su(t){if(t.config.emulator)return;let{authorizedDomains:e}=await Tu(t);for(let n of e)try{if(ku(n))return}catch{}U(t,"unauthorized-domain")}function ku(t){let e=ut(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){let a=new URL(t);return a.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&a.hostname===r}if(!Au.test(n))return!1;if(vu.test(t))return r===t;let i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}function Es(){let t=k().___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 Ru(t){return new Promise((e,n)=>{function r(){Es(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Es(),n(D(t,"network-request-failed"))},timeout:Pu.get()})}if(k().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(k().gapi?.load)r();else{let i=Js("iframefcb");return k()[i]=()=>{gapi.load?r():n(D(t,"network-request-failed"))},zr(`${dl()}?onload=${i}`).catch(s=>n(s))}}).catch(e=>{throw Ft=null,e})}function Cu(t){return Ft=Ft||Ru(t),Ft}function Uu(t){let e=t.config;d(e.authDomain,t,"auth-domain-config-required");let n=e.emulator?xr(e,Du):`https://${t.config.authDomain}/${Nu}`,r={apiKey:e.apiKey,appName:t.name,v:Te},i=Mu.get(t.config.apiHost);i&&(r.eid=i);let s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${be(r).slice(1)}`}async function Fu(t){let e=await Cu(t),n=k().gapi;return d(n,t,"internal-error"),e.open({where:document.body,url:Uu(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Lu,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});let a=D(t,"network-request-failed"),c=k().setTimeout(()=>{s(a)},Ou.get());function l(){k().clearTimeout(c),i(r)}r.ping(l).then(l,()=>{s(a)})}))}function Bu(t,e,n,r=Vu,i=Wu){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString(),c="",l={...xu,width:r.toString(),height:i.toString(),top:s,left:a},o=O().toLowerCase();n&&(c=zs(o)?Hu:n),Ws(o)&&(e=e||zu,l.scrollbars="yes");let u=Object.entries(l).reduce((h,[m,w])=>`${h}${m}=${w},`,"");if(il(o)&&c!=="_self")return $u(e||"",c),new cn(null);let f=window.open(e||"",c,u);d(f,t,"popup-blocked");try{f.focus()}catch{}return new cn(f)}function $u(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)}async function ws(t,e,n,r,i,s){d(t.config.authDomain,t,"auth-domain-config-required"),d(t.config.apiKey,t,"invalid-api-key");let a={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Te,eventId:i};if(e instanceof $){e.setDefaultLanguage(t.languageCode),a.providerId=e.providerId||"",Mi(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(let[u,f]of Object.entries(s||{}))a[u]=f}if(e instanceof Ie){let u=e.getScopes().filter(f=>f!=="");u.length>0&&(a.scopes=u.join(","))}t.tenantId&&(a.tid=t.tenantId);let c=a;for(let u of Object.keys(c))c[u]===void 0&&delete c[u];let l=await t._getAppCheckToken(),o=l?`#${qu}=${encodeURIComponent(l)}`:"";return`${Ku(t)}?${be(c).slice(1)}${o}`}function Ku({config:t}){return t.emulator?xr(t,Gu):`https://${t.authDomain}/${ju}`}function Dt(t){return typeof t>"u"||t?.length===0}function Ju(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 Yu(t){we(new q("auth",(e,{options:n})=>{let r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:a,authDomain:c}=r.options;d(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});let l={apiKey:a,authDomain:c,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ks(t)},o=new hr(r,i,s,l);return gl(o,n),o},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),we(new q("auth-internal",e=>{let n=S(e.getProvider("auth").getImmediate());return(r=>new Dr(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),J(Ts,vs,Ju(t)),J(Ts,vs,"esm2020")}function ra(t=er()){let e=nt(t,"auth");if(e.isInitialized())return e.getImmediate();let n=Br(t,{popupRedirectResolver:ni,persistence:[ei,Xr,mn]}),r=Un("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(r,location.origin);if(location.origin===s.origin){let a=Qu(s.toString());Zr(n,a,()=>a(n.currentUser)),Yr(n,c=>a(c))}}let i=Si("auth");return i&&$r(n,`http://${i}`),n}function ed(){return document.getElementsByTagName("head")?.[0]??document}var Ss,ks,Ps,Rs,Cs,Ns,Lr,Ds,Ls,xt,ve,Vt,qc,Kc,Jc,cr,Wt,lr,dt,at,me,us,zt,Bt,$t,ur,al,dr,hr,jt,yt,hl,fl,Nt,fr,pr,mr,gr,ml,ct,hs,ft,se,We,Rl,Z,Nl,Ae,Se,oe,$,Ie,Gt,He,ze,Be,Ul,qt,Fl,Kt,$e,j,_r,ke,Ir,yr,_e,Jt,br,Er,wr,Tr,Yt,vr,Ar,nr,Zt,Xt,Gl,ql,Qt,Xr,Kl,en,Fo,tn,mn,nn,Sr,xo,eu,rn,Vo,Pe,ru,iu,sn,ei,sr,au,kr,Pr,lt,lu,on,pt,je,mt,an,pu,Ge,mu,Ut,Rr,Eu,Cr,vu,Au,Pu,Ft,Ou,Nu,Du,Lu,Mu,xu,Vu,Wu,Hu,zu,cn,ju,Gu,qu,ar,Or,ni,ln,Nr,gt,_t,un,It,Ts,vs,Dr,Zu,Xu,As,Qu,ia=B(()=>{rt();Ue();Pt();kt();Ss={PHONE:"phone",TOTP:"totp"},ks={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},Ps={EMAIL_LINK:"emailLink",EMAIL_PASSWORD:"password",FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PHONE:"phone",TWITTER:"twitter.com"},Rs={LINK:"link",REAUTHENTICATE:"reauthenticate",SIGN_IN:"signIn"},Cs={EMAIL_SIGNIN:"EMAIL_SIGNIN",PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:"REVERT_SECOND_FACTOR_ADDITION",VERIFY_AND_CHANGE_EMAIL:"VERIFY_AND_CHANGE_EMAIL",VERIFY_EMAIL:"VERIFY_EMAIL"};Ns=Bc,Lr=Os,Ds=new Q("auth","Firebase",Os()),Ls={ADMIN_ONLY_OPERATION:"auth/admin-restricted-operation",ARGUMENT_ERROR:"auth/argument-error",APP_NOT_AUTHORIZED:"auth/app-not-authorized",APP_NOT_INSTALLED:"auth/app-not-installed",CAPTCHA_CHECK_FAILED:"auth/captcha-check-failed",CODE_EXPIRED:"auth/code-expired",CORDOVA_NOT_READY:"auth/cordova-not-ready",CORS_UNSUPPORTED:"auth/cors-unsupported",CREDENTIAL_ALREADY_IN_USE:"auth/credential-already-in-use",CREDENTIAL_MISMATCH:"auth/custom-token-mismatch",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"auth/requires-recent-login",DEPENDENT_SDK_INIT_BEFORE_AUTH:"auth/dependent-sdk-initialized-before-auth",DYNAMIC_LINK_NOT_ACTIVATED:"auth/dynamic-link-not-activated",EMAIL_CHANGE_NEEDS_VERIFICATION:"auth/email-change-needs-verification",EMAIL_EXISTS:"auth/email-already-in-use",EMULATOR_CONFIG_FAILED:"auth/emulator-config-failed",EXPIRED_OOB_CODE:"auth/expired-action-code",EXPIRED_POPUP_REQUEST:"auth/cancelled-popup-request",INTERNAL_ERROR:"auth/internal-error",INVALID_API_KEY:"auth/invalid-api-key",INVALID_APP_CREDENTIAL:"auth/invalid-app-credential",INVALID_APP_ID:"auth/invalid-app-id",INVALID_AUTH:"auth/invalid-user-token",INVALID_AUTH_EVENT:"auth/invalid-auth-event",INVALID_CERT_HASH:"auth/invalid-cert-hash",INVALID_CODE:"auth/invalid-verification-code",INVALID_CONTINUE_URI:"auth/invalid-continue-uri",INVALID_CORDOVA_CONFIGURATION:"auth/invalid-cordova-configuration",INVALID_CUSTOM_TOKEN:"auth/invalid-custom-token",INVALID_DYNAMIC_LINK_DOMAIN:"auth/invalid-dynamic-link-domain",INVALID_EMAIL:"auth/invalid-email",INVALID_EMULATOR_SCHEME:"auth/invalid-emulator-scheme",INVALID_IDP_RESPONSE:"auth/invalid-credential",INVALID_LOGIN_CREDENTIALS:"auth/invalid-credential",INVALID_MESSAGE_PAYLOAD:"auth/invalid-message-payload",INVALID_MFA_SESSION:"auth/invalid-multi-factor-session",INVALID_OAUTH_CLIENT_ID:"auth/invalid-oauth-client-id",INVALID_OAUTH_PROVIDER:"auth/invalid-oauth-provider",INVALID_OOB_CODE:"auth/invalid-action-code",INVALID_ORIGIN:"auth/unauthorized-domain",INVALID_PASSWORD:"auth/wrong-password",INVALID_PERSISTENCE:"auth/invalid-persistence-type",INVALID_PHONE_NUMBER:"auth/invalid-phone-number",INVALID_PROVIDER_ID:"auth/invalid-provider-id",INVALID_RECIPIENT_EMAIL:"auth/invalid-recipient-email",INVALID_SENDER:"auth/invalid-sender",INVALID_SESSION_INFO:"auth/invalid-verification-id",INVALID_TENANT_ID:"auth/invalid-tenant-id",MFA_INFO_NOT_FOUND:"auth/multi-factor-info-not-found",MFA_REQUIRED:"auth/multi-factor-auth-required",MISSING_ANDROID_PACKAGE_NAME:"auth/missing-android-pkg-name",MISSING_APP_CREDENTIAL:"auth/missing-app-credential",MISSING_AUTH_DOMAIN:"auth/auth-domain-config-required",MISSING_CODE:"auth/missing-verification-code",MISSING_CONTINUE_URI:"auth/missing-continue-uri",MISSING_IFRAME_START:"auth/missing-iframe-start",MISSING_IOS_BUNDLE_ID:"auth/missing-ios-bundle-id",MISSING_OR_INVALID_NONCE:"auth/missing-or-invalid-nonce",MISSING_MFA_INFO:"auth/missing-multi-factor-info",MISSING_MFA_SESSION:"auth/missing-multi-factor-session",MISSING_PHONE_NUMBER:"auth/missing-phone-number",MISSING_PASSWORD:"auth/missing-password",MISSING_SESSION_INFO:"auth/missing-verification-id",MODULE_DESTROYED:"auth/app-deleted",NEED_CONFIRMATION:"auth/account-exists-with-different-credential",NETWORK_REQUEST_FAILED:"auth/network-request-failed",NULL_USER:"auth/null-user",NO_AUTH_EVENT:"auth/no-auth-event",NO_SUCH_PROVIDER:"auth/no-such-provider",OPERATION_NOT_ALLOWED:"auth/operation-not-allowed",OPERATION_NOT_SUPPORTED:"auth/operation-not-supported-in-this-environment",POPUP_BLOCKED:"auth/popup-blocked",POPUP_CLOSED_BY_USER:"auth/popup-closed-by-user",PROVIDER_ALREADY_LINKED:"auth/provider-already-linked",QUOTA_EXCEEDED:"auth/quota-exceeded",REDIRECT_CANCELLED_BY_USER:"auth/redirect-cancelled-by-user",REDIRECT_OPERATION_PENDING:"auth/redirect-operation-pending",REJECTED_CREDENTIAL:"auth/rejected-credential",SECOND_FACTOR_ALREADY_ENROLLED:"auth/second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"auth/maximum-second-factor-count-exceeded",TENANT_ID_MISMATCH:"auth/tenant-id-mismatch",TIMEOUT:"auth/timeout",TOKEN_EXPIRED:"auth/user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"auth/too-many-requests",UNAUTHORIZED_DOMAIN:"auth/unauthorized-continue-uri",UNSUPPORTED_FIRST_FACTOR:"auth/unsupported-first-factor",UNSUPPORTED_PERSISTENCE:"auth/unsupported-persistence-type",UNSUPPORTED_TENANT_OPERATION:"auth/unsupported-tenant-operation",UNVERIFIED_EMAIL:"auth/unverified-email",USER_CANCELLED:"auth/user-cancelled",USER_DELETED:"auth/user-not-found",USER_DISABLED:"auth/user-disabled",USER_MISMATCH:"auth/user-mismatch",USER_SIGNED_OUT:"auth/user-signed-out",WEAK_PASSWORD:"auth/weak-password",WEB_STORAGE_UNSUPPORTED:"auth/web-storage-unsupported",ALREADY_INITIALIZED:"auth/already-initialized",RECAPTCHA_NOT_ENABLED:"auth/recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"auth/missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"auth/invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"auth/invalid-recaptcha-action",MISSING_CLIENT_TYPE:"auth/missing-client-type",MISSING_RECAPTCHA_VERSION:"auth/missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"auth/invalid-recaptcha-version",INVALID_REQ_TYPE:"auth/invalid-req-type",INVALID_HOSTING_LINK_DOMAIN:"auth/invalid-hosting-link-domain"};xt=new Fe("@firebase/auth");ve=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,re(n>e,"Short delay should be less than long delay!"),this.isMobile=ki()||Oi()}get(){return jc()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};Vt=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;Y("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;Y("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;Y("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};qc={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"};Kc=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Jc=new ve(3e4,6e4);cr=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(D(this.auth,"network-request-failed")),Jc.get())})}};Wt=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 Yc(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")}};lr=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()}};dt=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ot(this.lastLoginAt),this.creationTime=ot(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};at=class t{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){d(e.idToken,"internal-error"),d(typeof e.idToken<"u","internal-error"),d(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):ls(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){d(e.length!==0,"internal-error");let n=ls(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(d(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 nl(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,a=new t;return r&&(d(typeof r=="string","internal-error",{appName:e}),a.refreshToken=r),i&&(d(typeof i=="string","internal-error",{appName:e}),a.accessToken=i),s&&(d(typeof s=="number","internal-error",{appName:e}),a.expirationTime=s),a}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 Y("not implemented")}};me=class t{constructor({uid:e,auth:n,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new lr(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 dt(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){let n=await ie(this,this.stsTokenManager.getToken(this.auth,e));return d(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return Vr(this,e)}reload(){return Wr(this)}_assign(e){this!==e&&(d(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){d(!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 ht(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(E(this.auth.app))return Promise.reject(P(this.auth));let e=await this.getIdToken();return await ie(this,Xc(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,a=n.photoURL??void 0,c=n.tenantId??void 0,l=n._redirectEventId??void 0,o=n.createdAt??void 0,u=n.lastLoginAt??void 0,{uid:f,emailVerified:h,isAnonymous:m,providerData:w,stsTokenManager:T}=n;d(f&&T,e,"internal-error");let N=at.fromJSON(this.name,T);d(typeof f=="string",e,"internal-error"),pe(r,e.name),pe(i,e.name),d(typeof h=="boolean",e,"internal-error"),d(typeof m=="boolean",e,"internal-error"),pe(s,e.name),pe(a,e.name),pe(c,e.name),pe(l,e.name),pe(o,e.name),pe(u,e.name);let L=new t({uid:f,auth:e,email:i,emailVerified:h,displayName:r,isAnonymous:m,photoURL:a,phoneNumber:s,tenantId:c,stsTokenManager:N,createdAt:o,lastLoginAt:u});return w&&Array.isArray(w)&&(L.providerData=w.map(R=>({...R}))),l&&(L._redirectEventId=l),L}static async _fromIdTokenResponse(e,n,r=!1){let i=new at;i.updateFromServerResponse(n);let s=new t({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await ht(s),s}static async _fromGetAccountInfoResponse(e,n,r){let i=n.users[0];d(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?Vs(i.providerUserInfo):[],a=!(i.email&&i.passwordHash)&&!s?.length,c=new at;c.updateFromIdToken(r);let l=new t({uid:i.localId,auth:e,stsTokenManager:c,isAnonymous:a}),o={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 dt(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(l,o),l}};us=new Map;zt=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){}};zt.type="NONE";Bt=zt;$t=class t{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;let{config:i,name:s}=this.auth;this.fullUserKey=Mt(this.userKey,i.apiKey,s),this.fullPersistenceKey=Mt("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 Ht(this.auth,{idToken:e}).catch(()=>{});return n?me._fromGetAccountInfoResponse(this.auth,n,e):null}return me._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(te(Bt),e,r);let i=(await Promise.all(n.map(async o=>{if(await o._isAvailable())return o}))).filter(o=>o),s=i[0]||te(Bt),a=Mt(r,e.config.apiKey,e.name),c=null;for(let o of n)try{let u=await o._get(a);if(u){let f;if(typeof u=="string"){let h=await Ht(e,{idToken:u}).catch(()=>{});if(!h)break;f=await me._fromGetAccountInfoResponse(e,h,u)}else f=me._fromJSON(e,u);o!==s&&(c=f),s=o;break}}catch{}let l=i.filter(o=>o._shouldAllowMigration);return!s._shouldAllowMigration||!l.length?new t(s,e,r):(s=l[0],c&&await s._set(a,c.toJSON()),await Promise.all(n.map(async o=>{if(o!==s)try{await o._remove(a)}catch{}})),new t(s,e,r))}};ur=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let r=s=>new Promise((a,c)=>{try{let l=e(s);a(l)}catch(l){c(l)}});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})}}};al=6,dr=class{constructor(e){let n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??al,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))}};hr=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 jt(this),this.idTokenSubscription=new jt(this),this.beforeStateQueue=new ur(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=Ds,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=te(n)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await $t.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 Ht(this,{idToken:e}),r=await me._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(E(this.app)){let s=this.app.settings.authIdToken;return s?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(a,a))}):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,a=r?._redirectEventId,c=await this.tryRedirectSignIn(e);(!s||s===a)&&c?.user&&(r=c.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 d(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 ht(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=Gc()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(E(this.app))return Promise.reject(P(this));let n=e?p(e):null;return n&&d(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&&d(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 E(this.app)?Promise.reject(P(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return E(this.app)?Promise.reject(P(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(te(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 ol(this),n=new dr(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 Q("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 rl(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&&te(e)||this._popupRedirectResolver;d(n,this,"argument-error"),this.redirectPersistenceManager=await $t.create(this,[te(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),a=!1,c=this._isInitialized?Promise.resolve():this._initializationPromise;if(d(c,this,"internal-error"),c.then(()=>{a||s(this.currentUser)}),typeof n=="function"){let l=e.addObserver(n,r,i);return()=>{a=!0,l()}}else{let l=e.addObserver(n);return()=>{a=!0,l()}}}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 d(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Ks(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(E(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&$c(`Error while retrieving App Check token: ${e.error}`),e?.token}};jt=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=Ui(n=>this.observer=n)}get next(){return d(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};yt={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};hl=500,fl=6e4,Nt=1e12,fr=class{constructor(e){this.auth=e,this.counter=Nt,this._widgets=new Map}render(e,n){let r=this.counter;return this._widgets.set(r,new gr(e,this.auth.name,n||{})),this.counter++,r}reset(e){let n=e||Nt;this._widgets.get(n)?.delete(),this._widgets.delete(n)}getResponse(e){let n=e||Nt;return this._widgets.get(n)?.getResponse()||""}async execute(e){let n=e||Nt;return this._widgets.get(n)?.execute(),""}},pr=class{constructor(){this.enterprise=new mr}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}},mr=class{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}},gr=class{constructor(e,n,r){this.params=r,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};let i=typeof e=="string"?document.getElementById(e):e;d(i,"argument-error",{appName:n}),this.container=i,this.isVisible=this.params.size!=="invisible",this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){return this.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),!this.timerId&&(this.timerId=window.setTimeout(()=>{this.responseToken=pl(50);let{callback:e,"expired-callback":n}=this.params;if(e)try{e(this.responseToken)}catch{}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,n)try{n()}catch{}this.isVisible&&this.execute()},fl)},hl))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}};ml="recaptcha-enterprise",ct="NO_RECAPTCHA",hs="onFirebaseAuthREInstanceReady",ft=class t{constructor(e){this.type=ml,this.auth=S(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(a,c)=>{Fs(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)c(new Error("recaptcha Enterprise site key undefined"));else{let o=new Wt(l);return s.tenantId==null?s._agentRecaptchaConfig=o:s._tenantRecaptchaConfigs[s.tenantId]=o,a(o.siteKey)}}).catch(l=>{c(l)})})}function i(s,a,c){let l=window.grecaptcha;cs(l)?l.enterprise.ready(()=>{l.enterprise.execute(s,{action:e}).then(o=>{a(o)}).catch(()=>{a(ct)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new pr().execute("siteKey",{action:"verify"}):new Promise((s,a)=>{r(this.auth).then(async c=>{if(!n&&cs(window.grecaptcha)&&t.scriptInjectionDeferred)await t.scriptInjectionDeferred.promise,i(c,s,a);else{if(typeof window>"u"){a(new Error("RecaptchaVerifier is only supported in browser"));return}let l=ul();l.length!==0&&(l+=c+`&onload=${hs}`),t.scriptInjectionDeferred=new De,window[hs]=()=>{t.scriptInjectionDeferred?.resolve()},zr(l).then(()=>t.scriptInjectionDeferred?.promise).then(()=>{i(c,s,a)}).catch(o=>{a(o)})}}).catch(c=>{a(c)})})}};ft.scriptInjectionDeferred=null;se=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return Y("not implemented")}_getIdTokenResponse(e){return Y("not implemented")}_linkToIdToken(e,n){return Y("not implemented")}_getReauthenticationResolver(e){return Y("not implemented")}};We=class t extends se{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 ge(e,n,"signInWithPassword",wl,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return kl(e,{email:this._email,oobCode:this._password});default:U(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 ge(e,r,"signUpPassword",bl,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return Pl(e,{idToken:n,email:this._email,oobCode:this._password});default:U(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};Rl="http://localhost",Z=class t extends se{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):U("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 a=new t(r,i);return a.idToken=s.idToken||void 0,a.accessToken=s.accessToken||void 0,a.secret=s.secret,a.nonce=s.nonce,a.pendingToken=s.pendingToken||null,a}_getIdTokenResponse(e){let n=this.buildRequest();return ne(e,n)}_linkToIdToken(e,n){let r=this.buildRequest();return r.idToken=n,ne(e,r)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,ne(e,n)}buildRequest(){let e={requestUri:Rl,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=be(n)}return e}};Nl={USER_NOT_FOUND:"user-not-found"};Ae=class t extends se{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 Cl(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Ol(e,{idToken:n,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return Dl(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})}};Se=class t{constructor(e){let n=Le(Me(e)),r=n.apiKey??null,i=n.oobCode??null,s=Ll(n.mode??null);d(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=Ml(e);try{return new t(n)}catch{return null}}};oe=class t{constructor(){this.providerId=t.PROVIDER_ID}static credential(e,n){return We._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let r=Se.parseLink(n);return d(r,"argument-error"),We._fromEmailAndCode(e,r.code,r.tenantId)}};oe.PROVIDER_ID="password";oe.EMAIL_PASSWORD_SIGN_IN_METHOD="password";oe.EMAIL_LINK_SIGN_IN_METHOD="emailLink";$=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}};Ie=class extends ${constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}},Gt=class t extends Ie{static credentialFromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;return d("providerId"in n&&"signInMethod"in n,"argument-error"),Z._fromParams(n)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return d(e.idToken||e.accessToken,"argument-error"),Z._fromParams({...e,providerId:this.providerId,signInMethod:this.providerId})}static credentialFromResult(e){return t.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return t.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:r,oauthTokenSecret:i,pendingToken:s,nonce:a,providerId:c}=e;if(!r&&!i&&!n&&!s||!c)return null;try{return new t(c)._credential({idToken:n,accessToken:r,nonce:a,pendingToken:s})}catch{return null}}};He=class t extends Ie{constructor(){super("facebook.com")}static credential(e){return Z._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}}};He.FACEBOOK_SIGN_IN_METHOD="facebook.com";He.PROVIDER_ID="facebook.com";ze=class t extends Ie{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return Z._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}}};ze.GOOGLE_SIGN_IN_METHOD="google.com";ze.PROVIDER_ID="google.com";Be=class t extends Ie{constructor(){super("github.com")}static credential(e){return Z._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}}};Be.GITHUB_SIGN_IN_METHOD="github.com";Be.PROVIDER_ID="github.com";Ul="http://localhost",qt=class t extends se{constructor(e,n){super(e,e),this.pendingToken=n}_getIdTokenResponse(e){let n=this.buildRequest();return ne(e,n)}_linkToIdToken(e,n){let r=this.buildRequest();return r.idToken=n,ne(e,r)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,ne(e,n)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,pendingToken:s}=n;return!r||!i||!s||r!==i?null:new t(r,s)}static _create(e,n){return new t(e,n)}buildRequest(){return{requestUri:Ul,returnSecureToken:!0,pendingToken:this.pendingToken}}};Fl="saml.",Kt=class t extends ${constructor(e){d(e.startsWith(Fl),"argument-error"),super(e)}static credentialFromResult(e){return t.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return t.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){let n=qt.fromJSON(e);return d(n,"argument-error"),n}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{pendingToken:n,providerId:r}=e;if(!n||!r)return null;try{return qt._create(r,n)}catch{return null}}};$e=class t extends Ie{constructor(){super("twitter.com")}static credential(e,n){return Z._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}}};$e.TWITTER_SIGN_IN_METHOD="twitter.com";$e.PROVIDER_ID="twitter.com";j=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 me._fromIdTokenResponse(e,r,i),a=ms(r);return new t({user:s,providerId:a,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);let i=ms(r);return new t({user:e,providerId:i,_tokenResponse:r,operationType:n})}};_r=class t extends H{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)}};ke=class{constructor(e,n){this.factorId=e,this.uid=n.mfaEnrollmentId,this.enrollmentTime=new Date(n.enrolledAt).toUTCString(),this.displayName=n.displayName}static _fromServerResponse(e,n){return"phoneInfo"in n?Ir._fromServerResponse(e,n):"totpInfo"in n?yr._fromServerResponse(e,n):U(e,"internal-error")}},Ir=class t extends ke{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,n){return new t(n)}},yr=class t extends ke{constructor(e){super("totp",e)}static _fromServerResponse(e,n){return new t(n)}};_e=class{constructor(e,n,r={}){this.isNewUser=e,this.providerId=n,this.profile=r}},Jt=class extends _e{constructor(e,n,r,i){super(e,n,r),this.username=i}},br=class extends _e{constructor(e,n){super(e,"facebook.com",n)}},Er=class extends Jt{constructor(e,n){super(e,"github.com",n,typeof n?.login=="string"?n?.login:null)}},wr=class extends _e{constructor(e,n){super(e,"google.com",n)}},Tr=class extends Jt{constructor(e,n,r){super(e,"twitter.com",n,r)}};Yt=class t{constructor(e,n,r){this.type=e,this.credential=n,this.user=r}static _fromIdtoken(e,n){return new t("enroll",e,n)}static _fromMfaPendingCredential(e){return new t("signin",e)}toJSON(){return{multiFactorSession:{[this.type==="enroll"?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){if(e?.multiFactorSession){if(e.multiFactorSession?.pendingCredential)return t._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(e.multiFactorSession?.idToken)return t._fromIdtoken(e.multiFactorSession.idToken)}return null}};vr=class t{constructor(e,n,r){this.session=e,this.hints=n,this.signInResolver=r}static _fromError(e,n){let r=S(e),i=n.customData._serverResponse,s=(i.mfaInfo||[]).map(c=>ke._fromServerResponse(r,c));d(i.mfaPendingCredential,r,"internal-error");let a=Yt._fromMfaPendingCredential(i.mfaPendingCredential);return new t(a,s,async c=>{let l=await c._process(r,a);delete i.mfaInfo,delete i.mfaPendingCredential;let o={...i,idToken:l.idToken,refreshToken:l.refreshToken};switch(n.operationType){case"signIn":let u=await j._fromIdTokenResponse(r,n.operationType,o);return await r._updateCurrentUser(u.user),u;case"reauthenticate":return d(n.user,r,"internal-error"),j._forOperation(n.user,n.operationType,o);default:U(r,"internal-error")}})}async resolveSignIn(e){let n=e;return this.signInResolver(n)}};Ar=class t{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload(n=>{n.mfaInfo&&(this.enrolledFactors=n.mfaInfo.map(r=>ke._fromServerResponse(e.auth,r)))})}static _fromUser(e){return new t(e)}async getSession(){return Yt._fromIdtoken(await this.user.getIdToken(),this.user)}async enroll(e,n){let r=e,i=await this.getSession(),s=await ie(this.user,r._process(this.user.auth,i,n));return await this.user._updateTokensIfNecessary(s),this.user.reload()}async unenroll(e){let n=typeof e=="string"?e:e.uid,r=await this.user.getIdToken();try{let i=await ie(this.user,jl(this.user.auth,{idToken:r,mfaEnrollmentId:n}));this.enrolledFactors=this.enrolledFactors.filter(({uid:s})=>s!==n),await this.user._updateTokensIfNecessary(i),await this.user.reload()}catch(i){throw i}}},nr=new WeakMap;Zt="__sak";Xt=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Zt,"1"),this.storage.removeItem(Zt),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()}};Gl=1e3,ql=10,Qt=class extends Xt{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=qs(),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((a,c,l)=>{this.notifyListeners(a,l)});return}let r=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let a=this.storage.getItem(r);!n&&this.localCache[r]===a||this.notifyListeners(r,a)},s=this.storage.getItem(r);sl()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,ql):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)})},Gl)}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]}};Qt.type="LOCAL";Xr=Qt;Kl=1e3;en=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=ir(e);return window.cookieStore?(await window.cookieStore.get(n))?.value:rr(n)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let r=ir(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=ir(e);if(window.cookieStore){let c=(o=>{let u=o.changed.find(h=>h.name===r);u&&n(u.value),o.deleted.find(h=>h.name===r)&&n(null)}),l=()=>window.cookieStore.removeEventListener("change",c);return this.listenerUnsubscribes.set(n,l),window.cookieStore.addEventListener("change",c)}let i=rr(r),s=setInterval(()=>{let c=rr(r);c!==i&&(n(c),i=c)},Kl),a=()=>clearInterval(s);this.listenerUnsubscribes.set(n,a)}_removeListener(e,n){let r=this.listenerUnsubscribes.get(n);r&&(r(),this.listenerUnsubscribes.delete(n))}};en.type="COOKIE";Fo=en;tn=class extends Xt{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};tn.type="SESSION";mn=tn;nn=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,a=this.handlersMap[i];if(!a?.size)return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});let c=Array.from(a).map(async o=>o(n.origin,s)),l=await Jl(c);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:l})}_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)}};nn.receivers=[];Sr=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,a;return new Promise((c,l)=>{let o=gn("",20);i.port1.start();let u=setTimeout(()=>{l(new Error("unsupported_event"))},r);a={messageChannel:i,onMessage(f){let h=f;if(h.data.eventId===o)switch(h.data.status){case"ack":clearTimeout(u),s=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),c(h.data.response);break;default:clearTimeout(u),clearTimeout(s),l(new Error("invalid_response"));break}}},this.handlers.add(a),i.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:o,data:n},[i.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}};xo="firebaseLocalStorageDb",eu=1,rn="firebaseLocalStorage",Vo="fbase_key",Pe=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)})})}};ru=800,iu=3,sn=class{constructor(){this.type="LOCAL",this.dbPromise=null,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.dbPromise?this.dbPromise:(this.dbPromise=Wo(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let n=0;for(;;)try{let r=await this._openDb();return await e(r)}catch(r){if(n++>iu)throw r;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return Qr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=nn._getInstance(Ql()),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 Zl(),!this.activeServiceWorker)return;this.sender=new Sr(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||Xl()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async e=>{await _s(e,Zt,"1"),await Is(e,Zt)}),!0):!1}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=>_s(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(r=>nu(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Is(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=_n(i,!1).getAll();return new Pe(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(),ru)}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()}};sn.type="LOCAL";ei=sn;sr=Js("rcb"),au=new ve(3e4,6e4),kr=class{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!k().grecaptcha?.render}load(e,n=""){return d(cu(n),e,"argument-error"),this.shouldResolveImmediately(n)&&as(k().grecaptcha)?Promise.resolve(k().grecaptcha):new Promise((r,i)=>{let s=k().setTimeout(()=>{i(D(e,"network-request-failed"))},au.get());k()[sr]=()=>{k().clearTimeout(s),delete k()[sr];let c=k().grecaptcha;if(!c||!as(c)){i(D(e,"internal-error"));return}let l=c.render;c.render=(o,u)=>{let f=l(o,u);return this.counter++,f},this.hostLanguage=n,r(c)};let a=`${ll()}?${be({onload:sr,render:"explicit",hl:n})}`;zr(a).catch(()=>{clearTimeout(s),i(D(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!k().grecaptcha?.render&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}};Pr=class{async load(e){return new fr(e)}clearedOneInstance(){}};lt="recaptcha",lu={theme:"light",type:"image"},on=class{constructor(e,n,r={...lu}){this.parameters=r,this.type=lt,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=S(e),this.isInvisible=this.parameters.size==="invisible",d(typeof document<"u",this.auth,"operation-not-supported-in-this-environment");let i=typeof n=="string"?document.getElementById(n):n;d(i,this.auth,"argument-error"),this.container=i,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new Pr:new kr,this.validateStartingState()}async verify(){this.assertNotDestroyed();let e=await this.render(),n=this.getAssertedRecaptcha(),r=n.getResponse(e);return r||new Promise(i=>{let s=a=>{a&&(this.tokenChangeListeners.delete(s),i(a))};this.tokenChangeListeners.add(s),this.isInvisible&&n.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise?this.renderPromise:(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e}),this.renderPromise)}_reset(){this.assertNotDestroyed(),this.widgetId!==null&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){d(!this.parameters.sitekey,this.auth,"argument-error"),d(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),d(typeof document<"u",this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return n=>{if(this.tokenChangeListeners.forEach(r=>r(n)),typeof e=="function")e(n);else if(typeof e=="string"){let r=k()[e];typeof r=="function"&&r(n)}}}assertNotDestroyed(){d(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){let n=document.createElement("div");e.appendChild(n),e=n}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){d(Fr()&&!Qr(),this.auth,"internal-error"),await uu(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);let e=await Zc(this.auth);d(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return d(this.recaptcha,this.auth,"internal-error"),this.recaptcha}};pt=class{constructor(e,n){this.verificationId=e,this.onConfirmation=n}confirm(e){let n=Ae._fromVerification(this.verificationId,e);return this.onConfirmation(n)}};je=class t{constructor(e){this.providerId=t.PROVIDER_ID,this.auth=S(e)}verifyPhoneNumber(e,n){return In(this.auth,e,p(n))}static credential(e,n){return Ae._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?Ae._fromTokenResponse(n,r):null}};je.PROVIDER_ID="phone";je.PHONE_SIGN_IN_METHOD="phone";mt=class extends se{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ne(e,this._buildIdpRequest())}_linkToIdToken(e,n){return ne(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return ne(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}};an=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:a,type:c}=e;if(a){this.reject(a);return}let l={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(c)(l))}catch(o){this.reject(o)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return du;case"linkViaPopup":case"linkViaRedirect":return fu;case"reauthViaPopup":case"reauthViaRedirect":return hu;default:U(this.auth,"internal-error")}}resolve(e){re(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){re(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()}};pu=new ve(2e3,1e4);Ge=class t extends an{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 d(e,this.auth,"internal-error"),e}async onExecution(){re(this.filter.length===1,"Popup operations only handle one event");let e=gn();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(D(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(D(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(D(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,pu.get())};e()}};Ge.currentPopupAction=null;mu="pendingRedirect",Ut=new Map,Rr=class extends an{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=Ut.get(this.auth._key());if(!e){try{let r=await gu(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}Ut.set(this.auth._key(),e)}return this.bypassAuthState||Ut.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(){}};Eu=600*1e3,Cr=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||!wu(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){if(e.error&&!na(e)){let r=e.error.code?.split("auth/")[1]||"internal-error";n.onError(D(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>=Eu&&this.cachedEventUids.clear(),this.cachedEventUids.has(bs(e))}saveEventToCache(e){this.cachedEventUids.add(bs(e)),this.lastProcessedEventTime=Date.now()}};vu=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Au=/^https?/;Pu=new ve(3e4,6e4);Ft=null;Ou=new ve(5e3,15e3),Nu="__/auth/iframe",Du="emulator/auth/iframe",Lu={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Mu=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);xu={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Vu=500,Wu=600,Hu="_blank",zu="http://localhost",cn=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};ju="__/auth/handler",Gu="emulator/auth/handler",qu=encodeURIComponent("fac");ar="webStorageSupport",Or=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=mn,this._completeRedirectFn=ea,this._overrideRedirectResult=_u}async _openPopup(e,n,r,i){re(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");let s=await ws(e,n,r,ut(),i);return Bu(e,s,gn())}async _openRedirect(e,n,r,i){await this._originValidation(e);let s=await ws(e,n,r,ut(),i);return Yl(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):(re(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 Fu(e),r=new Cr(e);return n.register("authEvent",i=>(d(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(ar,{type:ar},i=>{let s=i?.[0]?.[ar];s!==void 0&&n(!!s),U(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=Su(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return qs()||Hs()||Hr()}},ni=Or,ln=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 Y("unexpected MultiFactorSessionType")}}},Nr=class t extends ln{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new t(e)}_finalizeEnroll(e,n,r){return zl(e,{idToken:n,displayName:r,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return su(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},gt=class{constructor(){}static assertion(e){return Nr._fromCredential(e)}};gt.FACTOR_ID="phone";_t=class{static assertionForEnrollment(e,n){return un._fromSecret(e,n)}static assertionForSignIn(e,n){return un._fromEnrollmentId(e,n)}static async generateSecret(e){let n=e;d(typeof n.user?.auth<"u","internal-error");let r=await Bl(n.user.auth,{idToken:n.credential,totpEnrollmentInfo:{}});return It._fromStartTotpMfaEnrollmentResponse(r,n.user.auth)}};_t.FACTOR_ID="totp";un=class t extends ln{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 d(typeof this.secret<"u",e,"argument-error"),$l(e,{idToken:n,displayName:r,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){d(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let r={verificationCode:this.otp};return ou(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:r})}},It=class t{constructor(e,n,r,i,s,a,c){this.sessionInfo=a,this.auth=c,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(Dt(e)||Dt(n))&&(r=!0),r&&(Dt(e)&&(e=this.auth.currentUser?.email||"unknownuser"),Dt(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};Ts="@firebase/auth",vs="1.13.3";Dr=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(){d(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};Zu=300,Xu=Un("authIdTokenMaxAge")||Zu,As=null,Qu=t=>async e=>{let n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>Xu)return;let i=n?.token;As!==i&&(As=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};cl({loadJS(t){return new Promise((e,n)=>{let r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{let s=D("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",ed().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="});Yu("Browser")});var sa=B(()=>{ia();rt();Ue();Pt();kt()});var yn={};bi(yn,{ActionCodeOperation:()=>Cs,ActionCodeURL:()=>Se,AuthCredential:()=>se,AuthErrorCodes:()=>Ls,EmailAuthCredential:()=>We,EmailAuthProvider:()=>oe,FacebookAuthProvider:()=>He,FactorId:()=>Ss,GithubAuthProvider:()=>Be,GoogleAuthProvider:()=>ze,OAuthCredential:()=>Z,OAuthProvider:()=>Gt,OperationType:()=>Rs,PhoneAuthCredential:()=>Ae,PhoneAuthProvider:()=>je,PhoneMultiFactorGenerator:()=>gt,ProviderId:()=>ks,RecaptchaVerifier:()=>on,SAMLAuthProvider:()=>Kt,SignInMethod:()=>Ps,TotpMultiFactorGenerator:()=>_t,TotpSecret:()=>It,TwitterAuthProvider:()=>$e,applyActionCode:()=>uo,beforeAuthStateChanged:()=>Zr,browserCookiePersistence:()=>Fo,browserLocalPersistence:()=>Xr,browserPopupRedirectResolver:()=>ni,browserSessionPersistence:()=>mn,checkActionCode:()=>Jr,confirmPasswordReset:()=>lo,connectAuthEmulator:()=>$r,createUserWithEmailAndPassword:()=>fo,debugErrorMap:()=>Ns,deleteUser:()=>Lo,fetchSignInMethodsForEmail:()=>Io,getAdditionalUserInfo:()=>Ao,getAuth:()=>ra,getIdToken:()=>xs,getIdTokenResult:()=>Vr,getMultiFactorResolver:()=>Mo,getRedirectResult:()=>Qo,inMemoryPersistence:()=>Bt,indexedDBLocalPersistence:()=>ei,initializeAuth:()=>Br,initializeRecaptchaConfig:()=>ko,isSignInWithEmailLink:()=>go,linkWithCredential:()=>Gr,linkWithPhoneNumber:()=>zo,linkWithPopup:()=>qo,linkWithRedirect:()=>Xo,multiFactor:()=>Uo,onAuthStateChanged:()=>Ro,onIdTokenChanged:()=>Yr,parseActionCodeURL:()=>Qs,prodErrorMap:()=>Lr,reauthenticateWithCredential:()=>qr,reauthenticateWithPhoneNumber:()=>Bo,reauthenticateWithPopup:()=>Go,reauthenticateWithRedirect:()=>Zo,reload:()=>Wr,revokeAccessToken:()=>Do,sendEmailVerification:()=>yo,sendPasswordResetEmail:()=>co,sendSignInLinkToEmail:()=>mo,setPersistence:()=>So,signInAnonymously:()=>to,signInWithCredential:()=>bt,signInWithCustomToken:()=>ao,signInWithEmailAndPassword:()=>po,signInWithEmailLink:()=>_o,signInWithPhoneNumber:()=>Ho,signInWithPopup:()=>jo,signInWithRedirect:()=>Yo,signOut:()=>No,unlink:()=>io,updateCurrentUser:()=>Oo,updateEmail:()=>wo,updatePassword:()=>To,updatePhoneNumber:()=>$o,updateProfile:()=>Eo,useDeviceLanguage:()=>Co,validatePassword:()=>Po,verifyBeforeUpdateEmail:()=>bo,verifyPasswordResetCode:()=>ho});var bn=B(()=>{sa()});var td={apiKey:"AIzaSyAC5ROxI3bnIO1DyNflMhFRrtnR-45p4RE",authDomain:"myapp-259bf.firebaseapp.com",projectId:"myapp-259bf"},ri=null,En=null;async function Ce(){return typeof window>"u"?null:(ri||(ri=(async()=>{let{initializeApp:t,getApps:e}=await Promise.resolve().then(()=>(ss(),is)),{getAuth:n,signInAnonymously:r,onAuthStateChanged:i}=await Promise.resolve().then(()=>(bn(),yn)),s=e().length?e()[0]:t(td);if(En=n(s),!await new Promise(c=>{let l=i(En,o=>{l(),c(o)})}))try{await r(En)}catch{console.warn("[oZ Auth] Anonymous session unavailable (offline or delayed).")}return En})()),ri)}async function oa(){try{let t=await Ce();return!t||!t.currentUser?null:await t.currentUser.getIdToken()}catch{return console.error("[OZmoz Auth] Session check failed."),null}}async function wn(t){let e=await Ce(),{signInWithCustomToken:n}=await Promise.resolve().then(()=>(bn(),yn)),r;try{r=await n(e,t)}catch{throw new Error("Sign-in failed. Please try again.")}return{uid:r.user.uid,email:r.user.email,isAnonymous:r.user.isAnonymous}}async function aa(){let t=await Ce(),{signOut:e,signInAnonymously:n}=await Promise.resolve().then(()=>(bn(),yn));return await e(t),await n(t),!0}async function ca(){let t=await Ce();return!t||!t.currentUser?null:{uid:t.currentUser.uid,email:t.currentUser.email,isAnonymous:t.currentUser.isAnonymous}}async function la(t=!1){try{let e=await Ce();return!e||!e.currentUser?!1:(await e.currentUser.getIdTokenResult(t)).claims.elog===!0}catch(e){return console.error("[OZmoz Auth Debug]",e),!1}}var nd="oz_proto",ii="proto_user",vn=new Map,fa=(t,e)=>`${nd}:${t||"app"}:${e}`,W=t=>t===void 0?t:JSON.parse(JSON.stringify(t)),pa=()=>`proto_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`}`,ai=t=>{let e=t?._id??t?.id??t?.documentId;return e==null?null:String(e)},si=new Set;function ce(t,e){let n=fa(t,e);if(si.has(n))return W(vn.get(n));try{if(typeof localStorage<"u"){let r=localStorage.getItem(n);if(r!==null){let i=JSON.parse(r);if(Array.isArray(i))return i}}}catch{}return vn.has(n)?W(vn.get(n)):null}function Et(t,e,n){let r=fa(t,e);vn.set(r,W(n));try{if(typeof localStorage<"u"){localStorage.setItem(r,JSON.stringify(n)),si.delete(r);return}}catch{}si.add(r)}var oi=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return{}}return t&&typeof t=="object"?t:{}};function rd(t,e,n){let r=String(e).split("."),i=t;r.forEach((s,a)=>{a===r.length-1?i[s]=n:((typeof i[s]!="object"||i[s]===null)&&(i[s]={}),i=i[s])})}function id(t){let e={...W(oi(t))};return e._id=ai(e)||pa(),e}var Tn=(t,e)=>t.findIndex(n=>ai(n)===String(e)),ua=/^[A-Za-z][A-Za-z0-9_]{0,39}$/;function sd(t){let e={where:[],sort:null,limit:0};if(t==null)return{ok:e};if(typeof t!="object"||Array.isArray(t))return{error:"Invalid query options."};let{where:n,limit:r,sort:i}=t;if(n!=null){if(typeof n!="object"||Array.isArray(n))return{error:"This filter isn't supported."};let s=Object.keys(n);if(s.length>3)return{error:"Too many filter conditions."};for(let a of s){let c=n[a],l=typeof c=="string"||typeof c=="boolean"||typeof c=="number"&&Number.isFinite(c);if(!ua.test(a)||!l)return{error:"This filter isn't supported."};e.where.push([a,c])}}if(r!=null){if(!Number.isInteger(r)||r<1||r>200)return{error:"The limit must be a whole number from 1 to 200."};e.limit=r}if(i!=null){let s=typeof i=="object"&&!Array.isArray(i)?Object.keys(i):[];if(s.length!==1||!ua.test(s[0])||i[s[0]]!==1&&i[s[0]]!==-1)return{error:"This sort isn't supported."};e.sort={field:s[0],dir:i[s[0]]}}return{ok:e}}var da=t=>t==null?0:typeof t=="number"?1:typeof t=="string"?2:typeof t=="boolean"?3:4,ha=(t,e)=>{let n=da(t),r=da(e);return n!==r?n-r:n===0||n===4?0:t<e?-1:t>e?1:0};function od(t,e){let n=t;if(e.where.length&&(n=n.filter(r=>e.where.every(([i,s])=>r[i]===s))),e.sort){let{field:r,dir:i}=e.sort;n=n.slice().sort((s,a)=>i*(ha(s[r],a[r])||ha(String(s._id),String(a._id))))}return e.limit&&(n=n.slice(0,e.limit)),n}function ma(t,e,n){let r=ce(t,e);if(r!==null)return{success:!0,seeded:!1,isPrototype:!0,count:r.length};let i=(Array.isArray(n)?n:[]).map(id);return Et(t,e,i),{success:!0,seeded:!0,isPrototype:!0,count:i.length}}function ga(t,e,n){let r=e||{},i=r.fleetboTable;switch(t){case"getdocsg":case"getdocsu":{let s=sd(r.queryOptions);return s.error?{success:!1,error:s.error}:{success:!0,data:od(W(ce(n,i)||[]),s.ok)}}case"getdoc":{let s=ce(n,i)||[],a=s[Tn(s,r.id)];return a?{success:!0,data:W(a)}:{success:!1,notFound:!0,message:"Document not found."}}case"add":case"addwithmedia":{let s=ce(n,i)||[],a=oi(r.jsonData),c={...W(a),_id:ai(a)||pa(),userId:ii,createdAt:new Date().toISOString()};if(t==="addwithmedia"){let l=typeof r.fileBase64=="string"&&r.fileBase64||a.mediaUrl||a.image||"";c.mediaUrl=c.image=c.imageUrl=c.coverImage=l}return s.push(c),Et(n,i,s),t==="addwithmedia"?{success:!0,id:c._id,mediaUrl:c.mediaUrl,isPrototype:!0}:{success:!0,documentId:c._id,isPrototype:!0}}case"addwithuserid":case"addwithid":{let s=ce(n,i)||[],a=t==="addwithuserid"?ii:String(r.id),c=W(oi(r.jsonData)),l=Tn(s,a),o={...l>=0?s[l]:{createdAt:new Date().toISOString()},...c,_id:a,userId:ii,updatedAt:new Date().toISOString()};return l>=0?s[l]=o:s.push(o),Et(n,i,s),t==="addwithuserid"?{success:!0,documentId:a,isPrototype:!0}:{success:!0,id:a,isPrototype:!0}}case"update":{let s=ce(n,i)||[],a=Tn(s,r.id);if(a<0)return{success:!1,documentId:r.id,error:"Document not found."};let{fleetboTable:c,id:l,...o}=r,u=W(s[a]);for(let[f,h]of Object.entries(o))rd(u,f,W(h));return u.updatedAt=new Date().toISOString(),s[a]=u,Et(n,i,s),{success:!0,documentId:String(r.id),isPrototype:!0}}case"delete":{let s=ce(n,i)||[],a=Tn(s,r.id);return a>=0&&(s.splice(a,1),Et(n,i,s)),{success:!0,documentId:String(r.id),isPrototype:!0}}case"join":{let s=r.joinOptions?.innerJoin;if(!s||!s.collection||!Array.isArray(s.on)||s.on.length!==3)return{success:!1,error:"The 'on' clause must contain 3 elements."};let[a,,c]=s.on,l=s.as||"joinedData",o=ce(n,s.collection)||[],u=h=>{if(!Array.isArray(s.select)||s.select.length===0)return W(h);let m={_id:h._id};return s.select.forEach(w=>{w in h&&(m[w]=W(h[w]))}),m};return{success:!0,data:(ce(n,i)||[]).map(h=>{let m=h[a],w=o.filter(T=>{if(m==null)return!1;let N=c==="id"?T._id??T.id:T[c];return String(N)===String(m)});return{...W(h),[l]:w.map(u)}})}}default:return null}}var ad="https://api.ozmoz.io/",wt=()=>typeof globalThis<"u"&&globalThis.OZ_CONFIG?globalThis.OZ_CONFIG:typeof window<"u"&&window.OZ_CONFIG?window.OZ_CONFIG:{},ci=()=>!!(typeof import.meta<"u"&&import.meta.env&&import.meta.env.OZ_PROTOTYPE==="true"||typeof process<"u"&&process.env&&process.env.OZ_PROTOTYPE==="true"||wt().prototype===!0||wt().prototype==="true"),li=()=>(typeof import.meta<"u"&&import.meta.env?import.meta.env.OZ_DB_KEY:typeof process<"u"?process.env.OZ_DB_KEY:void 0)||wt().dbKey||"",cd=()=>(typeof import.meta<"u"&&import.meta.env?import.meta.env.OZ_ENTERPRISE_ID:typeof process<"u"?process.env.OZ_ENTERPRISE_ID:void 0)||wt().enterpriseId||"",ld=()=>!!(typeof import.meta<"u"&&import.meta.env&&import.meta.env.OZ_DEBUG==="true"||typeof process<"u"&&process.env&&process.env.OZ_DEBUG==="true"||wt().debug===!0),Tt=async(t,e=null)=>{try{let n=li(),r=cd(),i=ci(),s=String(t).replace(/^[a-z]+:\/\//,"").split("-")[0]||"add",a=e?.operation||s,c=s==="crud"?"crud":a;if(i){let C=ga(a.toLowerCase(),e,n);if(C!=null)return C}let l={"Content-Type":"application/json"};i&&(l["x-oz-prototype"]="true");let o=ld()?Date.now():0,u=await oa(),f=o?Date.now():0;u&&(l.Authorization=`Bearer ${u}`);let h=null;if(e?.jsonData!==void 0)h=e.jsonData;else if(a==="update"){let{fleetboTable:C,id:Ne,operation:le,...ue}=e||{};h=ue}let m={targetFunction:c,operation:a,enterpriseID:r,fleetboDB:n,fleetboTable:e?.fleetboTable||null,jsonData:h,_prototype:i,data:{fleetboDB:n,enterpriseID:r,operation:a,...e}},w=C=>{if(!C||typeof C!="object")return C;let{fleetboDB:Ne,fleetboTable:le,...ue}=C;return{...ue,...Ne!==void 0?{ozDB:Ne}:{},...le!==void 0?{ozTable:le}:{}}},T={...w(m),data:w(m.data)},N=await fetch(ad,{method:"POST",headers:l,body:JSON.stringify(T)}),L=await N.json(),R=L.result||L;if(o){let C=Date.now();console.debug(`[OZmoz] ${c}(${e?.fleetboTable||""}) ${C-o} ms : auth ${f-o} ms, cloud ${C-f} ms, HTTP ${N.status}`)}let z=R?.error||(N.ok?null:R?.message||`HTTP ${N.status}`),Ye=z&&typeof z=="object"?z.message||JSON.stringify(z):z?String(z):void 0;return{success:!!(N.ok&&!Ye),...R||{},error:Ye}}catch(n){return{success:!1,error:n?.message||String(n)}}},_a=Tt,Ia=Tt,ya=Tt;var v=Tt||_a||Ia||ya,Sn=ci||(()=>!1),ba=li||(()=>"");if(typeof window<"u"&&typeof customElements<"u"){class t extends HTMLElement{static get observedAttributes(){return["value","fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get fallback(){return this.getAttribute("fallback")}set fallback(o){o==null?this.removeAttribute("fallback"):this.setAttribute("fallback",String(o))}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("fallback")||"\u2014",f=o!=null&&o.trim()!==""&&o!=="null"&&o!=="undefined";this.textContent=f?o:u}}class e extends HTMLElement{static get observedAttributes(){return["value","invalid-fallback","currency"]}get value(){return this.getAttribute("value")}set value(o){o==null||o===""?this.removeAttribute("value"):this.setAttribute("value",String(o))}get currency(){return this.getAttribute("currency")}set currency(o){o==null?this.removeAttribute("currency"):this.setAttribute("currency",String(o))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("invalid-fallback")||"0";if(o==null||o===""||o==="null"||o==="undefined"){this.textContent=u;return}let f=Number(o);if(Number.isNaN(f)){this.textContent=u;return}let h=this.getAttribute("currency");if(h)try{this.textContent=new Intl.NumberFormat("en-US",{style:"currency",currency:h}).format(f)}catch{this.textContent=`${f} ${h}`}else this.textContent=String(f)}}class n extends HTMLElement{static get observedAttributes(){return["value","label-true","label-false","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get labelTrue(){return this.getAttribute("label-true")}set labelTrue(o){o==null?this.removeAttribute("label-true"):this.setAttribute("label-true",String(o))}get"label-true"(){return this.labelTrue}set"label-true"(o){this.labelTrue=o}get labelFalse(){return this.getAttribute("label-false")}set labelFalse(o){o==null?this.removeAttribute("label-false"):this.setAttribute("label-false",String(o))}get"label-false"(){return this.labelFalse}set"label-false"(o){this.labelFalse=o}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("label-true")||"Yes",f=this.getAttribute("label-false")||"No",h=this.getAttribute("invalid-fallback")||"Unknown";o==="true"||o==="1"?this.textContent=u:o==="false"||o==="0"?this.textContent=f:this.textContent=h}}class r extends HTMLElement{static get observedAttributes(){return["value","locale","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null||o===""?this.removeAttribute("value"):o&&typeof o=="object"&&typeof o.toISOString=="function"?this.setAttribute("value",o.toISOString()):this.setAttribute("value",String(o))}get locale(){return this.getAttribute("locale")}set locale(o){o==null?this.removeAttribute("locale"):this.setAttribute("locale",String(o))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("invalid-fallback")||"Invalid date",f=this.getAttribute("locale")||"en-US";if(!o||o==="null"||o==="undefined"||o===""){this.textContent=u;return}let h=new Date(o);if(Number.isNaN(h.getTime())){this.textContent=u;return}try{this.textContent=h.toLocaleDateString(f)}catch{this.textContent=h.toLocaleDateString("en-US")}}}class i extends HTMLElement{static get observedAttributes(){return["value","allowed","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get allowed(){return this.getAttribute("allowed")}set allowed(o){o==null?this.removeAttribute("allowed"):Array.isArray(o)?this.setAttribute("allowed",o.join(",")):this.setAttribute("allowed",String(o))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=(this.getAttribute("allowed")||"").split(",").map(h=>h.trim()).filter(Boolean),f=this.getAttribute("invalid-fallback")||"Not allowed";if(!o||o==="null"||o==="undefined"||!u.includes(o)){this.textContent=f;return}this.textContent=String(o)}}class s extends HTMLElement{static get observedAttributes(){return["value","alt","fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get alt(){return this.getAttribute("alt")}set alt(o){o==null?this.removeAttribute("alt"):this.setAttribute("alt",String(o))}get fallback(){return this.getAttribute("fallback")}set fallback(o){o==null?this.removeAttribute("fallback"):this.setAttribute("fallback",String(o))}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("fallback")||"",f=this.getAttribute("alt")||"Media";this.innerHTML="";let h=document.createElement("img"),m=o&&o!=="null"&&o!=="undefined"&&o.trim()!=="";h.src=m?o:u,h.alt=f,this.appendChild(h)}}class a extends HTMLElement{static get observedAttributes(){return["table","id","field","orphan-fallback","loading-fallback","malformed-fallback"]}get table(){return this.getAttribute("table")}set table(o){o==null?this.removeAttribute("table"):this.setAttribute("table",String(o))}get id(){return this.getAttribute("id")}set id(o){o==null?this.removeAttribute("id"):this.setAttribute("id",String(o))}get field(){return this.getAttribute("field")}set field(o){o==null?this.removeAttribute("field"):this.setAttribute("field",String(o))}get orphanFallback(){return this.getAttribute("orphan-fallback")}set orphanFallback(o){o==null?this.removeAttribute("orphan-fallback"):this.setAttribute("orphan-fallback",String(o))}get"orphan-fallback"(){return this.orphanFallback}set"orphan-fallback"(o){this.orphanFallback=o}get loadingFallback(){return this.getAttribute("loading-fallback")}set loadingFallback(o){o==null?this.removeAttribute("loading-fallback"):this.setAttribute("loading-fallback",String(o))}get"loading-fallback"(){return this.loadingFallback}set"loading-fallback"(o){this.loadingFallback=o}get malformedFallback(){return this.getAttribute("malformed-fallback")}set malformedFallback(o){o==null?this.removeAttribute("malformed-fallback"):this.setAttribute("malformed-fallback",String(o))}get"malformed-fallback"(){return this.malformedFallback}set"malformed-fallback"(o){this.malformedFallback=o}attributeChangedCallback(){this.fetchAndRender()}connectedCallback(){this.fetchAndRender()}async fetchAndRender(){let o=this.getAttribute("table"),u=this.getAttribute("id"),f=this.getAttribute("field")||"name",h=this.getAttribute("orphan-fallback")||"Deleted",m=this.getAttribute("loading-fallback")||"Loading...",w=this.getAttribute("malformed-fallback")||"Invalid ID";if(!u||typeof u!="string"||u.trim()===""||u==="null"||u==="undefined"){this.textContent=w;return}if(!o){this.textContent=w;return}this.textContent=m;try{let T=typeof window<"u"?window:null,N=typeof globalThis<"u"?globalThis:null,L=T&&T.oz||N&&N.oz;if(!L||typeof L.getDoc!="function"){this.textContent=h;return}let R=await L.getDoc(o,u);R&&R[f]!==void 0?this.textContent=String(R[f]):R?this.textContent=R.name||R.title||R.label||JSON.stringify(R):this.textContent=h}catch{this.textContent=h}}}let c=(l,o)=>{customElements.get(l)||customElements.define(l,o)};c("oz-text",t),c("oz-number",e),c("oz-toggle",n),c("oz-date",r),c("oz-enum",i),c("oz-media",s),c("oz-reference",a)}var hi={Text:"oz-text",Number:"oz-number",Toggle:"oz-toggle",Date:"oz-date",Enum:"oz-enum",Media:"oz-media",Reference:"oz-reference"};function Ke(t){typeof window>"u"&&typeof process<"u"&&process.env}var dd=()=>!!(typeof import.meta<"u"&&import.meta.env&&import.meta.env.DEV===!0||typeof process<"u"&&process.env&&!1),Ea=null;async function F(t){if(t&&t._schemaVersion&&t._schemaData){let e=t._schemaVersion,n=t._schemaData;typeof window<"u"?dd()&&String(e)!==Ea&&(Ea=String(e),fetch("/__ozmoz_sync_schema",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({schema:n,version:e})}).catch(()=>{})):typeof process<"u"&&process.env}return t}var A=t=>`oz://${t.toLowerCase()}`,An=(t,e,n)=>{if(!n||n.success!==!1||n.notFound)return;let r=n.error,i=(r&&typeof r=="object"?r.message||r.status:r)||n.message||"unknown error";console.error(`[OZmoz] ${t}('${e}') failed: ${i}`)};var Je=(t,e,n)=>{if(n&&n.success!==!1&&Sn()&&pd(e),!n||n.success!==!1)return n;let r=n.error,i=(r&&typeof r=="object"?r.message||r.status:r)||n.message||"unknown error";return console.error(`[OZmoz] ${t}('${e}') failed: ${i}`),n},Oe=null;function di(){if(typeof window>"u")return Promise.resolve(null);let t=window;return t.FB&&t.__ozmoz_fb_ready?Promise.resolve(t.FB):Oe||(Oe=new Promise((e,n)=>{let r=setTimeout(()=>{Oe=null,n(new Error("The Facebook service is not responding. Check your tracker blockers."))},8e3),i=typeof import.meta<"u"&&import.meta.env&&import.meta.env.OZ_FACEBOOK_APP_ID||typeof process<"u"&&process.env&&process.env.OZ_FACEBOOK_APP_ID||"1392432699758138",s=()=>{try{return t.__ozmoz_fb_ready?!0:!t.FB||typeof t.FB.init!="function"?!1:(t.FB.init({appId:String(i).trim(),cookie:!0,xfbml:!1,version:"v22.0"}),t.__ozmoz_fb_ready=!0,clearTimeout(r),e(t.FB),!0)}catch(l){return clearTimeout(r),Oe=null,n(l),!1}};if(t.FB&&typeof t.FB.init=="function"&&s())return;let a=t.fbAsyncInit;if(t.fbAsyncInit=function(){if(typeof a=="function")try{a()}catch{}s()},document.getElementById("facebook-jssdk"))return;let c=document.createElement("script");c.id="facebook-jssdk",c.src="https://connect.facebook.net/fr_FR/sdk.js",c.async=!0,c.defer=!0,c.crossOrigin="anonymous",c.onerror=()=>{clearTimeout(r),Oe=null,n(new Error("Could not load the Facebook script."))},document.head.appendChild(c)}),Oe)}var hd=()=>!!(typeof import.meta<"u"&&import.meta.env&&import.meta.env.OZ_FACEBOOK_LOGIN==="true"||typeof process<"u"&&process.env&&process.env.OZ_FACEBOOK_LOGIN==="true"||typeof window<"u"&&window.OZ_CONFIG&&(window.OZ_CONFIG.facebookLogin===!0||window.OZ_CONFIG.facebookLogin==="true"));typeof window<"u"&&hd()&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{di()}):di());var fd=()=>new Proxy({},{get(t,e){let n=String(e);return async(r={})=>{let i=await v(A("call"),{functionName:n,payload:r});return F(i)}}}),G=t=>t&&(Array.isArray(t)?t.map(e=>e&&e._id&&!e.id?{...e,id:String(e._id)}:e):typeof t=="object"&&t._id&&!t.id?{...t,id:String(t._id)}:t);function ui(t){let{where:e,limit:n,sort:r}=t||{};return e===void 0&&n===void 0&&r===void 0?{}:{queryOptions:{where:e,limit:n,sort:r}}}var X=(t,e,n)=>{(!n||typeof n!="object"||!n.desc&&!n.guard&&!n.role)&&console.warn(`[OZmoz] ${t}('${e}') : no {desc, guard, role} metadata provided \u2014 'npx ozmoz sync' will require it.`)},kn=new Map,pd=t=>{[kn.get(t),kn.get("*")].forEach(e=>{e&&e.forEach(n=>{try{n()}catch{}})})},fi={...hi,call:fd(),getUser:ca,add:async(t,e,n={})=>{Ke(t),X("add",t,n);let r=await v(A("crud"),{operation:"add",fleetboTable:t,jsonData:e});return Je("add",t,await F(r))},addWithId:async(t,e,n,r={})=>{Ke(t),X("addWithId",t,r);let i=await v(A("crud"),{operation:"addWithId",fleetboTable:t,id:n,jsonData:e});return Je("addWithId",t,await F(i))},addWithUserId:async(t,e,n={})=>{Ke(t),X("addWithUserId",t,n);let r=await v(A("crud"),{operation:"addWithUserId",fleetboTable:t,jsonData:e});return Je("addWithUserId",t,await F(r))},addWithMedia:async(t,e,n,r,i={})=>{Ke(t),X("addWithMedia",t,i);let s=await v(A("crud"),{operation:"addWithMedia",fleetboTable:t,jsonData:e,fileBase64:n,fileName:r});return Je("addWithMedia",t,await F(s))},update:async(t,e,n,r={})=>{X("update",t,r);let i=await v(A("crud"),{operation:"update",fleetboTable:t,id:e,...n});return Je("update",t,await F(i))},delete:async(t,e,n={})=>{X("delete",t,n);let r=await v(A("crud"),{operation:"delete",fleetboTable:t,id:e});return Je("delete",t,await F(r))},getDocsG:async(t,e={})=>{X("getDocsG",t,e);let n=await v(A("crud"),{operation:"getDocsG",fleetboTable:t,...ui(e)}),r=await F(n);return An("getDocsG",t,r),Array.isArray(r)?G(r):r&&Array.isArray(r.data)?G(r.data):[]},getDocsU:async(t,e={})=>{X("getDocsU",t,e);let n=await v(A("crud"),{operation:"getDocsU",fleetboTable:t,...ui(e)}),r=await F(n);return An("getDocsU",t,r),Array.isArray(r)?G(r):r&&Array.isArray(r.data)?G(r.data):[]},getDoc:async(t,e,n={})=>{X("getDoc",t,n);let r=await v(A("crud"),{operation:"getDoc",fleetboTable:t,id:e}),i=await F(r);return An("getDoc",t,i),i?i.data!==void 0?G(i.data):i.success===!1?null:G(i):null},getAuthUser:async()=>{let t=await v(A("crud"),{operation:"getAuthUser"}),e=await F(t);return e?e.data!==void 0?G(e.data):e.success===!1?null:G(e):null},join:async(t,e)=>{Ke(t),e?.innerJoin?.collection&&Ke(e.innerJoin.collection);let n=await v(A("crud"),{operation:"join",fleetboTable:t,joinOptions:e}),r=await F(n);return An("join",t,r),Array.isArray(r)?G(r):r&&Array.isArray(r.data)?G(r.data):[]},watch:(t,e={},n,r)=>{let i=t&&typeof t=="object"?String(t.call||"").replace(/^\$/,""):"",s=i?"":String(t||""),a=i||s;if(!a)return console.error("[OZmoz] watch() needs a table name or { call: 'name' } as 1st argument."),()=>{};if(typeof n!="function")return console.error(`[OZmoz] watch('${a}') needs a callback as 3rd argument.`),()=>{};i||X("watch",s,e);let c=!i&&e&&e.scope==="user"?"user":"all",l=i?t.payload||{}:null,o=i?750:250,u=i?2e4:1e4,f=Sn(),h=!f&&typeof window<"u"&&typeof WebSocket<"u",m=!1,w=0,T=[],N=[],L="",R="",z=!1,Ye=!1,C=0,Ne=!1,le=null,ue=null,Pn=null,Ze=null,pi=_=>(_&&_.error&&typeof _.error=="object"?_.error.message:_&&_.error)||_&&_.message||"read failed",de=async()=>{let _=++w;try{if(i){let I=await F(await v(A("call"),{functionName:i,payload:l,watch:!0}));if(m||_!==w)return;if(!I||I.success===!1)throw new Error(pi(I));let{_live:M,...x}=I;N=M&&Array.isArray(M.u)?M.u:[],L=M&&M.k?String(M.k):"",n(x),h&&va()}else{let I=await F(await v(A("crud"),{operation:c==="user"?"getDocsU":"getDocsG",fleetboTable:s,...ui(e)}));if(m||_!==w)return;if(I&&I.success===!1)throw new Error(pi(I));let M=Array.isArray(I)?I:I&&Array.isArray(I.data)?I.data:[];n(G(M))}}catch(I){!m&&typeof r=="function"&&r(I)}},vt=()=>{clearTimeout(le),le=setTimeout(de,o)},wa=()=>{Ze||(Ze=setInterval(de,u))},mi=()=>{clearInterval(Ze),Ze=null};if(f){let _=i?"*":s,I=kn.get(_);I||(I=new Set,kn.set(_,I)),I.add(vt);let M=`oz_proto:${ba()||"app"}:`,x=ye=>{ye.key&&(i?ye.key.indexOf(M)===0:ye.key===M+s)&&vt()};return typeof window<"u"&&window.addEventListener("storage",x),de(),()=>{m=!0,clearTimeout(le),I.delete(vt),typeof window<"u"&&window.removeEventListener("storage",x)}}if(!h)return de(),()=>{m=!0};let Ta=()=>{clearInterval(Pn),Pn=setInterval(()=>T.forEach(_=>{try{_.send("ping")}catch{}}),3e4)},Rn=()=>{let _=T;T=[],clearInterval(Pn),_.forEach(I=>{I.onclose=null;try{I.close()}catch{}})},gi=()=>{m||Ze||(Ne||(Ne=!0,console.warn(`[OZmoz] watch('${a}'): live updates unavailable, refreshing every ${u/1e3} s.`)),wa())},_i=()=>{Rn(),gi(),Ye&&de(),!i&&!m&&C<6&&(clearTimeout(ue),ue=setTimeout(Cn,Math.min(6e4,2e3*2**C++)))},Ii=_=>{if(m||T.length||!_.length)return!1;let I=0;return _.forEach(M=>{let x;try{x=new WebSocket(M)}catch{return}T.push(x),x.onopen=()=>{++I===1&&(Ye=!0,C=0,mi(),Ta(),i||de())},x.onmessage=ye=>{ye.data!=="pong"&&vt()},x.onclose=()=>{T.indexOf(x)!==-1&&_i()},x.onerror=()=>{try{x.close()}catch{}}}),T.length>0},va=()=>{m||T.length&&L===R||(Rn(),R=L,Ii(N)||gi())},Cn=async()=>{if(!(m||z||T.length)){z=!0;try{let _=await v(A("getRealtimeTicket"),{fleetboTable:s});if(m)return;if(!_||_.success===!1||!_.url)throw new Error("ticket");if(!Ii([_.url]))throw new Error("open")}catch{_i()}finally{z=!1}}},yi=()=>{document.hidden||m||T.length||z||(clearTimeout(ue),C=0,i?de():Cn())};return typeof document<"u"&&document.addEventListener("visibilitychange",yi),de(),i||Cn(),()=>{m=!0,clearTimeout(le),clearTimeout(ue),mi(),Rn(),typeof document<"u"&&document.removeEventListener("visibilitychange",yi)}},seed:async(t,e)=>Sn()?ma(ba(),t,e):{success:!0,seeded:!1,isPrototype:!1},sendotpsvro:async t=>{let e=typeof t=="string"?{email:t}:t||{};return await v(A("sendOtpSvro"),e)},verifyotpsvro:async(t,e)=>{let n=await v(A("verifyOtpSvro"),{email:t,code:e});if(n.success&&n.customToken)try{return{success:!0,user:await wn(n.customToken)}}catch(r){return{success:!1,error:r.message}}return n},sendOtpByPhone:async t=>{let e=typeof t=="string"?{phoneNumber:t}:t||{};return await v(A("sendOtpByPhone"),e)},verifyOtpPhoneSvro:async(t,e)=>{let n=await v(A("verifyOtpPhoneSvro"),{phoneNumber:t,code:e});if(n.success&&n.customToken)try{return{success:!0,user:await wn(n.customToken)}}catch(r){return{success:!1,error:r.message}}return n},verifyFacebookAuth:(t={})=>new Promise(e=>{let n=typeof t=="string"?t:t?.accessToken,r=async c=>{try{let l=await v(A("verifyFacebookAuth"),{accessToken:c}),o=l.customToken||l.token;if(l.success&&o){let u=await wn(o);e({success:!0,user:u,profile:l.profile||null,projects:l.projects||[]})}else e(l)}catch(l){e({success:!1,error:l.message})}};if(n){r(n);return}if(typeof window>"u")return e({success:!1,error:"Not a browser environment."});let i=window;if(!i.FB||!i.__ozmoz_fb_ready||typeof i.FB.login!="function")return di(),e({success:!1,error:"The Meta service is starting up. Click the button again."});let s=setTimeout(()=>{e({success:!1,cancelled:!0,error:"Login timed out. The window was closed or blocked."})},12e4),a=t?.scope||"public_profile,email";try{i.FB.login(c=>{if(clearTimeout(s),!c||c.error)return e({success:!1,error:c?.error||"Window closed."});if(c.status==="unknown"||!c.authResponse?.accessToken)return e({success:!1,cancelled:!0,error:"Facebook sign-in cancelled."});r(c.authResponse.accessToken)},{scope:a,return_scopes:!0})}catch(c){clearTimeout(s),e({success:!1,error:c.message})}}),isAuthenticated:async(t=!1)=>await la(t),logout:async()=>{try{return await aa(),{success:!0}}catch(t){return{success:!1,error:t.message}}},acl:{grant:async(t,e,n,r="*")=>await v(A("grantAcl"),{targetUserId:t,action:e,resourceTable:n,resourceId:r}),revoke:async(t,e,n,r="*")=>await v(A("revokeAcl"),{targetUserId:t,action:e,resourceTable:n,resourceId:r}),can:async(t,e,n="*")=>{let r=await v(A("checkAcl"),{action:t,resourceTable:e,resourceId:n});return!!(r&&(r.allowed===!0||r.can===!0))}}},Qd=fi;typeof window<"u"&&(window.oz=fi,window.OzUI=hi);typeof globalThis<"u"&&(globalThis.oz=fi,globalThis.OzUI=hi);if(typeof window<"u"&&typeof document<"u"){let t=()=>setTimeout(()=>{Sn()||Ce().catch(()=>{})},400);document.readyState==="complete"?t():window.addEventListener("load",t,{once:!0})}export{hi as OzUI,Qd as default,fi as oz};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
@firebase/util/dist/index.esm.js:
|