1const tr=()=>{};var It={};/** 2* @license 3* Copyright 2017 Google LLC 4* 5* Licensed under the Apache License, Version 2.0 (the "License"); 6* you may not use this file except in compliance with the License. 7* You may obtain a copy of the License at 8* 9* http://www.apache.org/licenses/LICENSE-2.0 10* 11* Unless required by applicable law or agreed to in writing, software 12* distributed under the License is distributed on an "AS IS" BASIS, 13* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14* See the License for the specific language governing permissions and 15* limitations under the License. 16*/const Zt=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128)}return e},nr=function(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=n[t++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=n[t++],o=n[t++],a=n[t++],c=((s&7)<<18|(i&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{const i=n[t++],o=n[t++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|o&63)}}return e.join("")},Qt={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<n.length;s+=3){const i=n[s],o=s+1<n.length,a=o?n[s+1]:0,c=s+2<n.length,l=c?n[s+2]:0,d=i>>2,f=(i&3)<<4|a>>4;let u=(a&15)<<2|l>>6,m=l&63;c||(m=64,o||(u=64)),r.push(t[d],t[f],t[u],t[m])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Zt(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):nr(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<n.length;){const i=t[n.charAt(s++)],a=s<n.length?t[n.charAt(s)]:0;++s;const l=s<n.length?t[n.charAt(s)]:64;++s;const f=s<n.length?t[n.charAt(s)]:64;if(++s,i==null||a==null||l==null||f==null)throw new rr;const u=i<<2|a>>4;if(r.push(u),l!==64){const m=a<<4&240|l>>2;if(r.push(m),f!==64){const g=l<<6&192|f;r.push(g)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}};class rr extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const sr=function(n){const e=Zt(n);return Qt.encodeByteArray(e,!0)},en=function(n){return sr(n).replace(/\./g,"")},tn=function(n){try{return Qt.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/** 17* @license 18* Copyright 2022 Google LLC 19* 20* Licensed under the Apache License, Version 2.0 (the "License"); 21* you may not use this file except in compliance with the License. 22* You may obtain a copy of the License at 23* 24* http://www.apache.org/licenses/LICENSE-2.0 25* 26* Unless required by applicable law or agreed to in writing, software 27* distributed under the License is distributed on an "AS IS" BASIS, 28* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29* See the License for the specific language governing permissions and 30* limitations under the License. 31*/function ir(){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.")}/** 32* @license 33* Copyright 2022 Google LLC 34* 35* Licensed under the Apache License, Version 2.0 (the "License");
36* you may not use this file except in compliance with the License. 37* You may obtain a copy of the License at 38* 39* http://www.apache.org/licenses/LICENSE-2.0 40* 41* Unless required by applicable law or agreed to in writing, software 42* distributed under the License is distributed on an "AS IS" BASIS, 43* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 44* See the License for the specific language governing permissions and 45* limitations under the License. 46*/const or=()=>ir().__FIREBASE_DEFAULTS__,ar=()=>{if(typeof process>"u"||typeof It>"u")return;const n=It.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},cr=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&tn(n[1]);return e&&JSON.parse(e)},et=()=>{try{return tr()||or()||ar()||cr()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},nn=n=>{var e,t;return(t=(e=et())==null?void 0:e.emulatorHosts)==null?void 0:t[n]},lr=n=>{const e=nn(n);if(!e)return;const t=e.lastIndexOf(":");if(t<=0||t+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),r]:[e.substring(0,t),r]},rn=()=>{var n;return(n=et())==null?void 0:n.config},sn=n=>{var e;return(e=et())==null?void 0:e[`_${n}`]};/** 47* @license 48* Copyright 2017 Google LLC 49* 50* Licensed under the Apache License, Version 2.0 (the "License"); 51* you may not use this file except in compliance with the License. 52* You may obtain a copy of the License at 53* 54* http://www.apache.org/licenses/LICENSE-2.0 55* 56* Unless required by applicable law or agreed to in writing, software 57* distributed under the License is distributed on an "AS IS" BASIS, 58* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 59* See the License for the specific language governing permissions and 60* limitations under the License. 61*/class ur{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}}/** 62* @license 63* Copyright 2025 Google LLC 64* 65* Licensed under the Apache License, Version 2.0 (the "License"); 66* you may not use this file except in compliance with the License. 67* You may obtain a copy of the License at 68* 69* http://www.apache.org/licenses/LICENSE-2.0 70* 71* Unless required by applicable law or agreed to in writing, software 72* distributed under the License is distributed on an "AS IS" BASIS, 73* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 74* See the License for the specific language governing permissions and 75* limitations under the License. 76*/function ne(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}async function on(n){return(await fetch(n,{credentials:"include"})).ok}const ae={};function dr(){const n={prod:[],emulator:[]};for(const e of Object.keys(ae))ae[e]?n.emulator.push(e):n.prod.push(e);return n}function hr(n){let e=document.getElementById(n),t=!1;return e||(e=document.createElement("div"),e.setAttribute("id",n),t=!0),{created:t,element:e}}let wt=!1;function an(n,e){if(typeof window>"u"||typeof document>"u"||!ne(window.location.host)||ae[n]===e||ae[n]||wt)return;ae[n]=e;function t(u){return`__firebase__banner__${u}`}const r="__firebase__banner",i=dr().prod.length>0;function o(){const u=document.getElementById(r);u&&u.remove()}function a(u){u.style.display="flex",u.style.background="#7faaf0",u.style.position="fixed",u.style.bottom="5px",u.style.left="5px",u.style.padding=".5em",u.style.borderRadius="5px",u.style.alignItems="center"}function c(u,m){u.setAttribute("width","24"),u.setAttribute("id",m),u.setAttribute("height","24"),u.setAttribute("viewBox","0 0 24 24"),u.setAttribute("fill","none"),u.style.marginLeft="-6px"}function l(){const u=document.createElement("span");
76return u.style.cursor="pointer",u.style.marginLeft="16px",u.style.fontSize="24px",u.innerHTML=" ×",u.onclick=()=>{wt=!0,o()},u}function d(u,m){u.setAttribute("id",m),u.innerText="Learn more",u.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",u.setAttribute("target","__blank"),u.style.paddingLeft="5px",u.style.textDecoration="underline"}function f(){const u=hr(r),m=t("text"),g=document.getElementById(m)||document.createElement("span"),v=t("learnmore"),Ie=document.getElementById(v)||document.createElement("a"),q=t("preprendIcon"),K=document.getElementById(q)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(u.created){const Ue=u.element;a(Ue),d(Ie,v);const er=l();c(K,q),Ue.append(K,g,Ie,er),document.body.appendChild(Ue)}i?(g.innerText="Preview backend disconnected.",K.innerHTML=`<g clip-path="url(#clip0_6013_33858)"> 77<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/> 78</g> 79<defs> 80<clipPath id="clip0_6013_33858"> 81<rect width="24" height="24" fill="white"/> 82</clipPath> 83</defs>`):(K.innerHTML=`<g clip-path="url(#clip0_6083_34804)"> 84<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/> 85</g> 86<defs> 87<clipPath id="clip0_6083_34804"> 88<rect width="24" height="24" fill="white"/> 89</clipPath> 90</defs>`,g.innerText="Preview backend running in this workspace."),g.setAttribute("id",m)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",f):f()}/** 91* @license 92* Copyright 2017 Google LLC 93* 94* Licensed under the Apache License, Version 2.0 (the "License"); 95* you may not use this file except in compliance with the License. 96* You may obtain a copy of the License at 97* 98* http://www.apache.org/licenses/LICENSE-2.0 99* 100* Unless required by applicable law or agreed to in writing, software 101* distributed under the License is distributed on an "AS IS" BASIS, 102* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 103* See the License for the specific language governing permissions and 104* limitations under the License. 105*/function _(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function fr(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(_())}function pr(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function mr(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function gr(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function _r(){const n=_();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function Ir(){try{return typeof indexedDB=="object"}catch{return!1}}function wr(){return new Promise((n,e)=>{try{let t=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},s.onupgradeneeded=()=>{t=!1},s.onerror=()=>{var i;e(((i=s.error)==null?void 0:i.message)||"")}}catch(t){e(t)}})}/** 106* @license 107* Copyright 2017 Google LLC 108* 109* Licensed under the Apache License, Version 2.0 (the "License");
110* you may not use this file except in compliance with the License. 111* You may obtain a copy of the License at 112* 113* http://www.apache.org/licenses/LICENSE-2.0 114* 115* Unless required by applicable law or agreed to in writing, software 116* distributed under the License is distributed on an "AS IS" BASIS, 117* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 118* See the License for the specific language governing permissions and 119* limitations under the License. 120*/const yr="FirebaseError";class D extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=yr,Object.setPrototypeOf(this,D.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,he.prototype.create)}}class he{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},s=`${this.service}/${e}`,i=this.errors[e],o=i?Er(i,r):"Error",a=`${this.serviceName}: ${o} (${s}).`;return new D(s,a,r)}}function Er(n,e){return n.replace(Tr,(t,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const Tr=/\{\$([^}]+)}/g;function br(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function Q(n,e){if(n===e)return!0;const t=Object.keys(n),r=Object.keys(e);for(const s of t){if(!r.includes(s))return!1;const i=n[s],o=e[s];if(yt(i)&&yt(o)){if(!Q(i,o))return!1}else if(i!==o)return!1}for(const s of r)if(!t.includes(s))return!1;return!0}function yt(n){return n!==null&&typeof n=="object"}/** 121* @license 122* Copyright 2017 Google LLC 123* 124* Licensed under the Apache License, Version 2.0 (the "License"); 125* you may not use this file except in compliance with the License. 126* You may obtain a copy of the License at 127* 128* http://www.apache.org/licenses/LICENSE-2.0 129* 130* Unless required by applicable law or agreed to in writing, software 131* distributed under the License is distributed on an "AS IS" BASIS, 132* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 133* See the License for the specific language governing permissions and 134* limitations under the License. 135*/function fe(n){const e=[];for(const[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function ie(n){const e={};return n.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[s,i]=r.split("=");e[decodeURIComponent(s)]=decodeURIComponent(i)}}),e}function oe(n){const e=n.indexOf("?");if(!e)return"";const t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}function vr(n,e){const t=new Sr(n,e);return t.subscribe.bind(t)}class Sr{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let s;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");Cr(e,["next","error","complete"])?s=e:s={next:e,error:t,complete:r},s.next===void 0&&(s.next=xe),s.error===void 0&&(s.error=xe),s.complete===void 0&&(s.complete=xe);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function Cr(n,e){if(typeof n!="object"||n===null)return!1;for(const t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function xe(){}/** 136* @license 137* Copyright 2021 Google LLC 138* 139* Licensed under the Apache License, Version 2.0 (the "License");
140* you may not use this file except in compliance with the License. 141* You may obtain a copy of the License at 142* 143* http://www.apache.org/licenses/LICENSE-2.0 144* 145* Unless required by applicable law or agreed to in writing, software 146* distributed under the License is distributed on an "AS IS" BASIS, 147* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 148* See the License for the specific language governing permissions and 149* limitations under the License. 150*/function I(n){return n&&n._delegate?n._delegate:n}class z{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/** 151* @license 152* Copyright 2019 Google LLC 153* 154* Licensed under the Apache License, Version 2.0 (the "License"); 155* you may not use this file except in compliance with the License. 156* You may obtain a copy of the License at 157* 158* http://www.apache.org/licenses/LICENSE-2.0 159* 160* Unless required by applicable law or agreed to in writing, software 161* distributed under the License is distributed on an "AS IS" BASIS, 162* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 163* See the License for the specific language governing permissions and 164* limitations under the License. 165*/const j="[DEFAULT]";/** 166* @license 167* Copyright 2019 Google LLC 168* 169* Licensed under the Apache License, Version 2.0 (the "License"); 170* you may not use this file except in compliance with the License. 171* You may obtain a copy of the License at 172* 173* http://www.apache.org/licenses/LICENSE-2.0 174* 175* Unless required by applicable law or agreed to in writing, software 176* distributed under the License is distributed on an "AS IS" BASIS, 177* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 178* See the License for the specific language governing permissions and 179* limitations under the License. 180*/class Ar{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const r=new ur;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:t});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){const t=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(r)return null;throw s}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Pr(e))try{this.getOrInitializeService({instanceIdentifier:j})}catch{}for(const[t,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(t);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=j){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=j){return this.instances.has(e)}getOptions(e=j){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[i,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(i);r===a&&o.resolve(s)}return s}onInit(e,t){const r=this.normalizeInstanceIdentifier(t),s=this.onInitCallbacks.get(r)??new Set;s.add(e),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&e(i,r),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const s of r)try{s(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:kr(e),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=j){return this.component?this.component.multipleInstances?e:j:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function kr(n){return n===j?void 0:n}function Pr(n){return n.instantiationMode==="EAGER"}/** 181* @license 182* Copyright 2019 Google LLC 183* 184* Licensed under the Apache License, Version 2.0 (the "License");
185* you may not use this file except in compliance with the License. 186* You may obtain a copy of the License at 187* 188* http://www.apache.org/licenses/LICENSE-2.0 189* 190* Unless required by applicable law or agreed to in writing, software 191* distributed under the License is distributed on an "AS IS" BASIS, 192* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 193* See the License for the specific language governing permissions and 194* limitations under the License. 195*/class Rr{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new Ar(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/** 196* @license 197* Copyright 2017 Google LLC 198* 199* Licensed under the Apache License, Version 2.0 (the "License"); 200* you may not use this file except in compliance with the License. 201* You may obtain a copy of the License at 202* 203* http://www.apache.org/licenses/LICENSE-2.0 204* 205* Unless required by applicable law or agreed to in writing, software 206* distributed under the License is distributed on an "AS IS" BASIS, 207* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 208* See the License for the specific language governing permissions and 209* limitations under the License. 210*/var p;(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(p||(p={}));const Or={debug:p.DEBUG,verbose:p.VERBOSE,info:p.INFO,warn:p.WARN,error:p.ERROR,silent:p.SILENT},Nr=p.INFO,Dr={[p.DEBUG]:"log",[p.VERBOSE]:"log",[p.INFO]:"info",[p.WARN]:"warn",[p.ERROR]:"error"},Lr=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),s=Dr[e];if(s)console[s](`[${r}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class cn{constructor(e){this.name=e,this._logLevel=Nr,this._logHandler=Lr,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in p))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Or[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,p.DEBUG,...e),this._logHandler(this,p.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,p.VERBOSE,...e),this._logHandler(this,p.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,p.INFO,...e),this._logHandler(this,p.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,p.WARN,...e),this._logHandler(this,p.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,p.ERROR,...e),this._logHandler(this,p.ERROR,...e)}}const Mr=(n,e)=>e.some(t=>n instanceof t);let Et,Tt;function Ur(){return Et||(Et=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function xr(){return Tt||(Tt=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const ln=new WeakMap,je=new WeakMap,un=new WeakMap,Fe=new WeakMap,tt=new WeakMap;function Fr(n){const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("success",i),n.removeEventListener("error",o)},i=()=>{t(H(n.result)),s()},o=()=>{r(n.error),s()};n.addEventListener("success",i),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&ln.set(t,n)}).catch(()=>{}),tt.set(e,n),e}function Br(n){if(je.has(n))return;const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("complete",i),n.removeEventListener("error",o),n.removeEventListener("abort",o)},i=()=>{t(),s()},o=()=>{r(n.error||new DOMException("AbortError","AbortError")),s()};n.addEventListener("complete",i),n.addEventListener("error",o),n.addEventListener("abort",o)});je.set(n,e)}let ze={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return je.get(n);if(e==="objectStoreNames")return n.objectStoreNames||un.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return H(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function Hr(n){ze=n(ze)}
210function Vr(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=n.call(Be(this),e,...t);return un.set(r,e.sort?e.sort():[e]),H(r)}:xr().includes(n)?function(...e){return n.apply(Be(this),e),H(ln.get(this))}:function(...e){return H(n.apply(Be(this),e))}}function $r(n){return typeof n=="function"?Vr(n):(n instanceof IDBTransaction&&Br(n),Mr(n,Ur())?new Proxy(n,ze):n)}function H(n){if(n instanceof IDBRequest)return Fr(n);if(Fe.has(n))return Fe.get(n);const e=$r(n);return e!==n&&(Fe.set(n,e),tt.set(e,n)),e}const Be=n=>tt.get(n);function Wr(n,e,{blocked:t,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(n,e),a=H(o);return r&&o.addEventListener("upgradeneeded",c=>{r(H(o.result),c.oldVersion,c.newVersion,H(o.transaction),c)}),t&&o.addEventListener("blocked",c=>t(c.oldVersion,c.newVersion,c)),a.then(c=>{i&&c.addEventListener("close",()=>i()),s&&c.addEventListener("versionchange",l=>s(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}const jr=["get","getKey","getAll","getAllKeys","count"],zr=["put","add","delete","clear"],He=new Map;function bt(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(He.get(e))return He.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,s=zr.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(s||jr.includes(t)))return;const i=async function(o,...a){const c=this.transaction(o,s?"readwrite":"readonly");let l=c.store;return r&&(l=l.index(a.shift())),(await Promise.all([l[t](...a),s&&c.done]))[0]};return He.set(e,i),i}Hr(n=>({...n,get:(e,t,r)=>bt(e,t)||n.get(e,t,r),has:(e,t)=>!!bt(e,t)||n.has(e,t)}));/** 211* @license 212* Copyright 2019 Google LLC 213* 214* Licensed under the Apache License, Version 2.0 (the "License"); 215* you may not use this file except in compliance with the License. 216* You may obtain a copy of the License at 217* 218* http://www.apache.org/licenses/LICENSE-2.0 219* 220* Unless required by applicable law or agreed to in writing, software 221* distributed under the License is distributed on an "AS IS" BASIS, 222* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 223* See the License for the specific language governing permissions and 224* limitations under the License. 225*/class Gr{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(qr(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function qr(n){const e=n.getComponent();return e?.type==="VERSION"}const Ge="@firebase/app",vt="0.14.6";/** 226* @license 227* Copyright 2019 Google LLC 228* 229* Licensed under the Apache License, Version 2.0 (the "License"); 230* you may not use this file except in compliance with the License. 231* You may obtain a copy of the License at 232* 233* http://www.apache.org/licenses/LICENSE-2.0 234* 235* Unless required by applicable law or agreed to in writing, software 236* distributed under the License is distributed on an "AS IS" BASIS, 237* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 238* See the License for the specific language governing permissions and 239* limitations under the License. 240*/const O=new cn("@firebase/app"),Kr="@firebase/app-compat",Jr="@firebase/analytics-compat",Yr="@firebase/analytics",Xr="@firebase/app-check-compat",Zr="@firebase/app-check",Qr="@firebase/auth",es="@firebase/auth-compat",ts="@firebase/database",ns="@firebase/data-connect",rs="@firebase/database-compat",ss="@firebase/functions",is="@firebase/functions-compat",os="@firebase/installations",as="@firebase/installations-compat",cs="@firebase/messaging",ls="@firebase/messaging-compat",us="@firebase/performance",ds="@firebase/performance-compat",hs="@firebase/remote-config",fs="@firebase/remote-config-compat",ps="@firebase/storage",ms="@firebase/storage-compat",gs="@firebase/firestore",_s="@firebase/ai",Is="@firebase/firestore-compat",ws="firebase",ys="12.6.0";/** 241* @license 242* Copyright 2019 Google LLC 243* 244* Licensed under the Apache License, Version 2.0 (the "License"); 245* you may not use this file except in compliance with the License. 246* You may obtain a copy of the License at 247* 248* http://www.apache.org/licenses/LICENSE-2.0 249* 250* Unless required by applicable law or agreed to in writing, softw
250are 251* distributed under the License is distributed on an "AS IS" BASIS, 252* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 253* See the License for the specific language governing permissions and 254* limitations under the License. 255*/const qe="[DEFAULT]",Es={[Ge]:"fire-core",[Kr]:"fire-core-compat",[Yr]:"fire-analytics",[Jr]:"fire-analytics-compat",[Zr]:"fire-app-check",[Xr]:"fire-app-check-compat",[Qr]:"fire-auth",[es]:"fire-auth-compat",[ts]:"fire-rtdb",[ns]:"fire-data-connect",[rs]:"fire-rtdb-compat",[ss]:"fire-fn",[is]:"fire-fn-compat",[os]:"fire-iid",[as]:"fire-iid-compat",[cs]:"fire-fcm",[ls]:"fire-fcm-compat",[us]:"fire-perf",[ds]:"fire-perf-compat",[hs]:"fire-rc",[fs]:"fire-rc-compat",[ps]:"fire-gcs",[ms]:"fire-gcs-compat",[gs]:"fire-fst",[Is]:"fire-fst-compat",[_s]:"fire-vertex","fire-js":"fire-js",[ws]:"fire-js-all"};/** 256* @license 257* Copyright 2019 Google LLC 258* 259* Licensed under the Apache License, Version 2.0 (the "License"); 260* you may not use this file except in compliance with the License. 261* You may obtain a copy of the License at 262* 263* http://www.apache.org/licenses/LICENSE-2.0 264* 265* Unless required by applicable law or agreed to in writing, software 266* distributed under the License is distributed on an "AS IS" BASIS, 267* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 268* See the License for the specific language governing permissions and 269* limitations under the License. 270*/const ve=new Map,Ts=new Map,Ke=new Map;function St(n,e){try{n.container.addComponent(e)}catch(t){O.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function ee(n){const e=n.name;if(Ke.has(e))return O.debug(`There were multiple attempts to register component ${e}.`),!1;Ke.set(e,n);for(const t of ve.values())St(t,n);for(const t of Ts.values())St(t,n);return!0}function nt(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function y(n){return n==null?!1:n.settings!==void 0}/** 271* @license 272* Copyright 2019 Google LLC 273* 274* Licensed under the Apache License, Version 2.0 (the "License"); 275* you may not use this file except in compliance with the License. 276* You may obtain a copy of the License at 277* 278* http://www.apache.org/licenses/LICENSE-2.0 279* 280* Unless required by applicable law or agreed to in writing, software 281* distributed under the License is distributed on an "AS IS" BASIS, 282* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 283* See the License for the specific language governing permissions and 284* limitations under the License. 285*/const bs={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invali
285d-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},V=new he("app","Firebase",bs);/** 286* @license 287* Copyright 2019 Google LLC 288* 289* Licensed under the Apache License, Version 2.0 (the "License"); 290* you may not use this file except in compliance with the License. 291* You may obtain a copy of the License at 292* 293* http://www.apache.org/licenses/LICENSE-2.0 294* 295* Unless required by applicable law or agreed to in writing, software 296* distributed under the License is distributed on an "AS IS" BASIS, 297* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 298* See the License for the specific language governing permissions and 299* limitations under the License. 300*/class vs{constructor(e,t,r){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new z("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw V.create("app-deleted",{appName:this._name})}}/** 301* @license 302* Copyright 2019 Google LLC 303* 304* Licensed under the Apache License, Version 2.0 (the "License"); 305* you may not use this file except in compliance with the License. 306* You may obtain a copy of the License at 307* 308* http://www.apache.org/licenses/LICENSE-2.0 309* 310* Unless required by applicable law or agreed to in writing, software 311* distributed under the License is distributed on an "AS IS" BASIS, 312* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 313* See the License for the specific language governing permissions and 314* limitations under the License. 315*/const pe=ys;function dn(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r={name:qe,automaticDataCollectionEnabled:!0,...e},s=r.name;if(typeof s!="string"||!s)throw V.create("bad-app-name",{appName:String(s)});if(t||(t=rn()),!t)throw V.create("no-options");const i=ve.get(s);if(i){if(Q(t,i.options)&&Q(r,i.config))return i;throw V.create("duplicate-app",{appName:s})}const o=new Rr(s);for(const c of Ke.values())o.addComponent(c);const a=new vs(t,r,o);return ve.set(s,a),a}function hn(n=qe){const e=ve.get(n);if(!e&&n===qe&&rn())return dn();if(!e)throw V.create("no-app",{appName:n});return e}function $(n,e,t){let r=Es[n]??n;t&&(r+=`-${t}`);const s=r.match(/\s|\//),i=e.match(/\s|\//);if(s||i){const o=[`Unable to register library "${r}" with version "${e}":`];s&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&i&&o.push("and"),i&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),O.warn(o.join(" "));return}ee(new z(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/** 316* @license 317* Copyright 2021 Google LLC 318* 319* Licensed under the Apache License, Version 2.0 (the "License"); 320* you may not use this file except in compliance with the License. 321* You may obtain a copy of the License at 322* 323* http://www.apache.org/licenses/LICENSE-2.0 324* 325* Unless required by applicable law or agreed to in writing, software 326* distributed under the License is distributed on an "AS IS" BASIS, 327* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 328* See the License for the specific language governing permissions and 329* limitations under the License. 330*/const Ss="firebase-heartbeat-database",Cs=1,le="firebase-heartbeat-store";let Ve=null;function fn(){return Ve||(Ve=Wr(Ss,Cs,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(le)}catch(t){console.warn(t)}}}}).catch(n=>{throw V.create("idb-open",{originalErrorMessage:n.message})})),Ve}async function As(n){try{const t=(await fn()).transaction(le),r=await t.objectStore(le).get(pn(n));return await t.done,r}catch(e){if(e instanceof D)O.warn(e.message);else{const t=V.create("idb-get",{originalErrorMessage:e?.message});O.warn(t.message)}}}async function Ct(n,e){try{const r=(await fn()).transaction(le,"readwrite");await r.objectStore(le).put(e,pn(n)),await r.done}catch(t){if(t instanceof D)O.warn(t.message);else{const r=V.create("idb-set",{originalErrorMessage:t?.message});O.warn(r.message)}}}function pn(n){return`${n.name}!${n.options.appId}`}/** 331* @license 332* Copyright 2021 Google LLC 333* 334* Licensed under the Apache License, Version 2.0 (the "License");
335* you may not use this file except in compliance with the License. 336* You may obtain a copy of the License at 337* 338* http://www.apache.org/licenses/LICENSE-2.0 339* 340* Unless required by applicable law or agreed to in writing, software 341* distributed under the License is distributed on an "AS IS" BASIS, 342* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 343* See the License for the specific language governing permissions and 344* limitations under the License. 345*/const ks=1024,Ps=30;class Rs{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Ns(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,t;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=At();if(((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(o=>o.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats.length>Ps){const o=Ds(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){O.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const t=At(),{heartbeatsToSend:r,unsentEntries:s}=Os(this._heartbeatsCache.heartbeats),i=en(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(t){return O.warn(t),""}}}function At(){return new Date().toISOString().substring(0,10)}function Os(n,e=ks){const t=[];let r=n.slice();for(const s of n){const i=t.find(o=>o.agent===s.agent);if(i){if(i.dates.push(s.date),kt(t)>e){i.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),kt(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class Ns{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Ir()?wr().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await As(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return Ct(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return Ct(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function kt(n){return en(JSON.stringify({version:2,heartbeats:n})).length}function Ds(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let r=1;r<n.length;r++)n[r].date<t&&(t=n[r].date,e=r);return e}/** 346* @license 347* Copyright 2019 Google LLC 348* 349* Licensed under the Apache License, Version 2.0 (the "License"); 350* you may not use this file except in compliance with the License. 351* You may obtain a copy of the License at 352* 353* http://www.apache.org/licenses/LICENSE-2.0 354* 355* Unless required by applicable law or agreed to in writing, software 356* distributed under the License is distributed on an "AS IS" BASIS, 357* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 358* See the License for the specific language governing permissions and 359* limitations under the License. 360*/function Ls(n){ee(new z("platform-logger",e=>new Gr(e),"PRIVATE")),ee(new z("heartbeat",e=>new Rs(e),"PRIVATE")),$(Ge,vt,n),$(Ge,vt,"esm2020"),$("fire-js","")}Ls("");function mn(){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 Ms=mn,gn=new he("auth","Firebase",mn());/** 361* @license 362* Copyright 2020 Google LLC 363* 364* Licensed under the Apache License, Version 2.0 (the "License");
365* you may not use this file except in compliance with the License. 366* You may obtain a copy of the License at 367* 368* http://www.apache.org/licenses/LICENSE-2.0 369* 370* Unless required by applicable law or agreed to in writing, software 371* distributed under the License is distributed on an "AS IS" BASIS, 372* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 373* See the License for the specific language governing permissions and 374* limitations under the License. 375*/const Se=new cn("@firebase/auth");function Us(n,...e){Se.logLevel<=p.WARN&&Se.warn(`Auth (${pe}): ${n}`,...e)}function ye(n,...e){Se.logLevel<=p.ERROR&&Se.error(`Auth (${pe}): ${n}`,...e)}/** 376* @license 377* Copyright 2020 Google LLC 378* 379* Licensed under the Apache License, Version 2.0 (the "License"); 380* you may not use this file except in compliance with the License. 381* You may obtain a copy of the License at 382* 383* http://www.apache.org/licenses/LICENSE-2.0 384* 385* Unless required by applicable law or agreed to in writing, software 386* distributed under the License is distributed on an "AS IS" BASIS, 387* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 388* See the License for the specific language governing permissions and 389* limitations under the License. 390*/function E(n,...e){throw rt(n,...e)}function S(n,...e){return rt(n,...e)}function _n(n,e,t){const r={...Ms(),[e]:t};return new he("auth","Firebase",r).create(e,{appName:n.name})}function C(n){return _n(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function rt(n,...e){if(typeof n!="string"){const t=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=n.name),n._errorFactory.create(t,...r)}return gn.create(n,...e)}function h(n,e,...t){if(!n)throw rt(e,...t)}function P(n){const e="INTERNAL ASSERTION FAILED: "+n;throw ye(e),new Error(e)}function N(n,e){n||P(e)}/** 391* @license 392* Copyright 2020 Google LLC 393* 394* Licensed under the Apache License, Version 2.0 (the "License"); 395* you may not use this file except in compliance with the License. 396* You may obtain a copy of the License at 397* 398* http://www.apache.org/licenses/LICENSE-2.0 399* 400* Unless required by applicable law or agreed to in writing, software 401* distributed under the License is distributed on an "AS IS" BASIS, 402* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 403* See the License for the specific language governing permissions and 404* limitations under the License. 405*/function Je(){var n;return typeof self<"u"&&((n=self.location)==null?void 0:n.href)||""}function xs(){return Pt()==="http:"||Pt()==="https:"}function Pt(){var n;return typeof self<"u"&&((n=self.location)==null?void 0:n.protocol)||null}/** 406* @license 407* Copyright 2020 Google LLC 408* 409* Licensed under the Apache License, Version 2.0 (the "License"); 410* you may not use this file except in compliance with the License. 411* You may obtain a copy of the License at 412* 413* http://www.apache.org/licenses/LICENSE-2.0 414* 415* Unless required by applicable law or agreed to in writing, software 416* distributed under the License is distributed on an "AS IS" BASIS, 417* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 418* See the License for the specific language governing permissions and 419* limitations under the License. 420*/function Fs(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(xs()||mr()||"connection"in navigator)?navigator.onLine:!0}function Bs(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/** 421* @license 422* Copyright 2020 Google LLC 423* 424* Licensed under the Apache License, Version 2.0 (the "License"); 425* you may not use this file except in compliance with the License. 426* You may obtain a copy of the License at 427* 428* http://www.apache.org/licenses/LICENSE-2.0 429* 430* Unless required by applicable law or agreed to in writing, software 431* distributed under the License is distributed on an "AS IS" BASIS, 432* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 433* See the License for the specific language governing permissions and 434* limitations under the License. 435*/class me{constructor(e,t){this.shortDelay=e,this.longDelay=t,N(t>
435e,"Short delay should be less than long delay!"),this.isMobile=fr()||gr()}get(){return Fs()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/** 436* @license 437* Copyright 2020 Google LLC 438* 439* Licensed under the Apache License, Version 2.0 (the "License"); 440* you may not use this file except in compliance with the License. 441* You may obtain a copy of the License at 442* 443* http://www.apache.org/licenses/LICENSE-2.0 444* 445* Unless required by applicable law or agreed to in writing, software 446* distributed under the License is distributed on an "AS IS" BASIS, 447* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 448* See the License for the specific language governing permissions and 449* limitations under the License. 450*/function st(n,e){N(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/** 451* @license 452* Copyright 2020 Google LLC 453* 454* Licensed under the Apache License, Version 2.0 (the "License"); 455* you may not use this file except in compliance with the License. 456* You may obtain a copy of the License at 457* 458* http://www.apache.org/licenses/LICENSE-2.0 459* 460* Unless required by applicable law or agreed to in writing, software 461* distributed under the License is distributed on an "AS IS" BASIS, 462* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 463* See the License for the specific language governing permissions and 464* limitations under the License. 465*/class In{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;P("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;P("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;P("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/** 466* @license 467* Copyright 2020 Google LLC 468* 469* Licensed under the Apache License, Version 2.0 (the "License"); 470* you may not use this file except in compliance with the License. 471* You may obtain a copy of the License at 472* 473* http://www.apache.org/licenses/LICENSE-2.0 474* 475* Unless required by applicable law or agreed to in writing, software 476* distributed under the License is distributed on an "AS IS" BASIS, 477* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 478* See the License for the specific language governing permissions and 479* limitations under the License. 480*/const Hs={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-rec
480aptcha-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"};/** 481* @license 482* Copyright 2020 Google LLC 483* 484* Licensed under the Apache License, Version 2.0 (the "License"); 485* you may not use this file except in compliance with the License. 486* You may obtain a copy of the License at 487* 488* http://www.apache.org/licenses/LICENSE-2.0 489* 490* Unless required by applicable law or agreed to in writing, software 491* distributed under the License is distributed on an "AS IS" BASIS, 492* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 493* See the License for the specific language governing permissions and 494* limitations under the License. 495*/const Vs=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],$s=new me(3e4,6e4);function b(n,e){return n.tenantId&&!e.tenantId?{...e,tenantId:n.tenantId}:e}async function k(n,e,t,r,s={}){return wn(n,s,async()=>{let i={},o={};r&&(e==="GET"?o=r:i={body:JSON.stringify(r)});const a=fe({key:n.config.apiKey,...o}).slice(1),c=await n._getAdditionalHeaders();c["Content-Type"]="application/json",n.languageCode&&(c["X-Firebase-Locale"]=n.languageCode);const l={method:e,headers:c,...i};return pr()||(l.referrerPolicy="no-referrer"),n.emulatorConfig&&ne(n.emulatorConfig.host)&&(l.credentials="include"),In.fetch()(await yn(n,n.config.apiHost,t,a),l)})}async function wn(n,e,t){n._canInitEmulator=!1;const r={...Hs,...e};try{const s=new js(n),i=await Promise.race([t(),s.promise]);s.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw we(n,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const a=i.ok?o.errorMessage:o.error.message,[c,l]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw we(n,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw we(n,"email-already-in-use",o);if(c==="USER_DISABLED")throw we(n,"user-disabled",o);const d=r[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw _n(n,d,l);E(n,d)}}catch(s){if(s instanceof D)throw s;E(n,"network-request-failed",{message:String(s)})}}async function re(n,e,t,r,s={}){const i=await k(n,e,t,r,s);return"mfaPendingCredential"in i&&E(n,"multi-factor-auth-required",{_serverResponse:i}),i}async function yn(n,e,t,r){const s=`${e}${t}?${r}`,i=n,o=i.config.emulator?st(n.config,s):`${n.config.apiScheme}://${s}`;return Vs.includes(t)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?i._getPersistence()._getFinalTarget(o).toString():o}function Ws(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class js{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(S(this.auth,"network-request-failed")),$s.get())})}}function we(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const s=S(n,e,r);return s.customData._tokenResponse=t,s}function Rt(n){return n!==void 0&&n.enterprise!==void 0}class zs{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return Ws(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PRO
495VIDER")}}async function Gs(n,e){return k(n,"GET","/v2/recaptchaConfig",b(n,e))}/** 496* @license 497* Copyright 2020 Google LLC 498* 499* Licensed under the Apache License, Version 2.0 (the "License"); 500* you may not use this file except in compliance with the License. 501* You may obtain a copy of the License at 502* 503* http://www.apache.org/licenses/LICENSE-2.0 504* 505* Unless required by applicable law or agreed to in writing, software 506* distributed under the License is distributed on an "AS IS" BASIS, 507* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 508* See the License for the specific language governing permissions and 509* limitations under the License. 510*/async function qs(n,e){return k(n,"POST","/v1/accounts:delete",e)}async function Ce(n,e){return k(n,"POST","/v1/accounts:lookup",e)}/** 511* @license 512* Copyright 2020 Google LLC 513* 514* Licensed under the Apache License, Version 2.0 (the "License"); 515* you may not use this file except in compliance with the License. 516* You may obtain a copy of the License at 517* 518* http://www.apache.org/licenses/LICENSE-2.0 519* 520* Unless required by applicable law or agreed to in writing, software 521* distributed under the License is distributed on an "AS IS" BASIS, 522* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 523* See the License for the specific language governing permissions and 524* limitations under the License. 525*/function ce(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Ks(n,e=!1){const t=I(n),r=await t.getIdToken(e),s=it(r);h(s&&s.exp&&s.auth_time&&s.iat,t.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,o=i?.sign_in_provider;return{claims:s,token:r,authTime:ce($e(s.auth_time)),issuedAtTime:ce($e(s.iat)),expirationTime:ce($e(s.exp)),signInProvider:o||null,signInSecondFactor:i?.sign_in_second_factor||null}}function $e(n){return Number(n)*1e3}function it(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return ye("JWT malformed, contained fewer than 3 sections"),null;try{const s=tn(t);return s?JSON.parse(s):(ye("Failed to decode base64 JWT payload"),null)}catch(s){return ye("Caught error parsing JWT payload as JSON",s?.toString()),null}}function Ot(n){const e=it(n);return h(e,"internal-error"),h(typeof e.exp<"u","internal-error"),h(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/** 526* @license 527* Copyright 2020 Google LLC 528* 529* Licensed under the Apache License, Version 2.0 (the "License"); 530* you may not use this file except in compliance with the License. 531* You may obtain a copy of the License at 532* 533* http://www.apache.org/licenses/LICENSE-2.0 534* 535* Unless required by applicable law or agreed to in writing, software 536* distributed under the License is distributed on an "AS IS" BASIS, 537* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 538* See the License for the specific language governing permissions and 539* limitations under the License. 540*/async function ue(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof D&&Js(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function Js({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/** 541* @license 542* Copyright 2020 Google LLC 543* 544* Licensed under the Apache License, Version 2.0 (the "License"); 545* you may not use this file except in compliance with the License. 546* You may obtain a copy of the License at 547* 548* http://www.apache.org/licenses/LICENSE-2.0 549* 550* Unless required by applicable law or agreed to in writing, software 551* distributed under the License is distributed on an "AS IS" BASIS, 552* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 553* See the License for the specific language governing permissions and 554* limitations under the License. 555*/class Ys{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/** 556* @license 557* Copyright 2020 Google LLC 558* 559* Licensed under the Apache License, Version 2.0 (the "License");
560* you may not use this file except in compliance with the License. 561* You may obtain a copy of the License at 562* 563* http://www.apache.org/licenses/LICENSE-2.0 564* 565* Unless required by applicable law or agreed to in writing, software 566* distributed under the License is distributed on an "AS IS" BASIS, 567* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 568* See the License for the specific language governing permissions and 569* limitations under the License. 570*/class Ye{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=ce(this.lastLoginAt),this.creationTime=ce(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/** 571* @license 572* Copyright 2019 Google LLC 573* 574* Licensed under the Apache License, Version 2.0 (the "License"); 575* you may not use this file except in compliance with the License. 576* You may obtain a copy of the License at 577* 578* http://www.apache.org/licenses/LICENSE-2.0 579* 580* Unless required by applicable law or agreed to in writing, software 581* distributed under the License is distributed on an "AS IS" BASIS, 582* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 583* See the License for the specific language governing permissions and 584* limitations under the License. 585*/async function Ae(n){var f;const e=n.auth,t=await n.getIdToken(),r=await ue(n,Ce(e,{idToken:t}));h(r?.users.length,e,"internal-error");const s=r.users[0];n._notifyReloadListener(s);const i=(f=s.providerUserInfo)!=null&&f.length?En(s.providerUserInfo):[],o=Zs(n.providerData,i),a=n.isAnonymous,c=!(n.email&&s.passwordHash)&&!(o!=null&&o.length),l=a?c:!1,d={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new Ye(s.createdAt,s.lastLoginAt),isAnonymous:l};Object.assign(n,d)}async function Xs(n){const e=I(n);await Ae(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Zs(n,e){return[...n.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function En(n){return n.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}/** 586* @license 587* Copyright 2020 Google LLC 588* 589* Licensed under the Apache License, Version 2.0 (the "License"); 590* you may not use this file except in compliance with the License. 591* You may obtain a copy of the License at 592* 593* http://www.apache.org/licenses/LICENSE-2.0 594* 595* Unless required by applicable law or agreed to in writing, software 596* distributed under the License is distributed on an "AS IS" BASIS, 597* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 598* See the License for the specific language governing permissions and 599* limitations under the License. 600*/async function Qs(n,e){const t=await wn(n,{},async()=>{const r=fe({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=n.config,o=await yn(n,s,"/v1/token",`key=${i}`),a=await n._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const c={method:"POST",headers:a,body:r};return n.emulatorConfig&&ne(n.emulatorConfig.host)&&(c.credentials="include"),In.fetch()(o,c)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function ei(n,e){return k(n,"POST","/v2/accounts:revokeToken",b(n,e))}/** 601* @license 602* Copyright 2020 Google LLC 603* 604* Licensed under the Apache License, Version 2.0 (the "License"); 605* you may not use this file except in compliance with the License. 606* You may obtain a copy of the License at 607* 608* http://www.apache.org/licenses/LICENSE-2.0 609* 610* Unless required by applicable law or agreed to in writing, software 611* distributed under the License is distributed on an "AS IS" BASIS, 612* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 613* See the License for the specific language governing permissions and 614* limitations under the License. 615*/class Y{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){h(e.idToken,"internal-error"),h(typeof e.idToken<"u","internal-error"),h(typeof e.refreshToken<"u","internal-error");
615const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Ot(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){h(e.length!==0,"internal-error");const t=Ot(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(h(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:r,refreshToken:s,expiresIn:i}=await Qs(e,t);this.updateTokensAndExpiration(r,s,Number(i))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,t){const{refreshToken:r,accessToken:s,expirationTime:i}=t,o=new Y;return r&&(h(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),s&&(h(typeof s=="string","internal-error",{appName:e}),o.accessToken=s),i&&(h(typeof i=="number","internal-error",{appName:e}),o.expirationTime=i),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Y,this.toJSON())}_performRefresh(){return P("not implemented")}}/** 616* @license 617* Copyright 2020 Google LLC 618* 619* Licensed under the Apache License, Version 2.0 (the "License"); 620* you may not use this file except in compliance with the License. 621* You may obtain a copy of the License at 622* 623* http://www.apache.org/licenses/LICENSE-2.0 624* 625* Unless required by applicable law or agreed to in writing, software 626* distributed under the License is distributed on an "AS IS" BASIS, 627* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 628* See the License for the specific language governing permissions and 629* limitations under the License. 630*/function M(n,e){h(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class T{constructor({uid:e,auth:t,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new Ys(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new Ye(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await ue(this,this.stsTokenManager.getToken(this.auth,e));return h(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return Ks(this,e)}reload(){return Xs(this)}_assign(e){this!==e&&(h(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(t=>({...t})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new T({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){h(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await Ae(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(y(this.auth.app))return Promise.reject(C(this.auth));const e=await this.getIdToken();return await ue(this,qs(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isA
630nonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){const r=t.displayName??void 0,s=t.email??void 0,i=t.phoneNumber??void 0,o=t.photoURL??void 0,a=t.tenantId??void 0,c=t._redirectEventId??void 0,l=t.createdAt??void 0,d=t.lastLoginAt??void 0,{uid:f,emailVerified:u,isAnonymous:m,providerData:g,stsTokenManager:v}=t;h(f&&v,e,"internal-error");const Ie=Y.fromJSON(this.name,v);h(typeof f=="string",e,"internal-error"),M(r,e.name),M(s,e.name),h(typeof u=="boolean",e,"internal-error"),h(typeof m=="boolean",e,"internal-error"),M(i,e.name),M(o,e.name),M(a,e.name),M(c,e.name),M(l,e.name),M(d,e.name);const q=new T({uid:f,auth:e,email:s,emailVerified:u,displayName:r,isAnonymous:m,photoURL:o,phoneNumber:i,tenantId:a,stsTokenManager:Ie,createdAt:l,lastLoginAt:d});return g&&Array.isArray(g)&&(q.providerData=g.map(K=>({...K}))),c&&(q._redirectEventId=c),q}static async _fromIdTokenResponse(e,t,r=!1){const s=new Y;s.updateFromServerResponse(t);const i=new T({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await Ae(i),i}static async _fromGetAccountInfoResponse(e,t,r){const s=t.users[0];h(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?En(s.providerUserInfo):[],o=!(s.email&&s.passwordHash)&&!(i!=null&&i.length),a=new Y;a.updateFromIdToken(r);const c=new T({uid:s.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new Ye(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(i!=null&&i.length)};return Object.assign(c,l),c}}/** 631* @license 632* Copyright 2020 Google LLC 633* 634* Licensed under the Apache License, Version 2.0 (the "License"); 635* you may not use this file except in compliance with the License. 636* You may obtain a copy of the License at 637* 638* http://www.apache.org/licenses/LICENSE-2.0 639* 640* Unless required by applicable law or agreed to in writing, software 641* distributed under the License is distributed on an "AS IS" BASIS, 642* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 643* See the License for the specific language governing permissions and 644* limitations under the License. 645*/const Nt=new Map;function R(n){N(n instanceof Function,"Expected a class definition");let e=Nt.get(n);return e?(N(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,Nt.set(n,e),e)}/** 646* @license 647* Copyright 2019 Google LLC 648* 649* Licensed under the Apache License, Version 2.0 (the "License"); 650* you may not use this file except in compliance with the License. 651* You may obtain a copy of the License at 652* 653* http://www.apache.org/licenses/LICENSE-2.0 654* 655* Unless required by applicable law or agreed to in writing, software 656* distributed under the License is distributed on an "AS IS" BASIS, 657* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 658* See the License for the specific language governing permissions and 659* limitations under the License. 660*/class Tn{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}Tn.type="NONE";const Dt=Tn;/** 661* @license 662* Copyright 2019 Google LLC 663* 664* Licensed under the Apache License, Version 2.0 (the "License"); 665* you may not use this file except in compliance with the License. 666* You may obtain a copy of the License at 667* 668* http://www.apache.org/licenses/LICENSE-2.0 669* 670* Unless required by applicable law or agreed to in writing, software 671* distributed under the License is distributed on an "AS IS" BASIS, 672* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 673* See the License for the specific language governing permissions and 674* limitations under the License. 675*/function Ee(n,e,t){return`firebase:${n}:${e}:${t}`}class X{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=Ee(this.userKey,s.apiKey,i),this.fullPersistenceKey=Ee("persistence",s.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const t=await Ce(this.auth,{idToken:e}).catch(()=>{});return t?T._fromGetAccountInfoResponse(this.auth,t,e):null}return T._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new X(R(Dt),e,r);const s=(await Promise.all(t.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l);let i=s[0]||R(Dt);const o=Ee(r,e.config.apiKey,e.name);let a=null;for(const l of t)try{const d=await l._get(o);if(d){let f;
675if(typeof d=="string"){const u=await Ce(e,{idToken:d}).catch(()=>{});if(!u)break;f=await T._fromGetAccountInfoResponse(e,u,d)}else f=T._fromJSON(e,d);l!==i&&(a=f),i=l;break}}catch{}const c=s.filter(l=>l._shouldAllowMigration);return!i._shouldAllowMigration||!c.length?new X(i,e,r):(i=c[0],a&&await i._set(o,a.toJSON()),await Promise.all(t.map(async l=>{if(l!==i)try{await l._remove(o)}catch{}})),new X(i,e,r))}}/** 676* @license 677* Copyright 2020 Google LLC 678* 679* Licensed under the Apache License, Version 2.0 (the "License"); 680* you may not use this file except in compliance with the License. 681* You may obtain a copy of the License at 682* 683* http://www.apache.org/licenses/LICENSE-2.0 684* 685* Unless required by applicable law or agreed to in writing, software 686* distributed under the License is distributed on an "AS IS" BASIS, 687* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 688* See the License for the specific language governing permissions and 689* limitations under the License. 690*/function Lt(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Cn(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(bn(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(kn(e))return"Blackberry";if(Pn(e))return"Webos";if(vn(e))return"Safari";if((e.includes("chrome/")||Sn(e))&&!e.includes("edge/"))return"Chrome";if(An(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=n.match(t);if(r?.length===2)return r[1]}return"Other"}function bn(n=_()){return/firefox\//i.test(n)}function vn(n=_()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Sn(n=_()){return/crios\//i.test(n)}function Cn(n=_()){return/iemobile/i.test(n)}function An(n=_()){return/android/i.test(n)}function kn(n=_()){return/blackberry/i.test(n)}function Pn(n=_()){return/webos/i.test(n)}function ot(n=_()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function ti(n=_()){var e;return ot(n)&&!!((e=window.navigator)!=null&&e.standalone)}function ni(){return _r()&&document.documentMode===10}function Rn(n=_()){return ot(n)||An(n)||Pn(n)||kn(n)||/windows phone/i.test(n)||Cn(n)}/** 691* @license 692* Copyright 2020 Google LLC 693* 694* Licensed under the Apache License, Version 2.0 (the "License"); 695* you may not use this file except in compliance with the License. 696* You may obtain a copy of the License at 697* 698* http://www.apache.org/licenses/LICENSE-2.0 699* 700* Unless required by applicable law or agreed to in writing, software 701* distributed under the License is distributed on an "AS IS" BASIS, 702* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 703* See the License for the specific language governing permissions and 704* limitations under the License. 705*/function On(n,e=[]){let t;switch(n){case"Browser":t=Lt(_());break;case"Worker":t=`${Lt(_())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${pe}/${r}`}/** 706* @license 707* Copyright 2022 Google LLC 708* 709* Licensed under the Apache License, Version 2.0 (the "License"); 710* you may not use this file except in compliance with the License. 711* You may obtain a copy of the License at 712* 713* http://www.apache.org/licenses/LICENSE-2.0 714* 715* Unless required by applicable law or agreed to in writing, software 716* distributed under the License is distributed on an "AS IS" BASIS, 717* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 718* See the License for the specific language governing permissions and 719* limitations under the License. 720*/class ri{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=i=>new Promise((o,a)=>{try{const c=e(i);o(c)}catch(c){a(c)}});r.onAbort=t,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(r){t.reverse();for(const s of t)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}}}/** 721* @license 722* Copyright 2023 Google LLC 723* 724* Licensed under the Apache License, Version 2.0 (the "License");
725* you may not use this file except in compliance with the License. 726* You may obtain a copy of the License at 727* 728* http://www.apache.org/licenses/LICENSE-2.0 729* 730* Unless required by applicable law or agreed to in writing, software 731* distributed under the License is distributed on an "AS IS" BASIS, 732* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 733* See the License for the specific language governing permissions and 734* limitations under the License. 735*/async function si(n,e={}){return k(n,"GET","/v2/passwordPolicy",b(n,e))}/** 736* @license 737* Copyright 2023 Google LLC 738* 739* Licensed under the Apache License, Version 2.0 (the "License"); 740* you may not use this file except in compliance with the License. 741* You may obtain a copy of the License at 742* 743* http://www.apache.org/licenses/LICENSE-2.0 744* 745* Unless required by applicable law or agreed to in writing, software 746* distributed under the License is distributed on an "AS IS" BASIS, 747* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 748* See the License for the specific language governing permissions and 749* limitations under the License. 750*/const ii=6;class oi{constructor(e){var r;const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??ii,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),t.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),t.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),t.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),t.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=e.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),s&&(t.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let r;for(let s=0;s<e.length;s++)r=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}/** 751* @license 752* Copyright 2020 Google LLC 753* 754* Licensed under the Apache License, Version 2.0 (the "License"); 755* you may not use this file except in compliance with the License. 756* You may obtain a copy of the License at 757* 758* http://www.apache.org/licenses/LICENSE-2.0 759* 760* Unless required by applicable law or agreed to in writing, software 761* distributed under the License is distributed on an "AS IS" BASIS, 762* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 763* See the License for the specific language governing permissions and 764* limitations under the License. 765*/class ai{constructor(e,t,r,s){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Mt(this),this.idTokenSubscription=new Mt(this),this.beforeStateQueue=new ri(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=gn,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=R(t)),this._initializationPromise=this.queue(async()=>{var r,s,i;if(!this._deleted&&(this.persistenceManager=await X.create(this,e),(r=this._resolvePersistenceManagerAvailable)==null||r.call(this),!this._deleted)){if
765((s=this._popupRedirectResolver)!=null&&s._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=((i=this.currentUser)==null?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const t=await Ce(this,{idToken:e}),r=await T._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var i;if(y(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}const t=await this.assertedPersistence.getCurrentUser();let r=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(i=this.redirectUser)==null?void 0:i._redirectEventId,a=r?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c!=null&&c.user&&(r=c.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return h(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await Ae(e)}catch(t){if(t?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=Bs()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(y(this.app))return Promise.reject(C(this));const t=e?I(e):null;return t&&h(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&h(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return y(this.app)?Promise.reject(C(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return y(this.app)?Promise.reject(C(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(R(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await si(this),t=new oi(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new he("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((e,t)=>
765{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(r.tenantId=this.tenantId),await ei(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)==null?void 0:e.toJSON()}}async _setRedirectUser(e,t){const r=await this.getOrInitRedirectPersistenceManager(t);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&R(e)||this._popupRedirectResolver;h(t,this,"argument-error"),this.redirectPersistenceManager=await X.create(this,[R(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,r;return this._isInitialized&&await this.queue(async()=>{}),((t=this._currentUser)==null?void 0:t._redirectEventId)===e?this._currentUser:((r=this.redirectUser)==null?void 0:r._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(){var t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=((t=this.currentUser)==null?void 0:t.uid)??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,s){if(this._deleted)return()=>{};const i=typeof t=="function"?t:t.next.bind(t);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(h(a,this,"internal-error"),a.then(()=>{o||i(this.currentUser)}),typeof t=="function"){const c=e.addObserver(t,r,s);return()=>{o=!0,c()}}else{const c=e.addObserver(t);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return h(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=On(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var s;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const t=await((s=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:s.getHeartbeatsHeader());t&&(e["X-Firebase-Client"]=t);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var t;if(y(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await((t=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:t.getToken());return e!=null&&e.error&&Us(`Error while retrieving App Check token: ${e.error}`),e?.token}}function L(n){return I(n)}class Mt{constructor(e){this.auth=e,this.observer=null,this.addObserver=vr(t=>this.observer=t)}get next(){return h(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/** 766* @license 767* Copyright 2020 Google LLC 768* 769* Licensed under the Apache License, Version 2.0 (the "License");
770* you may not use this file except in compliance with the License. 771* You may obtain a copy of the License at 772* 773* http://www.apache.org/licenses/LICENSE-2.0 774* 775* Unless required by applicable law or agreed to in writing, software 776* distributed under the License is distributed on an "AS IS" BASIS, 777* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 778* See the License for the specific language governing permissions and 779* limitations under the License. 780*/let De={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function ci(n){De=n}function Nn(n){return De.loadJS(n)}function li(){return De.recaptchaEnterpriseScript}function ui(){return De.gapiScript}function di(n){return`__${n}${Math.floor(Math.random()*1e6)}`}class hi{constructor(){this.enterprise=new fi}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class fi{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}const pi="recaptcha-enterprise",Dn="NO_RECAPTCHA";class mi{constructor(e){this.type=pi,this.auth=L(e)}async verify(e="verify",t=!1){async function r(i){if(!t){if(i.tenantId==null&&i._agentRecaptchaConfig!=null)return i._agentRecaptchaConfig.siteKey;if(i.tenantId!=null&&i._tenantRecaptchaConfigs[i.tenantId]!==void 0)return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(o,a)=>{Gs(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{const l=new zs(c);return i.tenantId==null?i._agentRecaptchaConfig=l:i._tenantRecaptchaConfigs[i.tenantId]=l,o(l.siteKey)}}).catch(c=>{a(c)})})}function s(i,o,a){const c=window.grecaptcha;Rt(c)?c.enterprise.ready(()=>{c.enterprise.execute(i,{action:e}).then(l=>{o(l)}).catch(()=>{o(Dn)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new hi().execute("siteKey",{action:"verify"}):new Promise((i,o)=>{r(this.auth).then(a=>{if(!t&&Rt(window.grecaptcha))s(a,i,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let c=li();c.length!==0&&(c+=a),Nn(c).then(()=>{s(a,i,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}}async function Ut(n,e,t,r=!1,s=!1){const i=new mi(n);let o;if(s)o=Dn;else try{o=await i.verify(t)}catch{o=await i.verify(t,!0)}const a={...e};if(t==="mfaSmsEnrollment"||t==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in a){const c=a.phoneEnrollmentInfo.phoneNumber,l=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:c,recaptchaToken:l,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const c=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:c,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return r?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function Xe(n,e,t,r,s){var i;if((i=n._getRecaptchaConfig())!=null&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const o=await Ut(n,e,t,t==="getOobCode");return r(n,o)}else return r(n,e).catch(async o=>{if(o.code==="auth/missing-recaptcha-token"){console.log(`${t} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const a=await Ut(n,e,t,t==="getOobCode");return r(n,a)}else return Promise.reject(o)})}/** 781* @license 782* Copyright 2020 Google LLC 783* 784* Licensed under the Apache License, Version 2.0 (the "License"); 785* you may not use this file except in compliance with the License. 786* You may obtain a copy of the License at 787* 788* http://www.apache.org/licenses/LICENSE-2.0 789* 790* Unless required by applicable law or agreed to in writing, software 791* distributed under the License is distributed on an "AS IS" BASIS, 792* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 793* See the License for the specific language governing permissions and 794* limitations under the License. 795*/function gi(n,e){const t=nt(n,"auth");if(t.isInitialized()){const s=t.getImmediate(),i=t.getOptions();if(Q(i,e??{}))return s;E(s,"already-initialized")}return t.initialize({options:e})}function _i(n,e){const t=e?.persistence||[],r=(Array.isArray(t)?t:[t]).map(R);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e?.popupRedirectResolver)}function Ii(n,e,t){const r=L(n);
795h(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!!(t!=null&&t.disableWarnings),i=Ln(e),{host:o,port:a}=wi(e),c=a===null?"":`:${a}`,l={url:`${i}//${o}${c}/`},d=Object.freeze({host:o,port:a,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){h(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),h(Q(l,r.config.emulator)&&Q(d,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=l,r.emulatorConfig=d,r.settings.appVerificationDisabledForTesting=!0,ne(o)?(on(`${i}//${o}${c}`),an("Auth",!0)):yi()}function Ln(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function wi(n){const e=Ln(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const r=t[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const i=s[1];return{host:i,port:xt(r.substr(i.length+1))}}else{const[i,o]=r.split(":");return{host:i,port:xt(o)}}}function xt(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function yi(){function n(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}/** 796* @license 797* Copyright 2020 Google LLC 798* 799* Licensed under the Apache License, Version 2.0 (the "License"); 800* you may not use this file except in compliance with the License. 801* You may obtain a copy of the License at 802* 803* http://www.apache.org/licenses/LICENSE-2.0 804* 805* Unless required by applicable law or agreed to in writing, software 806* distributed under the License is distributed on an "AS IS" BASIS, 807* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 808* See the License for the specific language governing permissions and 809* limitations under the License. 810*/class at{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return P("not implemented")}_getIdTokenResponse(e){return P("not implemented")}_linkToIdToken(e,t){return P("not implemented")}_getReauthenticationResolver(e){return P("not implemented")}}/** 811* @license 812* Copyright 2020 Google LLC 813* 814* Licensed under the Apache License, Version 2.0 (the "License"); 815* you may not use this file except in compliance with the License. 816* You may obtain a copy of the License at 817* 818* http://www.apache.org/licenses/LICENSE-2.0 819* 820* Unless required by applicable law or agreed to in writing, software 821* distributed under the License is distributed on an "AS IS" BASIS, 822* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 823* See the License for the specific language governing permissions and 824* limitations under the License. 825*/async function Mn(n,e){return k(n,"POST","/v1/accounts:resetPassword",b(n,e))}async function Ei(n,e){return k(n,"POST","/v1/accounts:signUp",e)}async function Ti(n,e){return k(n,"POST","/v1/accounts:update",b(n,e))}/** 826* @license 827* Copyright 2020 Google LLC 828* 829* Licensed under the Apache License, Version 2.0 (the "License"); 830* you may not use this file except in compliance with the License. 831* You may obtain a copy of the License at 832* 833* http://www.apache.org/licenses/LICENSE-2.0 834* 835* Unless required by applicable law or agreed to in writing, software 836* distributed under the License is distributed on an "AS IS" BASIS, 837* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 838* See the License for the specific language governing permissions and 839* limitations under the License. 840*/async function bi(n,e){return re(n,"POST","/v1/accounts:signInWithPassword",b(n,e))}/** 841* @license 842* Copyright 2020 Google LLC 843* 844* Licensed under the Apache License, Version 2.0 (the "License");
845* you may not use this file except in compliance with the License. 846* You may obtain a copy of the License at 847* 848* http://www.apache.org/licenses/LICENSE-2.0 849* 850* Unless required by applicable law or agreed to in writing, software 851* distributed under the License is distributed on an "AS IS" BASIS, 852* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 853* See the License for the specific language governing permissions and 854* limitations under the License. 855*/async function vi(n,e){return re(n,"POST","/v1/accounts:signInWithEmailLink",b(n,e))}async function Si(n,e){return re(n,"POST","/v1/accounts:signInWithEmailLink",b(n,e))}/** 856* @license 857* Copyright 2020 Google LLC 858* 859* Licensed under the Apache License, Version 2.0 (the "License"); 860* you may not use this file except in compliance with the License. 861* You may obtain a copy of the License at 862* 863* http://www.apache.org/licenses/LICENSE-2.0 864* 865* Unless required by applicable law or agreed to in writing, software 866* distributed under the License is distributed on an "AS IS" BASIS, 867* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 868* See the License for the specific language governing permissions and 869* limitations under the License. 870*/class de extends at{constructor(e,t,r,s=null){super("password",r),this._email=e,this._password=t,this._tenantId=s}static _fromEmailAndPassword(e,t){return new de(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new de(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;if(t!=null&&t.email&&t!=null&&t.password){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const t={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Xe(e,t,"signInWithPassword",bi);case"emailLink":return vi(e,{email:this._email,oobCode:this._password});default:E(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":const r={idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Xe(e,r,"signUpPassword",Ei);case"emailLink":return Si(e,{idToken:t,email:this._email,oobCode:this._password});default:E(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/** 871* @license 872* Copyright 2020 Google LLC 873* 874* Licensed under the Apache License, Version 2.0 (the "License"); 875* you may not use this file except in compliance with the License. 876* You may obtain a copy of the License at 877* 878* http://www.apache.org/licenses/LICENSE-2.0 879* 880* Unless required by applicable law or agreed to in writing, software 881* distributed under the License is distributed on an "AS IS" BASIS, 882* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 883* See the License for the specific language governing permissions and 884* limitations under the License. 885*/async function Z(n,e){return re(n,"POST","/v1/accounts:signInWithIdp",b(n,e))}/** 886* @license 887* Copyright 2020 Google LLC 888* 889* Licensed under the Apache License, Version 2.0 (the "License"); 890* you may not use this file except in compliance with the License. 891* You may obtain a copy of the License at 892* 893* http://www.apache.org/licenses/LICENSE-2.0 894* 895* Unless required by applicable law or agreed to in writing, software 896* distributed under the License is distributed on an "AS IS" BASIS, 897* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 898* See the License for the specific language governing permissions and 899* limitations under the License. 900*/const Ci="http://localhost";class G extends at{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new G(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&
900(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):E("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:s,...i}=t;if(!r||!s)return null;const o=new G(r,s);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){const t=this.buildRequest();return Z(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,Z(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Z(e,t)}buildRequest(){const e={requestUri:Ci,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=fe(t)}return e}}/** 901* @license 902* Copyright 2020 Google LLC 903* 904* Licensed under the Apache License, Version 2.0 (the "License"); 905* you may not use this file except in compliance with the License. 906* You may obtain a copy of the License at 907* 908* http://www.apache.org/licenses/LICENSE-2.0 909* 910* Unless required by applicable law or agreed to in writing, software 911* distributed under the License is distributed on an "AS IS" BASIS, 912* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 913* See the License for the specific language governing permissions and 914* limitations under the License. 915*/function Ai(n){switch(n){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function ki(n){const e=ie(oe(n)).link,t=e?ie(oe(e)).deep_link_id:null,r=ie(oe(n)).deep_link_id;return(r?ie(oe(r)).link:null)||r||t||e||n}class ct{constructor(e){const t=ie(oe(e)),r=t.apiKey??null,s=t.oobCode??null,i=Ai(t.mode??null);h(r&&s&&i,"argument-error"),this.apiKey=r,this.operation=i,this.code=s,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){const t=ki(e);try{return new ct(t)}catch{return null}}}/** 916* @license 917* Copyright 2020 Google LLC 918* 919* Licensed under the Apache License, Version 2.0 (the "License"); 920* you may not use this file except in compliance with the License. 921* You may obtain a copy of the License at 922* 923* http://www.apache.org/licenses/LICENSE-2.0 924* 925* Unless required by applicable law or agreed to in writing, software 926* distributed under the License is distributed on an "AS IS" BASIS, 927* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 928* See the License for the specific language governing permissions and 929* limitations under the License. 930*/class se{constructor(){this.providerId=se.PROVIDER_ID}static credential(e,t){return de._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const r=ct.parseLink(t);return h(r,"argument-error"),de._fromEmailAndCode(e,r.code,r.tenantId)}}se.PROVIDER_ID="password",se.EMAIL_PASSWORD_SIGN_IN_METHOD="password",se.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/** 931* @license 932* Copyright 2020 Google LLC 933* 934* Licensed under the Apache License, Version 2.0 (the "License"); 935* you may not use this file except in compliance with the License. 936* You may obtain a copy of the License at 937* 938* http://www.apache.org/licenses/LICENSE-2.0 939* 940* Unless required by applicable law or agreed to in writing, software 941* distributed under the License is distributed on an "AS IS" BASIS, 942* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 943* See the License for the specific language governing permissions and 944* limitations under the License. 945*/class Un{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/** 946* @license 947* Copyright 2019 Google LLC 948* 949* Licensed under the Apache License, Version 2.0 (the "License");
950* you may not use this file except in compliance with the License. 951* You may obtain a copy of the License at 952* 953* http://www.apache.org/licenses/LICENSE-2.0 954* 955* Unless required by applicable law or agreed to in writing, software 956* distributed under the License is distributed on an "AS IS" BASIS, 957* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 958* See the License for the specific language governing permissions and 959* limitations under the License. 960*/class ge extends Un{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/** 961* @license 962* Copyright 2020 Google LLC 963* 964* Licensed under the Apache License, Version 2.0 (the "License"); 965* you may not use this file except in compliance with the License. 966* You may obtain a copy of the License at 967* 968* http://www.apache.org/licenses/LICENSE-2.0 969* 970* Unless required by applicable law or agreed to in writing, software 971* distributed under the License is distributed on an "AS IS" BASIS, 972* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 973* See the License for the specific language governing permissions and 974* limitations under the License. 975*/class U extends ge{constructor(){super("facebook.com")}static credential(e){return G._fromParams({providerId:U.PROVIDER_ID,signInMethod:U.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return U.credentialFromTaggedObject(e)}static credentialFromError(e){return U.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return U.credential(e.oauthAccessToken)}catch{return null}}}U.FACEBOOK_SIGN_IN_METHOD="facebook.com",U.PROVIDER_ID="facebook.com";/** 976* @license 977* Copyright 2020 Google LLC 978* 979* Licensed under the Apache License, Version 2.0 (the "License"); 980* you may not use this file except in compliance with the License. 981* You may obtain a copy of the License at 982* 983* http://www.apache.org/licenses/LICENSE-2.0 984* 985* Unless required by applicable law or agreed to in writing, software 986* distributed under the License is distributed on an "AS IS" BASIS, 987* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 988* See the License for the specific language governing permissions and 989* limitations under the License. 990*/class x extends ge{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return G._fromParams({providerId:x.PROVIDER_ID,signInMethod:x.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return x.credentialFromTaggedObject(e)}static credentialFromError(e){return x.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return x.credential(t,r)}catch{return null}}}x.GOOGLE_SIGN_IN_METHOD="google.com",x.PROVIDER_ID="google.com";/** 991* @license 992* Copyright 2020 Google LLC 993* 994* Licensed under the Apache License, Version 2.0 (the "License"); 995* you may not use this file except in compliance with the License. 996* You may obtain a copy of the License at 997* 998* http://www.apache.org/licenses/LICENSE-2.0 999* 1000* Unless required by applicable law or agreed to in writing, software 1001* distributed under the License is distributed on an "AS IS" BASIS, 1002* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1003* See the License for the specific language governing permissions and 1004* limitations under the License. 1005*/class F extends ge{constructor(){super("github.com")}static credential(e){return G._fromParams({providerId:F.PROVIDER_ID,signInMethod:F.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return F.credentialFromTaggedObject(e)}static credentialFromError(e){return F.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return F.credential(e.oauthAccessToken)}catch{return null}}}F.GITHUB_SIGN_IN_METHOD="github.com",F.PROVIDER_ID="github.com";/** 1006* @license 1007* Copyright 2020 Google LLC 1008* 1009* Licensed under the Apache License, Version 2.0 (the "License");
1010* you may not use this file except in compliance with the License. 1011* You may obtain a copy of the License at 1012* 1013* http://www.apache.org/licenses/LICENSE-2.0 1014* 1015* Unless required by applicable law or agreed to in writing, software 1016* distributed under the License is distributed on an "AS IS" BASIS, 1017* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1018* See the License for the specific language governing permissions and 1019* limitations under the License. 1020*/class B extends ge{constructor(){super("twitter.com")}static credential(e,t){return G._fromParams({providerId:B.PROVIDER_ID,signInMethod:B.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return B.credentialFromTaggedObject(e)}static credentialFromError(e){return B.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return B.credential(t,r)}catch{return null}}}B.TWITTER_SIGN_IN_METHOD="twitter.com",B.PROVIDER_ID="twitter.com";/** 1021* @license 1022* Copyright 2020 Google LLC 1023* 1024* Licensed under the Apache License, Version 2.0 (the "License"); 1025* you may not use this file except in compliance with the License. 1026* You may obtain a copy of the License at 1027* 1028* http://www.apache.org/licenses/LICENSE-2.0 1029* 1030* Unless required by applicable law or agreed to in writing, software 1031* distributed under the License is distributed on an "AS IS" BASIS, 1032* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1033* See the License for the specific language governing permissions and 1034* limitations under the License. 1035*/async function Pi(n,e){return re(n,"POST","/v1/accounts:signUp",b(n,e))}/** 1036* @license 1037* Copyright 2020 Google LLC 1038* 1039* Licensed under the Apache License, Version 2.0 (the "License"); 1040* you may not use this file except in compliance with the License. 1041* You may obtain a copy of the License at 1042* 1043* http://www.apache.org/licenses/LICENSE-2.0 1044* 1045* Unless required by applicable law or agreed to in writing, software 1046* distributed under the License is distributed on an "AS IS" BASIS, 1047* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1048* See the License for the specific language governing permissions and 1049* limitations under the License. 1050*/class W{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,s=!1){const i=await T._fromIdTokenResponse(e,r,s),o=Ft(r);return new W({user:i,providerId:o,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const s=Ft(r);return new W({user:e,providerId:s,_tokenResponse:r,operationType:t})}}function Ft(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/** 1051* @license 1052* Copyright 2020 Google LLC 1053* 1054* Licensed under the Apache License, Version 2.0 (the "License"); 1055* you may not use this file except in compliance with the License. 1056* You may obtain a copy of the License at 1057* 1058* http://www.apache.org/licenses/LICENSE-2.0 1059* 1060* Unless required by applicable law or agreed to in writing, software 1061* distributed under the License is distributed on an "AS IS" BASIS, 1062* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1063* See the License for the specific language governing permissions and 1064* limitations under the License. 1065*/class ke extends D{constructor(e,t,r,s){super(t.code,t.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,ke.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,s){return new ke(e,t,r,s)}}function xn(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?ke._fromErrorAndOperation(n,i,e,r):i})}async function Ri(n,e,t=!1){const r=await ue(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return W._forOperation(n,"link",r)}/** 1066* @license 1067* Copyright 2019 Google LLC 1068* 1069* Licensed under the Apache License, Version 2.0 (the "License");
1070* you may not use this file except in compliance with the License. 1071* You may obtain a copy of the License at 1072* 1073* http://www.apache.org/licenses/LICENSE-2.0 1074* 1075* Unless required by applicable law or agreed to in writing, software 1076* distributed under the License is distributed on an "AS IS" BASIS, 1077* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1078* See the License for the specific language governing permissions and 1079* limitations under the License. 1080*/async function Oi(n,e,t=!1){const{auth:r}=n;if(y(r.app))return Promise.reject(C(r));const s="reauthenticate";try{const i=await ue(n,xn(r,s,e,n),t);h(i.idToken,r,"internal-error");const o=it(i.idToken);h(o,r,"internal-error");const{sub:a}=o;return h(n.uid===a,r,"user-mismatch"),W._forOperation(n,s,i)}catch(i){throw i?.code==="auth/user-not-found"&&E(r,"user-mismatch"),i}}/** 1081* @license 1082* Copyright 2020 Google LLC 1083* 1084* Licensed under the Apache License, Version 2.0 (the "License"); 1085* you may not use this file except in compliance with the License. 1086* You may obtain a copy of the License at 1087* 1088* http://www.apache.org/licenses/LICENSE-2.0 1089* 1090* Unless required by applicable law or agreed to in writing, software 1091* distributed under the License is distributed on an "AS IS" BASIS, 1092* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1093* See the License for the specific language governing permissions and 1094* limitations under the License. 1095*/async function Fn(n,e,t=!1){if(y(n.app))return Promise.reject(C(n));const r="signIn",s=await xn(n,r,e),i=await W._fromIdTokenResponse(n,r,s);return t||await n._updateCurrentUser(i.user),i}async function Ni(n,e){return Fn(L(n),e)}/** 1096* @license 1097* Copyright 2020 Google LLC 1098* 1099* Licensed under the Apache License, Version 2.0 (the "License"); 1100* you may not use this file except in compliance with the License. 1101* You may obtain a copy of the License at 1102* 1103* http://www.apache.org/licenses/LICENSE-2.0 1104* 1105* Unless required by applicable law or agreed to in writing, software 1106* distributed under the License is distributed on an "AS IS" BASIS, 1107* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1108* See the License for the specific language governing permissions and 1109* limitations under the License. 1110*/async function Di(n,e){return re(n,"POST","/v1/accounts:signInWithCustomToken",b(n,e))}/** 1111* @license 1112* Copyright 2020 Google LLC 1113* 1114* Licensed under the Apache License, Version 2.0 (the "License"); 1115* you may not use this file except in compliance with the License. 1116* You may obtain a copy of the License at 1117* 1118* http://www.apache.org/licenses/LICENSE-2.0 1119* 1120* Unless required by applicable law or agreed to in writing, software 1121* distributed under the License is distributed on an "AS IS" BASIS, 1122* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1123* See the License for the specific language governing permissions and 1124* limitations under the License. 1125*/async function Li(n,e){if(y(n.app))return Promise.reject(C(n));const t=L(n),r=await Di(t,{token:e,returnSecureToken:!0}),s=await W._fromIdTokenResponse(t,"signIn",r);return await t._updateCurrentUser(s.user),s}/** 1126* @license 1127* Copyright 2020 Google LLC 1128* 1129* Licensed under the Apache License, Version 2.0 (the "License"); 1130* you may not use this file except in compliance with the License. 1131* You may obtain a copy of the License at 1132* 1133* http://www.apache.org/licenses/LICENSE-2.0 1134* 1135* Unless required by applicable law or agreed to in writing, software 1136* distributed under the License is distributed on an "AS IS" BASIS, 1137* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1138* See the License for the specific language governing permissions and 1139* limitations under the License. 1140*/class lt{constructor(e,t){this.factorId=e,this.uid=t.mfaEnrollmentId,this.enrollmentTime=new Date(t.enrolledAt).toUTCString(),this.displayName=t.displayName}static _fromServerResponse(e,t){return"phoneInfo"in t?ut._fromServerResponse(e,t):"totpInfo"in t?dt._fromServerResponse(e,t):E(e,"internal-error")}}class ut extends lt{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new ut(t)}}class dt extends lt{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new dt(t)}}/** 1141* @license 1142* Copyright 2020 Google LLC 1143* 1144* Licensed under the Apache License, Version 2.0 (the "License");
1145* you may not use this file except in compliance with the License. 1146* You may obtain a copy of the License at 1147* 1148* http://www.apache.org/licenses/LICENSE-2.0 1149* 1150* Unless required by applicable law or agreed to in writing, software 1151* distributed under the License is distributed on an "AS IS" BASIS, 1152* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1153* See the License for the specific language governing permissions and 1154* limitations under the License. 1155*/async function ht(n){const e=L(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function Na(n,e,t){await Mn(I(n),{oobCode:e,newPassword:t}).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&ht(n),r})}async function Da(n,e){await Ti(I(n),{oobCode:e})}async function Mi(n,e){const t=I(n),r=await Mn(t,{oobCode:e}),s=r.requestType;switch(h(s,t,"internal-error"),s){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":h(r.newEmail,t,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":h(r.mfaInfo,t,"internal-error");default:h(r.email,t,"internal-error")}let i=null;return r.mfaInfo&&(i=lt._fromServerResponse(L(t),r.mfaInfo)),{data:{email:(r.requestType==="VERIFY_AND_CHANGE_EMAIL"?r.newEmail:r.email)||null,previousEmail:(r.requestType==="VERIFY_AND_CHANGE_EMAIL"?r.email:r.newEmail)||null,multiFactorInfo:i},operation:s}}async function La(n,e){const{data:t}=await Mi(I(n),e);return t.email}async function Ma(n,e,t){if(y(n.app))return Promise.reject(C(n));const r=L(n),o=await Xe(r,{returnSecureToken:!0,email:e,password:t,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Pi).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&ht(n),c}),a=await W._fromIdTokenResponse(r,"signIn",o);return await r._updateCurrentUser(a.user),a}function Ua(n,e,t){return y(n.app)?Promise.reject(C(n)):Ni(I(n),se.credential(e,t)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&ht(n),r})}function Ui(n,e,t,r){return I(n).onIdTokenChanged(e,t,r)}function xi(n,e,t){return I(n).beforeAuthStateChanged(e,t)}function xa(n,e,t,r){return I(n).onAuthStateChanged(e,t,r)}const Pe="__sak";/** 1156* @license 1157* Copyright 2019 Google LLC 1158* 1159* Licensed under the Apache License, Version 2.0 (the "License"); 1160* you may not use this file except in compliance with the License. 1161* You may obtain a copy of the License at 1162* 1163* http://www.apache.org/licenses/LICENSE-2.0 1164* 1165* Unless required by applicable law or agreed to in writing, software 1166* distributed under the License is distributed on an "AS IS" BASIS, 1167* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1168* See the License for the specific language governing permissions and 1169* limitations under the License. 1170*/class Bn{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Pe,"1"),this.storage.removeItem(Pe),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/** 1171* @license 1172* Copyright 2020 Google LLC 1173* 1174* Licensed under the Apache License, Version 2.0 (the "License"); 1175* you may not use this file except in compliance with the License. 1176* You may obtain a copy of the License at 1177* 1178* http://www.apache.org/licenses/LICENSE-2.0 1179* 1180* Unless required by applicable law or agreed to in writing, software 1181* distributed under the License is distributed on an "AS IS" BASIS, 1182* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1183* See the License for the specific language governing permissions and 1184* limitations under the License. 1185*/const Fi=1e3,Bi=10;class Hn extends Bn{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Rn(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),s=this.localCache[t];r!==s&&e(t,s,r)}}
1185onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}const r=e.key;t?this.detachListener():this.stopPolling();const s=()=>{const o=this.storage.getItem(r);!t&&this.localCache[r]===o||this.notifyListeners(r,o)},i=this.storage.getItem(r);ni()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,Bi):s()}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},Fi)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Ob
1185ject.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Hn.type="LOCAL";const Hi=Hn;/** 1186* @license 1187* Copyright 2020 Google LLC 1188* 1189* Licensed under the Apache License, Version 2.0 (the "License"); 1190* you may not use this file except in compliance with the License. 1191* You may obtain a copy of the License at 1192* 1193* http://www.apache.org/licenses/LICENSE-2.0 1194* 1195* Unless required by applicable law or agreed to in writing, software 1196* distributed under the License is distributed on an "AS IS" BASIS, 1197* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1198* See the License for the specific language governing permissions and 1199* limitations under the License. 1200*/class Vn extends Bn{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Vn.type="SESSION";const $n=Vn;/** 1201* @license 1202* Copyright 2019 Google LLC 1203* 1204* Licensed under the Apache License, Version 2.0 (the "License"); 1205* you may not use this file except in compliance with the License. 1206* You may obtain a copy of the License at 1207* 1208* http://www.apache.org/licenses/LICENSE-2.0 1209* 1210* Unless required by applicable law or agreed to in writing, software 1211* distributed under the License is distributed on an "AS IS" BASIS, 1212* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1213* See the License for the specific language governing permissions and 1214* limitations under the License. 1215*/function Vi(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/** 1216* @license 1217* Copyright 2019 Google LLC 1218* 1219* Licensed under the Apache License, Version 2.0 (the "License"); 1220* you may not use this file except in compliance with the License. 1221* You may obtain a copy of the License at 1222* 1223* http://www.apache.org/licenses/LICENSE-2.0 1224* 1225* Unless required by applicable law or agreed to in writing, software 1226* distributed under the License is distributed on an "AS IS" BASIS, 1227* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1228* See the License for the specific language governing permissions and 1229* limitations under the License. 1230*/class Le{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(s=>s.isListeningto(e));if(t)return t;const r=new Le(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:s,data:i}=t.data,o=this.handlersMap[s];if(!(o!=null&&o.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const a=Array.from(o).map(async l=>l(t.origin,i)),c=await Vi(a);t.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:c})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Le.receivers=[];/** 1231* @license 1232* Copyright 2020 Google LLC 1233* 1234* Licensed under the Apache License, Version 2.0 (the "License"); 1235* you may not use this file except in compliance with the License. 1236* You may obtain a copy of the License at 1237* 1238* http://www.apache.org/licenses/LICENSE-2.0 1239* 1240* Unless required by applicable law or agreed to in writing, software 1241* distributed under the License is distributed on an "AS IS" BASIS, 1242* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1243* See the License for the specific language governing permissions and 1244* limitations under the License. 1245*/function ft(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/** 1246* @license 1247* Copyright 2019 Google LLC 1248* 1249* Licensed under the Apache License, Version 2.0 (the "License");
1250* you may not use this file except in compliance with the License. 1251* You may obtain a copy of the License at 1252* 1253* http://www.apache.org/licenses/LICENSE-2.0 1254* 1255* Unless required by applicable law or agreed to in writing, software 1256* distributed under the License is distributed on an "AS IS" BASIS, 1257* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1258* See the License for the specific language governing permissions and 1259* limitations under the License. 1260*/class $i{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let i,o;return new Promise((a,c)=>{const l=ft("",20);s.port1.start();const d=setTimeout(()=>{c(new Error("unsupported_event"))},r);o={messageChannel:s,onMessage(f){const u=f;if(u.data.eventId===l)switch(u.data.status){case"ack":clearTimeout(d),i=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),a(u.data.response);break;default:clearTimeout(d),clearTimeout(i),c(new Error("invalid_response"));break}}},this.handlers.add(o),s.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:t},[s.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/** 1261* @license 1262* Copyright 2020 Google LLC 1263* 1264* Licensed under the Apache License, Version 2.0 (the "License"); 1265* you may not use this file except in compliance with the License. 1266* You may obtain a copy of the License at 1267* 1268* http://www.apache.org/licenses/LICENSE-2.0 1269* 1270* Unless required by applicable law or agreed to in writing, software 1271* distributed under the License is distributed on an "AS IS" BASIS, 1272* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1273* See the License for the specific language governing permissions and 1274* limitations under the License. 1275*/function A(){return window}function Wi(n){A().location.href=n}/** 1276* @license 1277* Copyright 2020 Google LLC. 1278* 1279* Licensed under the Apache License, Version 2.0 (the "License"); 1280* you may not use this file except in compliance with the License. 1281* You may obtain a copy of the License at 1282* 1283* http://www.apache.org/licenses/LICENSE-2.0 1284* 1285* Unless required by applicable law or agreed to in writing, software 1286* distributed under the License is distributed on an "AS IS" BASIS, 1287* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1288* See the License for the specific language governing permissions and 1289* limitations under the License. 1290*/function Wn(){return typeof A().WorkerGlobalScope<"u"&&typeof A().importScripts=="function"}async function ji(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function zi(){var n;return((n=navigator?.serviceWorker)==null?void 0:n.controller)||null}function Gi(){return Wn()?self:null}/** 1291* @license 1292* Copyright 2019 Google LLC 1293* 1294* Licensed under the Apache License, Version 2.0 (the "License"); 1295* you may not use this file except in compliance with the License. 1296* You may obtain a copy of the License at 1297* 1298* http://www.apache.org/licenses/LICENSE-2.0 1299* 1300* Unless required by applicable law or agreed to in writing, software 1301* distributed under the License is distributed on an "AS IS" BASIS, 1302* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1303* See the License for the specific language governing permissions and 1304* limitations under the License. 1305*/const jn="firebaseLocalStorageDb",qi=1,Re="firebaseLocalStorage",zn="fbase_key";class _e{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function Me(n,e){return n.transaction([Re],e?"readwrite":"readonly").objectStore(Re)}function Ki(){const n=indexedDB.deleteDatabase(jn);return new _e(n).toPromise()}function Ze(){const n=indexedDB.open(jn,qi);return new Promise((e,t)=>
1305{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(Re,{keyPath:zn})}catch(s){t(s)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(Re)?e(r):(r.close(),await Ki(),e(await Ze()))})})}async function Bt(n,e,t){const r=Me(n,!0).put({[zn]:e,value:t});return new _e(r).toPromise()}async function Ji(n,e){const t=Me(n,!1).get(e),r=await new _e(t).toPromise();return r===void 0?null:r.value}function Ht(n,e){const t=Me(n,!0).delete(e);return new _e(t).toPromise()}const Yi=800,Xi=3;class Gn{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await Ze(),this.db)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>Xi)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Wn()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Le._getInstance(Gi()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var t,r;if(this.activeServiceWorker=await ji(),!this.activeServiceWorker)return;this.sender=new $i(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&(t=e[0])!=null&&t.fulfilled&&(r=e[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||zi()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Ze();return await Bt(e,Pe,"1"),await Ht(e,Pe),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(r=>Bt(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>Ji(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Ht(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=Me(s,!1).getAll();return new _e(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],r=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),t.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),t.push(s));return t}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Yi)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Ob
1305ject.keys(this.listeners).length===0&&this.stopPolling()}}Gn.type="LOCAL";const Zi=Gn;new me(3e4,6e4);/** 1306* @license 1307* Copyright 2021 Google LLC 1308* 1309* Licensed under the Apache License, Version 2.0 (the "License"); 1310* you may not use this file except in compliance with the License. 1311* You may obtain a copy of the License at 1312* 1313* http://www.apache.org/licenses/LICENSE-2.0 1314* 1315* Unless required by applicable law or agreed to in writing, software 1316* distributed under the License is distributed on an "AS IS" BASIS, 1317* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1318* See the License for the specific language governing permissions and 1319* limitations under the License. 1320*/function Qi(n,e){return e?R(e):(h(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/** 1321* @license 1322* Copyright 2019 Google LLC 1323* 1324* Licensed under the Apache License, Version 2.0 (the "License"); 1325* you may not use this file except in compliance with the License. 1326* You may obtain a copy of the License at 1327* 1328* http://www.apache.org/licenses/LICENSE-2.0 1329* 1330* Unless required by applicable law or agreed to in writing, software 1331* distributed under the License is distributed on an "AS IS" BASIS, 1332* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1333* See the License for the specific language governing permissions and 1334* limitations under the License. 1335*/class pt extends at{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Z(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Z(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Z(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function eo(n){return Fn(n.auth,new pt(n),n.bypassAuthState)}function to(n){const{auth:e,user:t}=n;return h(t,e,"internal-error"),Oi(t,new pt(n),n.bypassAuthState)}async function no(n){const{auth:e,user:t}=n;return h(t,e,"internal-error"),Ri(t,new pt(n),n.bypassAuthState)}/** 1336* @license 1337* Copyright 2020 Google LLC 1338* 1339* Licensed under the Apache License, Version 2.0 (the "License"); 1340* you may not use this file except in compliance with the License. 1341* You may obtain a copy of the License at 1342* 1343* http://www.apache.org/licenses/LICENSE-2.0 1344* 1345* Unless required by applicable law or agreed to in writing, software 1346* distributed under the License is distributed on an "AS IS" BASIS, 1347* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1348* See the License for the specific language governing permissions and 1349* limitations under the License. 1350*/class qn{constructor(e,t,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:r,postBody:s,tenantId:i,error:o,type:a}=e;if(o){this.reject(o);return}const c={auth:this.auth,requestUri:t,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return eo;case"linkViaPopup":case"linkViaRedirect":return no;case"reauthViaPopup":case"reauthViaRedirect":return to;default:E(this.auth,"internal-error")}}resolve(e){N(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){N(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/** 1351* @license 1352* Copyright 2020 Google LLC 1353* 1354* Licensed under the Apache License, Version 2.0 (the "License");
1355* you may not use this file except in compliance with the License. 1356* You may obtain a copy of the License at 1357* 1358* http://www.apache.org/licenses/LICENSE-2.0 1359* 1360* Unless required by applicable law or agreed to in writing, software 1361* distributed under the License is distributed on an "AS IS" BASIS, 1362* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1363* See the License for the specific language governing permissions and 1364* limitations under the License. 1365*/const ro=new me(2e3,1e4);class J extends qn{constructor(e,t,r,s,i){super(e,t,s,i),this.provider=r,this.authWindow=null,this.pollId=null,J.currentPopupAction&&J.currentPopupAction.cancel(),J.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return h(e,this.auth,"internal-error"),e}async onExecution(){N(this.filter.length===1,"Popup operations only handle one event");const e=ft();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(S(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)==null?void 0:e.associatedEvent)||null}cancel(){this.reject(S(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,J.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,r;if((r=(t=this.authWindow)==null?void 0:t.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(S(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,ro.get())};e()}}J.currentPopupAction=null;/** 1366* @license 1367* Copyright 2020 Google LLC 1368* 1369* Licensed under the Apache License, Version 2.0 (the "License"); 1370* you may not use this file except in compliance with the License. 1371* You may obtain a copy of the License at 1372* 1373* http://www.apache.org/licenses/LICENSE-2.0 1374* 1375* Unless required by applicable law or agreed to in writing, software 1376* distributed under the License is distributed on an "AS IS" BASIS, 1377* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1378* See the License for the specific language governing permissions and 1379* limitations under the License. 1380*/const so="pendingRedirect",Te=new Map;class io extends qn{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=Te.get(this.auth._key());if(!e){try{const r=await oo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}Te.set(this.auth._key(),e)}return this.bypassAuthState||Te.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function oo(n,e){const t=lo(e),r=co(n);if(!await r._isAvailable())return!1;const s=await r._get(t)==="true";return await r._remove(t),s}function ao(n,e){Te.set(n._key(),e)}function co(n){return R(n._redirectPersistence)}function lo(n){return Ee(so,n.config.apiKey,n.name)}async function uo(n,e,t=!1){if(y(n.app))return Promise.reject(C(n));const r=L(n),s=Qi(r,e),o=await new io(r,s,t).execute();return o&&!t&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/** 1381* @license 1382* Copyright 2020 Google LLC 1383* 1384* Licensed under the Apache License, Version 2.0 (the "License"); 1385* you may not use this file except in compliance with the License. 1386* You may obtain a copy of the License at 1387* 1388* http://www.apache.org/licenses/LICENSE-2.0 1389* 1390* Unless required by applicable law or agreed to in writing, software 1391* distributed under the License is distributed on an "AS IS" BASIS, 1392* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1393* See the License for the specific language governing permissions and 1394* limitations under the License. 1395*/const ho=600*1e3;class fo{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=
1395Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!po(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!Kn(e)){const s=((r=e.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";t.onError(S(this.auth,s))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const r=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=ho&&this.cachedEventUids.clear(),this.cachedEventUids.has(Vt(e))}saveEventToCache(e){this.cachedEventUids.add(Vt(e)),this.lastProcessedEventTime=Date.now()}}function Vt(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function Kn({type:n,error:e}){return n==="unknown"&&e?.code==="auth/no-auth-event"}function po(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Kn(n);default:return!1}}/** 1396* @license 1397* Copyright 2020 Google LLC 1398* 1399* Licensed under the Apache License, Version 2.0 (the "License"); 1400* you may not use this file except in compliance with the License. 1401* You may obtain a copy of the License at 1402* 1403* http://www.apache.org/licenses/LICENSE-2.0 1404* 1405* Unless required by applicable law or agreed to in writing, software 1406* distributed under the License is distributed on an "AS IS" BASIS, 1407* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1408* See the License for the specific language governing permissions and 1409* limitations under the License. 1410*/async function mo(n,e={}){return k(n,"GET","/v1/projects",e)}/** 1411* @license 1412* Copyright 2020 Google LLC 1413* 1414* Licensed under the Apache License, Version 2.0 (the "License"); 1415* you may not use this file except in compliance with the License. 1416* You may obtain a copy of the License at 1417* 1418* http://www.apache.org/licenses/LICENSE-2.0 1419* 1420* Unless required by applicable law or agreed to in writing, software 1421* distributed under the License is distributed on an "AS IS" BASIS, 1422* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1423* See the License for the specific language governing permissions and 1424* limitations under the License. 1425*/const go=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,_o=/^https?/;async function Io(n){if(n.config.emulator)return;const{authorizedDomains:e}=await mo(n);for(const t of e)try{if(wo(t))return}catch{}E(n,"unauthorized-domain")}function wo(n){const e=Je(),{protocol:t,hostname:r}=new URL(e);if(n.startsWith("chrome-extension://")){const o=new URL(n);return o.hostname===""&&r===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===r}if(!_o.test(t))return!1;if(go.test(n))return r===n;const s=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/** 1426* @license 1427* Copyright 2020 Google LLC. 1428* 1429* Licensed under the Apache License, Version 2.0 (the "License"); 1430* you may not use this file except in compliance with the License. 1431* You may obtain a copy of the License at 1432* 1433* http://www.apache.org/licenses/LICENSE-2.0 1434* 1435* Unless required by applicable law or agreed to in writing, software 1436* distributed under the License is distributed on an "AS IS" BASIS, 1437* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1438* See the License for the specific language governing permissions and 1439* limitations under the License. 1440*/const yo=new me(3e4,6e4);function $t(){const n=A().___jsl;if(n!=null&&n.H){for(const e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function Eo(n){return new Promise((e,t)=>
1440{var s,i,o;function r(){$t(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{$t(),t(S(n,"network-request-failed"))},timeout:yo.get()})}if((i=(s=A().gapi)==null?void 0:s.iframes)!=null&&i.Iframe)e(gapi.iframes.getContext());else if((o=A().gapi)!=null&&o.load)r();else{const a=di("iframefcb");return A()[a]=()=>{gapi.load?r():t(S(n,"network-request-failed"))},Nn(`${ui()}?onload=${a}`).catch(c=>t(c))}}).catch(e=>{throw be=null,e})}let be=null;function To(n){return be=be||Eo(n),be}/** 1441* @license 1442* Copyright 2020 Google LLC. 1443* 1444* Licensed under the Apache License, Version 2.0 (the "License"); 1445* you may not use this file except in compliance with the License. 1446* You may obtain a copy of the License at 1447* 1448* http://www.apache.org/licenses/LICENSE-2.0 1449* 1450* Unless required by applicable law or agreed to in writing, software 1451* distributed under the License is distributed on an "AS IS" BASIS, 1452* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1453* See the License for the specific language governing permissions and 1454* limitations under the License. 1455*/const bo=new me(5e3,15e3),vo="__/auth/iframe",So="emulator/auth/iframe",Co={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Ao=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function ko(n){const e=n.config;h(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?st(e,So):`https://${n.config.authDomain}/${vo}`,r={apiKey:e.apiKey,appName:n.name,v:pe},s=Ao.get(n.config.apiHost);s&&(r.eid=s);const i=n._getFrameworks();return i.length&&(r.fw=i.join(",")),`${t}?${fe(r).slice(1)}`}async function Po(n){const e=await To(n),t=A().gapi;return h(t,n,"internal-error"),e.open({where:document.body,url:ko(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Co,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const o=S(n,"network-request-failed"),a=A().setTimeout(()=>{i(o)},bo.get());function c(){A().clearTimeout(a),s(r)}r.ping(c).then(c,()=>{i(o)})}))}/** 1456* @license 1457* Copyright 2020 Google LLC. 1458* 1459* Licensed under the Apache License, Version 2.0 (the "License"); 1460* you may not use this file except in compliance with the License. 1461* You may obtain a copy of the License at 1462* 1463* http://www.apache.org/licenses/LICENSE-2.0 1464* 1465* Unless required by applicable law or agreed to in writing, software 1466* distributed under the License is distributed on an "AS IS" BASIS, 1467* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1468* See the License for the specific language governing permissions and 1469* limitations under the License. 1470*/const Ro={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Oo=500,No=600,Do="_blank",Lo="http://localhost";class Wt{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function Mo(n,e,t,r=Oo,s=No){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c={...Ro,width:r.toString(),height:s.toString(),top:i,left:o},l=_().toLowerCase();t&&(a=Sn(l)?Do:t),bn(l)&&(e=e||Lo,c.scrollbars="yes");const d=Object.entries(c).reduce((u,[m,g])=>`${u}${m}=${g},`,"");if(ti(l)&&a!=="_self")return Uo(e||"",a),new Wt(null);const f=window.open(e||"",a,d);h(f,n,"popup-blocked");try{f.focus()}catch{}return new Wt(f)}
1470function Uo(n,e){const t=document.createElement("a");t.href=n,t.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}/** 1471* @license 1472* Copyright 2021 Google LLC 1473* 1474* Licensed under the Apache License, Version 2.0 (the "License"); 1475* you may not use this file except in compliance with the License. 1476* You may obtain a copy of the License at 1477* 1478* http://www.apache.org/licenses/LICENSE-2.0 1479* 1480* Unless required by applicable law or agreed to in writing, software 1481* distributed under the License is distributed on an "AS IS" BASIS, 1482* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1483* See the License for the specific language governing permissions and 1484* limitations under the License. 1485*/const xo="__/auth/handler",Fo="emulator/auth/handler",Bo=encodeURIComponent("fac");async function jt(n,e,t,r,s,i){h(n.config.authDomain,n,"auth-domain-config-required"),h(n.config.apiKey,n,"invalid-api-key");const o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:pe,eventId:s};if(e instanceof Un){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",br(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[d,f]of Object.entries({}))o[d]=f}if(e instanceof ge){const d=e.getScopes().filter(f=>f!=="");d.length>0&&(o.scopes=d.join(","))}n.tenantId&&(o.tid=n.tenantId);const a=o;for(const d of Object.keys(a))a[d]===void 0&&delete a[d];const c=await n._getAppCheckToken(),l=c?`#${Bo}=${encodeURIComponent(c)}`:"";return`${Ho(n)}?${fe(a).slice(1)}${l}`}function Ho({config:n}){return n.emulator?st(n,Fo):`https://${n.authDomain}/${xo}`}/** 1486* @license 1487* Copyright 2020 Google LLC 1488* 1489* Licensed under the Apache License, Version 2.0 (the "License"); 1490* you may not use this file except in compliance with the License. 1491* You may obtain a copy of the License at 1492* 1493* http://www.apache.org/licenses/LICENSE-2.0 1494* 1495* Unless required by applicable law or agreed to in writing, software 1496* distributed under the License is distributed on an "AS IS" BASIS, 1497* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1498* See the License for the specific language governing permissions and 1499* limitations under the License. 1500*/const We="webStorageSupport";class Vo{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=$n,this._completeRedirectFn=uo,this._overrideRedirectResult=ao}async _openPopup(e,t,r,s){var o;N((o=this.eventManagers[e._key()])==null?void 0:o.manager,"_initialize() not called before _openPopup()");const i=await jt(e,t,r,Je(),s);return Mo(e,i,ft())}async _openRedirect(e,t,r,s){await this._originValidation(e);const i=await jt(e,t,r,Je(),s);return Wi(i),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:s,promise:i}=this.eventManagers[t];return s?Promise.resolve(s):(N(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){const t=await Po(e),r=new fo(e);return t.register("authEvent",s=>(h(s?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(We,{type:We},s=>{var o;const i=(o=s?.[0])==null?void 0:o[We];i!==void 0&&t(!!i),E(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Io(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Rn()||vn()||ot()}}const $o=Vo;var zt="@firebase/auth",Gt="1.12.0";/** 1501* @license 1502* Copyright 2020 Google LLC 1503* 1504* Licensed under the Apache License, Version 2.0 (the "License"); 1505* you may not use this file except in compliance with the License. 1506* You may obtain a copy of the License at 1507* 1508* http://www.apache.org/licenses/LICENSE-2.0 1509* 1510* Unless required by applicable law or agreed to in writing, softw
1510are 1511* distributed under the License is distributed on an "AS IS" BASIS, 1512* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1513* See the License for the specific language governing permissions and 1514* limitations under the License. 1515*/class Wo{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)==null?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(r=>{e(r?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){h(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/** 1516* @license 1517* Copyright 2020 Google LLC 1518* 1519* Licensed under the Apache License, Version 2.0 (the "License"); 1520* you may not use this file except in compliance with the License. 1521* You may obtain a copy of the License at 1522* 1523* http://www.apache.org/licenses/LICENSE-2.0 1524* 1525* Unless required by applicable law or agreed to in writing, software 1526* distributed under the License is distributed on an "AS IS" BASIS, 1527* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1528* See the License for the specific language governing permissions and 1529* limitations under the License. 1530*/function jo(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function zo(n){ee(new z("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;h(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const c={apiKey:o,authDomain:a,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:On(n)},l=new ai(r,s,i,c);return _i(l,t),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),ee(new z("auth-internal",e=>{const t=L(e.getProvider("auth").getImmediate());return(r=>new Wo(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),$(zt,Gt,jo(n)),$(zt,Gt,"esm2020")}/** 1531* @license 1532* Copyright 2021 Google LLC 1533* 1534* Licensed under the Apache License, Version 2.0 (the "License"); 1535* you may not use this file except in compliance with the License. 1536* You may obtain a copy of the License at 1537* 1538* http://www.apache.org/licenses/LICENSE-2.0 1539* 1540* Unless required by applicable law or agreed to in writing, software 1541* distributed under the License is distributed on an "AS IS" BASIS, 1542* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1543* See the License for the specific language governing permissions and 1544* limitations under the License. 1545*/const Go=300,qo=sn("authIdTokenMaxAge")||Go;let qt=null;const Ko=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>qo)return;const s=t?.token;qt!==s&&(qt=s,await fetch(n,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function Jo(n=hn()){const e=nt(n,"auth");if(e.isInitialized())return e.getImmediate();const t=gi(n,{popupRedirectResolver:$o,persistence:[Zi,Hi,$n]}),r=sn("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const o=Ko(i.toString());xi(t,o,()=>o(t.currentUser)),Ui(t,a=>o(a))}}const s=nn("auth");return s&&Ii(t,`http://${s}`),t}function Yo(){var n;return((n=document.getElementsByTagName("head"))==null?void 0:n[0])??document}ci({loadJS(n){return new Promise((e,t)=>
1545{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=s=>{const i=S("internal-error");i.customData=s,t(i)},r.type="text/javascript",r.charset="UTF-8",Yo().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),zo("Browser");const Xo=()=>{const n={apiKey:"AIzaSyCHuSgAImPa-saLAzlySEEHVpLcJu61g9w",authDomain:"authentication.ooni.com",projectId:"ooni-app",storageBucket:"ooni-app.firebasestorage.app",messagingSenderId:"201243091810",appId:"1:201243091810:web:a379b96666b985fdcf423b"};for(const e of Object.keys(n))if(typeof n[e]!="string")throw new Error(`Missing env variable '${e}'`);return n};var Zo="firebase",Qo="12.7.0";/** 1546* @license 1547* Copyright 2020 Google LLC 1548* 1549* Licensed under the Apache License, Version 2.0 (the "License"); 1550* you may not use this file except in compliance with the License. 1551* You may obtain a copy of the License at 1552* 1553* http://www.apache.org/licenses/LICENSE-2.0 1554* 1555* Unless required by applicable law or agreed to in writing, software 1556* distributed under the License is distributed on an "AS IS" BASIS, 1557* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1558* See the License for the specific language governing permissions and 1559* limitations under the License. 1560*/$(Zo,Qo,"app");/** 1561* @license 1562* Copyright 2017 Google LLC 1563* 1564* Licensed under the Apache License, Version 2.0 (the "License"); 1565* you may not use this file except in compliance with the License. 1566* You may obtain a copy of the License at 1567* 1568* http://www.apache.org/licenses/LICENSE-2.0 1569* 1570* Unless required by applicable law or agreed to in writing, software 1571* distributed under the License is distributed on an "AS IS" BASIS, 1572* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1573* See the License for the specific language governing permissions and 1574* limitations under the License. 1575*/const ea="type.googleapis.com/google.protobuf.Int64Value",ta="type.googleapis.com/google.protobuf.UInt64Value";function Jn(n,e){const t={};for(const r in n)n.hasOwnProperty(r)&&(t[r]=e(n[r]));return t}function Oe(n){if(n==null)return null;if(n instanceof Number&&(n=n.valueOf()),typeof n=="number"&&isFinite(n)||n===!0||n===!1||Object.prototype.toString.call(n)==="[object String]")return n;if(n instanceof Date)return n.toISOString();if(Array.isArray(n))return n.map(e=>Oe(e));if(typeof n=="function"||typeof n=="object")return Jn(n,e=>Oe(e));throw new Error("Data cannot be encoded in JSON: "+n)}function te(n){if(n==null)return n;if(n["@type"])switch(n["@type"]){case ea:case ta:{const e=Number(n.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+n);return e}default:throw new Error("Data cannot be decoded from JSON: "+n)}return Array.isArray(n)?n.map(e=>te(e)):typeof n=="function"||typeof n=="object"?Jn(n,e=>te(e)):n}/** 1576* @license 1577* Copyright 2020 Google LLC 1578* 1579* Licensed under the Apache License, Version 2.0 (the "License"); 1580* you may not use this file except in compliance with the License. 1581* You may obtain a copy of the License at 1582* 1583* http://www.apache.org/licenses/LICENSE-2.0 1584* 1585* Unless required by applicable law or agreed to in writing, software 1586* distributed under the License is distributed on an "AS IS" BASIS, 1587* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1588* See the License for the specific language governing permissions and 1589* limitations under the License. 1590*/const mt="functions";/** 1591* @license 1592* Copyright 2017 Google LLC 1593* 1594* Licensed under the Apache License, Version 2.0 (the "License"); 1595* you may not use this file except in compliance with the License. 1596* You may obtain a copy of the License at 1597* 1598* http://www.apache.org/licenses/LICENSE-2.0 1599* 1600* Unless required by applicable law or agreed to in writing, software 1601* distributed under the License is distributed on an "AS IS" BASIS, 1602* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1603* See the License for the specific language governing permissions and 1604* limitations under the License. 1605*/const Kt={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENT
1605ED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class w extends D{constructor(e,t,r){super(`${mt}/${e}`,t||""),this.details=r,Object.setPrototypeOf(this,w.prototype)}}function na(n){if(n>=200&&n<300)return"ok";switch(n){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function Ne(n,e){let t=na(n),r=t,s;try{const i=e&&e.error;if(i){const o=i.status;if(typeof o=="string"){if(!Kt[o])return new w("internal","internal");t=Kt[o],r=o}const a=i.message;typeof a=="string"&&(r=a),s=i.details,s!==void 0&&(s=te(s))}}catch{}return t==="ok"?null:new w(t,r,s)}/** 1606* @license 1607* Copyright 2017 Google LLC 1608* 1609* Licensed under the Apache License, Version 2.0 (the "License"); 1610* you may not use this file except in compliance with the License. 1611* You may obtain a copy of the License at 1612* 1613* http://www.apache.org/licenses/LICENSE-2.0 1614* 1615* Unless required by applicable law or agreed to in writing, software 1616* distributed under the License is distributed on an "AS IS" BASIS, 1617* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1618* See the License for the specific language governing permissions and 1619* limitations under the License. 1620*/class ra{constructor(e,t,r,s){this.app=e,this.auth=null,this.messaging=null,this.appCheck=null,this.serverAppAppCheckToken=null,y(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.auth=t.getImmediate({optional:!0}),this.messaging=r.getImmediate({optional:!0}),this.auth||t.get().then(i=>this.auth=i,()=>{}),this.messaging||r.get().then(i=>this.messaging=i,()=>{}),this.appCheck||s==null||s.get().then(i=>this.appCheck=i,()=>{})}async getAuthToken(){if(this.auth)try{const e=await this.auth.getToken();return e?.accessToken}catch{return}}async getMessagingToken(){if(!(!this.messaging||!("Notification"in self)||Notification.permission!=="granted"))try{return await this.messaging.getToken()}catch{return}}async getAppCheckToken(e){if(this.serverAppAppCheckToken)return this.serverAppAppCheckToken;if(this.appCheck){const t=e?await this.appCheck.getLimitedUseToken():await this.appCheck.getToken();return t.error?null:t.token}return null}async getContext(e){const t=await this.getAuthToken(),r=await this.getMessagingToken(),s=await this.getAppCheckToken(e);return{authToken:t,messagingToken:r,appCheckToken:s}}}/** 1621* @license 1622* Copyright 2017 Google LLC 1623* 1624* Licensed under the Apache License, Version 2.0 (the "License"); 1625* you may not use this file except in compliance with the License. 1626* You may obtain a copy of the License at 1627* 1628* http://www.apache.org/licenses/LICENSE-2.0 1629* 1630* Unless required by applicable law or agreed to in writing, software 1631* distributed under the License is distributed on an "AS IS" BASIS, 1632* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1633* See the License for the specific language governing permissions and 1634* limitations under the License. 1635*/const Qe="us-central1",sa=/^data: (.*?)(?:\n|$)/;function ia(n){let e=null;return{promise:new Promise((t,r)=>{e=setTimeout(()=>{r(new w("deadline-exceeded","deadline-exceeded"))},n)}),cancel:()=>{e&&clearTimeout(e)}}}class oa{constructor(e,t,r,s,i=Qe,o=(...a)=>fetch(...a)){this.app=e,this.fetchImpl=o,this.emulatorOrigin=null,this.contextProvider=new ra(e,t,r,s),this.cancelAllRequests=new Promise(a=>{this.deleteService=()=>Promise.resolve(a())});try{const a=new URL(i);this.customDomain=a.origin+(a.pathname==="/"?"":a.pathname),this.region=Qe}catch{this.customDomain=null,this.region=i}}_delete(){return this.deleteService()}_url(e){const t=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${t}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${t}.cloudfunctions.net/${e}`}}function aa(n,e,t){const r=ne(e);n.emulatorOrigin=`http${r?"s":""}://${e}:${t}`,r&&(on(n.emulatorOrigin+"/backends"),an("Functions",!0))}function ca(n,e,t){const r=s=>
1635ua(n,e,s,{});return r.stream=(s,i)=>ha(n,e,s,i),r}function Yn(n){return n.emulatorOrigin&&ne(n.emulatorOrigin)?"include":void 0}async function la(n,e,t,r,s){t["Content-Type"]="application/json";let i;try{i=await r(n,{method:"POST",body:JSON.stringify(e),headers:t,credentials:Yn(s)})}catch{return{status:0,json:null}}let o=null;try{o=await i.json()}catch{}return{status:i.status,json:o}}async function Xn(n,e){const t={},r=await n.contextProvider.getContext(e.limitedUseAppCheckTokens);return r.authToken&&(t.Authorization="Bearer "+r.authToken),r.messagingToken&&(t["Firebase-Instance-ID-Token"]=r.messagingToken),r.appCheckToken!==null&&(t["X-Firebase-AppCheck"]=r.appCheckToken),t}function ua(n,e,t,r){const s=n._url(e);return da(n,s,t,r)}async function da(n,e,t,r){t=Oe(t);const s={data:t},i=await Xn(n,r),o=r.timeout||7e4,a=ia(o),c=await Promise.race([la(e,s,i,n.fetchImpl,n),a.promise,n.cancelAllRequests]);if(a.cancel(),!c)throw new w("cancelled","Firebase Functions instance was deleted.");const l=Ne(c.status,c.json);if(l)throw l;if(!c.json)throw new w("internal","Response is not valid JSON object.");let d=c.json.data;if(typeof d>"u"&&(d=c.json.result),typeof d>"u")throw new w("internal","Response is missing data field.");return{data:te(d)}}function ha(n,e,t,r){const s=n._url(e);return fa(n,s,t,r||{})}async function fa(n,e,t,r){var u;t=Oe(t);const s={data:t},i=await Xn(n,r);i["Content-Type"]="application/json",i.Accept="text/event-stream";let o;try{o=await n.fetchImpl(e,{method:"POST",body:JSON.stringify(s),headers:i,signal:r?.signal,credentials:Yn(n)})}catch(m){if(m instanceof Error&&m.name==="AbortError"){const v=new w("cancelled","Request was cancelled.");return{data:Promise.reject(v),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(v)}}}}}}const g=Ne(0,null);return{data:Promise.reject(g),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(g)}}}}}}let a,c;const l=new Promise((m,g)=>{a=m,c=g});(u=r?.signal)==null||u.addEventListener("abort",()=>{const m=new w("cancelled","Request was cancelled.");c(m)});const d=o.body.getReader(),f=pa(d,a,c,r?.signal);return{stream:{[Symbol.asyncIterator](){const m=f.getReader();return{async next(){const{value:g,done:v}=await m.read();return{value:g,done:v}},async return(){return await m.cancel(),{done:!0,value:void 0}}}}},data:l}}function pa(n,e,t,r){const s=(o,a)=>{const c=o.match(sa);if(!c)return;const l=c[1];try{const d=JSON.parse(l);if("result"in d){e(te(d.result));return}if("message"in d){a.enqueue(te(d.message));return}if("error"in d){const f=Ne(0,d);a.error(f),t(f);return}}catch(d){if(d instanceof w){a.error(d),t(d);return}}},i=new TextDecoder;return new ReadableStream({start(o){let a="";return c();async function c(){if(r!=null&&r.aborted){const l=new w("cancelled","Request was cancelled");return o.error(l),t(l),Promise.resolve()}try{const{value:l,done:d}=await n.read();if(d){a.trim()&&s(a.trim(),o),o.close();return}if(r!=null&&r.aborted){const u=new w("cancelled","Request was cancelled");o.error(u),t(u),await n.cancel();return}a+=i.decode(l,{stream:!0});const f=a.split(` 1636`);a=f.pop()||"";for(const u of f)u.trim()&&s(u.trim(),o);return c()}catch(l){const d=l instanceof w?l:Ne(0,null);o.error(d),t(d)}}},cancel(){return n.cancel()}})}const Jt="@firebase/functions",Yt="0.13.1";/** 1637* @license 1638* Copyright 2019 Google LLC 1639* 1640* Licensed under the Apache License, Version 2.0 (the "License"); 1641* you may not use this file except in compliance with the License. 1642* You may obtain a copy of the License at 1643* 1644* http://www.apache.org/licenses/LICENSE-2.0 1645* 1646* Unless required by applicable law or agreed to in writing, software 1647* distributed under the License is distributed on an "AS IS" BASIS, 1648* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1649* See the License for the specific language governing permissions and 1650* limitations under the License. 1651*/const ma="auth-internal",ga="app-check-internal",_a="messaging-internal";function Ia(n){const e=(t,{instanceIdentifier:r})=>{const s=t.getProvider("app").getImmediate(),i=t.getProvider(ma),o=t.getProvider(_a),a=t.getProvider(ga);return new oa(s,i,o,a,r)};ee(new z(mt,e,"PUBLIC").setMultipleInstances(!0)),$(Jt,Yt,n),$(Jt,Yt,"esm2020")}/** 1652* @license 1653* Copyright 2020 Google LLC 1654* 1655* Licensed under the Apache License, Version 2.0 (the "License");
1656* you may not use this file except in compliance with the License. 1657* You may obtain a copy of the License at 1658* 1659* http://www.apache.org/licenses/LICENSE-2.0 1660* 1661* Unless required by applicable law or agreed to in writing, software 1662* distributed under the License is distributed on an "AS IS" BASIS, 1663* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1664* See the License for the specific language governing permissions and 1665* limitations under the License. 1666*/function wa(n=hn(),e=Qe){const r=nt(I(n),mt).getImmediate({identifier:e}),s=lr("functions");return s&&ya(r,...s),r}function ya(n,e,t){aa(I(n),e,t)}function gt(n,e,t){return ca(I(n),e)}Ia();const Ea=n=>typeof n=="object"&&n!==null&&"url"in n&&typeof n.url=="string",Ta=async n=>{const t=await gt(_t,"generateShopifyMultipass")({locale:window.Shopify.locale.toLowerCase(),storePermanentDomain:window.themeVars.store.permanent_domain,market:window.themeVars.locale.market.handle,return_to:n?.returnTo??window.themeVars.routes.account_url});if(!Ea(t.data))throw new Error(`Result data is invalid: ${JSON.stringify(t.data)}`);return t.data.url},Xt=async(n,e)=>{const t=new URLSearchParams(window.location.search),r=e?.checkoutUrl??t.get("checkout_url"),s=e?.returnUrl??t.get("return_url"),i=r??s??void 0;n.emailVerified?Ta({returnTo:i}).then(o=>{sessionStorage.removeItem("oauth_state"),window.location.replace(o)}):window.location.href=window.themeVars.routes.login_url},ba=async n=>gt(_t,"sendWelcomeEmail")({locale:window.Shopify.locale.toLowerCase(),storePermanentDomain:window.themeVars.store.permanent_domain,market:window.themeVars.locale.market.handle,email:n}),va=n=>n!==null&&typeof n=="object"&&"customToken"in n&&typeof n.customToken=="string",Sa=async({provider:n,code:e})=>{const r=await gt(_t,"exchangeGoogleToken")({locale:window.Shopify.locale.toLowerCase(),storePermanentDomain:window.themeVars.store.permanent_domain,market:window.themeVars.locale.market.handle,provider:n,code:e,redirectUri:`${window.location.origin}${window.themeVars.routes.login_url}`});if(!va(r.data))throw new Error("Invalid response from exchangeGoogleToken function");return r.data.customToken},Ca=Xo(),Zn=dn(Ca),Qn=Jo(Zn);Qn.languageCode=window.Shopify.locale.toLowerCase();const _t=wa(Zn),Aa=async()=>{if(!sessionStorage.getItem("social-sign-in"))return;const n=new URLSearchParams(window.location.search),e=n.get("code"),t=n.get("state"),r=t?JSON.parse(atob(t))??void 0:void 0,s=sessionStorage.getItem("oauth_state"),i=n.get("token");let o=null;if(e&&r&&r.csrf===s&&(o=await Sa({provider:"google",code:e})),i&&(o=i),!!o)try{const a=await Li(Qn,o),c="isWelcomeEmailSent";if(a.user.metadata.creationTime&&!sessionStorage.getItem(c)){const l=new Date(a.user.metadata.creationTime).getTime(),d=Date.now();if(Math.floor((d-l)/1e3)<20)try{await ba(),sessionStorage.setItem(c,"1")}catch{console.error("Failed to send welcome email")}}if(r&&r.csrf===s){const l=new URL(r.redirectUrl).searchParams;Xt(a.user,{checkoutUrl:l.get("checkout_url")??void 0,returnUrl:l.get("return_url")??void 0})}else Xt(a.user)}catch(a){console.error("getRedirectResult error: ",a),sessionStorage.removeItem("oauth_state");const c=document.querySelector("#form-hint");c&&(c.classList.add("error"),c.classList.remove("is-hidden"),c.innerText=window.themeVars.strings.form.errorMessages.somethingWentWrong)}};Aa();const ka=window.themeVars.routes.register_url,Pa=window.themeVars.routes.login_url,Ra=window.themeVars.routes.account_url,Oa=window.themeVars.customer.isLoggedIn;Oa&&[ka,Pa].includes(window.location.pathname)&&(window.location.href=Ra);export{D as F,Qn as a,Da as b,Mi as c,Ua as d,Ma as e,gt as f,Ta as g,Xt as h,_t as i,Na as j,xa as o,ba as s,La as v}; 1667//# sourceMappingURL=/cdn/shop/t/621/assets/__vite-init.BJQWp-PH.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.