const Us=()=>{};var Hr={};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Si=function(i){const e=[];let n=0;for(let o=0;o>6|192,e[n++]=a&63|128):(a&64512)===55296&&o+1>18|240,e[n++]=a>>12&63|128,e[n++]=a>>6&63|128,e[n++]=a&63|128):(e[n++]=a>>12|224,e[n++]=a>>6&63|128,e[n++]=a&63|128)}return e},xs=function(i){const e=[];let n=0,o=0;for(;n191&&a<224){const f=i[n++];e[o++]=String.fromCharCode((a&31)<<6|f&63)}else if(a>239&&a<365){const f=i[n++],y=i[n++],w=i[n++],E=((a&7)<<18|(f&63)<<12|(y&63)<<6|w&63)-65536;e[o++]=String.fromCharCode(55296+(E>>10)),e[o++]=String.fromCharCode(56320+(E&1023))}else{const f=i[n++],y=i[n++];e[o++]=String.fromCharCode((a&15)<<12|(f&63)<<6|y&63)}}return e.join("")},bi={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(i,e){if(!Array.isArray(i))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,o=[];for(let a=0;a>2,M=(f&3)<<4|w>>4;let D=(w&15)<<2|A>>6,W=A&63;E||(W=64,y||(D=64)),o.push(n[O],n[M],n[D],n[W])}return o.join("")},encodeString(i,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(i):this.encodeByteArray(Si(i),e)},decodeString(i,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(i):xs(this.decodeStringToByteArray(i,e))},decodeStringToByteArray(i,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,o=[];for(let a=0;a>4;if(o.push(D),A!==64){const W=w<<4&240|A>>2;if(o.push(W),M!==64){const S=A<<6&192|M;o.push(S)}}}return o},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let i=0;i=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)]=i,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)]=i)}}};class Vs extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Fs=function(i){const e=Si(i);return bi.encodeByteArray(e,!0)},Ci=function(i){return Fs(i).replace(/\./g,"")},Pi=function(i){try{return bi.decodeString(i,!0)}catch{}return null};/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function js(){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.")}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Bs=()=>js().__FIREBASE_DEFAULTS__,Hs=()=>{if(typeof process>"u"||typeof Hr>"u")return;const i=Hr.__FIREBASE_DEFAULTS__;if(i)return JSON.parse(i)},$s=()=>{if(typeof document>"u")return;let i;try{i=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=i&&Pi(i[1]);return e&&JSON.parse(e)},Gs=()=>{try{return Us()||Bs()||Hs()||$s()}catch{return}},Ws=i=>Gs()?.[`_${i}`];/** * @license * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Ni(i){try{return(i.startsWith("http://")||i.startsWith("https://")?new URL(i).hostname:i).endsWith(".cloudworkstations.dev")}catch{return!1}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function at(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function zs(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(at())}function qs(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Ks(){const i=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof i=="object"&&i.id!==void 0}function Xs(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Js(){try{return typeof indexedDB=="object"}catch{return!1}}function Ys(){return new Promise((i,e)=>{try{let n=!0;const o="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(o);a.onsuccess=()=>{a.result.close(),n||self.indexedDB.deleteDatabase(o),i(!0)},a.onupgradeneeded=()=>{n=!1},a.onerror=()=>{e(a.error?.message||"")}}catch(n){e(n)}})}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Qs="FirebaseError";class It extends Error{constructor(e,n,o){super(n),this.code=e,this.customData=o,this.name=Qs,Object.setPrototypeOf(this,It.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,fe.prototype.create)}}class fe{constructor(e,n,o){this.service=e,this.serviceName=n,this.errors=o}create(e,...n){const o=n[0]||{},a=`${this.service}/${e}`,f=this.errors[e],y=f?Zs(f,o):"Error",w=`${this.serviceName}: ${y} (${a}).`;return new It(a,w,o)}}function Zs(i,e){return i.replace(to,(n,o)=>{const a=e[o];return a!=null?String(a):`<${o}?>`})}const to=/\{\$([^}]+)}/g;/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Ri(i){const e=[];for(const[n,o]of Object.entries(i))Array.isArray(o)?o.forEach(a=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(a))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(o));return e.length?"&"+e.join("&"):""}function eo(i,e){const n=new no(i,e);return n.subscribe.bind(n)}class no{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(o=>{this.error(o)})}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,o){let a;if(e===void 0&&n===void 0&&o===void 0)throw new Error("Missing Observer.");ro(e,["next","error","complete"])?a=e:a={next:e,error:n,complete:o},a.next===void 0&&(a.next=In),a.error===void 0&&(a.error=In),a.complete===void 0&&(a.complete=In);const f=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?a.error(this.finalError):a.complete()}catch{}}),this.observers.push(a),f}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{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch{}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function ro(i,e){if(typeof i!="object"||i===null)return!1;for(const n of e)if(n in i&&typeof i[n]=="function")return!0;return!1}function In(){}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function We(i){return i&&i._delegate?i._delegate:i}class Bt{constructor(e,n,o){this.name=e,this.instanceFactory=n,this.type=o,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}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */var R;(function(i){i[i.DEBUG=0]="DEBUG",i[i.VERBOSE=1]="VERBOSE",i[i.INFO=2]="INFO",i[i.WARN=3]="WARN",i[i.ERROR=4]="ERROR",i[i.SILENT=5]="SILENT"})(R||(R={}));const io={debug:R.DEBUG,verbose:R.VERBOSE,info:R.INFO,warn:R.WARN,error:R.ERROR,silent:R.SILENT},so=R.INFO,oo={[R.DEBUG]:"log",[R.VERBOSE]:"log",[R.INFO]:"info",[R.WARN]:"warn",[R.ERROR]:"error"},ao=(i,e,...n)=>{if(ee.some(n=>i instanceof n);let $r,Gr;function co(){return $r||($r=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function lo(){return Gr||(Gr=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Di=new WeakMap,Dn=new WeakMap,ki=new WeakMap,An=new WeakMap,xn=new WeakMap;function uo(i){const e=new Promise((n,o)=>{const a=()=>{i.removeEventListener("success",f),i.removeEventListener("error",y)},f=()=>{n(vt(i.result)),a()},y=()=>{o(i.error),a()};i.addEventListener("success",f),i.addEventListener("error",y)});return e.then(n=>{n instanceof IDBCursor&&Di.set(n,i)}).catch(()=>{}),xn.set(e,i),e}function fo(i){if(Dn.has(i))return;const e=new Promise((n,o)=>{const a=()=>{i.removeEventListener("complete",f),i.removeEventListener("error",y),i.removeEventListener("abort",y)},f=()=>{n(),a()},y=()=>{o(i.error||new DOMException("AbortError","AbortError")),a()};i.addEventListener("complete",f),i.addEventListener("error",y),i.addEventListener("abort",y)});Dn.set(i,e)}let kn={get(i,e,n){if(i instanceof IDBTransaction){if(e==="done")return Dn.get(i);if(e==="objectStoreNames")return i.objectStoreNames||ki.get(i);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return vt(i[e])},set(i,e,n){return i[e]=n,!0},has(i,e){return i instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in i}};function po(i){kn=i(kn)}function go(i){return i===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const o=i.call(Tn(this),e,...n);return ki.set(o,e.sort?e.sort():[e]),vt(o)}:lo().includes(i)?function(...e){return i.apply(Tn(this),e),vt(Di.get(this))}:function(...e){return vt(i.apply(Tn(this),e))}}function mo(i){return typeof i=="function"?go(i):(i instanceof IDBTransaction&&fo(i),ho(i,co())?new Proxy(i,kn):i)}function vt(i){if(i instanceof IDBRequest)return uo(i);if(An.has(i))return An.get(i);const e=mo(i);return e!==i&&(An.set(i,e),xn.set(e,i)),e}const Tn=i=>xn.get(i);function yo(i,e,{blocked:n,upgrade:o,blocking:a,terminated:f}={}){const y=indexedDB.open(i,e),w=vt(y);return o&&y.addEventListener("upgradeneeded",E=>{o(vt(y.result),E.oldVersion,E.newVersion,vt(y.transaction),E)}),n&&y.addEventListener("blocked",E=>n(E.oldVersion,E.newVersion,E)),w.then(E=>{f&&E.addEventListener("close",()=>f()),a&&E.addEventListener("versionchange",A=>a(A.oldVersion,A.newVersion,A))}).catch(()=>{}),w}const _o=["get","getKey","getAll","getAllKeys","count"],vo=["put","add","delete","clear"],Sn=new Map;function Wr(i,e){if(!(i instanceof IDBDatabase&&!(e in i)&&typeof e=="string"))return;if(Sn.get(e))return Sn.get(e);const n=e.replace(/FromIndex$/,""),o=e!==n,a=vo.includes(n);if(!(n in(o?IDBIndex:IDBObjectStore).prototype)||!(a||_o.includes(n)))return;const f=async function(y,...w){const E=this.transaction(y,a?"readwrite":"readonly");let A=E.store;return o&&(A=A.index(w.shift())),(await Promise.all([A[n](...w),a&&E.done]))[0]};return Sn.set(e,f),f}po(i=>({...i,get:(e,n,o)=>Wr(e,n)||i.get(e,n,o),has:(e,n)=>!!Wr(e,n)||i.has(e,n)}));/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class wo{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(Eo(n)){const o=n.getImmediate();return`${o.library}/${o.version}`}else return null}).filter(n=>n).join(" ")}}function Eo(i){return i.getComponent()?.type==="VERSION"}const On="@firebase/app",zr="0.14.1";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ft=new Un("@firebase/app"),Io="@firebase/app-compat",Ao="@firebase/analytics-compat",To="@firebase/analytics",So="@firebase/app-check-compat",bo="@firebase/app-check",Co="@firebase/auth",Po="@firebase/auth-compat",No="@firebase/database",Ro="@firebase/data-connect",Do="@firebase/database-compat",ko="@firebase/functions",Oo="@firebase/functions-compat",Lo="@firebase/installations",Mo="@firebase/installations-compat",Uo="@firebase/messaging",xo="@firebase/messaging-compat",Vo="@firebase/performance",Fo="@firebase/performance-compat",jo="@firebase/remote-config",Bo="@firebase/remote-config-compat",Ho="@firebase/storage",$o="@firebase/storage-compat",Go="@firebase/firestore",Wo="@firebase/ai",zo="@firebase/firestore-compat",qo="firebase",Ko="12.1.0",Xo={[On]:"fire-core",[Io]:"fire-core-compat",[To]:"fire-analytics",[Ao]:"fire-analytics-compat",[bo]:"fire-app-check",[So]:"fire-app-check-compat",[Co]:"fire-auth",[Po]:"fire-auth-compat",[No]:"fire-rtdb",[Ro]:"fire-data-connect",[Do]:"fire-rtdb-compat",[ko]:"fire-fn",[Oo]:"fire-fn-compat",[Lo]:"fire-iid",[Mo]:"fire-iid-compat",[Uo]:"fire-fcm",[xo]:"fire-fcm-compat",[Vo]:"fire-perf",[Fo]:"fire-perf-compat",[jo]:"fire-rc",[Bo]:"fire-rc-compat",[Ho]:"fire-gcs",[$o]:"fire-gcs-compat",[Go]:"fire-fst",[zo]:"fire-fst-compat",[Wo]:"fire-vertex","fire-js":"fire-js",[qo]:"fire-js-all"};/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Jo=new Map,Yo=new Map,qr=new Map;function Kr(i,e){try{i.container.addComponent(e)}catch(n){ft.debug(`Component ${e.name} failed to register with FirebaseApp ${i.name}`,n)}}function Ht(i){const e=i.name;if(qr.has(e))return ft.debug(`There were multiple attempts to register component ${e}.`),!1;qr.set(e,i);for(const n of Jo.values())Kr(n,i);for(const n of Yo.values())Kr(n,i);return!0}function bt(i){return i==null?!1:i.settings!==void 0}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Qo={"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."},Vn=new fe("app","Firebase",Qo);/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ze=Ko;function wt(i,e,n){let o=Xo[i]??i;n&&(o+=`-${n}`);const a=o.match(/\s|\//),f=e.match(/\s|\//);if(a||f){const y=[`Unable to register library "${o}" with version "${e}":`];a&&y.push(`library name "${o}" contains illegal characters (whitespace or "/")`),a&&f&&y.push("and"),f&&y.push(`version name "${e}" contains illegal characters (whitespace or "/")`),ft.warn(y.join(" "));return}Ht(new Bt(`${o}-version`,()=>({library:o,version:e}),"VERSION"))}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Zo="firebase-heartbeat-database",ta=1,ue="firebase-heartbeat-store";let bn=null;function Oi(){return bn||(bn=yo(Zo,ta,{upgrade:(i,e)=>{switch(e){case 0:try{i.createObjectStore(ue)}catch{}}}}).catch(i=>{throw Vn.create("idb-open",{originalErrorMessage:i.message})})),bn}async function ea(i){try{const n=(await Oi()).transaction(ue),o=await n.objectStore(ue).get(Li(i));return await n.done,o}catch(e){if(e instanceof It)ft.warn(e.message);else{const n=Vn.create("idb-get",{originalErrorMessage:e?.message});ft.warn(n.message)}}}async function Xr(i,e){try{const o=(await Oi()).transaction(ue,"readwrite");await o.objectStore(ue).put(e,Li(i)),await o.done}catch(n){if(n instanceof It)ft.warn(n.message);else{const o=Vn.create("idb-set",{originalErrorMessage:n?.message});ft.warn(o.message)}}}function Li(i){return`${i.name}!${i.options.appId}`}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const na=1024,ra=30;class ia{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new oa(n),this._heartbeatsCachePromise=this._storage.read().then(o=>(this._heartbeatsCache=o,o))}async triggerHeartbeat(){try{const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),o=Jr();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===o||this._heartbeatsCache.heartbeats.some(a=>a.date===o))return;if(this._heartbeatsCache.heartbeats.push({date:o,agent:n}),this._heartbeatsCache.heartbeats.length>ra){const a=aa(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(a,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){ft.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";const e=Jr(),{heartbeatsToSend:n,unsentEntries:o}=sa(this._heartbeatsCache.heartbeats),a=Ci(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,o.length>0?(this._heartbeatsCache.heartbeats=o,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),a}catch(e){return ft.warn(e),""}}}function Jr(){return new Date().toISOString().substring(0,10)}function sa(i,e=na){const n=[];let o=i.slice();for(const a of i){const f=n.find(y=>y.agent===a.agent);if(f){if(f.dates.push(a.date),Yr(n)>e){f.dates.pop();break}}else if(n.push({agent:a.agent,dates:[a.date]}),Yr(n)>e){n.pop();break}o=o.slice(1)}return{heartbeatsToSend:n,unsentEntries:o}}class oa{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Js()?Ys().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await ea(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const o=await this.read();return Xr(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??o.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const o=await this.read();return Xr(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??o.lastSentHeartbeatDate,heartbeats:[...o.heartbeats,...e.heartbeats]})}else return}}function Yr(i){return Ci(JSON.stringify({version:2,heartbeats:i})).length}function aa(i){if(i.length===0)return-1;let e=0,n=i[0].date;for(let o=1;onew wo(e),"PRIVATE")),Ht(new Bt("heartbeat",e=>new ia(e),"PRIVATE")),wt(On,zr,i),wt(On,zr,"esm2020"),wt("fire-js","")}ha("");function Mi(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const ca=Mi,Ui=new fe("auth","Firebase",Mi());/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Ve=new Un("@firebase/auth");function la(i,...e){Ve.logLevel<=R.WARN&&Ve.warn(`Auth (${ze}): ${i}`,...e)}function Me(i,...e){Ve.logLevel<=R.ERROR&&Ve.error(`Auth (${ze}): ${i}`,...e)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Qr(i,...e){throw Fn(i,...e)}function xi(i,...e){return Fn(i,...e)}function Vi(i,e,n){const o={...ca(),[e]:n};return new fe("auth","Firebase",o).create(e,{appName:i.name})}function Ue(i){return Vi(i,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Fn(i,...e){if(typeof i!="string"){const n=e[0],o=[...e.slice(1)];return o[0]&&(o[0].appName=i.name),i._errorFactory.create(n,...o)}return Ui.create(i,...e)}function C(i,e,...n){if(!i)throw Fn(e,...n)}function oe(i){const e="INTERNAL ASSERTION FAILED: "+i;throw Me(e),new Error(e)}function Fe(i,e){i||oe(e)}function ua(){return Zr()==="http:"||Zr()==="https:"}function Zr(){return typeof self<"u"&&self.location?.protocol||null}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function fa(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(ua()||Ks()||"connection"in navigator)?navigator.onLine:!0}function da(){if(typeof navigator>"u")return null;const i=navigator;return i.languages&&i.languages[0]||i.language||null}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class de{constructor(e,n){this.shortDelay=e,this.longDelay=n,Fe(n>e,"Short delay should be less than long delay!"),this.isMobile=zs()||Xs()}get(){return fa()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function pa(i,e){Fe(i.emulator,"Emulator should always be set here");const{url:n}=i.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Fi{static initialize(e,n,o){this.fetchImpl=e,n&&(this.headersImpl=n),o&&(this.responseImpl=o)}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;oe("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;oe("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;oe("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ga={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"};/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ma=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],ya=new de(3e4,6e4);function ji(i,e){return i.tenantId&&!e.tenantId?{...e,tenantId:i.tenantId}:e}async function qe(i,e,n,o,a={}){return Bi(i,a,async()=>{let f={},y={};o&&(e==="GET"?y=o:f={body:JSON.stringify(o)});const w=Ri({key:i.config.apiKey,...y}).slice(1),E=await i._getAdditionalHeaders();E["Content-Type"]="application/json",i.languageCode&&(E["X-Firebase-Locale"]=i.languageCode);const A={method:e,headers:E,...f};return qs()||(A.referrerPolicy="no-referrer"),i.emulatorConfig&&Ni(i.emulatorConfig.host)&&(A.credentials="include"),Fi.fetch()(await Hi(i,i.config.apiHost,n,w),A)})}async function Bi(i,e,n){i._canInitEmulator=!1;const o={...ga,...e};try{const a=new _a(i),f=await Promise.race([n(),a.promise]);a.clearNetworkTimeout();const y=await f.json();if("needConfirmation"in y)throw ke(i,"account-exists-with-different-credential",y);if(f.ok&&!("errorMessage"in y))return y;{const w=f.ok?y.errorMessage:y.error.message,[E,A]=w.split(" : ");if(E==="FEDERATED_USER_ID_ALREADY_LINKED")throw ke(i,"credential-already-in-use",y);if(E==="EMAIL_EXISTS")throw ke(i,"email-already-in-use",y);if(E==="USER_DISABLED")throw ke(i,"user-disabled",y);const O=o[E]||E.toLowerCase().replace(/[_\s]+/g,"-");if(A)throw Vi(i,O,A);Qr(i,O)}}catch(a){if(a instanceof It)throw a;Qr(i,"network-request-failed",{message:String(a)})}}async function Hi(i,e,n,o){const a=`${e}${n}?${o}`,f=i,y=f.config.emulator?pa(i.config,a):`${i.config.apiScheme}://${a}`;return ma.includes(n)&&(await f._persistenceManagerAvailable,f._getPersistenceType()==="COOKIE")?f._getPersistence()._getFinalTarget(y).toString():y}class _a{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,o)=>{this.timer=setTimeout(()=>o(xi(this.auth,"network-request-failed")),ya.get())})}}function ke(i,e,n){const o={appName:i.name};n.email&&(o.email=n.email),n.phoneNumber&&(o.phoneNumber=n.phoneNumber);const a=xi(i,e,o);return a.customData._tokenResponse=n,a}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function va(i,e){return qe(i,"POST","/v1/accounts:delete",e)}async function je(i,e){return qe(i,"POST","/v1/accounts:lookup",e)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function ae(i){if(i)try{const e=new Date(Number(i));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function wa(i,e=!1){const n=We(i),o=await n.getIdToken(e),a=$i(o);C(a&&a.exp&&a.auth_time&&a.iat,n.auth,"internal-error");const f=typeof a.firebase=="object"?a.firebase:void 0,y=f?.sign_in_provider;return{claims:a,token:o,authTime:ae(Cn(a.auth_time)),issuedAtTime:ae(Cn(a.iat)),expirationTime:ae(Cn(a.exp)),signInProvider:y||null,signInSecondFactor:f?.sign_in_second_factor||null}}function Cn(i){return Number(i)*1e3}function $i(i){const[e,n,o]=i.split(".");if(e===void 0||n===void 0||o===void 0)return Me("JWT malformed, contained fewer than 3 sections"),null;try{const a=Pi(n);return a?JSON.parse(a):(Me("Failed to decode base64 JWT payload"),null)}catch(a){return Me("Caught error parsing JWT payload as JSON",a?.toString()),null}}function ti(i){const e=$i(i);return C(e,"internal-error"),C(typeof e.exp<"u","internal-error"),C(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function Ln(i,e,n=!1){if(n)return e;try{return await e}catch(o){throw o instanceof It&&Ea(o)&&i.auth.currentUser===i&&await i.auth.signOut(),o}}function Ea({code:i}){return i==="auth/user-disabled"||i==="auth/user-token-expired"}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ia{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const o=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,o)}}schedule(e=!1){if(!this.isRunning)return;const 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()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Mn{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ae(this.lastLoginAt),this.creationTime=ae(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function Be(i){const e=i.auth,n=await i.getIdToken(),o=await Ln(i,je(e,{idToken:n}));C(o?.users.length,e,"internal-error");const a=o.users[0];i._notifyReloadListener(a);const f=a.providerUserInfo?.length?Gi(a.providerUserInfo):[],y=Ta(i.providerData,f),w=i.isAnonymous,E=!(i.email&&a.passwordHash)&&!y?.length,A=w?E:!1,O={uid:a.localId,displayName:a.displayName||null,photoURL:a.photoUrl||null,email:a.email||null,emailVerified:a.emailVerified||!1,phoneNumber:a.phoneNumber||null,tenantId:a.tenantId||null,providerData:y,metadata:new Mn(a.createdAt,a.lastLoginAt),isAnonymous:A};Object.assign(i,O)}async function Aa(i){const e=We(i);await Be(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Ta(i,e){return[...i.filter(o=>!e.some(a=>a.providerId===o.providerId)),...e]}function Gi(i){return i.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}))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function Sa(i,e){const n=await Bi(i,{},async()=>{const o=Ri({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:a,apiKey:f}=i.config,y=await Hi(i,a,"/v1/token",`key=${f}`),w=await i._getAdditionalHeaders();w["Content-Type"]="application/x-www-form-urlencoded";const E={method:"POST",headers:w,body:o};return i.emulatorConfig&&Ni(i.emulatorConfig.host)&&(E.credentials="include"),Fi.fetch()(y,E)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ba(i,e){return qe(i,"POST","/v2/accounts:revokeToken",ji(i,e))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Vt{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){C(e.idToken,"internal-error"),C(typeof e.idToken<"u","internal-error"),C(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):ti(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){C(e.length!==0,"internal-error");const n=ti(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(C(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){const{accessToken:o,refreshToken:a,expiresIn:f}=await Sa(e,n);this.updateTokensAndExpiration(o,a,Number(f))}updateTokensAndExpiration(e,n,o){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+o*1e3}static fromJSON(e,n){const{refreshToken:o,accessToken:a,expirationTime:f}=n,y=new Vt;return o&&(C(typeof o=="string","internal-error",{appName:e}),y.refreshToken=o),a&&(C(typeof a=="string","internal-error",{appName:e}),y.accessToken=a),f&&(C(typeof f=="number","internal-error",{appName:e}),y.expirationTime=f),y}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 Vt,this.toJSON())}_performRefresh(){return oe("not implemented")}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function _t(i,e){C(typeof i=="string"||typeof i>"u","internal-error",{appName:e})}class st{constructor({uid:e,auth:n,stsTokenManager:o,...a}){this.providerId="firebase",this.proactiveRefresh=new Ia(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=o,this.accessToken=o.accessToken,this.displayName=a.displayName||null,this.email=a.email||null,this.emailVerified=a.emailVerified||!1,this.phoneNumber=a.phoneNumber||null,this.photoURL=a.photoURL||null,this.isAnonymous=a.isAnonymous||!1,this.tenantId=a.tenantId||null,this.providerData=a.providerData?[...a.providerData]:[],this.metadata=new Mn(a.createdAt||void 0,a.lastLoginAt||void 0)}async getIdToken(e){const n=await Ln(this,this.stsTokenManager.getToken(this.auth,e));return C(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return wa(this,e)}reload(){return Aa(this)}_assign(e){this!==e&&(C(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){const n=new st({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){C(!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 o=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),o=!0),n&&await Be(this),await this.auth._persistUserIfCurrent(this),o&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(bt(this.auth.app))return Promise.reject(Ue(this.auth));const e=await this.getIdToken();return await Ln(this,va(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){const o=n.displayName??void 0,a=n.email??void 0,f=n.phoneNumber??void 0,y=n.photoURL??void 0,w=n.tenantId??void 0,E=n._redirectEventId??void 0,A=n.createdAt??void 0,O=n.lastLoginAt??void 0,{uid:M,emailVerified:D,isAnonymous:W,providerData:S,stsTokenManager:F}=n;C(M&&F,e,"internal-error");const U=Vt.fromJSON(this.name,F);C(typeof M=="string",e,"internal-error"),_t(o,e.name),_t(a,e.name),C(typeof D=="boolean",e,"internal-error"),C(typeof W=="boolean",e,"internal-error"),_t(f,e.name),_t(y,e.name),_t(w,e.name),_t(E,e.name),_t(A,e.name),_t(O,e.name);const et=new st({uid:M,auth:e,email:a,emailVerified:D,displayName:o,isAnonymous:W,photoURL:y,phoneNumber:f,tenantId:w,stsTokenManager:U,createdAt:A,lastLoginAt:O});return S&&Array.isArray(S)&&(et.providerData=S.map(X=>({...X}))),E&&(et._redirectEventId=E),et}static async _fromIdTokenResponse(e,n,o=!1){const a=new Vt;a.updateFromServerResponse(n);const f=new st({uid:n.localId,auth:e,stsTokenManager:a,isAnonymous:o});return await Be(f),f}static async _fromGetAccountInfoResponse(e,n,o){const a=n.users[0];C(a.localId!==void 0,"internal-error");const f=a.providerUserInfo!==void 0?Gi(a.providerUserInfo):[],y=!(a.email&&a.passwordHash)&&!f?.length,w=new Vt;w.updateFromIdToken(o);const E=new st({uid:a.localId,auth:e,stsTokenManager:w,isAnonymous:y}),A={uid:a.localId,displayName:a.displayName||null,photoURL:a.photoUrl||null,email:a.email||null,emailVerified:a.emailVerified||!1,phoneNumber:a.phoneNumber||null,tenantId:a.tenantId||null,providerData:f,metadata:new Mn(a.createdAt,a.lastLoginAt),isAnonymous:!(a.email&&a.passwordHash)&&!f?.length};return Object.assign(E,A),E}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ei=new Map;function Pt(i){Fe(i instanceof Function,"Expected a class definition");let e=ei.get(i);return e?(Fe(e instanceof i,"Instance stored in cache mismatched with class"),e):(e=new i,ei.set(i,e),e)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Wi{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){const n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}}Wi.type="NONE";const ni=Wi;/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Pn(i,e,n){return`firebase:${i}:${e}:${n}`}class Ft{constructor(e,n,o){this.persistence=e,this.auth=n,this.userKey=o;const{config:a,name:f}=this.auth;this.fullUserKey=Pn(this.userKey,a.apiKey,f),this.fullPersistenceKey=Pn("persistence",a.apiKey,f),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(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const n=await je(this.auth,{idToken:e}).catch(()=>{});return n?st._fromGetAccountInfoResponse(this.auth,n,e):null}return st._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const 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,o="authUser"){if(!n.length)return new Ft(Pt(ni),e,o);const a=(await Promise.all(n.map(async A=>{if(await A._isAvailable())return A}))).filter(A=>A);let f=a[0]||Pt(ni);const y=Pn(o,e.config.apiKey,e.name);let w=null;for(const A of n)try{const O=await A._get(y);if(O){let M;if(typeof O=="string"){const D=await je(e,{idToken:O}).catch(()=>{});if(!D)break;M=await st._fromGetAccountInfoResponse(e,D,O)}else M=st._fromJSON(e,O);A!==f&&(w=M),f=A;break}}catch{}const E=a.filter(A=>A._shouldAllowMigration);return!f._shouldAllowMigration||!E.length?new Ft(f,e,o):(f=E[0],w&&await f._set(y,w.toJSON()),await Promise.all(n.map(async A=>{if(A!==f)try{await A._remove(y)}catch{}})),new Ft(f,e,o))}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function ri(i){const e=i.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Ra(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Ca(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(ka(e))return"Blackberry";if(Oa(e))return"Webos";if(Pa(e))return"Safari";if((e.includes("chrome/")||Na(e))&&!e.includes("edge/"))return"Chrome";if(Da(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,o=i.match(n);if(o?.length===2)return o[1]}return"Other"}function Ca(i=at()){return/firefox\//i.test(i)}function Pa(i=at()){const e=i.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Na(i=at()){return/crios\//i.test(i)}function Ra(i=at()){return/iemobile/i.test(i)}function Da(i=at()){return/android/i.test(i)}function ka(i=at()){return/blackberry/i.test(i)}function Oa(i=at()){return/webos/i.test(i)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function zi(i,e=[]){let n;switch(i){case"Browser":n=ri(at());break;case"Worker":n=`${ri(at())}-${i}`;break;default:n=i}const o=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ze}/${o}`}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class La{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const o=f=>new Promise((y,w)=>{try{const E=e(f);y(E)}catch(E){w(E)}});o.onAbort=n,this.queue.push(o);const a=this.queue.length-1;return()=>{this.queue[a]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const o of this.queue)await o(e),o.onAbort&&n.push(o.onAbort)}catch(o){n.reverse();for(const a of n)try{a()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:o?.message})}}}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function Ma(i,e={}){return qe(i,"GET","/v2/passwordPolicy",ji(i,e))}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Ua=6;class xa{constructor(e){const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??Ua,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){const 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){const o=this.customStrengthOptions.minPasswordLength,a=this.customStrengthOptions.maxPasswordLength;o&&(n.meetsMinPasswordLength=e.length>=o),a&&(n.meetsMaxPasswordLength=e.length<=a)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let o;for(let a=0;a="a"&&o<="z",o>="A"&&o<="Z",o>="0"&&o<="9",this.allowedNonAlphanumericCharacters.includes(o))}updatePasswordCharacterOptionsStatuses(e,n,o,a,f){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=o)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=a)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=f))}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Va{constructor(e,n,o,a){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=o,this.config=a,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new ii(this),this.idTokenSubscription=new ii(this),this.beforeStateQueue=new La(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=Ui,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=a.sdkClientVersion,this._persistenceManagerAvailable=new Promise(f=>this._resolvePersistenceManagerAvailable=f)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=Pt(n)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await Ft.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;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const n=await je(this,{idToken:e}),o=await st._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(o)}catch{await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(bt(this.app)){const f=this.app.settings.authIdToken;return f?new Promise(y=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(f).then(y,y))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let o=n,a=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const f=this.redirectUser?._redirectEventId,y=o?._redirectEventId,w=await this.tryRedirectSignIn(e);(!f||f===y)&&w?.user&&(o=w.user,a=!0)}if(!o)return this.directlySetCurrentUser(null);if(!o._redirectEventId){if(a)try{await this.beforeStateQueue.runMiddleware(o)}catch(f){o=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(f))}return o?this.reloadAndSetCurrentUserOrClear(o):this.directlySetCurrentUser(null)}return C(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===o._redirectEventId?this.directlySetCurrentUser(o):this.reloadAndSetCurrentUserOrClear(o)}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 Be(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=da()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(bt(this.app))return Promise.reject(Ue(this));const n=e?We(e):null;return n&&C(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&&C(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 bt(this.app)?Promise.reject(Ue(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return bt(this.app)?Promise.reject(Ue(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Pt(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const 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(){const e=await Ma(this),n=new xa(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 fe("auth","Firebase",e())}onAuthStateChanged(e,n,o){return this.registerStateListener(this.authStateSubscription,e,n,o)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,o){return this.registerStateListener(this.idTokenSubscription,e,n,o)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const o=this.onAuthStateChanged(()=>{o(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),o={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(o.tenantId=this.tenantId),await ba(this,o)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,n){const o=await this.getOrInitRedirectPersistenceManager(n);return e===null?o.removeCurrentUser():o.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&Pt(e)||this._popupRedirectResolver;C(n,this,"argument-error"),this.redirectPersistenceManager=await Ft.create(this,[Pt(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);const e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,o,a){if(this._deleted)return()=>{};const f=typeof n=="function"?n:n.next.bind(n);let y=!1;const w=this._isInitialized?Promise.resolve():this._initializationPromise;if(C(w,this,"internal-error"),w.then(()=>{y||f(this.currentUser)}),typeof n=="function"){const E=e.addObserver(n,o,a);return()=>{y=!0,E()}}else{const E=e.addObserver(n);return()=>{y=!0,E()}}}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 C(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=zi(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();n&&(e["X-Firebase-Client"]=n);const o=await this._getAppCheckToken();return o&&(e["X-Firebase-AppCheck"]=o),e}async _getAppCheckToken(){if(bt(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&la(`Error while retrieving App Check token: ${e.error}`),e?.token}}function Fa(i){return We(i)}class ii{constructor(e){this.auth=e,this.observer=null,this.addObserver=eo(n=>this.observer=n)}get next(){return C(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function ja(i,e){const n=e?.persistence||[],o=(Array.isArray(n)?n:[n]).map(Pt);e?.errorMap&&i._updateErrorMap(e.errorMap),i._initializeWithPersistence(o,e?.popupRedirectResolver)}new de(3e4,6e4);/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */new de(2e3,1e4);/** * @license * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */new de(3e4,6e4);/** * @license * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */new de(5e3,15e3);var si="@firebase/auth",oi="1.11.0";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ba{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(o=>{e(o?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){C(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Ha(i){switch(i){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function $a(i){Ht(new Bt("auth",(e,{options:n})=>{const o=e.getProvider("app").getImmediate(),a=e.getProvider("heartbeat"),f=e.getProvider("app-check-internal"),{apiKey:y,authDomain:w}=o.options;C(y&&!y.includes(":"),"invalid-api-key",{appName:o.name});const E={apiKey:y,authDomain:w,clientPlatform:i,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:zi(i)},A=new Va(o,a,f,E);return ja(A,n),A},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,o)=>{e.getProvider("auth-internal").initialize()})),Ht(new Bt("auth-internal",e=>{const n=Fa(e.getProvider("auth").getImmediate());return(o=>new Ba(o))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),wt(si,oi,Ha(i)),wt(si,oi,"esm2020")}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Ga=300;Ws("authIdTokenMaxAge");$a("Browser");var ai=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */var jn;(function(){var i;/** @license Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */function e(g,c){function u(){}u.prototype=c.prototype,g.D=c.prototype,g.prototype=new u,g.prototype.constructor=g,g.C=function(d,p,_){for(var l=Array(arguments.length-2),ht=2;htp;++p)d[p]=c.charCodeAt(u++)|c.charCodeAt(u++)<<8|c.charCodeAt(u++)<<16|c.charCodeAt(u++)<<24;else for(p=0;16>p;++p)d[p]=c[u++]|c[u++]<<8|c[u++]<<16|c[u++]<<24;c=g.g[0],u=g.g[1],p=g.g[2];var _=g.g[3],l=c+(_^u&(p^_))+d[0]+3614090360&4294967295;c=u+(l<<7&4294967295|l>>>25),l=_+(p^c&(u^p))+d[1]+3905402710&4294967295,_=c+(l<<12&4294967295|l>>>20),l=p+(u^_&(c^u))+d[2]+606105819&4294967295,p=_+(l<<17&4294967295|l>>>15),l=u+(c^p&(_^c))+d[3]+3250441966&4294967295,u=p+(l<<22&4294967295|l>>>10),l=c+(_^u&(p^_))+d[4]+4118548399&4294967295,c=u+(l<<7&4294967295|l>>>25),l=_+(p^c&(u^p))+d[5]+1200080426&4294967295,_=c+(l<<12&4294967295|l>>>20),l=p+(u^_&(c^u))+d[6]+2821735955&4294967295,p=_+(l<<17&4294967295|l>>>15),l=u+(c^p&(_^c))+d[7]+4249261313&4294967295,u=p+(l<<22&4294967295|l>>>10),l=c+(_^u&(p^_))+d[8]+1770035416&4294967295,c=u+(l<<7&4294967295|l>>>25),l=_+(p^c&(u^p))+d[9]+2336552879&4294967295,_=c+(l<<12&4294967295|l>>>20),l=p+(u^_&(c^u))+d[10]+4294925233&4294967295,p=_+(l<<17&4294967295|l>>>15),l=u+(c^p&(_^c))+d[11]+2304563134&4294967295,u=p+(l<<22&4294967295|l>>>10),l=c+(_^u&(p^_))+d[12]+1804603682&4294967295,c=u+(l<<7&4294967295|l>>>25),l=_+(p^c&(u^p))+d[13]+4254626195&4294967295,_=c+(l<<12&4294967295|l>>>20),l=p+(u^_&(c^u))+d[14]+2792965006&4294967295,p=_+(l<<17&4294967295|l>>>15),l=u+(c^p&(_^c))+d[15]+1236535329&4294967295,u=p+(l<<22&4294967295|l>>>10),l=c+(p^_&(u^p))+d[1]+4129170786&4294967295,c=u+(l<<5&4294967295|l>>>27),l=_+(u^p&(c^u))+d[6]+3225465664&4294967295,_=c+(l<<9&4294967295|l>>>23),l=p+(c^u&(_^c))+d[11]+643717713&4294967295,p=_+(l<<14&4294967295|l>>>18),l=u+(_^c&(p^_))+d[0]+3921069994&4294967295,u=p+(l<<20&4294967295|l>>>12),l=c+(p^_&(u^p))+d[5]+3593408605&4294967295,c=u+(l<<5&4294967295|l>>>27),l=_+(u^p&(c^u))+d[10]+38016083&4294967295,_=c+(l<<9&4294967295|l>>>23),l=p+(c^u&(_^c))+d[15]+3634488961&4294967295,p=_+(l<<14&4294967295|l>>>18),l=u+(_^c&(p^_))+d[4]+3889429448&4294967295,u=p+(l<<20&4294967295|l>>>12),l=c+(p^_&(u^p))+d[9]+568446438&4294967295,c=u+(l<<5&4294967295|l>>>27),l=_+(u^p&(c^u))+d[14]+3275163606&4294967295,_=c+(l<<9&4294967295|l>>>23),l=p+(c^u&(_^c))+d[3]+4107603335&4294967295,p=_+(l<<14&4294967295|l>>>18),l=u+(_^c&(p^_))+d[8]+1163531501&4294967295,u=p+(l<<20&4294967295|l>>>12),l=c+(p^_&(u^p))+d[13]+2850285829&4294967295,c=u+(l<<5&4294967295|l>>>27),l=_+(u^p&(c^u))+d[2]+4243563512&4294967295,_=c+(l<<9&4294967295|l>>>23),l=p+(c^u&(_^c))+d[7]+1735328473&4294967295,p=_+(l<<14&4294967295|l>>>18),l=u+(_^c&(p^_))+d[12]+2368359562&4294967295,u=p+(l<<20&4294967295|l>>>12),l=c+(u^p^_)+d[5]+4294588738&4294967295,c=u+(l<<4&4294967295|l>>>28),l=_+(c^u^p)+d[8]+2272392833&4294967295,_=c+(l<<11&4294967295|l>>>21),l=p+(_^c^u)+d[11]+1839030562&4294967295,p=_+(l<<16&4294967295|l>>>16),l=u+(p^_^c)+d[14]+4259657740&4294967295,u=p+(l<<23&4294967295|l>>>9),l=c+(u^p^_)+d[1]+2763975236&4294967295,c=u+(l<<4&4294967295|l>>>28),l=_+(c^u^p)+d[4]+1272893353&4294967295,_=c+(l<<11&4294967295|l>>>21),l=p+(_^c^u)+d[7]+4139469664&4294967295,p=_+(l<<16&4294967295|l>>>16),l=u+(p^_^c)+d[10]+3200236656&4294967295,u=p+(l<<23&4294967295|l>>>9),l=c+(u^p^_)+d[13]+681279174&4294967295,c=u+(l<<4&4294967295|l>>>28),l=_+(c^u^p)+d[0]+3936430074&4294967295,_=c+(l<<11&4294967295|l>>>21),l=p+(_^c^u)+d[3]+3572445317&4294967295,p=_+(l<<16&4294967295|l>>>16),l=u+(p^_^c)+d[6]+76029189&4294967295,u=p+(l<<23&4294967295|l>>>9),l=c+(u^p^_)+d[9]+3654602809&4294967295,c=u+(l<<4&4294967295|l>>>28),l=_+(c^u^p)+d[12]+3873151461&4294967295,_=c+(l<<11&4294967295|l>>>21),l=p+(_^c^u)+d[15]+530742520&4294967295,p=_+(l<<16&4294967295|l>>>16),l=u+(p^_^c)+d[2]+3299628645&4294967295,u=p+(l<<23&4294967295|l>>>9),l=c+(p^(u|~_))+d[0]+4096336452&4294967295,c=u+(l<<6&4294967295|l>>>26),l=_+(u^(c|~p))+d[7]+1126891415&4294967295,_=c+(l<<10&4294967295|l>>>22),l=p+(c^(_|~u))+d[14]+2878612391&4294967295,p=_+(l<<15&4294967295|l>>>17),l=u+(_^(p|~c))+d[5]+4237533241&4294967295,u=p+(l<<21&4294967295|l>>>11),l=c+(p^(u|~_))+d[12]+1700485571&4294967295,c=u+(l<<6&4294967295|l>>>26),l=_+(u^(c|~p))+d[3]+2399980690&4294967295,_=c+(l<<10&4294967295|l>>>22),l=p+(c^(_|~u))+d[10]+4293915773&4294967295,p=_+(l<<15&4294967295|l>>>17),l=u+(_^(p|~c))+d[1]+2240044497&4294967295,u=p+(l<<21&4294967295|l>>>11),l=c+(p^(u|~_))+d[8]+1873313359&4294967295,c=u+(l<<6&4294967295|l>>>26),l=_+(u^(c|~p))+d[15]+4264355552&4294967295,_=c+(l<<10&4294967295|l>>>22),l=p+(c^(_|~u))+d[6]+2734768916&4294967295,p=_+(l<<15&4294967295|l>>>17),l=u+(_^(p|~c))+d[13]+1309151649&4294967295,u=p+(l<<21&4294967295|l>>>11),l=c+(p^(u|~_))+d[4]+4149444226&4294967295,c=u+(l<<6&4294967295|l>>>26),l=_+(u^(c|~p))+d[11]+3174756917&4294967295,_=c+(l<<10&4294967295|l>>>22),l=p+(c^(_|~u))+d[2]+718787259&4294967295,p=_+(l<<15&4294967295|l>>>17),l=u+(_^(p|~c))+d[9]+3951481745&4294967295,g.g[0]=g.g[0]+c&4294967295,g.g[1]=g.g[1]+(p+(l<<21&4294967295|l>>>11))&4294967295,g.g[2]=g.g[2]+p&4294967295,g.g[3]=g.g[3]+_&4294967295}o.prototype.u=function(g,c){c===void 0&&(c=g.length);for(var u=c-this.blockSize,d=this.B,p=this.h,_=0;_this.h?this.blockSize:2*this.blockSize)-this.h);g[0]=128;for(var c=1;cc;++c)for(var d=0;32>d;d+=8)g[u++]=this.g[c]>>>d&255;return g};function f(g,c){var u=w;return Object.prototype.hasOwnProperty.call(u,g)?u[g]:u[g]=c(g)}function y(g,c){this.h=c;for(var u=[],d=!0,p=g.length-1;0<=p;p--){var _=g[p]|0;d&&_==c||(u[p]=_,d=!1)}this.g=u}var w={};function E(g){return-128<=g&&128>g?f(g,function(c){return new y([c|0],0>c?-1:0)}):new y([g|0],0>g?-1:0)}function A(g){if(isNaN(g)||!isFinite(g))return M;if(0>g)return U(A(-g));for(var c=[],u=1,d=0;g>=u;d++)c[d]=g/u|0,u*=4294967296;return new y(c,0)}function O(g,c){if(g.length==0)throw Error("number format error: empty string");if(c=c||10,2>c||36_?(_=A(Math.pow(c,_)),d=d.j(_).add(A(l))):(d=d.j(u),d=d.add(A(l)))}return d}var M=E(0),D=E(1),W=E(16777216);i=y.prototype,i.m=function(){if(F(this))return-U(this).m();for(var g=0,c=1,u=0;ug||36>>0).toString(g);if(u=p,S(u))return _+d;for(;6>_.length;)_="0"+_;d=_+d}},i.i=function(g){return 0>g?0:g>>16)+(this.i(p)>>>16)+(g.i(p)>>>16);d=l>>>16,_&=65535,l&=65535,u[p]=l<<16|_}return new y(u,u[u.length-1]&-2147483648?-1:0)};function et(g,c){return g.add(U(c))}i.j=function(g){if(S(this)||S(g))return M;if(F(this))return F(g)?U(this).j(U(g)):U(U(this).j(g));if(F(g))return U(this.j(U(g)));if(0>this.l(W)&&0>g.l(W))return A(this.m()*g.m());for(var c=this.g.length+g.g.length,u=[],d=0;d<2*c;d++)u[d]=0;for(d=0;d>>16,l=this.i(d)&65535,ht=g.i(p)>>>16,$t=g.i(p)&65535;u[2*d+2*p]+=l*$t,X(u,2*d+2*p),u[2*d+2*p+1]+=_*$t,X(u,2*d+2*p+1),u[2*d+2*p+1]+=l*ht,X(u,2*d+2*p+1),u[2*d+2*p+2]+=_*ht,X(u,2*d+2*p+2)}for(d=0;d>>16,g[c]&=65535,c++}function J(g,c){this.g=g,this.h=c}function dt(g,c){if(S(c))throw Error("division by zero");if(S(g))return new J(M,M);if(F(g))return c=dt(U(g),c),new J(U(c.g),U(c.h));if(F(c))return c=dt(g,U(c)),new J(U(c.g),c.h);if(30=d.l(g);)u=ge(u),d=ge(d);var p=nt(u,1),_=nt(d,1);for(d=nt(d,2),u=nt(u,2);!S(d);){var l=_.add(d);0>=l.l(g)&&(p=p.add(u),_=l),d=nt(d,1),u=nt(u,1)}return c=et(g,p.j(c)),new J(p,c)}for(p=M;0<=g.l(c);){for(u=Math.max(1,Math.floor(g.m()/c.m())),d=Math.ceil(Math.log(u)/Math.LN2),d=48>=d?1:Math.pow(2,d-48),_=A(u),l=_.j(c);F(l)||0>>31;return new y(u,g.h)}function nt(g,c){var u=c>>5;c%=32;for(var d=g.g.length-u,p=[],_=0;_>>c|g.i(_+u+1)<<32-c:g.i(_+u);return new y(p,g.h)}o.prototype.digest=o.prototype.v,o.prototype.reset=o.prototype.s,o.prototype.update=o.prototype.u,y.prototype.add=y.prototype.add,y.prototype.multiply=y.prototype.j,y.prototype.modulo=y.prototype.A,y.prototype.compare=y.prototype.l,y.prototype.toNumber=y.prototype.m,y.prototype.toString=y.prototype.toString,y.prototype.getBits=y.prototype.i,y.fromNumber=A,y.fromString=O,jn=y}).apply(typeof ai<"u"?ai:typeof self<"u"?self:typeof window<"u"?window:{});var Oe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};(function(){var i,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(t,r,s){return t==Array.prototype||t==Object.prototype||(t[r]=s.value),t};function n(t){t=[typeof globalThis=="object"&&globalThis,t,typeof window=="object"&&window,typeof self=="object"&&self,typeof Oe=="object"&&Oe];for(var r=0;r{throw t},0)}function l(){var t=Xe;let r=null;return t.g&&(r=t.g,t.g=t.g.next,t.g||(t.h=null),r.next=null),r}class ht{constructor(){this.h=this.g=null}add(r,s){const h=$t.get();h.set(r,s),this.h?this.h.next=h:this.g=h,this.h=h}}var $t=new et(()=>new Zi,t=>t.reset());class Zi{constructor(){this.next=this.g=this.h=null}set(r,s){this.h=r,this.g=s,this.next=null}reset(){this.next=this.g=this.h=null}}let Gt,Wt=!1,Xe=new ht,Gn=()=>{const t=w.Promise.resolve(void 0);Gt=()=>{t.then(ts)}};var ts=()=>{for(var t;t=l();){try{t.h.call(t.g)}catch(s){_(s)}var r=$t;r.j(t),100>r.h&&(r.h++,t.next=r.g,r.g=t)}Wt=!1};function pt(){this.s=this.s,this.C=this.C}pt.prototype.s=!1,pt.prototype.ma=function(){this.s||(this.s=!0,this.N())},pt.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function B(t,r){this.type=t,this.g=this.target=r,this.defaultPrevented=!1}B.prototype.h=function(){this.defaultPrevented=!0};var es=(function(){if(!w.addEventListener||!Object.defineProperty)return!1;var t=!1,r=Object.defineProperty({},"passive",{get:function(){t=!0}});try{const s=()=>{};w.addEventListener("test",s,r),w.removeEventListener("test",s,r)}catch{}return t})();function zt(t,r){if(B.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var s=this.type=t.type,h=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=r,r=t.relatedTarget){if(ge){t:{try{dt(r.nodeName);var m=!0;break t}catch{}m=!1}m||(r=null)}}else s=="mouseover"?r=t.fromElement:s=="mouseout"&&(r=t.toElement);this.relatedTarget=r,h?(this.clientX=h.clientX!==void 0?h.clientX:h.pageX,this.clientY=h.clientY!==void 0?h.clientY:h.pageY,this.screenX=h.screenX||0,this.screenY=h.screenY||0):(this.clientX=t.clientX!==void 0?t.clientX:t.pageX,this.clientY=t.clientY!==void 0?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType=typeof t.pointerType=="string"?t.pointerType:ns[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&zt.aa.h.call(this)}}S(zt,B);var ns={2:"touch",3:"pen",4:"mouse"};zt.prototype.h=function(){zt.aa.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var me="closure_listenable_"+(1e6*Math.random()|0),rs=0;function is(t,r,s,h,m){this.listener=t,this.proxy=null,this.src=r,this.type=s,this.capture=!!h,this.ha=m,this.key=++rs,this.da=this.fa=!1}function ye(t){t.da=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function _e(t){this.src=t,this.g={},this.h=0}_e.prototype.add=function(t,r,s,h,m){var v=t.toString();t=this.g[v],t||(t=this.g[v]=[],this.h++);var I=Ye(t,r,h,m);return-1>>0);function Kn(t){return typeof t=="function"?t:(t[nn]||(t[nn]=function(r){return t.handleEvent(r)}),t[nn])}function H(){pt.call(this),this.i=new _e(this),this.M=this,this.F=null}S(H,pt),H.prototype[me]=!0,H.prototype.removeEventListener=function(t,r,s,h){zn(this,t,r,s,h)};function z(t,r){var s,h=t.F;if(h)for(s=[];h;h=h.F)s.push(h);if(t=t.M,h=r.type||r,typeof r=="string")r=new B(r,t);else if(r instanceof B)r.target=r.target||t;else{var m=r;r=new B(h,t),d(r,m)}if(m=!0,s)for(var v=s.length-1;0<=v;v--){var I=r.g=s[v];m=ve(I,h,!0,r)&&m}if(I=r.g=t,m=ve(I,h,!0,r)&&m,m=ve(I,h,!1,r)&&m,s)for(v=0;v{t.g=null,t.i&&(t.i=!1,Jn(t))},t.l);const r=t.h;t.h=null,t.m.apply(null,r)}class hs extends pt{constructor(r,s){super(),this.m=r,this.l=s,this.h=null,this.i=!1,this.g=null}j(r){this.h=arguments,this.g?this.i=!0:Jn(this)}N(){super.N(),this.g&&(w.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function qt(t){pt.call(this),this.h=t,this.g={}}S(qt,pt);var Yn=[];function Qn(t){nt(t.g,function(r,s){this.g.hasOwnProperty(s)&&tn(r)},t),t.g={}}qt.prototype.N=function(){qt.aa.N.call(this),Qn(this)},qt.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var rn=w.JSON.stringify,cs=w.JSON.parse,ls=class{stringify(t){return w.JSON.stringify(t,void 0)}parse(t){return w.JSON.parse(t,void 0)}};function sn(){}sn.prototype.h=null;function Zn(t){return t.h||(t.h=t.i())}function us(){}var Kt={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function on(){B.call(this,"d")}S(on,B);function an(){B.call(this,"c")}S(an,B);var Ot={},tr=null;function hn(){return tr=tr||new H}Ot.La="serverreachability";function er(t){B.call(this,Ot.La,t)}S(er,B);function Xt(t){const r=hn();z(r,new er(r))}Ot.STAT_EVENT="statevent";function nr(t,r){B.call(this,Ot.STAT_EVENT,t),this.stat=r}S(nr,B);function q(t){const r=hn();z(r,new nr(r,t))}Ot.Ma="timingevent";function rr(t,r){B.call(this,Ot.Ma,t),this.size=r}S(rr,B);function Jt(t,r){if(typeof t!="function")throw Error("Fn must not be null and must be a function");return w.setTimeout(function(){t()},r)}function Yt(){this.g=!0}Yt.prototype.xa=function(){this.g=!1};function fs(t,r,s,h,m,v){t.info(function(){if(t.g)if(v)for(var I="",k=v.split("&"),j=0;jh.length)){var m=h[1];if(Array.isArray(m)&&!(1>m.length)){var v=m[0];if(v!="noop"&&v!="stop"&&v!="close")for(var I=1;IG)&&(G!=3||this.g&&(this.h.h||this.g.oa()||Cr(this.g)))){this.J||G!=4||r==7||(r==8||0>=xt?Xt(3):Xt(2)),dn(this);var s=this.g.Z();this.X=s;e:if(ar(this)){var h=Cr(this.g);t="";var m=h.length,v=lt(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){At(this),Qt(this);var I="";break e}this.h.i=new w.TextDecoder}for(r=0;rr.length?un:(r=r.slice(h,h+s),t.C=h+s,r)))}gt.prototype.cancel=function(){this.J=!0,At(this)};function Ee(t){t.S=Date.now()+t.I,hr(t,t.I)}function hr(t,r){if(t.B!=null)throw Error("WatchDog timer not null");t.B=Jt(D(t.ba,t),r)}function dn(t){t.B&&(w.clearTimeout(t.B),t.B=null)}gt.prototype.ba=function(){this.B=null;const t=Date.now();0<=t-this.S?(ps(this.i,this.A),this.L!=2&&(Xt(),q(17)),At(this),this.s=2,Qt(this)):hr(this,this.S-t)};function Qt(t){t.j.G==0||t.J||Lr(t.j,t)}function At(t){dn(t);var r=t.M;r&&typeof r.ma=="function"&&r.ma(),t.M=null,Qn(t.U),t.g&&(r=t.g,t.g=null,r.abort(),r.ma())}function pn(t,r){try{var s=t.j;if(s.G!=0&&(s.g==t||gn(s.h,t))){if(!t.K&&gn(s.h,t)&&s.G==3){try{var h=s.Da.g.parse(r)}catch{h=null}if(Array.isArray(h)&&h.length==3){var m=h;if(m[0]==0){t:if(!s.u){if(s.g)if(s.g.F+3e3m[2]&&s.F&&s.v==0&&!s.C&&(s.C=Jt(D(s.Za,s),6e3));if(1>=ur(s.h)&&s.ca){try{s.ca()}catch{}s.ca=void 0}}else St(s,11)}else if((t.K||s.g==t)&&Re(s),!X(r))for(m=s.Da.g.parse(r),r=0;r=t.j:!1}function ur(t){return t.h?1:t.g?t.g.size:0}function gn(t,r){return t.h?t.h==r:t.g?t.g.has(r):!1}function mn(t,r){t.g?t.g.add(r):t.h=r}function fr(t,r){t.h&&t.h==r?t.h=null:t.g&&t.g.has(r)&&t.g.delete(r)}cr.prototype.cancel=function(){if(this.i=dr(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const t of this.g.values())t.cancel();this.g.clear()}};function dr(t){if(t.h!=null)return t.i.concat(t.h.D);if(t.g!=null&&t.g.size!==0){let r=t.i;for(const s of t.g.values())r=r.concat(s.D);return r}return F(t.i)}function vs(t){if(t.V&&typeof t.V=="function")return t.V();if(typeof Map<"u"&&t instanceof Map||typeof Set<"u"&&t instanceof Set)return Array.from(t.values());if(typeof t=="string")return t.split("");if(E(t)){for(var r=[],s=t.length,h=0;hr)throw Error("Bad port number "+r);t.s=r}else t.s=null}function mr(t,r,s){r instanceof ee?(t.i=r,Cs(t.i,t.h)):(s||(r=te(r,Ss)),t.i=new ee(r,t.h))}function L(t,r,s){t.i.set(r,s)}function Te(t){return L(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Zt(t,r){return t?r?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function te(t,r,s){return typeof t=="string"?(t=encodeURI(t).replace(r,Is),s&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Is(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(t&15).toString(16)}var yr=/[#\/\?@]/g,As=/[#\?:]/g,Ts=/[#\?]/g,Ss=/[#\?@]/g,bs=/#/g;function ee(t,r){this.h=this.g=null,this.i=t||null,this.j=!!r}function mt(t){t.g||(t.g=new Map,t.h=0,t.i&&Es(t.i,function(r,s){t.add(decodeURIComponent(r.replace(/\+/g," ")),s)}))}i=ee.prototype,i.add=function(t,r){mt(this),this.i=null,t=Mt(this,t);var s=this.g.get(t);return s||this.g.set(t,s=[]),s.push(r),this.h+=1,this};function _r(t,r){mt(t),r=Mt(t,r),t.g.has(r)&&(t.i=null,t.h-=t.g.get(r).length,t.g.delete(r))}function vr(t,r){return mt(t),r=Mt(t,r),t.g.has(r)}i.forEach=function(t,r){mt(this),this.g.forEach(function(s,h){s.forEach(function(m){t.call(r,m,h,this)},this)},this)},i.na=function(){mt(this);const t=Array.from(this.g.values()),r=Array.from(this.g.keys()),s=[];for(let h=0;h{h.abort(),yt(s,"TestPingServer: timeout",!1,r)},1e4);fetch(t,{signal:h.signal}).then(v=>{clearTimeout(m),v.ok?yt(s,"TestPingServer: ok",!0,r):yt(s,"TestPingServer: server error",!1,r)}).catch(()=>{clearTimeout(m),yt(s,"TestPingServer: error",!1,r)})}function yt(t,r,s,h,m){try{m&&(m.onload=null,m.onerror=null,m.onabort=null,m.ontimeout=null),h(s)}catch{}}function Rs(){this.g=new ls}function Ds(t,r,s){const h=s||"";try{pr(t,function(m,v){let I=m;A(m)&&(I=rn(m)),r.push(h+v+"="+encodeURIComponent(I))})}catch(m){throw r.push(h+"type="+encodeURIComponent("_badmap")),m}}function Se(t){this.l=t.Ub||null,this.j=t.eb||!1}S(Se,sn),Se.prototype.g=function(){return new be(this.l,this.j)},Se.prototype.i=(function(t){return function(){return t}})({});function be(t,r){H.call(this),this.D=t,this.o=r,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}S(be,H),i=be.prototype,i.open=function(t,r){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=t,this.A=r,this.readyState=1,re(this)},i.send=function(t){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const r={headers:this.u,method:this.B,credentials:this.m,cache:void 0};t&&(r.body=t),(this.D||w).fetch(new Request(this.A,r)).then(this.Sa.bind(this),this.ga.bind(this))},i.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,ne(this)),this.readyState=0},i.Sa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,re(this)),this.g&&(this.readyState=3,re(this),this.g)))if(this.responseType==="arraybuffer")t.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof w.ReadableStream<"u"&&"body"in t){if(this.j=t.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;Er(this)}else t.text().then(this.Ra.bind(this),this.ga.bind(this))};function Er(t){t.j.read().then(t.Pa.bind(t)).catch(t.ga.bind(t))}i.Pa=function(t){if(this.g){if(this.o&&t.value)this.response.push(t.value);else if(!this.o){var r=t.value?t.value:new Uint8Array(0);(r=this.v.decode(r,{stream:!t.done}))&&(this.response=this.responseText+=r)}t.done?ne(this):re(this),this.readyState==3&&Er(this)}},i.Ra=function(t){this.g&&(this.response=this.responseText=t,ne(this))},i.Qa=function(t){this.g&&(this.response=t,ne(this))},i.ga=function(){this.g&&ne(this)};function ne(t){t.readyState=4,t.l=null,t.j=null,t.v=null,re(t)}i.setRequestHeader=function(t,r){this.u.append(t,r)},i.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},i.getAllResponseHeaders=function(){if(!this.h)return"";const t=[],r=this.h.entries();for(var s=r.next();!s.done;)s=s.value,t.push(s[0]+": "+s[1]),s=r.next();return t.join(`\r `)};function re(t){t.onreadystatechange&&t.onreadystatechange.call(t)}Object.defineProperty(be.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(t){this.m=t?"include":"same-origin"}});function Ir(t){let r="";return nt(t,function(s,h){r+=h,r+=":",r+=s,r+=`\r `}),r}function yn(t,r,s){t:{for(h in s){var h=!1;break t}h=!0}h||(s=Ir(s),typeof t=="string"?s!=null&&encodeURIComponent(String(s)):L(t,r,s))}function x(t){H.call(this),this.headers=new Map,this.o=t||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}S(x,H);var ks=/^https?$/i,Os=["POST","PUT"];i=x.prototype,i.Ha=function(t){this.J=t},i.ea=function(t,r,s,h){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+t);r=r?r.toUpperCase():"GET",this.D=t,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():ln.g(),this.v=this.o?Zn(this.o):Zn(ln),this.g.onreadystatechange=D(this.Ea,this);try{this.B=!0,this.g.open(r,String(t),!0),this.B=!1}catch(v){Ar(this,v);return}if(t=s||"",s=new Map(this.headers),h)if(Object.getPrototypeOf(h)===Object.prototype)for(var m in h)s.set(m,h[m]);else if(typeof h.keys=="function"&&typeof h.get=="function")for(const v of h.keys())s.set(v,h.get(v));else throw Error("Unknown input type for opt_headers: "+String(h));h=Array.from(s.keys()).find(v=>v.toLowerCase()=="content-type"),m=w.FormData&&t instanceof w.FormData,!(0<=Array.prototype.indexOf.call(Os,r,void 0))||h||m||s.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[v,I]of s)this.g.setRequestHeader(v,I);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{br(this),this.u=!0,this.g.send(t),this.u=!1}catch(v){Ar(this,v)}};function Ar(t,r){t.h=!1,t.g&&(t.j=!0,t.g.abort(),t.j=!1),t.l=r,t.m=5,Tr(t),Ce(t)}function Tr(t){t.A||(t.A=!0,z(t,"complete"),z(t,"error"))}i.abort=function(t){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=t||7,z(this,"complete"),z(this,"abort"),Ce(this))},i.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Ce(this,!0)),x.aa.N.call(this)},i.Ea=function(){this.s||(this.B||this.u||this.j?Sr(this):this.bb())},i.bb=function(){Sr(this)};function Sr(t){if(t.h&&typeof y<"u"&&(!t.v[1]||lt(t)!=4||t.Z()!=2)){if(t.u&<(t)==4)Xn(t.Ea,0,t);else if(z(t,"readystatechange"),lt(t)==4){t.h=!1;try{const I=t.Z();t:switch(I){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}var s;if(!(s=r)){var h;if(h=I===0){var m=String(t.D).match(gr)[1]||null;!m&&w.self&&w.self.location&&(m=w.self.location.protocol.slice(0,-1)),h=!ks.test(m?m.toLowerCase():"")}s=h}if(s)z(t,"complete"),z(t,"success");else{t.m=6;try{var v=2{}:null;t.g=null,t.v=null,r||z(t,"ready");try{s.onreadystatechange=h}catch{}}}function br(t){t.I&&(w.clearTimeout(t.I),t.I=null)}i.isActive=function(){return!!this.g};function lt(t){return t.g?t.g.readyState:0}i.Z=function(){try{return 2=t.h.j-(t.s?1:0)?!1:t.s?(t.i=r.D.concat(t.i),!0):t.G==1||t.G==2||t.B>=(t.Va?0:t.Wa)?!1:(t.s=Jt(D(t.Ga,t,r),Mr(t,t.B)),t.B++,!0)}i.Ga=function(t){if(this.s)if(this.s=null,this.G==1){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;const m=new gt(this,this.j,t);let v=this.o;if(this.S&&(v?(v=c(v),d(v,this.S)):v=this.S),this.m!==null||this.O||(m.H=v,v=null),this.P)t:{for(var r=0,s=0;sb)v=Math.max(0,m[j].g-100),k=!1;else try{Ds($,I,"req"+b+"_")}catch{h&&h($)}}if(k){h=I.join("&");break t}}}return t=t.i.splice(0,s),r.D=t,h}function kr(t){if(!t.g&&!t.u){t.Y=1;var r=t.Fa;Gt||Gn(),Wt||(Gt(),Wt=!0),Xe.add(r,t),t.v=0}}function vn(t){return t.g||t.u||3<=t.v?!1:(t.Y++,t.u=Jt(D(t.Fa,t),Mr(t,t.v)),t.v++,!0)}i.Fa=function(){if(this.u=null,Or(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var t=2*this.R;this.j.info("BP detection timer enabled: "+t),this.A=Jt(D(this.ab,this),t)}},i.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,q(10),Pe(this),Or(this))};function wn(t){t.A!=null&&(w.clearTimeout(t.A),t.A=null)}function Or(t){t.g=new gt(t,t.j,"rpc",t.Y),t.m===null&&(t.g.H=t.o),t.g.O=0;var r=ct(t.qa);L(r,"RID","rpc"),L(r,"SID",t.K),L(r,"AID",t.T),L(r,"CI",t.F?"0":"1"),!t.F&&t.ja&&L(r,"TO",t.ja),L(r,"TYPE","xmlhttp"),se(t,r),t.m&&t.o&&yn(r,t.m,t.o),t.L&&(t.g.I=t.L);var s=t.g;t=t.ia,s.L=1,s.v=Te(ct(r)),s.m=null,s.P=!0,or(s,t)}i.Za=function(){this.C!=null&&(this.C=null,Pe(this),vn(this),q(19))};function Re(t){t.C!=null&&(w.clearTimeout(t.C),t.C=null)}function Lr(t,r){var s=null;if(t.g==r){Re(t),wn(t),t.g=null;var h=2}else if(gn(t.h,r))s=r.D,fr(t.h,r),h=1;else return;if(t.G!=0){if(r.o)if(h==1){s=r.m?r.m.length:0,r=Date.now()-r.F;var m=t.B;h=hn(),z(h,new rr(h,s)),Ne(t)}else kr(t);else if(m=r.s,m==3||m==0&&0`${this.name}: [code=${this.code}]: ${this.message}`}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ce{constructor(){this.promise=new Promise(((e,n)=>{this.resolve=e,this.reject=n}))}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Wa{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class za{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable((()=>n(K.UNAUTHENTICATED)))}shutdown(){}}class qa{constructor(e){this.t=e,this.currentUser=K.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){he(this.o===void 0,42304);let o=this.i;const a=E=>this.i!==o?(o=this.i,n(E)):Promise.resolve();let f=new ce;this.o=()=>{this.i++,this.currentUser=this.u(),f.resolve(),f=new ce,e.enqueueRetryable((()=>a(this.currentUser)))};const y=()=>{const E=f;e.enqueueRetryable((async()=>{await E.promise,await a(this.currentUser)}))},w=E=>{tt("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=E,this.o&&(this.auth.addAuthTokenListener(this.o),y())};this.t.onInit((E=>w(E))),setTimeout((()=>{if(!this.auth){const E=this.t.getImmediate({optional:!0});E?w(E):(tt("FirebaseAuthCredentialsProvider","Auth not yet detected"),f.resolve(),f=new ce)}}),0),y()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then((o=>this.i!==e?(tt("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):o?(he(typeof o.accessToken=="string",31837,{l:o}),new Wa(o.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return he(e===null||typeof e=="string",2055,{h:e}),new K(e)}}class Ka{constructor(e,n,o){this.P=e,this.T=n,this.I=o,this.type="FirstParty",this.user=K.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);const e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class Xa{constructor(e,n,o){this.P=e,this.T=n,this.I=o}getToken(){return Promise.resolve(new Ka(this.P,this.T,this.I))}start(e,n){e.enqueueRetryable((()=>n(K.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class li{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Ja{constructor(e,n){this.V=n,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,bt(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,n){he(this.o===void 0,3512);const o=f=>{f.error!=null&&tt("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${f.error.message}`);const y=f.token!==this.m;return this.m=f.token,tt("FirebaseAppCheckTokenProvider",`Received ${y?"new":"existing"} token.`),y?n(f.token):Promise.resolve()};this.o=f=>{e.enqueueRetryable((()=>o(f)))};const a=f=>{tt("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=f,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((f=>a(f))),setTimeout((()=>{if(!this.appCheck){const f=this.V.getImmediate({optional:!0});f?a(f):tt("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){if(this.p)return Promise.resolve(new li(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((n=>n?(he(typeof n.token=="string",44558,{tokenResult:n}),this.m=n.token,new li(n.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Ya(i){const e=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(i);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let o=0;oe?1:0}function Za(i,e){const n=Math.min(i.length,e.length);for(let o=0;o=th&&e<=eh}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const ui="__name__";class rt{constructor(e,n,o){n===void 0?n=0:n>e.length&&$e(637,{offset:n,range:e.length}),o===void 0?o=e.length-n:o>e.length-n&&$e(1746,{length:o,range:e.length-n}),this.segments=e,this.offset=n,this.len=o}get length(){return this.len}isEqual(e){return rt.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof rt?e.forEach((o=>{n.push(o)})):n.push(e),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length=0)throw new N(P.INVALID_ARGUMENT,`Invalid segment (${o}). Paths must not contain // in them.`);n.push(...o.split("/").filter((a=>a.length>0)))}return new Z(n)}static emptyPath(){return new Z([])}}const nh=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Ct extends rt{construct(e,n,o){return new Ct(e,n,o)}static isValidIdentifier(e){return nh.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Ct.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===ui}static keyField(){return new Ct([ui])}static fromServerFormat(e){const n=[];let o="",a=0;const f=()=>{if(o.length===0)throw new N(P.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(o),o=""};let y=!1;for(;a=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&Z.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return Z.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new Nt(new Z(e.slice()))}}function rh(i,e,n,o){if(e===!0&&o===!0)throw new N(P.INVALID_ARGUMENT,`${i} and ${n} cannot be used together.`)}function ih(i){return typeof i=="object"&&i!==null&&(Object.getPrototypeOf(i)===Object.prototype||Object.getPrototypeOf(i)===null)}/** * @license * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function V(i,e){const n={typeString:i};return e&&(n.value=e),n}function pe(i,e){if(!ih(i))throw new N(P.INVALID_ARGUMENT,"JSON must be an object");let n;for(const o in e)if(e[o]){const a=e[o].typeString,f="value"in e[o]?{value:e[o].value}:void 0;if(!(o in i)){n=`JSON missing required field: '${o}'`;break}const y=i[o];if(a&&typeof y!==a){n=`JSON field '${o}' must be a ${a}.`;break}if(f!==void 0&&y!==f.value){n=`Expected '${o}' field to equal '${f.value}'`;break}}if(n)throw new N(P.INVALID_ARGUMENT,n);return!0}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const fi=-62135596800,di=1e6;class it{static now(){return it.fromMillis(Date.now())}static fromDate(e){return it.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),o=Math.floor((e-1e3*n)*di);return new it(n,o)}constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new N(P.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new N(P.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e=253402300800)throw new N(P.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/di}_compareTo(e){return this.seconds===e.seconds?Et(this.nanoseconds,e.nanoseconds):Et(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:it._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(pe(e,it._jsonSchema))return new it(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-fi;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}it._jsonSchemaVersion="firestore/timestamp/1.0",it._jsonSchema={type:V("string",it._jsonSchemaVersion),seconds:V("number"),nanoseconds:V("number")};function sh(i){return i.name==="IndexedDbTransactionError"}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class oh extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class kt{constructor(e){this.binaryString=e}static fromBase64String(e){const n=(function(a){try{return atob(a)}catch(f){throw typeof DOMException<"u"&&f instanceof DOMException?new oh("Invalid base64 string: "+f):f}})(e);return new kt(n)}static fromUint8Array(e){const n=(function(a){let f="";for(let y=0;ye0&&tt("ExponentialBackoff",`Backing off for ${a} ms (base delay: ${this.V_} ms, delay with jitter: ${n} ms, last attempt: ${o} ms ago)`),this.m_=this.Mi.enqueueAfterDelay(this.timerId,a,(()=>(this.f_=Date.now(),e()))),this.V_*=this.A_,this.V_this.R_&&(this.V_=this.R_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.V_}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Bn{constructor(e,n,o,a,f){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=o,this.op=a,this.removalCallback=f,this.deferred=new ce,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((y=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(e,n,o,a,f){const y=Date.now()+o,w=new Bn(e,n,y,a,f);return w.start(o),w}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new N(P.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}var mi,yi;(yi=mi||(mi={})).Ma="default",yi.Cache="cache";/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function fh(i){const e={};return i.timeoutSeconds!==void 0&&(e.timeoutSeconds=i.timeoutSeconds),e}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const _i=new Map;/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const dh="firestore.googleapis.com",vi=!0;class wi{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new N(P.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=dh,this.ssl=vi}else this.host=e.host,this.ssl=e.ssl??vi;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=ch;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes30)throw new N(P.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (maximum allowed value is 30)`)}})(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(function(o,a){return o.timeoutSeconds===a.timeoutSeconds})(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class ph{constructor(e,n,o,a){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=o,this._app=a,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new wi({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new N(P.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new N(P.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new wi(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=(function(o){if(!o)return new za;switch(o.type){case"firstParty":return new Xa(o.sessionIndex||"0",o.iamToken||null,o.authTokenFactory||null);case"provider":return o.client;default:throw new N(P.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}})(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(n){const o=_i.get(n);o&&(tt("ComponentProvider","Removing Datastore"),_i.delete(n),o.terminate())})(this),Promise.resolve()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Hn{constructor(e,n,o){this.converter=n,this._query=o,this.type="query",this.firestore=e}withConverter(e){return new Hn(this.firestore,e,this._query)}}class ot{constructor(e,n,o){this.converter=n,this._key=o,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new $n(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new ot(this.firestore,e,this._key)}toJSON(){return{type:ot._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,n,o){if(pe(n,ot._jsonSchema))return new ot(e,o||null,new Nt(Z.fromString(n.referencePath)))}}ot._jsonSchemaVersion="firestore/documentReference/1.0",ot._jsonSchema={type:V("string",ot._jsonSchemaVersion),referencePath:V("string")};class $n extends Hn{constructor(e,n,o){super(e,n,hh(o)),this._path=o,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new ot(this.firestore,null,new Nt(e))}withConverter(e){return new $n(this.firestore,e,this._path)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Ei="AsyncQueue";class Ii{constructor(e=Promise.resolve()){this.Xu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new uh(this,"async_queue_retry"),this._c=()=>{const o=Rn();o&&tt(Ei,"Visibility state changed to "+o.visibilityState),this.M_.w_()},this.ac=e;const n=Rn();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;const n=Rn();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise((()=>{}));const n=new ce;return this.cc((()=>this.ec&&this.sc?Promise.resolve():(e().then(n.resolve,n.reject),n.promise))).then((()=>n.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.Xu.push(e),this.lc())))}async lc(){if(this.Xu.length!==0){try{await this.Xu[0](),this.Xu.shift(),this.M_.reset()}catch(e){if(!sh(e))throw e;tt(Ei,"Operation failed with retryable error: "+e)}this.Xu.length>0&&this.M_.p_((()=>this.lc()))}}cc(e){const n=this.ac.then((()=>(this.rc=!0,e().catch((o=>{throw this.nc=o,this.rc=!1,qi("INTERNAL UNHANDLED ERROR: ",Ai(o)),o})).then((o=>(this.rc=!1,o))))));return this.ac=n,n}enqueueAfterDelay(e,n,o){this.uc(),this.oc.indexOf(e)>-1&&(n=0);const a=Bn.createAndSchedule(this,e,n,o,(f=>this.hc(f)));return this.tc.push(a),a}uc(){this.nc&&$e(47125,{Pc:Ai(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do e=this.ac,await e;while(e!==this.ac)}Ic(e){for(const n of this.tc)if(n.timerId===e)return!0;return!1}Ec(e){return this.Tc().then((()=>{this.tc.sort(((n,o)=>n.targetTimeMs-o.targetTimeMs));for(const n of this.tc)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.Tc()}))}dc(e){this.oc.push(e)}hc(e){const n=this.tc.indexOf(e);this.tc.splice(n,1)}}function Ai(i){let e=i.message||"";return i.stack&&(e=i.stack.includes(i.message)?i.stack:i.message+` `+i.stack),e}class gh extends ph{constructor(e,n,o,a){super(e,n,o,a),this.type="firestore",this._queue=new Ii,this._persistenceKey=a?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Ii(e),this._firestoreClient=void 0,await e}}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ut{constructor(e){this._byteString=e}static fromBase64String(e){try{return new ut(kt.fromBase64String(e))}catch(n){throw new N(P.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new ut(kt.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:ut._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(pe(e,ut._jsonSchema))return ut.fromBase64String(e.bytes)}}ut._jsonSchemaVersion="firestore/bytes/1.0",ut._jsonSchema={type:V("string",ut._jsonSchemaVersion),bytes:V("string")};/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ji{constructor(...e){for(let n=0;n90)throw new N(P.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new N(P.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return Et(this._lat,e._lat)||Et(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:Rt._jsonSchemaVersion}}static fromJSON(e){if(pe(e,Rt._jsonSchema))return new Rt(e.latitude,e.longitude)}}Rt._jsonSchemaVersion="firestore/geoPoint/1.0",Rt._jsonSchema={type:V("string",Rt._jsonSchemaVersion),latitude:V("number"),longitude:V("number")};/** * @license * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Dt{constructor(e){this._values=(e||[]).map((n=>n))}toArray(){return this._values.map((e=>e))}isEqual(e){return(function(o,a){if(o.length!==a.length)return!1;for(let f=0;ftypeof n=="number")))return new Dt(e.vectorValues);throw new N(P.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}Dt._jsonSchemaVersion="firestore/vectorValue/1.0",Dt._jsonSchema={type:V("string",Dt._jsonSchemaVersion),vectorValues:V("object")};const mh=new RegExp("[~\\*/\\[\\]]");function yh(i,e,n){if(e.search(mh)>=0)throw Ti(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,i);try{return new Ji(...e.split("."))._internalPath}catch{throw Ti(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,i)}}function Ti(i,e,n,o,a){let f=`Function ${e}() called with invalid data`;f+=". ";let y="";return new N(P.INVALID_ARGUMENT,f+i+y)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Yi{constructor(e,n,o,a,f){this._firestore=e,this._userDataWriter=n,this._key=o,this._document=a,this._converter=f}get id(){return this._key.path.lastSegment()}get ref(){return new ot(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new _h(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const n=this._document.data.field(Qi("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class _h extends Yi{data(){return super.data()}}function Qi(i,e){return typeof e=="string"?yh(i,e):e instanceof Ji?e._internalPath:e._delegate._internalPath}class Le{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class jt extends Yi{constructor(e,n,o,a,f,y){super(e,n,o,a,y),this._firestore=e,this._firestoreImpl=e,this.metadata=f}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new xe(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){const o=this._document.data.field(Qi("DocumentSnapshot.get",e));if(o!==null)return this._userDataWriter.convertValue(o,n.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new N(P.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,n={};return n.type=jt._jsonSchemaVersion,n.bundle="",n.bundleSource="DocumentSnapshot",n.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),n.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),n)}}jt._jsonSchemaVersion="firestore/documentSnapshot/1.0",jt._jsonSchema={type:V("string",jt._jsonSchemaVersion),bundleSource:V("string","DocumentSnapshot"),bundleName:V("string"),bundle:V("string")};class xe extends jt{data(e={}){return super.data(e)}}class le{constructor(e,n,o,a){this._firestore=e,this._userDataWriter=n,this._snapshot=a,this.metadata=new Le(a.hasPendingWrites,a.fromCache),this.query=o}get docs(){const e=[];return this.forEach((n=>e.push(n))),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach((o=>{e.call(n,new xe(this._firestore,this._userDataWriter,o.key,o,new Le(this._snapshot.mutatedKeys.has(o.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new N(P.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=(function(a,f){if(a._snapshot.oldDocs.isEmpty()){let y=0;return a._snapshot.docChanges.map((w=>{const E=new xe(a._firestore,a._userDataWriter,w.doc.key,w.doc,new Le(a._snapshot.mutatedKeys.has(w.doc.key),a._snapshot.fromCache),a.query.converter);return w.doc,{type:"added",doc:E,oldIndex:-1,newIndex:y++}}))}{let y=a._snapshot.oldDocs;return a._snapshot.docChanges.filter((w=>f||w.type!==3)).map((w=>{const E=new xe(a._firestore,a._userDataWriter,w.doc.key,w.doc,new Le(a._snapshot.mutatedKeys.has(w.doc.key),a._snapshot.fromCache),a.query.converter);let A=-1,O=-1;return w.type!==0&&(A=y.indexOf(w.doc.key),y=y.delete(w.doc.key)),w.type!==1&&(y=y.add(w.doc),O=y.indexOf(w.doc.key)),{type:vh(w.type),doc:E,oldIndex:A,newIndex:O}}))}})(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new N(P.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=le._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Qa.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const n=[],o=[],a=[];return this.docs.forEach((f=>{f._document!==null&&(n.push(f._document),o.push(this._userDataWriter.convertObjectMap(f._document.data.value.mapValue.fields,"previous")),a.push(f.ref.path))})),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function vh(i){switch(i){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return $e(61501,{type:i})}}le._jsonSchemaVersion="firestore/querySnapshot/1.0",le._jsonSchema={type:V("string",le._jsonSchemaVersion),bundleSource:V("string","QuerySnapshot"),bundleName:V("string"),bundle:V("string")};(function(e,n=!0){(function(a){Ke=a})(ze),Ht(new Bt("firestore",((o,{instanceIdentifier:a,options:f})=>{const y=o.getProvider("app").getImmediate(),w=new gh(new qa(o.getProvider("auth-internal")),new Ja(y,o.getProvider("app-check-internal")),(function(A,O){if(!Object.prototype.hasOwnProperty.apply(A.options,["projectId"]))throw new N(P.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Ge(A.options.projectId,O)})(y,a),y);return f={useFetchStreams:n,...f},w._setSettings(f),w}),"PUBLIC").setMultipleInstances(!0)),wt(hi,ci,e),wt(hi,ci,"esm2020")})();var wh="firebase",Eh="12.1.0";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */wt(wh,Eh,"app");