1import{r as v,A as Be,b as mt,j as u,ax as ir,av as sr,P as y,D as or,l as ar,Q as cr,ay as lr,y as dn,m as dr,h as ur,t as un,u as hr,Z as fr,az as pr,x as Le,q as Lt,f as mr,o as gr,au as _r}from"./index-DOEDGpFv.js";import{u as vr}from"./user.service-vzbCZA7Y.js";import{F as yr,f as Ir,g as br,E as wr,c as Er,b as Tr}from"./index.esm-DaRz_fRj.js";function Sr({open:n,onClose:e,back:t}){const{setUser:r,signup:i,setAccessToken:s,startSilentRefresh:o}=v.useContext(Be),c=v.useRef(),a=v.useRef(),l=v.useRef(),h=v.useRef(),[m,d]=v.useState(null),[_,I]=v.useState(null),[S,b]=v.useState(null),[O,C]=v.useState(null),[R,w]=v.useState(n);v.useEffect(()=>{w(n)},[n]);const P=()=>{w(!1),e(!0)},ne=mt(),oe=k=>{let q={user_id:i.user_id,otp:m+_+S+O};vr.verifyGmailOTP(q).then(F=>{var _e;r(F.data.user),s((_e=F==null?void 0:F.data)==null?void 0:_e.token),o(),P(),ne("/app/dashboard")})};return u.jsxs("div",{className:"form__container",children:[u.jsx("div",{className:R?"overlay block":"hidden"}),u.jsxs("div",{className:R?"singup__screen signup_open":"singup__screen",children:[u.jsxs("div",{className:"signup__header flex justify-between items-center",children:[u.jsxs("h4",{className:"font-semibold text-gray-700 signup__title",children:[u.jsx(ir,{onClick:t,style:{marginRight:"10px",display:"inline"}}),"Email Verification"]}),u.jsx(sr,{className:"close_icon",onClick:P})]}),u.jsxs("div",{className:"email_container",children:[u.jsx("p",{className:"mt-5",children:"We just sent an OTP to your email address. Please enter it below to verify your email."}),u.jsx("h5",{className:"mt-5 font-semibold",children:"Enter OTP sent to your email"})]}),u.jsxs("div",{className:"flex otp_input",children:[u.jsx("div",{className:"input_container",children:u.jsx("input",{className:"casting_input",ref:c,name:"otp",onChange:k=>{d(k.target.value),a.current&&a.current.focus()}})}),u.jsx("div",{className:"input_container",children:u.jsx("input",{className:"casting_input",ref:a,name:"otp",onChange:k=>{I(k.target.value),l.current&&l.current.focus()}})}),u.jsx("div",{className:"input_container",children:u.jsx("input",{className:"casting_input",ref:l,name:"otp",onChange:k=>{b(k.target.value),h.current&&h.current.focus()}})}),u.jsx("div",{className:"input_container",children:u.jsx("input",{className:"casting_input",ref:h,name:"otp",onChange:k=>{C(k.target.value)}})})]}),u.jsx("button",{type:"submit",className:"casting_btn primary-bg font-medium ",onClick:k=>{k.preventDefault(),oe()},children:"verify"})]})]})}Sr.propTypes={open:y.bool.isRequired,onClose:y.func.isRequired,back:y.func.isRequired};const Cr=()=>{};var Mt={};/** 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 hn=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let i=n.charCodeAt(r);i<128?e[t++]=i:i<2048?(e[t++]=i>>6|192,e[t++]=i&63|128):(i&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=i>>18|240,e[t++]=i>>12&63|128,e[t++]=i>>6&63|128,e[t++]=i&63|128):(e[t++]=i>>12|224,e[t++]=i>>6&63|128,e[t++]=i&63|128)}return e},kr=function(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=n[t++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=n[t++],o=n[t++],c=n[t++],a=((i&7)<<18|(s&63)<<12|(o&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(a>>10)),e[r++]=String.fromCharCode(56320+(a&1023))}else{const s=n[t++],o=n[t++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},fn={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 i=0;i<n.length;i+=3){const s=n[i],o=i+1<n.length,c=o?n[i+1]:0,a=i+2<n.length,l=a?n[i+2]:0,h=s>>2,m=(s&3)<<4|c>>4;let d=(c&15)<<2|l>>6,_=l&63;a||(_=64,o||(d=64)),r.push(t[h],t[m],t[d],t[_])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(hn(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):kr(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<n.length;){const s=t[n.charAt(i++)],c=i<n.length?t[n.charAt(i)]:0;++i;const l=i<n.length?t[n.charAt(i)]:64;++i;const m=i<n.length?t[n.charAt(i)]:64;if(++i,s==null||c==null||l==null||m==null)throw new Ar;const d=s<<2|c>>4;if(r.push(d),l!==64){const _=c<<4&240|l>>2;if(r.push(_),m!==64){const I=l<<6&192|m;r.push(I)}}}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)}}};
16class Ar extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Rr=function(n){const e=hn(n);return fn.encodeByteArray(e,!0)},pn=function(n){return Rr(n).replace(/\./g,"")},mn=function(n){try{return fn.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 Pr(){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=()=>Pr().__FIREBASE_DEFAULTS__,Nr=()=>{if(typeof process>"u"||typeof Mt>"u")return;const n=Mt.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Dr=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&mn(n[1]);return e&&JSON.parse(e)},gt=()=>{try{return Cr()||Or()||Nr()||Dr()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Lr=n=>{var e,t;return(t=(e=gt())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},gn=()=>{var n;return(n=gt())===null||n===void 0?void 0:n.config},_n=n=>{var e;return(e=gt())===null||e===void 0?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 Mr{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 Ke(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}async function xr(n){return(await fetch(n,{credentials:"include"})).ok}const Ee={};function Ur(){const n={prod:[],emulator:[]};for(const e of Object.keys(Ee))Ee[e]?n.emulator.push(e):n.prod.push(e);return n}function Fr(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 xt=!1;function jr(n,e){if(typeof window>"u"||typeof document>"u"||!Ke(window.location.host)||Ee[n]===e||Ee[n]||xt)return;Ee[n]=e;function t(d){return`__firebase__banner__${d}`}const r="__firebase__banner",s=Ur().prod.length>0;function o(){const d=document.getElementById(r);d&&d.remove()}function c(d){d.style.display="flex",d.style.background="#7faaf0",d.style.position="fixed",d.style.bottom="5px",d.style.left="5px",d.style.padding=".5em",d.style.borderRadius="5px",d.style.alignItems="center"}function a(d,_){d.setAttribute("width","24"),d.setAttribute("id",_),d.setAttribute("height","24"),d.setAttribute("viewBox","0 0 24 24"),d.setAttribute("fill","none"),d.style.marginLeft="-6px"}function l(){const d=document.createElement("span");
76return d.style.cursor="pointer",d.style.marginLeft="16px",d.style.fontSize="24px",d.innerHTML=" ×",d.onclick=()=>{xt=!0,o()},d}function h(d,_){d.setAttribute("id",_),d.innerText="Learn more",d.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",d.setAttribute("target","__blank"),d.style.paddingLeft="5px",d.style.textDecoration="underline"}function m(){const d=Fr(r),_=t("text"),I=document.getElementById(_)||document.createElement("span"),S=t("learnmore"),b=document.getElementById(S)||document.createElement("a"),O=t("preprendIcon"),C=document.getElementById(O)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(d.created){const R=d.element;c(R),h(b,S);const w=l();a(C,O),R.append(C,I,b,w),document.body.appendChild(R)}s?(I.innerText="Preview backend disconnected.",C.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>`):(C.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>`,I.innerText="Preview backend running in this workspace."),I.setAttribute("id",_)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",m):m()}/** 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 T(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Br(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(T())}function $r(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Hr(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function Vr(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Wr(){const n=T();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function zr(){try{return typeof indexedDB=="object"}catch{return!1}}function qr(){return new Promise((n,e)=>{try{let t=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},i.onupgradeneeded=()=>{t=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.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 Gr="FirebaseError";class te extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=Gr,Object.setPrototypeOf(this,te.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Re.prototype.create)}}class Re{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?Kr(s,r):"Error",c=`${this.serviceName}: ${o} (${i}).`;return new te(i,c,r)}}function Kr(n,e){return n.replace(Jr,(t,r)=>{const i=e[r];return i!=null?String(i):`<${r}?>`})}const Jr=/\{\$([^}]+)}/g;function Yr(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function ue(n,e){if(n===e)return!0;const t=Object.keys(n),r=Object.keys(e);for(const i of t){if(!r.includes(i))return!1;const s=n[i],o=e[i];if(Ut(s)&&Ut(o)){if(!ue(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!t.includes(i))return!1;return!0}function Ut(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 Pe(n){const e=[];for(const[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Xr(n,e){const t=new Zr(n,e);return t.subscribe.bind(t)}class Zr{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 i;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");Qr(e,["next","error","complete"])?i=e:i={next:e,error:t,complete:r},i.next===void 0&&(i.next=et),i.error===void 0&&(i.error=et),i.complete===void 0&&(i.complete=et);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let 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 Qr(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 et(){}/** 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 pe(n){return n&&n._delegate?n._delegate:n}class he{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 re="[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 ei{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 Mr;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:t});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const r=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),i=(t=e==null?void 0:e.optional)!==null&&t!==void 0?t:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(s){if(i)return null;throw s}else{if(i)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(ni(e))try{this.getOrInitializeService({instanceIdentifier:re})}catch{}for(const[t,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(t);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=re){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=re){return this.instances.has(e)}getOptions(e=re){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 i=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[s,o]of this.instancesDeferred.entries()){const c=this.normalizeInstanceIdentifier(s);r===c&&o.resolve(i)}return i}onInit(e,t){var r;const i=this.normalizeInstanceIdentifier(t),s=(r=this.onInitCallbacks.get(i))!==null&&r!==void 0?r:new Set;s.add(e),this.onInitCallbacks.set(i,s);const o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const i of r)try{i(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:ti(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=re){return this.component?this.component.multipleInstances?e:re:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function ti(n){return n===re?void 0:n}function ni(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 ri{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 ei(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 g;(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(g||(g={}));const ii={debug:g.DEBUG,verbose:g.VERBOSE,info:g.INFO,warn:g.WARN,error:g.ERROR,silent:g.SILENT},si=g.INFO,oi={[g.DEBUG]:"log",[g.VERBOSE]:"log",[g.INFO]:"info",[g.WARN]:"warn",[g.ERROR]:"error"},ai=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),i=oi[e];if(i)console[i](`[${r}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class vn{constructor(e){this.name=e,this._logLevel=si,this._logHandler=ai,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in g))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?ii[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,g.DEBUG,...e),this._logHandler(this,g.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,g.VERBOSE,...e),this._logHandler(this,g.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,g.INFO,...e),this._logHandler(this,g.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,g.WARN,...e),this._logHandler(this,g.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,g.ERROR,...e),this._logHandler(this,g.ERROR,...e)}}const ci=(n,e)=>e.some(t=>n instanceof t);let Ft,jt;function li(){return Ft||(Ft=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function di(){return jt||(jt=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const yn=new WeakMap,at=new WeakMap,In=new WeakMap,tt=new WeakMap,_t=new WeakMap;function ui(n){const e=new Promise((t,r)=>{const i=()=>{n.removeEventListener("success",s),n.removeEventListener("error",o)},s=()=>{t(Q(n.result)),i()},o=()=>{r(n.error),i()};n.addEventListener("success",s),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&yn.set(t,n)}).catch(()=>{}),_t.set(e,n),e}function hi(n){if(at.has(n))return;const e=new Promise((t,r)=>{const i=()=>{n.removeEventListener("complete",s),n.removeEventListener("error",o),n.removeEventListener("abort",o)},s=()=>{t(),i()},o=()=>{r(n.error||new DOMException("AbortError","AbortError")),i()};n.addEventListener("complete",s),n.addEventListener("error",o),n.addEventListener("abort",o)});at.set(n,e)}let ct={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return at.get(n);if(e==="objectStoreNames")return n.objectStoreNames||In.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return Q(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 fi(n){ct=n(ct)}
210function pi(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=n.call(nt(this),e,...t);return In.set(r,e.sort?e.sort():[e]),Q(r)}:di().includes(n)?function(...e){return n.apply(nt(this),e),Q(yn.get(this))}:function(...e){return Q(n.apply(nt(this),e))}}function mi(n){return typeof n=="function"?pi(n):(n instanceof IDBTransaction&&hi(n),ci(n,li())?new Proxy(n,ct):n)}function Q(n){if(n instanceof IDBRequest)return ui(n);if(tt.has(n))return tt.get(n);const e=mi(n);return e!==n&&(tt.set(n,e),_t.set(e,n)),e}const nt=n=>_t.get(n);function gi(n,e,{blocked:t,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(n,e),c=Q(o);return r&&o.addEventListener("upgradeneeded",a=>{r(Q(o.result),a.oldVersion,a.newVersion,Q(o.transaction),a)}),t&&o.addEventListener("blocked",a=>t(a.oldVersion,a.newVersion,a)),c.then(a=>{s&&a.addEventListener("close",()=>s()),i&&a.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),c}const _i=["get","getKey","getAll","getAllKeys","count"],vi=["put","add","delete","clear"],rt=new Map;function Bt(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(rt.get(e))return rt.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,i=vi.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(i||_i.includes(t)))return;const s=async function(o,...c){const a=this.transaction(o,i?"readwrite":"readonly");let l=a.store;return r&&(l=l.index(c.shift())),(await Promise.all([l[t](...c),i&&a.done]))[0]};return rt.set(e,s),s}fi(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 yi{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Ii(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function Ii(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const lt="@firebase/app",$t="0.13.2";/** 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 V=new vn("@firebase/app"),bi="@firebase/app-compat",wi="@firebase/analytics-compat",Ei="@firebase/analytics",Ti="@firebase/app-check-compat",Si="@firebase/app-check",Ci="@firebase/auth",ki="@firebase/auth-compat",Ai="@firebase/database",Ri="@firebase/data-connect",Pi="@firebase/database-compat",Oi="@firebase/functions",Ni="@firebase/functions-compat",Di="@firebase/installations",Li="@firebase/installations-compat",Mi="@firebase/messaging",xi="@firebase/messaging-compat",Ui="@firebase/performance",Fi="@firebase/performance-compat",ji="@firebase/remote-config",Bi="@firebase/remote-config-compat",$i="@firebase/storage",Hi="@firebase/storage-compat",Vi="@firebase/firestore",Wi="@firebase/ai",zi="@firebase/firestore-compat",qi="firebase",Gi="11.10.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, software 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 dt="[DEFAULT]",Ki={[lt]:"fire-core",[bi]:"fire-core-compat",[Ei]:"fire-analytics",[wi]:"fire-analytics-compat",[Si]:"fire-app-check",[Ti]:"fire-app-check-compat",[Ci]:"fire-auth",[ki]:"fire-auth-compat",[Ai]:"fire-rtdb",[Ri]:"fire-data-connect",[Pi]:"fire-rtdb-compat",[Oi]:"fire-fn",[Ni]:"fire-fn-compat",[Di]:"fire-iid",[Li]:"fire-iid-compat",[Mi]:"fire-fcm",[xi]:"fire-fcm-compat",[Ui]:"fire-perf",[Fi]:"fire-perf-compat",[ji]:"fire-rc",[Bi]:"fire-rc-compat",[$i]:"fire-gcs",[Hi]:"fire-gcs-compat",[Vi]:"fire-fst",[zi]:"fire-fst-compat",[Wi]:"fire-vertex","fire-js":"fire-js",[qi]:"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 $e=new Map,Ji=new Map,ut=new Map;function Ht(n,e){try{n.container.addComponent(e)}catch(t){V.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function Ce(n){const e=n.name;if(ut.has(e))return V.debug(`There were multiple attempts to register component ${e}.`),!1;ut.set(e,n);for(const t of $e.values())Ht(t,n);for(const t of Ji.values())Ht(t,n);return!0}function bn(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function M(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 Yi={"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."},ee=new Re("app","Firebase",Yi);/** 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 Xi{constructor(e,t,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new he("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 ee.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 Oe=Gi;function wn(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r=Object.assign({name:dt,automaticDataCollectionEnabled:!0},e),i=r.name;if(typeof i!="string"||!i)throw ee.create("bad-app-name",{appName:String(i)});if(t||(t=gn()),!t)throw ee.create("no-options");const s=$e.get(i);if(s){if(ue(t,s.options)&&ue(r,s.config))return s;throw ee.create("duplicate-app",{appName:i})}const o=new ri(i);for(const a of ut.values())o.addComponent(a);const c=new Xi(t,r,o);return $e.set(i,c),c}function Zi(n=dt){const e=$e.get(n);if(!e&&n===dt&&gn())return wn();if(!e)throw ee.create("no-app",{appName:n});return e}function ae(n,e,t){var r;let i=(r=Ki[n])!==null&&r!==void 0?r:n;t&&(i+=`-${t}`);const s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const c=[`Unable to register library "${i}" with version "${e}":`];s&&c.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&c.push("and"),o&&c.push(`version name "${e}" contains illegal characters (whitespace or "/")`),V.warn(c.join(" "));return}Ce(new he(`${i}-version`,()=>({library:i,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, softw
325are 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 Qi="firebase-heartbeat-database",es=1,ke="firebase-heartbeat-store";let it=null;function En(){return it||(it=gi(Qi,es,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(ke)}catch(t){console.warn(t)}}}}).catch(n=>{throw ee.create("idb-open",{originalErrorMessage:n.message})})),it}async function ts(n){try{const t=(await En()).transaction(ke),r=await t.objectStore(ke).get(Tn(n));return await t.done,r}catch(e){if(e instanceof te)V.warn(e.message);else{const t=ee.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});V.warn(t.message)}}}async function Vt(n,e){try{const r=(await En()).transaction(ke,"readwrite");await r.objectStore(ke).put(e,Tn(n)),await r.done}catch(t){if(t instanceof te)V.warn(t.message);else{const r=ee.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});V.warn(r.message)}}}function Tn(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 ns=1024,rs=30;class is{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new os(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,t;try{const i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Wt();if(((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s))return;if(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats.length>rs){const o=as(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){V.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const t=Wt(),{heartbeatsToSend:r,unsentEntries:i}=ss(this._heartbeatsCache.heartbeats),s=pn(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(t){return V.warn(t),""}}}function Wt(){return new Date().toISOString().substring(0,10)}function ss(n,e=ns){const t=[];let r=n.slice();for(const i of n){const s=t.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),zt(t)>e){s.dates.pop();break}}else if(t.push({agent:i.agent,dates:[i.date]}),zt(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class os{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return zr()?qr().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await ts(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const i=await this.read();return Vt(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var t;if(await this._canUseIndexedDBPromise){const i=await this.read();return Vt(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}}function zt(n){return pn(JSON.stringify({version:2,heartbeats:n})).length}function as(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 cs(n){Ce(new he("platform-logger",e=>new yi(e),"PRIVATE")),Ce(new he("heartbeat",e=>new is(e),"PRIVATE")),ae(lt,$t,n),ae(lt,$t,"esm2017"),ae("fire-js","")}cs("");var ls="firebase",ds="11.10.0";/** 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 */ae(ls,ds,"app");function vt(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t}function Sn(){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 us=Sn,Cn=new Re("auth","Firebase",Sn());/** 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 */const He=new vn("@firebase/auth");function hs(n,...e){He.logLevel<=g.WARN&&He.warn(`Auth (${Oe}): ${n}`,...e)}function xe(n,...e){He.logLevel<=g.ERROR&&He.error(`Auth (${Oe}): ${n}`,...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 U(n,...e){throw It(n,...e)}function D(n,...e){return It(n,...e)}function yt(n,e,t){const r=Object.assign(Object.assign({},us()),{[e]:t});return new Re("auth","Firebase",r).create(e,{appName:n.name})}function se(n){return yt(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function fs(n,e,t){const r=t;if(!(e instanceof r))throw r.name!==e.constructor.name&&U(n,"argument-error"),yt(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function It(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 Cn.create(n,...e)}function p(n,e,...t){if(!n)throw It(e,...t)}function $(n){const e="INTERNAL ASSERTION FAILED: "+n;throw xe(e),new Error(e)}function W(n,e){n||$(e)}/** 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 ht(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function ps(){return qt()==="http:"||qt()==="https:"}function qt(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||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 */function ms(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(ps()||Hr()||"connection"in navigator)?navigator.onLine:!0}function gs(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/** 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 */class Ne{constructor(e,t){this.shortDelay=e,this.longDelay=t,W(t>e,"Short delay should be less than long delay!"),this.isMobile=Br()||Vr()}get(){return ms()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/** 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 */function bt(n,e){W(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/** 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 */class kn{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;$("Could not find fetch implementation, make sure you call FetchProvi
480der.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;$("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;$("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/** 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 _s={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/** 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 */const vs=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],ys=new Ne(3e4,6e4);function wt(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function me(n,e,t,r,i={}){return An(n,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});const c=Pe(Object.assign({key:n.config.apiKey},o)).slice(1),a=await n._getAdditionalHeaders();a["Content-Type"]="application/json",n.languageCode&&(a["X-Firebase-Locale"]=n.languageCode);const l=Object.assign({method:e,headers:a},s);return $r()||(l.referrerPolicy="no-referrer"),n.emulatorConfig&&Ke(n.emulatorConfig.host)&&(l.credentials="include"),kn.fetch()(await Rn(n,n.config.apiHost,t,c),l)})}async function An(n,e,t){n._canInitEmulator=!1;const r=Object.assign(Object.assign({},_s),e);try{const i=new bs(n),s=await Promise.race([t(),i.promise]);i.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw Me(n,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const c=s.ok?o.errorMessage:o.error.message,[a,l]=c.split(" : ");if(a==="FEDERATED_USER_ID_ALREADY_LINKED")throw Me(n,"credential-already-in-use",o);if(a==="EMAIL_EXISTS")throw Me(n,"email-already-in-use",o);if(a==="USER_DISABLED")throw Me(n,"user-disabled",o);const h=r[a]||a.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw yt(n,h,l);U(n,h)}}catch(i){if(i instanceof te)throw i;U(n,"network-request-failed",{message:String(i)})}}async function Is(n,e,t,r,i={}){const s=await me(n,e,t,r,i);return"mfaPendingCredential"in s&&U(n,"multi-factor-auth-required",{_serverResponse:s}),s}async function Rn(n,e,t,r){const i=`${e}${t}?${r}`,s=n,o=s.config.emulator?bt(n.config,i):`${n.config.apiScheme}://${i}`;return vs.includes(t)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}class bs{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(D(this.auth,"network-request-failed")),ys.get())})}}function Me(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const i=D(n,e,r);return i.customData._tokenResponse=t,i}/** 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 */async function ws(n,e){return me(n,"POST","/v1/accounts:delete",e)}async function Ve(n,e){return me(n,"POST","/v1/accounts:lookup",e)}/** 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 */function Te(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Es(n,e=!1){const t=pe(n),r=await t.getIdToken(e),i=Et(r);p(i&&i.exp&&i.auth_time&&i.iat,t.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,o=s==null?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:Te(st(i.auth_time)),issuedAtTime:Te(st(i.iat)),expirationTime:Te(st(i.exp)),signInProvider:o||null,signInSecondFactor:(s==null?void 0:s.sign_in_second_factor)||null}}function st(n){return Number(n)*1e3}function Et(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return xe("JWT malformed, contained fewer than 3 sections"),null;try{const i=mn(t);return i?JSON.parse(i):(xe("Failed to decode base64 JWT payload"),null)}catch(i){return xe("Caught error parsing JWT payload as JSON",i==null?void 0:i.toString()),null}}function Gt(n){const e=Et(n);return p(e,"internal-error"),p(typeof e.exp<"u","internal-error"),p(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/** 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 */async function Ae(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof te&&Ts(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function Ts({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/** 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 Ss{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){var t;if(e){const r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;const i=((t=this.user.stsTokenManager.expirationTime)!==null&&t!==void 0?t:0)-Date.now()-3e5;return Math.max(0,i)}}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==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/** 571 * @license 572 * Copyright 2020 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 */class ft{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Te(this.lastLoginAt),this.creationTime=Te(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/** 586 * @license 587 * Copyright 2019 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 We(n){var e;const t=n.auth,r=await n.getIdToken(),i=await Ae(n,Ve(t,{idToken:r}));p(i==null?void 0:i.users.length,t,"internal-error");const s=i.users[0];n._notifyReloadListener(s);const o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?Pn(s.providerUserInfo):[],c=ks(n.providerData,o),a=n.isAnonymous,l=!(n.email&&s.passwordHash)&&!(c!=null&&c.length),h=a?l:!1,m={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:c,metadata:new ft(s.createdAt,s.lastLoginAt),isAnonymous:h};Object.assign(n,m)}async function Cs(n){const e=pe(n);await We(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function ks(n,e){return[...n.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function Pn(n){return n.map(e=>{var{providerId:t}=e,r=vt(e,["providerId"]);return{providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}/** 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 */async function As(n,e){const t=await An(n,{},async()=>{const r=Pe({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=n.config,o=await Rn(n,i,"/v1/token",`key=${s}`),c=await n._getAdditionalHeaders();c["Content-Type"]="application/x-www-form-urlencoded";const a={method:"POST",headers:c,body:r};return n.emulatorConfig&&Ke(n.emulatorConfig.host)&&(a.credentials="include"),kn.fetch()(o,a)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function Rs(n,e){return me(n,"POST","/v2/accounts:revokeToken",wt(n,e))}/** 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 */class ce{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){p(e.idToken,"internal-error"),p(typeof e.idToken<"u","internal-error"),p(typeof e.refreshToken<"u","internal-error");
630const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Gt(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){p(e.length!==0,"internal-error");const t=Gt(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(p(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:r,refreshToken:i,expiresIn:s}=await As(e,t);this.updateTokensAndExpiration(r,i,Number(s))}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:i,expirationTime:s}=t,o=new ce;return r&&(p(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(p(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(p(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new ce,this.toJSON())}_performRefresh(){return $("not implemented")}}/** 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 */function Y(n,e){p(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class N{constructor(e){var{uid:t,auth:r,stsTokenManager:i}=e,s=vt(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Ss(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,this.stsTokenManager=i,this.accessToken=i.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 ft(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await Ae(this,this.stsTokenManager.getToken(this.auth,e));return p(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return Es(this,e)}reload(){return Cs(this)}_assign(e){this!==e&&(p(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(t=>Object.assign({},t)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new N(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){p(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await We(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(M(this.auth.app))return Promise.reject(se(this.auth));const e=await this.getIdToken();return await Ae(this,ws(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isA
645nonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},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){var r,i,s,o,c,a,l,h;const m=(r=t.displayName)!==null&&r!==void 0?r:void 0,d=(i=t.email)!==null&&i!==void 0?i:void 0,_=(s=t.phoneNumber)!==null&&s!==void 0?s:void 0,I=(o=t.photoURL)!==null&&o!==void 0?o:void 0,S=(c=t.tenantId)!==null&&c!==void 0?c:void 0,b=(a=t._redirectEventId)!==null&&a!==void 0?a:void 0,O=(l=t.createdAt)!==null&&l!==void 0?l:void 0,C=(h=t.lastLoginAt)!==null&&h!==void 0?h:void 0,{uid:R,emailVerified:w,isAnonymous:P,providerData:ne,stsTokenManager:oe}=t;p(R&&oe,e,"internal-error");const k=ce.fromJSON(this.name,oe);p(typeof R=="string",e,"internal-error"),Y(m,e.name),Y(d,e.name),p(typeof w=="boolean",e,"internal-error"),p(typeof P=="boolean",e,"internal-error"),Y(_,e.name),Y(I,e.name),Y(S,e.name),Y(b,e.name),Y(O,e.name),Y(C,e.name);const q=new N({uid:R,auth:e,email:d,emailVerified:w,displayName:m,isAnonymous:P,photoURL:I,phoneNumber:_,tenantId:S,stsTokenManager:k,createdAt:O,lastLoginAt:C});return ne&&Array.isArray(ne)&&(q.providerData=ne.map(F=>Object.assign({},F))),b&&(q._redirectEventId=b),q}static async _fromIdTokenResponse(e,t,r=!1){const i=new ce;i.updateFromServerResponse(t);const s=new N({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await We(s),s}static async _fromGetAccountInfoResponse(e,t,r){const i=t.users[0];p(i.localId!==void 0,"internal-error");const s=i.providerUserInfo!==void 0?Pn(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!(s!=null&&s.length),c=new ce;c.updateFromIdToken(r);const a=new N({uid:i.localId,auth:e,stsTokenManager:c,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new ft(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!(s!=null&&s.length)};return Object.assign(a,l),a}}/** 646 * @license 647 * Copyright 2020 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 */const Kt=new Map;function H(n){W(n instanceof Function,"Expected a class definition");let e=Kt.get(n);return e?(W(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,Kt.set(n,e),e)}/** 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 */class On{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}On.type="NONE";const Jt=On;/** 676 * @license 677 * Copyright 2019 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 Ue(n,e,t){return`firebase:${n}:${e}:${t}`}class le{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=Ue(this.userKey,i.apiKey,s),this.fullPersistenceKey=Ue("persistence",i.apiKey,s),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 Ve(this.auth,{idToken:e}).catch(()=>{});return t?N._fromGetAccountInfoResponse(this.auth,t,e):null}return N._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 le(H(Jt),e,r);const i=(await Promise.all(t.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l);let s=i[0]||H(Jt);const o=Ue(r,e.config.apiKey,e.name);let c=null;for(const l of t)try{const h=await l._get(o);if(h){let m;if(typeof h=="string"){const d=await Ve(e,{idToken:h}).catch(()=>{});if(!d)break;m=await N._fromGetAccountInfoResponse(e,d,h)}else m=N._fromJSON(e,h);l!==s&&(c=m),s=l;break}}catch{}const a=i.filter(l=>l._shouldAllowMigration);return!s._shouldAllowMigration||!a.length?new le(s,e,r):(s=a[0],c&&await s._set(o,c.toJSON()),await Promise.all(t.map(async l=>{if(l!==s)try{await l._remove(o)}catch{}})),new le(s,e,r))}}/** 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 Yt(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Mn(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Nn(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Un(e))return"Blackberry";if(Fn(e))return"Webos";if(Dn(e))return"Safari";if((e.includes("chrome/")||Ln(e))&&!e.includes("edge/"))return"Chrome";if(xn(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=n.match(t);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function Nn(n=T()){return/firefox\//i.test(n)}function Dn(n=T()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Ln(n=T()){return/crios\//i.test(n)}function Mn(n=T()){return/iemobile/i.test(n)}function xn(n=T()){return/android/i.test(n)}function Un(n=T()){return/blackberry/i.test(n)}function Fn(n=T()){return/webos/i.test(n)}function Tt(n=T()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function Ps(n=T()){var e;return Tt(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function Os(){return Wr()&&document.documentMode===10}function jn(n=T()){return Tt(n)||xn(n)||Fn(n)||Un(n)||/windows phone/i.test(n)||Mn(n)}/** 706 * @license 707 * Copyright 2020 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 */function Bn(n,e=[]){let t;switch(n){case"Browser":t=Yt(T());break;case"Worker":t=`${Yt(T())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${Oe}/${r}`}/** 721 * @license 722 * Copyright 2022 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 */class Ns{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=s=>new Promise((o,c)=>{try{const a=e(s);o(a)}catch(a){c(a)}});r.onAbort=t,this.queue.push(r);const i=this.queue.length-1;return()=>{this.queue[i]=()=>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 i of t)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/** 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 */async function Ds(n,e={}){return me(n,"GET","/v2/passwordPolicy",wt(n,e))}/** 751 * @license 752 * Copyright 2023 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 */const Ls=6;class Ms{constructor(e){var t,r,i,s;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(t=o.minPasswordLength)!==null&&t!==void 0?t:Ls,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(r=e.allowedNonAlphanumericCharacters)===null||r===void 0?void 0:r.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,r,i,s,o,c;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,a),this.validatePasswordCharacterOptions(e,a),a.isValid&&
vendor: 2,092 bytes, lines 765-779
765(a.isValid=(t=a.meetsMinPasswordLength)!==null&&t!==void 0?t:!0),a.isValid&&(a.isValid=(r=a.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),a.isValid&&(a.isValid=(i=a.containsLowercaseLetter)!==null&&i!==void 0?i:!0),a.isValid&&(a.isValid=(s=a.containsUppercaseLetter)!==null&&s!==void 0?s:!0),a.isValid&&(a.isValid=(o=a.containsNumericCharacter)!==null&&o!==void 0?o:!0),a.isValid&&(a.isValid=(c=a.containsNonAlphanumericCharacter)!==null&&c!==void 0?c:!0),a}validatePasswordLengthOptions(e,t){const r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),i&&(t.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}/** 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 */class xs{constructor(e,t,r,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Xt(this),this.idTokenSubscription=new Xt(this),this.beforeStateQueue=new Ns(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=Cn,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=H(t)),this._initializationPromise=this.queue(async()=>{var r,i,s;if(!this._deleted&&(this.persistenceManager=await le.create(this,e),(r=this._resolvePersistenceManagerAvailable)===null||r===void 0||r.call(this),!this._deleted)){if(!((i=this._popupRedirectResolver)===null||i===void 0)&&i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=((s=this.currentUser)===null||s===void 0?void 0:s.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 Ve(this,{idToken:e}),r=await N._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 t;if(M(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(c=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(c,c))}):this.directlySetCurrentUser(null)}const r=await this.assertedPersistence.getCurrentUser();let i=r,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId,c=i==null?void 0:i._redirectEventId,a=await this.tryRedirectSignIn(e);(!o||o===c)&&(a!=null&&a.user)&&(i=a.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return p(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}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 We(e)}catch(t){if((t==null?void 0:t.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=gs()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(M(this.app))return Promise.reject(se(this));const t=e?pe(e):null;return t&&p(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&&p(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 M(this.app)?Promise.reject(se(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return M(this.app)?Promise.reject(se(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(H(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 Ds(this),t=new Ms(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 Re("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)=>
780{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 Rs(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?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&&H(e)||this._popupRedirectResolver;p(t,this,"argument-error"),this.redirectPersistenceManager=await le.create(this,[H(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||t===void 0?void 0:t._redirectEventId)===e?this._currentUser:((r=this.redirectUser)===null||r===void 0?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 e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const r=(t=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&t!==void 0?t:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,i){if(this._deleted)return()=>{};const s=typeof t=="function"?t:t.next.bind(t);let o=!1;const c=this._isInitialized?Promise.resolve():this._initializationPromise;if(p(c,this,"internal-error"),c.then(()=>{o||s(this.currentUser)}),typeof t=="function"){const a=e.addObserver(t,r,i);return()=>{o=!0,a()}}else{const a=e.addObserver(t);return()=>{o=!0,a()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return p(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Bn(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const r=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());r&&(t["X-Firebase-Client"]=r);const i=await this._getAppCheckToken();return i&&(t["X-Firebase-AppCheck"]=i),t}async _getAppCheckToken(){var e;if(M(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return t!=null&&t.error&&hs(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function Je(n){return pe(n)}class Xt{constructor(e){this.auth=e,this.observer=null,this.addObserver=Xr(t=>this.observer=t)}get next(){return p(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/** 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 */let St={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Us(n){St=n}function Fs(n){return St.loadJS(n)}function js(){return St.gapiScript}function Bs(n){return`__${n}${Math.floor(Math.random()*1e6)}`}/** 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 */function $s(n,e){const t=bn(n,"auth");if(t.isInitialized()){const i=t.getImmediate(),s=t.getOptions();if(ue(s,e??{}))return i;U(i,"already-initialized")}return t.initialize({options:e})}function Hs(n,e){const t=(e==null?void 0:e.persistence)||[],r=(Array.isArray(t)?t:[t]).map(H);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function Vs(n,e,t){const r=Je(n);
810p(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!1,s=$n(e),{host:o,port:c}=Ws(e),a=c===null?"":`:${c}`,l={url:`${s}//${o}${a}/`},h=Object.freeze({host:o,port:c,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){p(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),p(ue(l,r.config.emulator)&&ue(h,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=l,r.emulatorConfig=h,r.settings.appVerificationDisabledForTesting=!0,Ke(o)?(xr(`${s}//${o}${a}`),jr("Auth",!0)):zs()}function $n(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function Ws(n){const e=$n(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const r=t[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const s=i[1];return{host:s,port:Zt(r.substr(s.length+1))}}else{const[s,o]=r.split(":");return{host:s,port:Zt(o)}}}function Zt(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function zs(){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())}/** 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 */class Hn{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return $("not implemented")}_getIdTokenResponse(e){return $("not implemented")}_linkToIdToken(e,t){return $("not implemented")}_getReauthenticationResolver(e){return $("not implemented")}}/** 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 de(n,e){return Is(n,"POST","/v1/accounts:signInWithIdp",wt(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 */const qs="http://localhost";class z extends Hn{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new z(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&&
855(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):U("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:i}=t,s=vt(t,["providerId","signInMethod"]);if(!r||!i)return null;const o=new z(r,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){const t=this.buildRequest();return de(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,de(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,de(e,t)}buildRequest(){const e={requestUri:qs,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=Pe(t)}
855return 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 Ct{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}}/** 871 * @license 872 * Copyright 2019 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 */class ge extends Ct{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class Se extends ge{static credentialFromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;return p("providerId"in t&&"signInMethod"in t,"argument-error"),z._fromParams(t)}credential(e){return this._credential(Object.assign(Object.assign({},e),{nonce:e.rawNonce}))}_credential(e){return p(e.idToken||e.accessToken,"argument-error"),z._fromParams(Object.assign(Object.assign({}
885,e),{providerId:this.providerId,signInMethod:this.providerId}))}static credentialFromResult(e){return Se.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return Se.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r,oauthTokenSecret:i,pendingToken:s,nonce:o,providerId:c}=e;if(!r&&!i&&!t&&!s||!c)return null;try{return new Se(c)._credential({idToken:t,accessToken:r,nonce:o,pendingToken:s})}catch{return null}}}/** 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 */class j extends ge{constructor(){super("facebook.com")}static credential(e){return z._fromParams({providerId:j.PROVIDER_ID,signInMethod:j.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return j.credentialFromTaggedObject(e)}static credentialFromError(e){return j.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return j.credential(e.oauthAccessToken)}catch{return null}}}j.FACEBOOK_SIGN_IN_METHOD="facebook.com";j.PROVIDER_ID="facebook.com";/** 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 */class B extends ge{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return z._fromParams({providerId:B.PROVIDER_ID,signInMethod:B.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken: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{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return B.credential(t,r)}catch{return null}}}B.GOOGLE_SIGN_IN_METHOD="google.com";B.PROVIDER_ID="google.com";/** 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 X extends ge{constructor(){super("github.com")}static credential(e){return z._fromParams({providerId:X.PROVIDER_ID,signInMethod:X.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return X.credentialFromTaggedObject(e)}static credentialFromError(e){return X.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return X.credential(e.oauthAccessToken)}catch{return null}}}X.GITHUB_SIGN_IN_METHOD="github.com";X.PROVIDER_ID="github.com";/** 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 Z extends ge{constructor(){super("twitter.com")}static credential(e,t){return z._fromParams({providerId:Z.PROVIDER_ID,signInMethod:Z.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return Z.credentialFromTaggedObject(e)}static credentialFromError(e){return Z.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return Z.credential(t,r)}catch{return null}}}Z.TWITTER_SIGN_IN_METHOD="twitter.com";Z.PROVIDER_ID="twitter.com";/** 946 * @license 947 * Copyright 2020 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 fe{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,i=!1){const s=await N._fromIdTokenResponse(e,r,i),o=Qt(r);return new fe({user:s,providerId:o,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const i=Qt(r);return new fe({user:e,providerId:i,_tokenResponse:r,operationType:t})}}function Qt(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/** 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 ze extends te{constructor(e,t,r,i){var s;super(t.code,t.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,ze.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,i){return new ze(e,t,r,i)}}function Vn(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?ze._fromErrorAndOperation(n,s,e,r):s})}async function Gs(n,e,t=!1){const r=await Ae(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return fe._forOperation(n,"link",r)}/** 976 * @license 977 * Copyright 2019 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 */async function Ks(n,e,t=!1){const{auth:r}=n;if(M(r.app))return Promise.reject(se(r));const i="reauthenticate";try{const s=await Ae(n,Vn(r,i,e,n),t);p(s.idToken,r,"internal-error");const o=Et(s.idToken);p(o,r,"internal-error");const{sub:c}=o;return p(n.uid===c,r,"user-mismatch"),fe._forOperation(n,i,s)}catch(s){throw(s==null?void 0:s.code)==="auth/user-not-found"&&U(r,"user-mismatch"),s}}/** 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 */async function Js(n,e,t=!1){if(M(n.app))return Promise.reject(se(n));const r="signIn",i=await Vn(n,r,e),s=await fe._fromIdTokenResponse(n,r,i);return t||await n._updateCurrentUser(s.user),s}function Ys(n,e,t,r){return pe(n).onIdTokenChanged(e,t,r)}function Xs(n,e,t){return pe(n).beforeAuthStateChanged(e,t)}const qe="__sak";/** 1006 * @license 1007 * Copyright 2019 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 Wn{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(qe,"1"),this.storage.removeItem(qe),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()}}/** 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 */const Zs=1e3,Qs=10;class zn extends Wn{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=jn(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),i=this.localCache[t];r!==i&&e(t,i,r)}}
1035onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,c,a)=>{this.notifyListeners(o,a)});return}const r=e.key;t?this.detachListener():this.stopPolling();const i=()=>{const o=this.storage.getItem(r);!t&&this.localCache[r]===o||this.notifyListeners(r,o)},s=this.storage.getItem(r);Os()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Qs):i()}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(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)})},Zs)}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
1035ject.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]}}zn.type="LOCAL";const eo=zn;/** 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 qn extends Wn{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}qn.type="SESSION";const Gn=qn;/** 1051 * @license 1052 * Copyright 2019 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 */function to(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/** 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 */class Ye{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(i=>i.isListeningto(e));if(t)return t;const r=new Ye(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:i,data:s}=t.data,o=this.handlersMap[i];if(!(o!=null&&o.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const c=Array.from(o).map(async l=>l(t.origin,s)),a=await to(c);t.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:a})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Ye.receivers=[];/** 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 */function kt(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/** 1096 * @license 1097 * Copyright 2019 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 */class no{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 i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,o;return new Promise((c,a)=>{const l=kt("",20);i.port1.start();const h=setTimeout(()=>{a(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(m){const d=m;if(d.data.eventId===l)switch(d.data.status){case"ack":clearTimeout(h),s=setTimeout(()=>{a(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),c(d.data.response);break;default:clearTimeout(h),clearTimeout(s),a(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:t},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/** 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 */function x(){return window}function ro(n){x().location.href=n}/** 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 */function Kn(){return typeof x().WorkerGlobalScope<"u"&&typeof x().importScripts=="function"}async function io(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function so(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function oo(){return Kn()?self:null}/** 1141 * @license 1142 * Copyright 2019 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 */const Jn="firebaseLocalStorageDb",ao=1,Ge="firebaseLocalStorage",Yn="fbase_key";class De{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 Xe(n,e){return n.transaction([Ge],e?"readwrite":"readonly").objectStore(Ge)}
1155function co(){const n=indexedDB.deleteDatabase(Jn);return new De(n).toPromise()}function pt(){const n=indexedDB.open(Jn,ao);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(Ge,{keyPath:Yn})}catch(i){t(i)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(Ge)?e(r):(r.close(),await co(),e(await pt()))})})}async function en(n,e,t){const r=Xe(n,!0).put({[Yn]:e,value:t});return new De(r).toPromise()}async function lo(n,e){const t=Xe(n,!1).get(e),r=await new De(t).toPromise();return r===void 0?null:r.value}function tn(n,e){const t=Xe(n,!0).delete(e);return new De(t).toPromise()}const uo=800,ho=3;class Xn{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 pt(),this.db)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>ho)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Kn()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ye._getInstance(oo()),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 e,t;if(this.activeServiceWorker=await io(),!this.activeServiceWorker)return;this.sender=new no(this.activeServiceWorker);const r=await this.sender._send("ping",{},800);r&&!((e=r[0])===null||e===void 0)&&e.fulfilled&&!((t=r[0])===null||t===void 0)&&t.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||so()!==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 pt();return await en(e,qe,"1"),await tn(e,qe),!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=>en(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>lo(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>tn(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(i=>{const s=Xe(i,!1).getAll();return new De(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],r=new Set;if(e.length!==0)for(const{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),t.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),t.push(i));return t}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),uo)}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
1155ject.keys(this.listeners).length===0&&this.stopPolling()}}Xn.type="LOCAL";const fo=Xn;new Ne(3e4,6e4);/** 1156 * @license 1157 * Copyright 2021 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 */function Zn(n,e){return e?H(e):(p(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/** 1171 * @license 1172 * Copyright 2019 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 */class At extends Hn{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return de(e,this._buildIdpRequest())}_linkToIdToken(e,t){return de(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return de(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 po(n){return Js(n.auth,new At(n),n.bypassAuthState)}function mo(n){const{auth:e,user:t}=n;return p(t,e,"internal-error"),Ks(t,new At(n),n.bypassAuthState)}async function go(n){const{auth:e,user:t}=n;return p(t,e,"internal-error"),Gs(t,new At(n),n.bypassAuthState)}/** 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 Qn{constructor(e,t,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(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:i,tenantId:s,error:o,type:c}=e;if(o){this.reject(o);return}const a={auth:this.auth,requestUri:t,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(a))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return po;case"linkViaPopup":case"linkViaRedirect":return go;case"reauthViaPopup":case"reauthViaRedirect":return mo;default:U(this.auth,"internal-error")}}resolve(e){W(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){W(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()}}/** 1201 * @license 1202 * Copyright 2020 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 */const _o=new Ne(2e3,1e4);async function vo(n,e,t){if(M(n.app))return Promise.reject(D(n,"operation-not-supported-in-this-environment"));const r=Je(n);fs(n,e,Ct);const i=Zn(r,t);return new ie(r,"signInViaPopup",e,i).executeNotNull()}class ie extends Qn{constructor(e,t,r,i,s){super(e,t,i,s),this.provider=r,this.authWindow=null,this.pollId=null,ie.currentPopupAction&&ie.currentPopupAction.cancel(),ie.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return p(e,this.auth,"internal-error"),e}async onExecution(){W(this.filter.length===1,"Popup operations only handle one event");const e=kt();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(D(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(D(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ie.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,r;if(!((r=(t=this.authWindow)===null||t===void 0?void 0:t.window)===null||r===void 0)&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(D(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,_o.get())};e()}}ie.currentPopupAction=null;/** 1216 * @license 1217 * Copyright 2020 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 */const yo="pendingRedirect",Fe=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=Fe.get(this.auth._key());if(!e){try{const r=await bo(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}Fe.set(this.auth._key(),e)}return this.bypassAuthState||Fe.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 bo(n,e){const t=To(e),r=Eo(n);if(!await r._isAvailable())return!1;const i=await r._get(t)==="true";return await r._remove(t),i}function wo(n,e){Fe.set(n._key(),e)}function Eo(n){return H(n._redirectPersistence)}function To(n){return Ue(yo,n.config.apiKey,n.name)}async function So(n,e,t=!1){if(M(n.app))return Promise.reject(se(n));const r=Je(n),i=Zn(r,e),o=await new Io(r,i,t).execute();return o&&!t&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/** 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 */const Co=600*1e3;class ko{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!Ao(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!er(e)){const i=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";t.onError(D(this.auth,i))}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>=Co&&this.cachedEventUids.clear(),this.cachedEventUids.has(nn(e))}saveEventToCache(e){this.cachedEventUids.add(nn(e)),this.lastProcessedEventTime=Date.now()}}function nn(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function er({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function Ao(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return er(n);default:return!1}}/** 1246 * @license 1247 * Copyright 2020 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 */async function Ro(n,e={}){return me(n,"GET","/v1/projects",e)}/** 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 */const Po=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Oo=/^https?/;async function No(n){if(n.config.emulator)return;const{authorizedDomains:e}=await Ro(n);for(const t of e)try{if(Do(t))return}catch{}U(n,"unauthorized-domain")}function Do(n){const e=ht(),{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(!Oo.test(t))return!1;if(Po.test(n))return r===n;const i=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}/** 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 */const Lo=new Ne(3e4,6e4);function rn(){const n=x().___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 Mo(n){return new Promise((e,t)=>{var r,i,s;function o(){rn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{rn(),t(D(n,"network-request-failed"))},timeout:Lo.get()})}if(!((i=(r=x().gapi)===null||r===void 0?void 0:r.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=x().gapi)===null||s===void 0)&&s.load)o();else{const c=Bs("iframefcb");return x()[c]=()=>{gapi.load?o():t(D(n,"network-request-failed"))},Fs(`${js()}?onload=${c}`).catch(a=>t(a))}}).catch(e=>{throw je=null,e})}let je=null;function xo(n){return je=je||Mo(n),je}/** 1291 * @license 1292 * Copyright 2020 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 Uo=new Ne(5e3,15e3),Fo="__/auth/iframe",jo="emulator/auth/iframe",Bo={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},$o=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Ho(n){const e=n.config;p(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?bt(e,jo):`https://${n.config.authDomain}/${Fo}`,r={apiKey:e.apiKey,appName:n.name,v:Oe},i=$o.get(n.config.apiHost);i&&(r.eid=i);const s=n._getFrameworks();return s.length&&(r.fw=s.join(",")),`${t}?${Pe(r).slice(1)}`}async function Vo(n){const e=await xo(n),t=x().gapi;return p(t,n,"internal-error"),e.open({where:document.body,url:Ho(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Bo,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const o=D(n,"network-request-failed"),c=x().setTimeout(()=>{s(o)},Uo.get());function a(){x().clearTimeout(c),i(r)}r.ping(a).then(a,()=>{s(o)})}))}/** 1306 * @license 1307 * Copyright 2020 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 */const Wo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},zo=500,qo=600,Go="_blank",Ko="http://localhost";class sn{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function Jo(n,e,t,r=zo,i=qo){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const a=Object.assign(Object.assign({},Wo),{width:r.toString(),height:i.toString(),top:s,left:o}),l=T().toLowerCase();t&&(c=Ln(l)?Go:t),Nn(l)&&(e=e||Ko,a.scrollbars="yes");const h=Object.entries(a).reduce((d,[_,I])=>`${d}${_}=${I},`,"");if(Ps(l)&&c!=="_self")return Yo(e||"",c),new sn(null);const m=window.open(e||"",c,h);p(m,n,"popup-blocked");try{m.focus()}catch{}return new sn(m)}function Yo(n,e){const t=document.createElement("a");t.href=n,t.target=e;const r=document.createEvent("MouseEvent");
1320r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}/** 1321 * @license 1322 * Copyright 2021 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 */const Xo="__/auth/handler",Zo="emulator/auth/handler",Qo=encodeURIComponent("fac");async function on(n,e,t,r,i,s){p(n.config.authDomain,n,"auth-domain-config-required"),p(n.config.apiKey,n,"invalid-api-key");const o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:Oe,eventId:i};if(e instanceof Ct){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",Yr(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[h,m]of Object.entries({}))o[h]=m}if(e instanceof ge){const h=e.getScopes().filter(m=>m!=="");h.length>0&&(o.scopes=h.join(","))}n.tenantId&&(o.tid=n.tenantId);const c=o;for(const h of Object.keys(c))c[h]===void 0&&delete c[h];const a=await n._getAppCheckToken(),l=a?`#${Qo}=${encodeURIComponent(a)}`:"";return`${ea(n)}?${Pe(c).slice(1)}${l}`}function ea({config:n}){return n.emulator?bt(n,Zo):`https://${n.authDomain}/${Xo}`}/** 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 */const ot="webStorageSupport";class ta{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Gn,this._completeRedirectFn=So,this._overrideRedirectResult=wo}async _openPopup(e,t,r,i){var s;W((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");const o=await on(e,t,r,ht(),i);return Jo(e,o,kt())}
1350async _openRedirect(e,t,r,i){await this._originValidation(e);const s=await on(e,t,r,ht(),i);return ro(s),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:i,promise:s}=this.eventManagers[t];return i?Promise.resolve(i):(W(s,"If manager is not set, promise should be"),s)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){const t=await Vo(e),r=new ko(e);return t.register("authEvent",i=>(p(i==null?void 0:i.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(ot,{type:ot},i=>{var s;const o=(s=i==null?void 0:i[0])===null||s===void 0?void 0:s[ot];o!==void 0&&t(!!o),U(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=No(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return jn()||Dn()||Tt()}}const na=ta;var an="@firebase/auth",cn="1.10.8";/** 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 */class ra{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?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==null?void 0: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(){p(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/** 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 */function ia(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 sa(n){Ce(new he("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:c}=r.options;p(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const a={apiKey:o,authDomain:c,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Bn(n)},l=new xs(r,i,s,a);return Hs(l,t),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),Ce(new he("auth-internal",e=>{const t=Je(e.getProvider("auth").getImmediate());return(r=>new ra(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),ae(an,cn,ia(n)),ae(an,cn,"esm2017")}/** 1381 * @license 1382 * Copyright 2021 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 oa=300,aa=_n("authIdTokenMaxAge")||oa;let ln=null;const ca=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>aa)return;const i=t==null?void 0:t.token;ln!==i&&(ln=i,await fetch(n,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function la(n=Zi()){const e=bn(n,"auth");if(e.isInitialized())return e.getImmediate();const t=$s(n,{popupRedirectResolver:na,persistence:[fo,eo,Gn]}),r=_n("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(r,location.origin);if(location.origin===s.origin){const o=ca(s.toString());Xs(t,o,()=>o(t.currentUser)),Ys(t,c=>o(c))}}const i=Lr("auth");return i&&Vs(t,`http://${i}`),t}function da(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}Us({loadJS(n){return new Promise((e,t)=>{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=i=>{const s=D("internal-error");s.customData=i,t(s)},r.type="text/javascript",r.charset="UTF-8",da().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="});sa("Browser");const ua={apiKey:"AIzaSyBiPF6YJTshansEvC4W3qztFMtlvul0kn8",authDomain:"castingbellindia.firebaseapp.com",projectId:"castingbellindia",storageBucket:"castingbellindia.appspot.com",messagingSenderId:"601876832145",appId:"1:601876832145:web:1fb23c0d4b1d4adb04c430",measurementId:"G-9L5QB03FV0"};wn(ua);const ha=la(),Ze=new B;Ze.setCustomParameters({prompt:"select_account"});Ze.addScope("profile");Ze.addScope("email");const tr=new j;tr.addScope("email");tr.setCustomParameters({display:"popup"});const nr=new Se("apple.com");nr.addScope("email");nr.addScope("name");y.func.isRequired,y.string.isRequired;y.func.isRequired,y.string.isRequired,y.func.isRequired,y.func.isRequired,y.func.isRequired,y.bool.isRequired,y.bool,y.string;const rr=({openDialog:n,onSubmit:e})=>{const[t,r]=v.useState(!1),[i,s]=v.useState(""),[o,c]=v.useState(!1);v.useEffect(()=>{r(n)},[n]);const a=h=>!!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.exec(String(h).toLowerCase()),l=()=>{var h;(h=a(i))!=null&&h.length?(e(i),c(!1),r(!1)):c(!0)};return u.jsx("div",{className:"createProjectPopup",children:u.jsxs(or,{open:t,"aria-labelledby":"alert-dialog-title","aria-describedby":"alert-dialog-description",children:[u.jsx(ar,{id:"alert-dialog-title",className:"text-center character_title pt-40 font-semibold"}),u.jsx(cr,{children:u.jsx(lr,{id:"alert-dialog-description",children:u.jsxs("div",{className:"w-96 pb-3",children:[u.jsx("p",{className:"Email_pop_title pb-6",children:"Add Email Id"}),u.jsx("p",{className:"Email_pop_label",children:"Email:"}),u.jsx(dn,{margin:"dense",id:"name",type:"email",fullWidth:!0,variant:"standard",onChange:h=>{s(h.target.value)},helperText:o&&"please enter valid email address",error:o})]})})}),u.jsx(dr,{className:"createProject_button",children:u.jsx("div",{className:"view_profile Email_pop_button m-0 pb-3",children:u.jsx(ur,{variant:"contained",onClick:()=>l(),children:"Submit"})})})]})})};rr.propTypes={openDialog:y.bool.isRequired,onSubmit:y.func.isRequired};function fa({closemodel:n,name:e,setAccountStatus:t,isRecruiter:r=!1,isLogin:i=!1,referral:s="",setReferral:o}){var q,F,_e;const{setIsProfileFreezed:c}=v.useContext(Be),{setUser:a,setAccessToken:l,startSilentRefresh:h,GetSignUpDependency:m,setIsLoaded:d,isJobapply:_,checkNewNotification:I}=v.useContext(Be),[S,b]=v.useState({}),[O,C]=v.useState(!1),{openSnackbar:R}=v.useContext(un),w=mt(),P=hr(),ne=(q=P==null?void 0:P.pathname)!=null&&q.includes("find-jobs")?(_e=(F=P==null?void 0:P.pathname)==null?void 0:F.split("/"))==null?void 0:_e.pop():null;v.useEffect(()=>{const f=A=>{O&&(A.stopPropagation(),A.preventDefault())};return document.addEventListener("click",f,!0),()=>{document.removeEventListener("click",f,!0)}},[O]);const oe=()=>{C(!0),vo(ha,Ze).then(f=>{var K,J,ve,ye,Ie,be,we;const A=((J=(K=f==null?void 0:f.user)==null?void 0:K.displayName)==null?void 0:J.split(" "))||[],E=A[0]||"",L=((Ie=(ve=f==null?void 0:f.user)==null?void 0:ve.displayName)==null?void 0:Ie.substring(((ye=A[0])==null?void 0:ye.length)||0).trim())||"",G={email:(we=(be=f==null?void 0:f.user)==null?void 0:be.providerData[0])==null?void 0:we.email,oauth_id:f.user.uid,first_name:E,last_name:L,isRecruiter:r,registered_on:new Date,oauth_type:"Google",isLogin:i,user_referral_code:s?s.toLowerCase():""};return b(G),Le.handleOauthUser(G)}).then(f=>{var A,E,L,G,K,J,ve,ye,Ie,be,we,Rt,Pt,Ot,Nt,Dt;if(localStorage.setItem("hasValidUserSession","true"),a(f.data.user),typeof o=="function"&&o(""),(A=f.data.user)!=null&&A.isFreezed?c(f.data.user.isFreezed):c(!1),l((E=f==null?void 0:f.data)==null?void 0:E.token),h(),m(),I((L=f.data.user)==null?void 0:L.user_id
1395),_===!0||ne){n(),d(!0),C(!1);return}if(f.data.user.user_type===1){const Qe={user_id:`${(G=f.data.user)==null?void 0:G.user_id}`,message:`<p><a class="talent_name" href="${Lt.admin_url}/app/talent-management/profile/${(K=f.data.user)==null?void 0:K.user_id}">${(J=f.data.user)==null?void 0:J.first_name} (Talent ${(ve=f.data.user)==null?void 0:ve.user_id})</a> signed in using Google</p>`};Le.createLog(Qe),n(),(Ie=(ye=f.data.user)==null?void 0:ye.talenter)!=null&&Ie.is_profile_creation_completed?f.data.user.profile_status===1?w("/app/openings/my-applications"):w(`/talent/${(be=f.data.user)==null?void 0:be.userUniqueId}`):w("/app/dashboard")}else if(f.data.user.user_type===2){const Qe={user_id:`${(we=f.data.user)==null?void 0:we.user_id}`,message:`<p><a class="talent_name" href="${Lt.admin_url}/app/recruiter/details/${(Rt=f.data.user)==null?void 0:Rt.user_id}">${(Pt=f.data.user)==null?void 0:Pt.first_name} (Recruiter ${(Ot=f.data.user)==null?void 0:Ot.user_id})</a> signed in using Google</p>`};Le.createLog(Qe),n(),(Dt=(Nt=f.data.user)==null?void 0:Nt.recruiter)!=null&&Dt.is_profile_creation_completed?w("/app/my-projects"):w(`/app/recruiter-form/${f.data.user.userUniqueId}`)}d(!0),C(!1)}).catch(f=>{var A,E,L,G,K,J;console.error("Google Auth Error:",f),((E=(A=f==null?void 0:f.response)==null?void 0:A.data)==null?void 0:E.code)===400&&(localStorage.removeItem("hasValidUserSession"),t((G=(L=f==null?void 0:f.response)==null?void 0:L.data)==null?void 0:G.message),R((J=(K=f==null?void 0:f.response)==null?void 0:K.data)==null?void 0:J.message,"error")),d(!0),C(!1),localStorage.removeItem("hasValidUserSession")})},k=f=>{const A={...S,email:f};b(A),Le.handleOauthUser(A).then(E=>{var L;a(E.data.user),l((L=E==null?void 0:E.data)==null?void 0:L.token),h(),m(),E.data.user_type===1?w("/app/dashboard"):E.data.user_type===2?w("/app/my-projects"):w("/find-talents")}).catch(E=>{console.error("Error handling email:",E),R("Failed to update email. Please try again.","error")})};return u.jsxs(u.Fragment,{children:[u.jsx(rr,{openDialog:!1,onSubmit:k}),O?u.jsx("div",{className:"authContainer",children:u.jsx(fr,{size:"24px",sx:{color:"#9B26B6"}})}):u.jsxs("button",{className:"auth_btn white-bg font-medium",onClick:f=>{f.preventDefault(),oe()},children:[u.jsx(pr,{className:"w-6 h-6","aria-hidden":"true"}),u.jsx("p",{children:e})]})]})}fa.propTypes={closemodel:y.func.isRequired,name:y.string.isRequired,setAccountStatus:y.func.isRequired,isRecruiter:y.bool,isLogin:y.bool,referral:y.string,setReferral:y.func};const pa=Er({email:Tr().email("Invalid email format").required("Email id is required")});function va({setSubmitted:n}){const e=mt(),[t,r]=mr.useState(!1),{openSnackbar:i,setIsSignUpPopup:s}=v.useContext(un),[o,c]=v.useState(""),{submitted:a,setSubmittedState:l}=v.useContext(Be),h=async(m,{setSubmitting:d})=>{var _,I;r(!0);try{const S={email:m.email},b=await _r.forgotPassoword(S);(b==null?void 0:b.status)===200&&(c(m.email),l(!0),i("Password reset link sent to your email!","success"))}catch(S){console.error("Submission error:",S);const b=((I=(_=S.response)==null?void 0:_.data)==null?void 0:I.message)||"Something went wrong. Please try again.";i(b,"error")}finally{r(!1),d(!1)}};return u.jsxs(u.Fragment,{children:[!a&&u.jsxs("div",{className:"Requiterdetails form_action_container mt-3",children:[u.jsx("small",{style:{color:"#000"},children:"Please enter your email to get Password reset link."}),u.jsx(yr,{initialValues:{email:""},validationSchema:pa,onSubmit:h,children:({errors:m,touched:d,isSubmitting:_})=>u.jsxs(Ir,{children:[u.jsxs("div",{className:"mb-5 cxpart",children:[u.jsx("p",{children:"Enter your email"}),u.jsx(br,{as:dn,name:"email",variant:"standard",error:d.email&&!!m.email,helperText:u.jsx(wr,{name:"email"})})]}),u.jsx(gr,{text:"Submit",type:"submit",disabled:t||_})]})})]}),a&&u.jsx("div",{className:"submitted_confirm mt-3",children:u.jsxs("p",{children:["We emailed a password reset link to ",u.jsxs("span",{children:[o," "]})," . Please follow instruction is that email.Don't receive an email ? ",u.jsx("button",{onClick:()=>{e("/about/contact-us"),s(!1)},className:"link",children:u.jsxs("b",{children:["Contact us ",""]})}),""," we will get back asap."]})})]})}export{Sr as E,va as F,fa as G};
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.