!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).firebase=e()}(this,function(){"use strict";!function(t){var e,n,s,r,i,o,a,u,c,h;function l(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return t="string"!=typeof t?String(t):t}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach(function(t,e){this.append(e,t)},this):Array.isArray(e)?e.forEach(function(t){this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function v(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function g(n){return new Promise(function(t,e){n.onload=function(){t(n.result)},n.onerror=function(){e(n.error)}})}function y(t){var e=new FileReader,n=g(e);return e.readAsArrayBuffer(t),n}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t)if("string"==typeof t)this._bodyText=t;else if(s&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(r&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(i&&s&&a(t))this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!i||!ArrayBuffer.prototype.isPrototypeOf(t)&&!u(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=m(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var t=v(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?v(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,n=v(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=g(e),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;ri;)c(r,n=e[i++])&&(~wt(o,n)||o.push(n));return o}function ot(t,e){for(var n=St(e),r=k.f,i=N.f,o=0;o"+t+""}var ht,lt={set:j,get:q,has:V,enforce:function(t){return V(t)?q(t):j(t,{})},getterFor:function(n){return function(t){var e;if(!y(t)||(e=q(t)).type!==n)throw TypeError("Incompatible receiver, "+n+" required");return e}}},ft=e(function(t){var e=lt.get,a=lt.enforce,u=String(String).split("String");(t.exports=function(t,e,n,r){var i=!!r&&!!r.unsafe,o=!!r&&!!r.enumerable,s=!!r&&!!r.noTargetGet;"function"==typeof n&&("string"!=typeof e||c(n,"name")||R(n,"name",e),(r=a(n)).source||(r.source=u.join("string"==typeof e?e:""))),t!==b?(i?!s&&t[e]&&(o=!0):delete t[e],o?t[e]=n:R(t,e,n)):o?t[e]=n:h(e,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&e(this).source||K(this)})}),pt=b,dt=Math.ceil,vt=Math.floor,gt=Math.min,yt=Math.max,mt=Math.min,bt=function(a){return function(t,e,n){var r,i=u(t),o=rt(i.length),s=function(t,e){t=nt(t);return t<0?yt(t+e,0):mt(t,e)}(n,o);if(a&&e!=e){for(;sn;){var r,i,o,s=p[n++],a=e?s.ok:s.fail,u=s.resolve,c=s.reject,h=s.domain;try{a?(e||(2===l.rejection&&An(l),l.rejection=1),!0===a?r=t:(h&&h.enter(),r=a(t),h&&(h.exit(),o=!0)),r===s.promise?c(gn("Promise-chain cycle")):(i=$e(r))?i.call(r,u,c):u(r)):c(t)}catch(t){h&&!o&&h.exit(),c(t)}}l.reactions=[],l.notified=!1,f&&!l.rejection&&Cn(l)}))}function tn(t,e,n){var r,i;In?((r=yn.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),b.dispatchEvent(r)):r={promise:e,reason:n},!Tn&&(i=b["on"+t])?i(r):t===En&&function(t,e){var n=b.console;n&&n.error&&(1===arguments.length?n.error(t):n.error(t,e))}("Unhandled promise rejection",n)}function en(e,n,r){return function(t){e(n,t,r)}}function nn(t,e,n){t.done||(t.done=!0,(t=n?n:t).value=e,t.state=2,Ze(t,!0))}var rn,on,sn,an,un=Pn&&+Pn,cn=We.set,hn=Wt("species"),ln="Promise",fn=lt.get,pn=lt.set,dn=lt.getterFor(ln),vn=ve,gn=b.TypeError,yn=b.document,mn=b.process,bn=et("fetch"),wn=Je.f,_n=wn,In=!!(yn&&yn.createEvent&&b.dispatchEvent),Tn="function"==typeof PromiseRejectionEvent,En="unhandledrejection",Z=Pt(ln,function(){if(!(K(vn)!==String(vn))){if(66===un)return!0;if(!ke&&!Tn)return!0}if(51<=un&&/native code/.test(vn))return!1;function t(t){t(function(){},function(){})}var e=vn.resolve(1);return(e.constructor={})[hn]=t,!(e.then(function(){})instanceof t)}),Sn=Z||!Te(function(t){vn.all(t).catch(function(){})}),Cn=function(i){cn.call(b,function(){var t,e=i.facade,n=i.value,r=Nn(i);if(r&&(t=Ye(function(){ke?mn.emit("unhandledRejection",n,e):tn(En,e,n)}),i.rejection=ke||Nn(i)?2:1,t.error))throw t.value})},Nn=function(t){return 1!==t.rejection&&!t.parent},An=function(e){cn.call(b,function(){var t=e.facade;ke?mn.emit("rejectionHandled",t):tn("rejectionhandled",t,e.value)})},kn=function(n,t,e){if(!n.done){n.done=!0,e&&(n=e);try{if(n.facade===t)throw gn("Promise can't be resolved itself");var r=$e(t);r?Xe(function(){var e={done:!1};try{r.call(t,en(kn,e,n),en(nn,e,n))}catch(t){nn(e,t,n)}}):(n.value=t,n.state=1,Ze(n,!1))}catch(t){nn({done:!1},t,n)}}};Z&&(vn=function(t){de(this,vn,ln),Gt(t),rn.call(this);var e=fn(this);try{t(en(kn,e),en(nn,e))}catch(t){nn(e,t)}},(rn=function(t){pn(this,{type:ln,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=le(vn.prototype,{then:function(t,e){var n=dn(this),r=wn(Ee(this,vn));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=ke?mn.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&Ze(n,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),on=function(){var t=new rn,e=fn(t);this.promise=t,this.resolve=en(kn,e),this.reject=en(nn,e)},Je.f=wn=function(t){return t===vn||t===sn?new on:_n(t)},"function"==typeof ve&&(an=ve.prototype.then,ft(ve.prototype,"then",function(t,e){var n=this;return new vn(function(t,e){an.call(n,t,e)}).then(t,e)},{unsafe:!0}),"function"==typeof bn&&st({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return Qe(vn,bn.apply(b,arguments))}}))),st({global:!0,wrap:!0,forced:Z},{Promise:vn}),fe(vn,ln,!1),pe(ln),sn=et(ln),st({target:ln,stat:!0,forced:Z},{reject:function(t){var e=wn(this);return e.reject.call(void 0,t),e.promise}}),st({target:ln,stat:!0,forced:Z},{resolve:function(t){return Qe(this,t)}}),st({target:ln,stat:!0,forced:Sn},{all:function(t){var a=this,e=wn(a),u=e.resolve,c=e.reject,n=Ye(function(){var r=Gt(a.resolve),i=[],o=0,s=1;oe(t,function(t){var e=o++,n=!1;i.push(void 0),s++,r.call(a,t).then(function(t){n||(n=!0,i[e]=t,--s||u(i))},c)}),--s||u(i)});return n.error&&c(n.value),e.promise},race:function(t){var n=this,r=wn(n),i=r.reject,e=Ye(function(){var e=Gt(n.resolve);oe(t,function(t){e.call(n,t).then(r.resolve,i)})});return e.error&&i(e.value),r.promise}}),st({target:"Promise",stat:!0},{allSettled:function(t){var a=this,e=Je.f(a),u=e.resolve,n=e.reject,r=Ye(function(){var r=Gt(a.resolve),i=[],o=0,s=1;oe(t,function(t){var e=o++,n=!1;i.push(void 0),s++,r.call(a,t).then(function(t){n||(n=!0,i[e]={status:"fulfilled",value:t},--s||u(i))},function(t){n||(n=!0,i[e]={status:"rejected",reason:t},--s||u(i))})}),--s||u(i)});return r.error&&n(r.value),e.promise}});var Rn="No one promise resolved";st({target:"Promise",stat:!0},{any:function(t){var u=this,e=Je.f(u),c=e.resolve,h=e.reject,n=Ye(function(){var r=Gt(u.resolve),i=[],o=0,s=1,a=!1;oe(t,function(t){var e=o++,n=!1;i.push(void 0),s++,r.call(u,t).then(function(t){n||a||(a=!0,c(t))},function(t){n||a||(n=!0,i[e]=t,--s||h(new(et("AggregateError"))(i,Rn)))})}),--s||h(new(et("AggregateError"))(i,Rn))});return n.error&&h(n.value),e.promise}});var Pn=!!ve&&g(function(){ve.prototype.finally.call({then:function(){}},function(){})});st({target:"Promise",proto:!0,real:!0,forced:Pn},{finally:function(e){var n=Ee(this,et("Promise")),t="function"==typeof e;return this.then(t?function(t){return Qe(n,e()).then(function(){return t})}:e,t?function(t){return Qe(n,e()).then(function(){throw t})}:e)}}),"function"!=typeof ve||ve.prototype.finally||ft(ve.prototype,"finally",et("Promise").prototype.finally);We=function(o){return function(t,e){var n,r=String(s(t)),i=nt(e),t=r.length;return i<0||t<=i?o?"":void 0:(e=r.charCodeAt(i))<55296||56319=e.length?{value:void 0,done:!0}:(n=Vn(e,n),t.index+=n.length,{value:n,done:!1})});var Hn={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Gn=Wt("unscopables"),zn=Array.prototype;null==zn[Gn]&&k.f(zn,Gn,{configurable:!0,value:Qt(null)});var Qn=function(t){zn[Gn][t]=!0},Yn="Array Iterator",Xn=lt.set,Jn=lt.getterFor(Yn),$n=xn(Array,"Array",function(t,e){Xn(this,{type:Yn,target:u(t),index:0,kind:e})},function(){var t=Jn(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?{value:t.target=void 0,done:!0}:"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}},"values");Zt.Arguments=Zt.Array,Qn("keys"),Qn("values"),Qn("entries");var Zn,tr=Wt("iterator"),er=Wt("toStringTag"),nr=$n.values;for(Zn in Hn){var rr=b[Zn],ir=rr&&rr.prototype;if(ir){if(ir[tr]!==nr)try{R(ir,tr,nr)}catch(Fs){ir[tr]=nr}if(ir[er]||R(ir,er,Zn),Hn[Zn])for(var or in $n)if(ir[or]!==$n[or])try{R(ir,or,$n[or])}catch(Fs){ir[or]=$n[or]}}}pt.Promise;st({target:"Promise",stat:!0},{try:function(t){var e=Je.f(this),t=Ye(t);return(t.error?e.reject:e.resolve)(t.value),e.promise}});function sr(t,e){var n;return new(void 0===(n=ur(t)&&("function"==typeof(n=t.constructor)&&(n===Array||ur(n.prototype))||y(n)&&null===(n=n[cr]))?void 0:n)?Array:n)(0===e?0:e)}function ar(t){throw t}var ur=Array.isArray||function(t){return"Array"==r(t)},cr=Wt("species"),hr=[].push,lr=function(f){var p=1==f,d=2==f,v=3==f,g=4==f,y=6==f,m=7==f,b=5==f||y;return function(t,e,n,r){for(var i,o,s=at(t),a=_(s),u=zt(e,n,3),c=rt(a.length),h=0,r=r||sr,l=p?r(t,c):d||m?r(t,0):void 0;h>>=1)&&(e+=e))1&r&&(n+=e);return n}});Z("String","repeat");var Yr,Xr=Wt("species"),Jr=Wt("isConcatSpreadable"),$r=9007199254740991,Zr="Maximum allowed index exceeded",lr=51<=un||!g(function(){var t=[];return t[Jr]=!1,t.concat()[0]!==t}),Z=(Yr="concat",51<=un||!g(function(){var t=[];return(t.constructor={})[Xr]=function(){return{foo:1}},1!==t[Yr](Boolean).foo}));st({target:"Array",proto:!0,forced:!lr||!Z},{concat:function(t){for(var e,n,r,i=at(this),o=sr(i,0),s=0,a=-1,u=arguments.length;as[0]&&e[1]=t.length?void 0:t)&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function eo(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||0>6|192:(55296==(64512&i)&&r+1>18|240,e[n++]=i>>12&63|128):e[n++]=i>>12|224,e[n++]=i>>6&63|128),e[n++]=63&i|128)}return e}function io(t){try{return uo.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}var oo={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},so=function(t,e){if(!t)throw ao(e)},ao=function(t){return new Error("Firebase Database ("+oo.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)},uo={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:"function"==typeof atob,encodeByteArray:function(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i>2,o=(3&o)<<4|a>>4,a=(15&a)<<2|c>>6,c=63&c;u||(c=64,s||(a=64)),r.push(n[h],n[o],n[a],n[c])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(ro(t),e)},decodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){for(var e=[],n=0,r=0;n>10)),e[r++]=String.fromCharCode(56320+(1023&i))):(o=t[n++],s=t[n++],e[r++]=String.fromCharCode((15&a)<<12|(63&o)<<6|63&s))}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray:function(t,e){this.init_();for(var n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i>4;r.push(o),64!==a&&(s=s<<4&240|a>>2,r.push(s),64!==u&&(u=a<<6&192|u,r.push(u)))}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var t=0;t=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};function co(t){return ho(void 0,t)}function ho(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n in e)e.hasOwnProperty(n)&&"__proto__"!==n&&(t[n]=ho(t[n],e[n]));return t}var lo=(fo.prototype.wrapCallback=function(n){var r=this;return function(t,e){t?r.reject(t):r.resolve(e),"function"==typeof n&&(r.promise.catch(function(){}),1===n.length?n(t):n(t,e))}},fo);function fo(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}function po(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function vo(){return"undefined"!=typeof window&&(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(po())}function go(){var t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}function yo(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function mo(){return!0===oo.NODE_ADMIN}function bo(){return"indexedDB"in self&&null!=indexedDB}function wo(){return new Promise(function(t,e){try{var n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=window.indexedDB.open(r);i.onsuccess=function(){i.result.close(),n||window.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=function(){n=!1},i.onerror=function(){var t;e((null===(t=i.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})}function _o(){return!(!navigator||!navigator.cookieEnabled)}var Io,To="FirebaseError",Eo=(Xi(So,Io=Error),So);function So(t,e,n){e=Io.call(this,e)||this;return e.code=t,e.customData=n,e.name=To,Object.setPrototypeOf(e,So.prototype),Error.captureStackTrace&&Error.captureStackTrace(e,Co.prototype.create),e}var Co=(No.prototype.create=function(t){for(var e=[],n=1;n"})):"Error",t=this.serviceName+": "+t+" ("+o+").";return new Eo(o,t,i)},No);function No(t,e,n){this.service=t,this.serviceName=e,this.errors=n}var Ao=/\{\$([^}]+)}/g;function ko(t){return JSON.parse(t)}function Ro(t){return JSON.stringify(t)}function Po(t){var e={},n={},r={},i="";try{var o=t.split("."),e=ko(io(o[0])||""),n=ko(io(o[1])||""),i=o[2],r=n.d||{};delete n.d}catch(t){}return{header:e,claims:n,data:r,signature:i}}function Oo(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Do(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e]}function xo(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Lo(t,e,n){var r,i={};for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=e.call(n,t[r],r,t));return i}function Mo(t){for(var n=[],e=0,r=Object.entries(t);e>>31)}for(var o,s=this.chain_[0],a=this.chain_[1],u=this.chain_[2],c=this.chain_[3],h=this.chain_[4],r=0;r<80;r++)var l=r<40?r<20?(o=c^a&(u^c),1518500249):(o=a^u^c,1859775393):r<60?(o=a&u|c&(a|u),2400959708):(o=a^u^c,3395469782),i=(s<<5|s>>>27)+o+h+l+n[r]&4294967295,h=c,c=u,u=4294967295&(a<<30|a>>>2),a=s,s=i;this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+a&4294967295,this.chain_[2]=this.chain_[2]+u&4294967295,this.chain_[3]=this.chain_[3]+c&4294967295,this.chain_[4]=this.chain_[4]+h&4294967295},Uo.prototype.update=function(t,e){if(null!=t){for(var n=(e=void 0===e?t.length:e)-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r>i&255,++r;return t},Uo);function Uo(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(var t=1;t 4. Need to update it?")}t+=" failed: ";return t+=r+" argument "}function Ho(t,e,n,r){if((!r||n)&&"function"!=typeof n)throw new Error(Wo(t,e,r)+"must be a valid function.")}function Go(t,e,n,r){if((!r||n)&&("object"!=typeof n||null===n))throw new Error(Wo(t,e,r)+"must be a valid context object.")}function zo(t){for(var e=0,n=0;n=(null!=o?o:t.logLevel)&&s({level:as[e].toLowerCase(),message:i,args:n,type:t.name})}}(n[t])}var Sn=((G={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",G["bad-app-name"]="Illegal App name: '{$appName}",G["duplicate-app"]="Firebase App named '{$appName}' already exists",G["app-deleted"]="Firebase App named '{$appName}' already deleted",G["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",G["invalid-log-argument"]="First argument to `onLog` must be null or a function.",G),ys=new Co("app","Firebase",Sn),ms="@firebase/app",bs="[DEFAULT]",ws=((z={})[ms]="fire-core",z["@firebase/analytics"]="fire-analytics",z["@firebase/auth"]="fire-auth",z["@firebase/database"]="fire-rtdb",z["@firebase/functions"]="fire-fn",z["@firebase/installations"]="fire-iid",z["@firebase/messaging"]="fire-fcm",z["@firebase/performance"]="fire-perf",z["@firebase/remote-config"]="fire-rc",z["@firebase/storage"]="fire-gcs",z["@firebase/firestore"]="fire-fst",z["fire-js"]="fire-js",z["firebase-wrapper"]="fire-js-all",z),_s=new ps("@firebase/app"),Is=(Object.defineProperty(Ts.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(t){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=t},enumerable:!1,configurable:!0}),Object.defineProperty(Ts.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!1,configurable:!0}),Object.defineProperty(Ts.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!1,configurable:!0}),Ts.prototype.delete=function(){var e=this;return new Promise(function(t){e.checkDestroyed_(),t()}).then(function(){return e.firebase_.INTERNAL.removeApp(e.name_),Promise.all(e.container.getProviders().map(function(t){return t.delete()}))}).then(function(){e.isDeleted_=!0})},Ts.prototype._getService=function(t,e){return void 0===e&&(e=bs),this.checkDestroyed_(),this.container.getProvider(t).getImmediate({identifier:e})},Ts.prototype._removeServiceInstance=function(t,e){void 0===e&&(e=bs),this.container.getProvider(t).clearInstance(e)},Ts.prototype._addComponent=function(e){try{this.container.addComponent(e)}catch(t){_s.debug("Component "+e.name+" failed to register with FirebaseApp "+this.name,t)}},Ts.prototype._addOrOverwriteComponent=function(t){this.container.addOrOverwriteComponent(t)},Ts.prototype.toJSON=function(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}},Ts.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw ys.create("app-deleted",{appName:this.name_})},Ts);function Ts(t,e,n){var r=this;this.firebase_=n,this.isDeleted_=!1,this.name_=e.name,this.automaticDataCollectionEnabled_=e.automaticDataCollectionEnabled||!1,this.options_=co(t),this.container=new os(e.name),this._addComponent(new ts("app",function(){return r},"PUBLIC")),this.firebase_.INTERNAL.components.forEach(function(t){return r._addComponent(t)})}Is.prototype.name&&Is.prototype.options||Is.prototype.delete||console.log("dc");var Es="8.3.2";function Ss(s){var a={},u=new Map,c={__esModule:!0,initializeApp:function(t,e){void 0===e&&(e={});"object"==typeof e&&null!==e||(e={name:e});var n=e;void 0===n.name&&(n.name=bs);e=n.name;if("string"!=typeof e||!e)throw ys.create("bad-app-name",{appName:String(e)});if(Oo(a,e))throw ys.create("duplicate-app",{appName:e});n=new s(t,n,c);return a[e]=n},app:h,registerVersion:function(t,e,n){var r=null!==(i=ws[t])&&void 0!==i?i:t;n&&(r+="-"+n);var i=r.match(/\s|\//),t=e.match(/\s|\//);if(i||t){n=['Unable to register library "'+r+'" with version "'+e+'":'];return i&&n.push('library name "'+r+'" contains illegal characters (whitespace or "/")'),i&&t&&n.push("and"),t&&n.push('version name "'+e+'" contains illegal characters (whitespace or "/")'),void _s.warn(n.join(" "))}o(new ts(r+"-version",function(){return{library:r,version:e}},"VERSION"))},setLogLevel:vs,onLog:function(t,e){if(null!==t&&"function"!=typeof t)throw ys.create("invalid-log-argument");gs(t,e)},apps:null,SDK_VERSION:Es,INTERNAL:{registerComponent:o,removeApp:function(t){delete a[t]},components:u,useAsService:function(t,e){if("serverAuth"===e)return null;return e}}};function h(t){if(!Oo(a,t=t||bs))throw ys.create("no-app",{appName:t});return a[t]}function o(n){var t,r=n.name;if(u.has(r))return _s.debug("There were multiple attempts to register component "+r+"."),"PUBLIC"===n.type?c[r]:null;u.set(r,n),"PUBLIC"===n.type&&(t=function(t){if("function"!=typeof(t=void 0===t?h():t)[r])throw ys.create("invalid-app-argument",{appName:r});return t[r]()},void 0!==n.serviceProps&&ho(t,n.serviceProps),c[r]=t,s.prototype[r]=function(){for(var t=[],e=0;e>>0),r=0;function i(t,e,n){return t.call.apply(t.bind,arguments)}function y(e,n,t){if(!e)throw Error();if(2/g,Z=/"/g,tt=/'/g,et=/\x00/g,nt=/[\x00&<>"']/;function rt(t,e){return-1!=t.indexOf(e)}function it(t,e){return t"}else i=void 0===t?"undefined":null===t?"null":typeof t;O("Argument is not a %s (or a non-Element, non-Location mock); got: %s",e,i)}}function pt(t,e){this.a=t===yt&&e||"",this.b=gt}function dt(t){return t instanceof pt&&t.constructor===pt&&t.b===gt?t.a:(O("expected object of type Const, got '"+t+"'"),"type_error:Const")}pt.prototype.sa=!0,pt.prototype.ra=function(){return this.a},pt.prototype.toString=function(){return"Const{"+this.a+"}"};var vt,gt={},yt={};function mt(){if(void 0===vt){var t=null,e=l.trustedTypes;if(e&&e.createPolicy){try{t=e.createPolicy("goog#html",{createHTML:_,createScript:_,createScriptURL:_})}catch(t){l.console&&l.console.error(t.message)}vt=t}else vt=t}return vt}function bt(t,e){this.a=e===Et?t:""}function wt(t){return t instanceof bt&&t.constructor===bt?t.a:(O("expected object of type TrustedResourceUrl, got '"+t+"' of type "+p(t)),"type_error:TrustedResourceUrl")}function _t(t,n){var e,r=dt(t);if(!Tt.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return t=r.replace(It,function(t,e){if(!Object.prototype.hasOwnProperty.call(n,e))throw Error('Found marker, "'+e+'", in format string, "'+r+'", but no valid label mapping found in args: '+JSON.stringify(n));return(t=n[e])instanceof pt?dt(t):encodeURIComponent(String(t))}),e=t,t=mt(),new bt(e=t?t.createScriptURL(e):e,Et)}bt.prototype.sa=!0,bt.prototype.ra=function(){return this.a.toString()},bt.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var It=/%{(\w+)}/g,Tt=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,Et={};function St(t,e){this.a=e===Ot?t:""}function Ct(t){return t instanceof St&&t.constructor===St?t.a:(O("expected object of type SafeUrl, got '"+t+"' of type "+p(t)),"type_error:SafeUrl")}St.prototype.sa=!0,St.prototype.ra=function(){return this.a.toString()},St.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var Nt=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|font\/\w+|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i,At=/^data:(.*);base64,[a-z0-9+\/]+=*$/i,kt=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function Rt(t){return t instanceof St?t:(t="object"==typeof t&&t.sa?t.ra():String(t),t=kt.test(t)||(e=(t=(t=String(t)).replace(/(%0A|%0D)/g,"")).match(At))&&Nt.test(e[1])?new St(t,Ot):null);var e}function Pt(t){return t instanceof St?t:(t="object"==typeof t&&t.sa?t.ra():String(t),new St(t=!kt.test(t)?"about:invalid#zClosurez":t,Ot))}var Ot={},Dt=new St("about:invalid#zClosurez",Ot);function xt(t,e,n){this.a=n===Lt?t:""}xt.prototype.sa=!0,xt.prototype.ra=function(){return this.a.toString()},xt.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var Lt={};function Mt(t,e,n,r){return t=t instanceof St?t:Pt(t),e=e||l,n=n instanceof pt?dt(n):n||"",e.open(Ct(t),n,r,void 0)}function Ft(t){for(var e=t.split("%s"),n="",r=Array.prototype.slice.call(arguments,1);r.length&&1")?t.replace($,">"):t).indexOf('"')?t.replace(Z,"""):t).indexOf("'")?t.replace(tt,"'"):t).indexOf("\0")&&(t=t.replace(et,"�"))),t}function jt(t){return jt[" "](t),t}jt[" "]=s;var qt,Vt=st("Opera"),Bt=st("Trident")||st("MSIE"),Kt=st("Edge"),Wt=Kt||Bt,Ht=st("Gecko")&&!(rt(Q.toLowerCase(),"webkit")&&!st("Edge"))&&!(st("Trident")||st("MSIE"))&&!st("Edge"),Gt=rt(Q.toLowerCase(),"webkit")&&!st("Edge");function zt(){var t=l.document;return t?t.documentMode:void 0}t:{var Qt="",Yt=(Yt=Q,Ht?/rv:([^\);]+)(\)|;)/.exec(Yt):Kt?/Edge\/([\d\.]+)/.exec(Yt):Bt?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Yt):Gt?/WebKit\/(\S+)/.exec(Yt):Vt?/(?:Version)[ \/]?(\S+)/.exec(Yt):void 0);if(Yt&&(Qt=Yt?Yt[1]:""),Bt){Yt=zt();if(null!=Yt&&Yt>parseFloat(Qt)){qt=String(Yt);break t}}qt=Qt}var Xt={};function Jt(a){return t=a,e=function(){for(var t=0,e=Y(String(qt)).split("."),n=Y(String(a)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i"),r=r.join("")),r=se(n,r),i&&("string"==typeof i?r.className=i:Array.isArray(i)?r.className=i.join(" "):ee(r,i)),2>>0);function hn(e){return v(e)?e:(e[cn]||(e[cn]=function(t){return e.handleEvent(t)}),e[cn])}function ln(){De.call(this),this.v=new ze(this),(this.ac=this).gb=null}function fn(t,e,n,r,i){t.v.add(String(e),n,!1,r,i)}function pn(t,e,n,r,i){t.v.add(String(e),n,!0,r,i)}function dn(t,e,n,r){if(!(e=t.v.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o>4&15).toString(16)+(15&t).toString(16)}Tn.prototype.toString=function(){var t=[],e=this.c;e&&t.push(On(e,xn,!0),":");var n=this.a;return!n&&"file"!=e||(t.push("//"),(e=this.l)&&t.push(On(e,xn,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.g)&&t.push(":",String(n))),(n=this.f)&&(this.a&&"/"!=n.charAt(0)&&t.push("/"),t.push(On(n,"/"==n.charAt(0)?Mn:Ln,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.h)&&t.push("#",On(n,Un)),t.join("")},Tn.prototype.resolve=function(t){var e=new Tn(this),n=!!t.c;n?En(e,t.c):n=!!t.l,n?e.l=t.l:n=!!t.a,n?e.a=t.a:n=null!=t.g;var r=t.f;if(n)Sn(e,t.g);else if(n=!!t.f)if("/"!=r.charAt(0)&&(this.a&&!this.f?r="/"+r:-1!=(i=e.f.lastIndexOf("/"))&&(r=e.f.substr(0,i+1)+r)),".."==(i=r)||"."==i)r="";else if(rt(i,"./")||rt(i,"/.")){for(var r=0==i.lastIndexOf("/",0),i=i.split("/"),o=[],s=0;s2*t.c&&wn(t)))}function Kn(t,e){return qn(t),e=Gn(t,e),_n(t.a.b,e)}function Wn(t,e,n){Bn(t,e),0',t=new xt(t=(r=mt())?r.createHTML(t):t,0,Lt),r=s.document)&&(r.write((o=t)instanceof xt&&o.constructor===xt?o.a:(O("expected object of type SafeHtml, got '"+o+"' of type "+p(o)),"type_error:SafeHtml")),r.close())):(s=Mt(e,r,n,s))&&t.noopener&&(s.opener=null),s)try{s.focus()}catch(t){}return s}var ir=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,or=/^[^@]+@[^@]+$/;function sr(){var e=null;return new fe(function(t){"complete"==l.document.readyState?t():(e=function(){t()},tn(window,"load",e))}).o(function(t){throw en(window,"load",e),t})}function ar(t){return t=t||yr(),!("file:"!==Ir()&&"ionic:"!==Ir()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function ur(){var t=l.window;try{return t&&t!=t.top}catch(t){return}}function cr(){return void 0!==l.WorkerGlobalScope&&"function"==typeof l.importScripts}function hr(){return Xl.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":Xl.INTERNAL.hasOwnProperty("node")?"Node":cr()?"Worker":"Browser"}function lr(){var t=hr();return"ReactNative"===t||"Node"===t}var fr="Firefox",pr="Chrome";function dr(t){var e=t.toLowerCase();return rt(e,"opera/")||rt(e,"opr/")||rt(e,"opios/")?"Opera":rt(e,"iemobile")?"IEMobile":rt(e,"msie")||rt(e,"trident/")?"IE":rt(e,"edge/")?"Edge":rt(e,"firefox/")?fr:rt(e,"silk/")?"Silk":rt(e,"blackberry")?"Blackberry":rt(e,"webos")?"Webos":!rt(e,"safari/")||rt(e,"chrome/")||rt(e,"crios/")||rt(e,"android")?!rt(e,"chrome/")&&!rt(e,"crios/")||rt(e,"edge/")?rt(e,"android")?"Android":(t=t.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==t.length?t[1]:"Other":pr:"Safari"}var vr={md:"FirebaseCore-web",od:"FirebaseUI-web"};function gr(t,e){e=e||[];var n,r=[],i={};for(n in vr)i[vr[n]]=!0;for(n=0;n>4),64!=s&&(t(o<<4&240|s>>2),64!=a&&t(s<<6&192|a))}}(t,function(t){e.push(t)}),e}function Oi(t){var e=xi(t);if(!(e&&e.sub&&e.iss&&e.aud&&e.exp))throw Error("Invalid JWT");this.h=t,this.a=e.exp,this.i=e.sub,t=Date.now()/1e3,this.g=e.iat||(t>this.a?this.a:t),this.b=e.provider_id||e.firebase&&e.firebase.sign_in_provider||null,this.f=e.firebase&&e.firebase.tenant||null,this.c=!!e.is_anonymous||"anonymous"==this.b}function Di(t){try{return new Oi(t)}catch(t){return null}}function xi(t){if(!t)return null;if(3!=(t=t.split(".")).length)return null;for(var e=(4-(t=t[1]).length%4)%4,n=0;n>10)),t[n++]=String.fromCharCode(56320+(1023&s))):(i=r[e++],o=r[e++],t[n++]=String.fromCharCode((15&a)<<12|(63&i)<<6|63&o))}return JSON.parse(t.join(""))}catch(t){}return null}Oi.prototype.T=function(){return this.f},Oi.prototype.l=function(){return this.c},Oi.prototype.toString=function(){return this.h};var Li="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),Mi=["client_id","response_type","scope","redirect_uri","state"],Fi={nd:{Ja:"locale",ua:700,ta:600,fa:"facebook.com",Xa:Mi},pd:{Ja:null,ua:500,ta:750,fa:"github.com",Xa:Mi},qd:{Ja:"hl",ua:515,ta:680,fa:"google.com",Xa:Mi},wd:{Ja:"lang",ua:485,ta:705,fa:"twitter.com",Xa:Li},kd:{Ja:"locale",ua:640,ta:600,fa:"apple.com",Xa:[]}};function Ui(t){for(var e in Fi)if(Fi[e].fa==t)return Fi[e];return null}function ji(t){var e={};e["facebook.com"]=Wi,e["google.com"]=Gi,e["github.com"]=Hi,e["twitter.com"]=zi;var n=t&&t[Vi];try{if(n)return new(e[n]||Ki)(t);if(void 0!==t[qi])return new Bi(t)}catch(t){}return null}var qi="idToken",Vi="providerId";function Bi(t){var e,n=t[Vi];if(n||!t[qi]||(e=Di(t[qi]))&&e.b&&(n=e.b),!n)throw Error("Invalid additional user info!");"anonymous"!=n&&"custom"!=n||(n=null),e=!1,void 0!==t.isNewUser?e=!!t.isNewUser:"identitytoolkit#SignupNewUserResponse"===t.kind&&(e=!0),jr(this,"providerId",n),jr(this,"isNewUser",e)}function Ki(t){Bi.call(this,t),jr(this,"profile",Br((t=Cr(t.rawUserInfo||"{}"))||{}))}function Wi(t){if(Ki.call(this,t),"facebook.com"!=this.providerId)throw Error("Invalid provider ID!")}function Hi(t){if(Ki.call(this,t),"github.com"!=this.providerId)throw Error("Invalid provider ID!");jr(this,"username",this.profile&&this.profile.login||null)}function Gi(t){if(Ki.call(this,t),"google.com"!=this.providerId)throw Error("Invalid provider ID!")}function zi(t){if(Ki.call(this,t),"twitter.com"!=this.providerId)throw Error("Invalid provider ID!");jr(this,"username",t.screenName||null)}function Qi(t){var e=An(r=kn(t),"link"),n=An(kn(e),"link"),r=An(r,"deep_link_id");return An(kn(r),"link")||r||n||e||t}function Yi(t,e){if(!t&&!e)throw new I("internal-error","Internal assert: no raw session string available");if(t&&e)throw new I("internal-error","Internal assert: unable to determine the session type");this.a=t||null,this.b=e||null,this.type=this.a?Xi:Ji}w(Ki,Bi),w(Wi,Ki),w(Hi,Ki),w(Gi,Ki),w(zi,Ki);var Xi="enroll",Ji="signin";function $i(){}function Zi(t,n){return t.then(function(t){if(t[Bs]){var e=Di(t[Bs]);if(!e||n!=e.i)throw new I("user-mismatch");return t}throw new I("user-mismatch")}).o(function(t){throw t&&t.code&&t.code==S+"user-not-found"?new I("user-mismatch"):t})}function to(t,e){if(!e)throw new I("internal-error","failed to construct a credential");this.a=e,jr(this,"providerId",t),jr(this,"signInMethod",t)}function eo(t){return{pendingToken:t.a,requestUri:"http://localhost"}}function no(t){if(t&&t.providerId&&t.signInMethod&&0==t.providerId.indexOf("saml.")&&t.pendingToken)try{return new to(t.providerId,t.pendingToken)}catch(t){}return null}function ro(t,e,n){if(this.a=null,e.idToken||e.accessToken)e.idToken&&jr(this,"idToken",e.idToken),e.accessToken&&jr(this,"accessToken",e.accessToken),e.nonce&&!e.pendingToken&&jr(this,"nonce",e.nonce),e.pendingToken&&(this.a=e.pendingToken);else{if(!e.oauthToken||!e.oauthTokenSecret)throw new I("internal-error","failed to construct a credential");jr(this,"accessToken",e.oauthToken),jr(this,"secret",e.oauthTokenSecret)}jr(this,"providerId",t),jr(this,"signInMethod",n)}function io(t){var e={};return t.idToken&&(e.id_token=t.idToken),t.accessToken&&(e.access_token=t.accessToken),t.secret&&(e.oauth_token_secret=t.secret),e.providerId=t.providerId,t.nonce&&!t.a&&(e.nonce=t.nonce),e={postBody:Vn(e).toString(),requestUri:"http://localhost"},t.a&&(delete e.postBody,e.pendingToken=t.a),e}function oo(t){if(t&&t.providerId&&t.signInMethod){var e={idToken:t.oauthIdToken,accessToken:t.oauthTokenSecret?null:t.oauthAccessToken,oauthTokenSecret:t.oauthTokenSecret,oauthToken:t.oauthTokenSecret&&t.oauthAccessToken,nonce:t.nonce,pendingToken:t.pendingToken};try{return new ro(t.providerId,e,t.signInMethod)}catch(t){}}return null}function so(t,e){this.Qc=e||[],qr(this,{providerId:t,isOAuthProvider:!0}),this.Ib={},this.pb=(Ui(t)||{}).Ja||null,this.ob=null}function ao(t){if("string"!=typeof t||0!=t.indexOf("saml."))throw new I("argument-error",'SAML provider IDs must be prefixed with "saml."');so.call(this,t,[])}function uo(t){so.call(this,t,Mi),this.a=[]}function co(){uo.call(this,"facebook.com")}function ho(t){if(!t)throw new I("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return g(t)&&(e=t.accessToken),(new co).credential({accessToken:e})}function lo(){uo.call(this,"github.com")}function fo(t){if(!t)throw new I("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return g(t)&&(e=t.accessToken),(new lo).credential({accessToken:e})}function po(){uo.call(this,"google.com"),this.Ca("profile")}function vo(t,e){var n=t;return g(t)&&(n=t.idToken,e=t.accessToken),(new po).credential({idToken:n,accessToken:e})}function go(){so.call(this,"twitter.com",Li)}function yo(t,e){var n=t;if(!(n=!g(n)?{oauthToken:t,oauthTokenSecret:e}:n).oauthToken||!n.oauthTokenSecret)throw new I("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new ro("twitter.com",n,"twitter.com")}function mo(t,e,n){this.a=t,this.f=e,jr(this,"providerId","password"),jr(this,"signInMethod",n===wo.EMAIL_LINK_SIGN_IN_METHOD?wo.EMAIL_LINK_SIGN_IN_METHOD:wo.EMAIL_PASSWORD_SIGN_IN_METHOD)}function bo(t){return t&&t.email&&t.password?new mo(t.email,t.password,t.signInMethod):null}function wo(){qr(this,{providerId:"password",isOAuthProvider:!1})}function _o(t,e){if(!(e=Io(e)))throw new I("argument-error","Invalid email link!");return new mo(t,e.code,wo.EMAIL_LINK_SIGN_IN_METHOD)}function Io(t){return(t=mi(t=Qi(t)))&&t.operation===$r?t:null}function To(t){if(!(t.eb&&t.cb||t.La&&t.ea))throw new I("internal-error");this.a=t,jr(this,"providerId","phone"),this.fa="phone",jr(this,"signInMethod","phone")}function Eo(e){if(e&&"phone"===e.providerId&&(e.verificationId&&e.verificationCode||e.temporaryProof&&e.phoneNumber)){var n={};return j(["verificationId","verificationCode","temporaryProof","phoneNumber"],function(t){e[t]&&(n[t]=e[t])}),new To(n)}return null}function So(t){return t.a.La&&t.a.ea?{temporaryProof:t.a.La,phoneNumber:t.a.ea}:{sessionInfo:t.a.eb,code:t.a.cb}}function Co(t){try{this.a=t||Xl.auth()}catch(t){throw new I("argument-error","Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().")}qr(this,{providerId:"phone",isOAuthProvider:!1})}function No(t,e){if(!t)throw new I("missing-verification-id");if(!e)throw new I("missing-verification-code");return new To({eb:t,cb:e})}function Ao(t){if(t.temporaryProof&&t.phoneNumber)return new To({La:t.temporaryProof,ea:t.phoneNumber});var e=t&&t.providerId;if(!e||"password"===e)return null;var n=t&&t.oauthAccessToken,r=t&&t.oauthTokenSecret,i=t&&t.nonce,o=t&&t.oauthIdToken,s=t&&t.pendingToken;try{switch(e){case"google.com":return vo(o,n);case"facebook.com":return ho(n);case"github.com":return fo(n);case"twitter.com":return yo(n,r);default:return n||r||o||s?s?0==e.indexOf("saml.")?new to(e,s):new ro(e,{pendingToken:s,idToken:t.oauthIdToken,accessToken:t.oauthAccessToken},e):new uo(e).credential({idToken:o,accessToken:n,rawNonce:i}):null}}catch(t){return null}}function ko(t){if(!t.isOAuthProvider)throw new I("invalid-oauth-provider")}function Ro(t,e,n,r,i,o,s){if(this.c=t,this.b=e||null,this.g=n||null,this.f=r||null,this.i=o||null,this.h=s||null,this.a=i||null,!this.g&&!this.a)throw new I("invalid-auth-event");if(this.g&&this.a)throw new I("invalid-auth-event");if(this.g&&!this.f)throw new I("invalid-auth-event")}function Po(t){return(t=t||{}).type?new Ro(t.type,t.eventId,t.urlResponse,t.sessionId,t.error&&T(t.error),t.postBody,t.tenantId):null}function Oo(){this.b=null,this.a=[]}Yi.prototype.Ha=function(){return this.a?be(this.a):be(this.b)},Yi.prototype.w=function(){return this.type==Xi?{multiFactorSession:{idToken:this.a}}:{multiFactorSession:{pendingCredential:this.b}}},$i.prototype.ka=function(){},$i.prototype.b=function(){},$i.prototype.c=function(){},$i.prototype.w=function(){},to.prototype.ka=function(t){return ha(t,eo(this))},to.prototype.b=function(t,e){var n=eo(this);return n.idToken=e,la(t,n)},to.prototype.c=function(t,e){return Zi(fa(t,eo(this)),e)},to.prototype.w=function(){return{providerId:this.providerId,signInMethod:this.signInMethod,pendingToken:this.a}},ro.prototype.ka=function(t){return ha(t,io(this))},ro.prototype.b=function(t,e){var n=io(this);return n.idToken=e,la(t,n)},ro.prototype.c=function(t,e){return Zi(fa(t,io(this)),e)},ro.prototype.w=function(){var t={providerId:this.providerId,signInMethod:this.signInMethod};return this.idToken&&(t.oauthIdToken=this.idToken),this.accessToken&&(t.oauthAccessToken=this.accessToken),this.secret&&(t.oauthTokenSecret=this.secret),this.nonce&&(t.nonce=this.nonce),this.a&&(t.pendingToken=this.a),t},so.prototype.Ka=function(t){return this.Ib=ct(t),this},w(ao,so),w(uo,so),uo.prototype.Ca=function(t){return K(this.a,t)||this.a.push(t),this},uo.prototype.Qb=function(){return z(this.a)},uo.prototype.credential=function(t,e){e=g(t)?{idToken:t.idToken||null,accessToken:t.accessToken||null,nonce:t.rawNonce||null}:{idToken:t||null,accessToken:e||null};if(!e.idToken&&!e.accessToken)throw new I("argument-error","credential failed: must provide the ID token and/or the access token.");return new ro(this.providerId,e,this.providerId)},w(co,uo),jr(co,"PROVIDER_ID","facebook.com"),jr(co,"FACEBOOK_SIGN_IN_METHOD","facebook.com"),w(lo,uo),jr(lo,"PROVIDER_ID","github.com"),jr(lo,"GITHUB_SIGN_IN_METHOD","github.com"),w(po,uo),jr(po,"PROVIDER_ID","google.com"),jr(po,"GOOGLE_SIGN_IN_METHOD","google.com"),w(go,so),jr(go,"PROVIDER_ID","twitter.com"),jr(go,"TWITTER_SIGN_IN_METHOD","twitter.com"),mo.prototype.ka=function(t){return this.signInMethod==wo.EMAIL_LINK_SIGN_IN_METHOD?za(t,wa,{email:this.a,oobCode:this.f}):za(t,Ba,{email:this.a,password:this.f})},mo.prototype.b=function(t,e){return this.signInMethod==wo.EMAIL_LINK_SIGN_IN_METHOD?za(t,_a,{idToken:e,email:this.a,oobCode:this.f}):za(t,xa,{idToken:e,email:this.a,password:this.f})},mo.prototype.c=function(t,e){return Zi(this.ka(t),e)},mo.prototype.w=function(){return{email:this.a,password:this.f,signInMethod:this.signInMethod}},qr(wo,{PROVIDER_ID:"password"}),qr(wo,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),qr(wo,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"}),To.prototype.ka=function(t){return t.fb(So(this))},To.prototype.b=function(t,e){var n=So(this);return n.idToken=e,za(t,Wa,n)},To.prototype.c=function(t,e){var n=So(this);return n.operation="REAUTH",Zi(t=za(t,Ha,n),e)},To.prototype.w=function(){var t={providerId:"phone"};return this.a.eb&&(t.verificationId=this.a.eb),this.a.cb&&(t.verificationCode=this.a.cb),this.a.La&&(t.temporaryProof=this.a.La),this.a.ea&&(t.phoneNumber=this.a.ea),t},Co.prototype.fb=function(r,i){var o=this.a.a;return be(i.verify()).then(function(n){if("string"!=typeof n)throw new I("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");if("recaptcha"!==i.type)throw new I("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.');var t=g(r)?r.session:null,e=g(r)?r.phoneNumber:r,t=t&&t.type==Xi?t.Ha().then(function(t){return za(o,Ma,{idToken:t,phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:n}}).then(function(t){return t.phoneSessionInfo.sessionInfo})}):t&&t.type==Ji?t.Ha().then(function(t){return e=o,t={mfaPendingCredential:t,mfaEnrollmentId:r.multiFactorHint&&r.multiFactorHint.uid||r.multiFactorUid,phoneSignInInfo:{recaptchaToken:n}},za(e,Fa,t).then(function(t){return t.phoneResponseInfo.sessionInfo});var e}):za(o,Oa,{phoneNumber:e,recaptchaToken:n});return t.then(function(t){return"function"==typeof i.reset&&i.reset(),t},function(t){throw"function"==typeof i.reset&&i.reset(),t})})},qr(Co,{PROVIDER_ID:"phone"}),qr(Co,{PHONE_SIGN_IN_METHOD:"phone"}),Ro.prototype.getUid=function(){var t=[];return t.push(this.c),this.b&&t.push(this.b),this.f&&t.push(this.f),this.h&&t.push(this.h),t.join("-")},Ro.prototype.T=function(){return this.h},Ro.prototype.w=function(){return{type:this.c,eventId:this.b,urlResponse:this.g,sessionId:this.f,postBody:this.i,tenantId:this.h,error:this.a&&this.a.w()}};var Do,xo=null;function Lo(t){var e="unauthorized-domain",n=void 0,r=kn(t);t=r.a,"chrome-extension"==(r=r.c)?n=Ft("This chrome extension ID (chrome-extension://%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",t):"http"==r||"https"==r?n=Ft("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",t):e="operation-not-supported-in-this-environment",I.call(this,e,n)}function Mo(t,e,n){I.call(this,t,n),(t=e||{}).Jb&&jr(this,"email",t.Jb),t.ea&&jr(this,"phoneNumber",t.ea),t.credential&&jr(this,"credential",t.credential),t.Zb&&jr(this,"tenantId",t.Zb)}function Fo(t){if(t.code){var e=t.code||"";0==e.indexOf(S)&&(e=e.substring(S.length));var n={credential:Ao(t),Zb:t.tenantId};if(t.email)n.Jb=t.email;else if(t.phoneNumber)n.ea=t.phoneNumber;else if(!n.credential)return new I(e,t.message||void 0);return new Mo(e,n,t.message)}return null}function Uo(){}function jo(t){return t.c||(t.c=t.b())}function qo(){}function Vo(t){if(t.f||"undefined"!=typeof XMLHttpRequest||"undefined"==typeof ActiveXObject)return t.f;for(var e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],n=0;n=function t(e){return e.c||(e.a?t(e.a):(O("Root logger has no level set."),null))}(this).value)for(v(e)&&(e=e()),t=new Ho(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var $o,Zo={},ts=null;function es(t){var e,n,r;return ts||(ts=new Go(""),(Zo[""]=ts).c=Xo),(e=Zo[t])||(e=new Go(t),r=t.lastIndexOf("."),n=t.substr(r+1),(r=es(t.substr(0,r))).b||(r.b={}),(r.b[n]=e).a=r,Zo[t]=e),e}function ns(t,e){t&&t.log(Jo,e,void 0)}function rs(t){this.f=t}function is(t){ln.call(this),this.u=t,this.h=void 0,this.readyState=os,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.l=new Headers,this.b=null,this.s="GET",this.f="",this.a=!1,this.i=es("goog.net.FetchXmlHttp"),this.m=this.c=this.g=null}w(rs,Uo),rs.prototype.a=function(){return new is(this.f)},rs.prototype.b=($o={},function(){return $o}),w(is,ln);var os=0;function ss(t){t.c.read().then(t.pc.bind(t)).catch(t.Ua.bind(t))}function as(t){t.readyState=4,t.g=null,t.c=null,t.m=null,us(t)}function us(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function cs(t){ln.call(this),this.headers=new bn,this.D=t||null,this.c=!1,this.C=this.a=null,this.h=this.R=this.l="",this.f=this.O=this.i=this.J=!1,this.g=0,this.s=null,this.m=hs,this.u=this.S=!1}(t=is.prototype).open=function(t,e){if(this.readyState!=os)throw this.abort(),Error("Error reopening a connection");this.s=t,this.f=e,this.readyState=1,us(this)},t.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.a=!0;var e={headers:this.l,method:this.s,credentials:this.h,cache:void 0};t&&(e.body=t),this.u.fetch(new Request(this.f,e)).then(this.uc.bind(this),this.Ua.bind(this))},t.abort=function(){this.response=this.responseText="",this.l=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&4!=this.readyState&&(this.a=!1,as(this)),this.readyState=os},t.uc=function(t){this.a&&(this.g=t,this.b||(this.status=this.g.status,this.statusText=this.g.statusText,this.b=t.headers,this.readyState=2,us(this)),this.a&&(this.readyState=3,us(this),this.a&&("arraybuffer"===this.responseType?t.arrayBuffer().then(this.sc.bind(this),this.Ua.bind(this)):void 0!==l.ReadableStream&&"body"in t?(this.response=this.responseText="",this.c=t.body.getReader(),this.m=new TextDecoder,ss(this)):t.text().then(this.tc.bind(this),this.Ua.bind(this)))))},t.pc=function(t){var e;this.a&&((e=this.m.decode(t.value||new Uint8Array(0),{stream:!t.done}))&&(this.response=this.responseText+=e),(t.done?as:us)(this),3==this.readyState&&ss(this))},t.tc=function(t){this.a&&(this.response=this.responseText=t,as(this))},t.sc=function(t){this.a&&(this.response=t,as(this))},t.Ua=function(t){var e=this.i;e&&e.log(Yo,"Failed to fetch url "+this.f,t instanceof Error?t:Error(t)),this.a&&as(this)},t.setRequestHeader=function(t,e){this.l.append(t,e)},t.getResponseHeader=function(t){return this.b?this.b.get(t.toLowerCase())||"":((t=this.i)&&t.log(Yo,"Attempting to get response header but no headers have been received for url: "+this.f,void 0),"")},t.getAllResponseHeaders=function(){if(!this.b){var t=this.i;return t&&t.log(Yo,"Attempting to get all response headers but no headers have been received for url: "+this.f,void 0),""}for(var t=[],e=this.b.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(is.prototype,"withCredentials",{get:function(){return"include"===this.h},set:function(t){this.h=t?"include":"same-origin"}}),w(cs,ln);var hs="";cs.prototype.b=es("goog.net.XhrIo");var ls=/^https?$/i,fs=["POST","PUT"];function ps(e,t,n,r,i){if(e.a)throw Error("[goog.net.XhrIo] Object is active with another request="+e.l+"; newUri="+t);n=n?n.toUpperCase():"GET",e.l=t,e.h="",e.R=n,e.J=!1,e.c=!0,e.a=(e.D||Do).a(),e.C=e.D?jo(e.D):jo(Do),e.a.onreadystatechange=m(e.Vb,e);try{ns(e.b,Is(e,"Opening Xhr")),e.O=!0,e.a.open(n,String(t),!0),e.O=!1}catch(t){return ns(e.b,Is(e,"Error opening Xhr: "+t.message)),void vs(e,t)}t=r||"";var o,s=new bn(e.headers);i&&function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(d(t)||"string"==typeof t)j(t,e,void 0);else for(var n=mn(t),r=yn(t),i=r.length,o=0;o>>7|i<<25)^(i>>>18|i<<14)^i>>>3)|0,s=(0|n[e-7])+((r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)|0;n[e]=o+s|0}r=0|t.a[0],i=0|t.a[1];var a=0|t.a[2],u=0|t.a[3],c=0|t.a[4],h=0|t.a[5],l=0|t.a[6];for(o=0|t.a[7],e=0;e<64;e++){var f=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&i^r&a^i&a)|0;s=(o=o+((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))|0)+((s=(s=c&h^~c&l)+(0|Ju[e])|0)+(0|n[e])|0)|0,o=l,l=h,h=c,c=u+s|0,u=a,a=i,i=r,r=s+f|0}t.a[0]=t.a[0]+r|0,t.a[1]=t.a[1]+i|0,t.a[2]=t.a[2]+a|0,t.a[3]=t.a[3]+u|0,t.a[4]=t.a[4]+c|0,t.a[5]=t.a[5]+h|0,t.a[6]=t.a[6]+l|0,t.a[7]=t.a[7]+o|0}function ac(t,e,n){void 0===n&&(n=e.length);var r=0,i=t.c;if("string"==typeof e)for(;r>i&255;return V(t,function(t){return 1<(t=t.toString(16)).length?t:"0"+t}).join("")}function dc(t,e){for(var n=0;nt.f&&(t.a=t.f),e)}function ih(t){this.f=t,this.b=this.a=null,this.c=Date.now()}function oh(t,e){void 0===e&&(e=t.b?(e=t.b).a-e.g:0),t.c=Date.now()+1e3*e}function sh(t,e){t.b=Di(e[Bs]||""),t.a=e.refreshToken,oh(t,void 0!==(e=e.expiresIn)?Number(e):void 0)}function ah(e,t){return r=e.f,i=t,new fe(function(e,n){"refresh_token"==i.grant_type&&i.refresh_token||"authorization_code"==i.grant_type&&i.code?Js(r,r.l+"?key="+encodeURIComponent(r.c),function(t){t?t.error?n(Ya(t)):t.access_token&&t.refresh_token?e(t):n(new I("internal-error")):n(new I("network-request-failed"))},"POST",Vn(i).toString(),r.g,r.m.get()):n(new I("internal-error"))}).then(function(t){return e.b=Di(t.access_token),e.a=t.refresh_token,oh(e,t.expires_in),{accessToken:e.b.toString(),refreshToken:e.a}}).o(function(t){throw"auth/user-token-expired"==t.code&&(e.a=null),t});var r,i}function uh(t,e){this.a=t||null,this.b=e||null,qr(this,{lastSignInTime:Dr(e||null),creationTime:Dr(t||null)})}function ch(t,e,n,r,i,o){qr(this,{uid:t,displayName:r||null,photoURL:i||null,email:n||null,phoneNumber:o||null,providerId:e})}function hh(t,e,n){this.J=[],this.l=t.apiKey,this.m=t.appName,this.s=t.authDomain||null;var r,i=Xl.SDK_VERSION?gr(Xl.SDK_VERSION):null;this.a=new qs(this.l,A(E),i),t.emulatorConfig&&Qs(this.a,t.emulatorConfig),this.b=new ih(this.a),mh(this,e[Bs]),sh(this.b,e),jr(this,"refreshToken",this.b.a),_h(this,n||{}),ln.call(this),this.R=!1,this.s&&wr()&&(this.i=xc(this.s,this.l,this.m)),this.S=[],this.h=null,this.u=(r=this,new nh(function(){return r.I(!0)},function(t){return!(!t||"auth/network-request-failed"!=t.code)},function(){var t=r.b.c-Date.now()-3e5;return 0this.c-3e4?this.a?ah(this,{grant_type:"refresh_token",refresh_token:this.a}):be(null):be({accessToken:this.b.toString(),refreshToken:this.a})},uh.prototype.w=function(){return{lastLoginAt:this.b,createdAt:this.a}},w(hh,ln),hh.prototype.wa=function(t){this.ya=t,zs(this.a,t)},hh.prototype.la=function(){return this.ya},hh.prototype.Ga=function(){return z(this.$)},hh.prototype.hb=function(){this.u.b&&(this.u.stop(),this.u.start())},jr(hh.prototype,"providerId","firebase"),(t=hh.prototype).reload=function(){var t=this;return Fh(this,Th(this).then(function(){return kh(t).then(function(){return bh(t)}).then(Ih)}))},t.oc=function(t){return this.I(t).then(function(t){return new Wc(t)})},t.I=function(t){var e=this;return Fh(this,Th(this).then(function(){return e.b.getToken(t)}).then(function(t){if(!t)throw new I("internal-error");return t.accessToken!=e.za&&(mh(e,t.accessToken),e.dispatchEvent(new Zc("tokenChanged"))),Nh(e,"refreshToken",t.refreshToken),t.accessToken}))},t.Kc=function(t){if(!(t=t.users)||!t.length)throw new I("internal-error");_h(this,{uid:(t=t[0]).localId,displayName:t.displayName,photoURL:t.photoUrl,email:t.email,emailVerified:!!t.emailVerified,phoneNumber:t.phoneNumber,lastLoginAt:t.lastLoginAt,createdAt:t.createdAt,tenantId:t.tenantId});for(var e,n=(e=(e=t).providerUserInfo)&&e.length?V(e,function(t){return new ch(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)}):[],r=0;r=Dl.length)throw new I("internal-error","Argument validator received an unsupported number of arguments.");n=Dl[i],r=(r?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.K+".";break t}r=null}}if(r)throw new I("argument-error",t+" failed: "+r)}(t=Tl.prototype).Ia=function(){var e=this;return this.f||(this.f=kl(this,be().then(function(){if(_r()&&!cr())return sr();throw new I("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")}).then(function(){return e.m.g(e.u())}).then(function(t){return e.g=t,za(e.s,Ra,{})}).then(function(t){e.a[Cl]=t.recaptchaSiteKey}).o(function(t){throw e.f=null,t})))},t.render=function(){Rl(this);var n=this;return kl(this,this.Ia().then(function(){var t,e;return null===n.c&&(e=n.v,n.i||(t=te(e),e=oe("DIV"),t.appendChild(e)),n.c=n.g.render(e,n.a)),n.c}))},t.verify=function(){Rl(this);var i=this;return kl(this,this.render().then(function(e){return new fe(function(n){var r,t=i.g.getResponse(e);t?n(t):(r=function(t){var e;t&&(e=r,H(i.l,function(t){return t==e}),n(t))},i.l.push(r),i.i&&i.g.execute(i.c))})}))},t.reset=function(){Rl(this),null!==this.c&&this.g.reset(this.c)},t.clear=function(){Rl(this),this.D=!0,this.m.c();for(var t,e=0;e>6|192:(o<65536?e[n++]=o>>12|224:(e[n++]=o>>18|240,e[n++]=o>>12&63|128),e[n++]=o>>6&63|128),e[n++]=63&o|128)}return e}(t);return(t=new Fo).update(e),t=t.digest(),uo.encodeByteArray(t)}function Ms(t,e){so(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(Hs.logLevel=as.VERBOSE,Qs=Hs.log.bind(Hs),e&&Ws.set("logging_enabled",!0)):"function"==typeof t?Qs=t:(Qs=null,Ws.remove("logging_enabled"))}function Fs(){for(var t=[],e=0;e=Math.pow(2,-1022)?(n=(i=Math.min(Math.floor(Math.log(t)/Math.LN2),1023))+1023,Math.round(t*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,Math.round(t/Math.pow(2,-1074))));for(var o=[],s=52;s;--s)o.push(r%2?1:0),r=Math.floor(r/2);for(s=11;s;--s)o.push(n%2?1:0),n=Math.floor(n/2);o.push(e?1:0),o.reverse();var a=o.join(""),u="";for(s=0;s<64;s+=8){var c=parseInt(a.substr(s,8),2).toString(16);u+=c=1===c.length?"0"+c:c}return u.toLowerCase()}function sa(t,e){return"object"==typeof(e=setTimeout(t,e))&&e.unref&&e.unref(),e}var aa=function(t,e){var n="Unknown Error";"too_big"===t?n="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"===t?n="Client doesn't have permission to access the desired data.":"unavailable"===t&&(n="The service is unavailable");n=new Error(t+" at "+e.path.toString()+": "+n);return n.code=t.toUpperCase(),n},ua=new RegExp("^-?(0*)\\d{1,10}$"),ca=-2147483648,ha=2147483647,la=function(t){if(ua.test(t)){t=Number(t);if(ca<=t&&t<=ha)return t}return null},fa=function(t){try{t()}catch(e){setTimeout(function(){var t=e.stack||"";throw Zs("Exception was thrown by user callback.",t),e},Math.floor(0))}},pa=(da.prototype.getToken=function(t){return this.auth_?this.auth_.getToken(t).catch(function(t){return t&&"auth/token-not-initialized"===t.code?(Xs("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(t)}):Promise.resolve(null)},da.prototype.addTokenChangeListener=function(e){this.auth_?this.auth_.addAuthTokenListener(e):(setTimeout(function(){return e(null)},0),this.authProvider_.get().then(function(t){return t.addAuthTokenListener(e)}))},da.prototype.removeTokenChangeListener=function(e){this.authProvider_.get().then(function(t){return t.removeAuthTokenListener(e)})},da.prototype.notifyForInvalidToken=function(){var t='Provided authentication credentials for the app named "'+this.app_.name+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.app_.options?t+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.app_.options?t+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':t+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',Zs(t)},da);function da(t,e){var n=this;this.app_=t,this.authProvider_=e,this.auth_=null,this.auth_=e.getImmediate({optional:!0}),this.auth_||e.get().then(function(t){return n.auth_=t})}var va=(ga.prototype.getToken=function(t){return Promise.resolve({accessToken:ga.EMULATOR_AUTH_TOKEN})},ga.prototype.addTokenChangeListener=function(t){t(ga.EMULATOR_AUTH_TOKEN)},ga.prototype.removeTokenChangeListener=function(t){},ga.prototype.notifyForInvalidToken=function(){},ga.EMULATOR_AUTH_TOKEN="owner",ga);function ga(){}var ya=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,ma="websocket",ba="long_polling",wa=(_a.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},_a.prototype.isCustomHost=function(){return"firebaseio.com"!==this._domain&&"firebaseio-demo.com"!==this._domain},Object.defineProperty(_a.prototype,"host",{get:function(){return this._host},set:function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&Ks.set("host:"+this._host,this.internalHost))},enumerable:!1,configurable:!0}),_a.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},_a.prototype.toURLString=function(){var t=this.secure?"https://":"http://",e=this.includeNamespaceInQueryParams?"?ns="+this.namespace:"";return t+this.host+"/"+e},_a);function _a(t,e,n,r,i,o,s){void 0===i&&(i=!1),void 0===o&&(o=""),void 0===s&&(s=!1),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.nodeAdmin=i,this.persistenceKey=o,this.includeNamespaceInQueryParams=s,this._host=t.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=Ks.get("host:"+t)||this._host}function Ia(t,e,n){var r;if(so("string"==typeof e,"typeof type must == string"),so("object"==typeof n,"typeof params must == object"),e===ma)r=(t.secure?"wss://":"ws://")+t.internalHost+"/.ws?";else{if(e!==ba)throw new Error("Unknown connection type: "+e);r=(t.secure?"https://":"http://")+t.internalHost+"/.lp?"}((e=t).host!==e.internalHost||e.isCustomHost()||e.includeNamespaceInQueryParams)&&(n.ns=t.namespace);var i=[];return ia(n,function(t,e){i.push(t+"="+e)}),r+i.join("&")}var Ta=(Ea.prototype.incrementCounter=function(t,e){void 0===e&&(e=1),Oo(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=e},Ea.prototype.get=function(){return co(this.counters_)},Ea);function Ea(){this.counters_={}}var Sa={},Ca={};function Na(t){t=t.toString();return Sa[t]||(Sa[t]=new Ta),Sa[t]}var Aa=(ka.prototype.closeAfter=function(t,e){this.closeAfterResponse=t,this.onClose=e,this.closeAfterResponsedocument.domain="'+document.domain+'";<\/script>':e)+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(i),this.myIFrame.doc.close()}catch(t){Xs("frame writing exception"),t.stack&&Xs(t.stack),Xs(t)}}var Ma="";function Fa(t){Ma=t}var Ua=null;"undefined"!=typeof MozWebSocket?Ua=MozWebSocket:"undefined"!=typeof WebSocket&&(Ua=WebSocket);var ja=(qa.connectionURL_=function(t,e,n){var r={v:"5"};return"undefined"!=typeof location&&location.hostname&&ya.test(location.hostname)&&(r.r="f"),e&&(r.s=e),n&&(r.ls=n),Ia(t,ma,r)},qa.prototype.open=function(e,t){var n,r=this;this.onDisconnect=t,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,Ks.set("previous_websocket_failure",!0);try{mo()||(n={headers:{"X-Firebase-GMPID":this.applicationId||""}},this.mySock=new Ua(this.connURL,[],n))}catch(t){this.log_("Error instantiating WebSocket.");e=t.message||t.data;return e&&this.log_(e),void this.onClosed_()}this.mySock.onopen=function(){r.log_("Websocket connected."),r.everConnected_=!0},this.mySock.onclose=function(){r.log_("Websocket connection was disconnected."),r.mySock=null,r.onClosed_()},this.mySock.onmessage=function(t){r.handleIncomingFrame(t)},this.mySock.onerror=function(t){r.log_("WebSocket error. Closing connection.");t=t.message||t.data;t&&r.log_(t),r.onClosed_()}},qa.prototype.start=function(){},qa.forceDisallow=function(){qa.forceDisallow_=!0},qa.isAvailable=function(){var t,e=!1;return"undefined"!=typeof navigator&&navigator.userAgent&&((t=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/))&&1=t.pieces_.length?null:t.pieces_[t.pieceNum_]}function ru(t){return t.pieces_.length-t.pieceNum_}function iu(t){var e=t.pieceNum_;return e=t.pieces_.length)return null;for(var e=[],n=t.pieceNum_;n=t.pieces_.length}function hu(t,e){var n=nu(t),r=nu(e);if(null===n)return e;if(n===r)return hu(iu(t),iu(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")}function lu(t,e){for(var n=su(t,0),r=su(e,0),i=0;iru(e))return!1;for(;n$a)throw new Error(t.errorPrefix_+"has a key path longer than "+$a+" bytes ("+t.byteLength_+").");if(t.parts_.length>Ja)throw new Error(t.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Ja+") or object contains a cycle "+gu(t))}function gu(t){return 0===t.parts_.length?"":"in property '"+t.parts_.join(".")+"'"}var yu,mu=(Xi(bu,yu=Ga),bu.getInstance=function(){return new bu},bu.prototype.getInitialEvent=function(t){return so("visible"===t,"Unknown event type: "+t),[this.visible_]},bu);function bu(){var e,t,n=yu.call(this,["visible"])||this;return"undefined"!=typeof document&&void 0!==document.addEventListener&&(void 0!==document.hidden?(t="visibilitychange",e="hidden"):void 0!==document.mozHidden?(t="mozvisibilitychange",e="mozHidden"):void 0!==document.msHidden?(t="msvisibilitychange",e="msHidden"):void 0!==document.webkitHidden&&(t="webkitvisibilitychange",e="webkitHidden")),n.visible_=!0,t&&document.addEventListener(t,function(){var t=!document[e];t!==n.visible_&&(n.visible_=t,n.trigger("visible",t))},!1),n}var wu,_u=1e3,Iu=3e5,Tu=(Xi(Eu,wu=z),Eu.prototype.sendRequest=function(t,e,n){var r=++this.requestNumber_,e={r:r,a:t,b:e};this.log_(Ro(e)),so(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(e),n&&(this.requestCBHash_[r]=n)},Eu.prototype.get=function(t){var n=this,r=new lo,i={p:t.path.toString(),q:t.queryObject()},e={action:"g",request:i,onComplete:function(t){var e=t.d;"ok"===t.s?(n.onDataUpdate_(i.p,e,!1,null),r.resolve(e)):r.reject(e)}};this.outstandingGets_.push(e),this.outstandingGetCount_++;var o=this.outstandingGets_.length-1;return this.connected_||setTimeout(function(){var t=n.outstandingGets_[o];void 0!==t&&e===t&&(delete n.outstandingGets_[o],n.outstandingGetCount_--,0===n.outstandingGetCount_&&(n.outstandingGets_=[]),n.log_("get "+o+" timed out on connection"),r.reject(new Error("Client is offline.")))},3e3),this.connected_&&this.sendGet_(o),r.promise},Eu.prototype.listen=function(t,e,n,r){var i=t.queryIdentifier(),o=t.path.toString();this.log_("Listen called for "+o+" "+i),this.listens.has(o)||this.listens.set(o,new Map),so(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"listen() called for non-default but complete query"),so(!this.listens.get(o).has(i),"listen() called twice for same path/queryId.");n={onComplete:r,hashFn:e,query:t,tag:n};this.listens.get(o).set(i,n),this.connected_&&this.sendListen_(n)},Eu.prototype.sendGet_=function(e){var n=this,r=this.outstandingGets_[e];this.sendRequest("g",r.request,function(t){delete n.outstandingGets_[e],n.outstandingGetCount_--,0===n.outstandingGetCount_&&(n.outstandingGets_=[]),r.onComplete&&r.onComplete(t)})},Eu.prototype.sendListen_=function(r){var i=this,o=r.query,s=o.path.toString(),a=o.queryIdentifier();this.log_("Listen on "+s+" for "+a);var t={p:s};r.tag&&(t.q=o.queryObject(),t.t=r.tag),t.h=r.hashFn(),this.sendRequest("q",t,function(t){var e=t.d,n=t.s;Eu.warnOnListenWarnings_(e,o),(i.listens.get(s)&&i.listens.get(s).get(a))===r&&(i.log_("listen response",t),"ok"!==n&&i.removeListen_(s,a),r.onComplete&&r.onComplete(n,e))})},Eu.warnOnListenWarnings_=function(t,e){t&&"object"==typeof t&&Oo(t,"w")&&(t=Do(t,"w"),Array.isArray(t)&&~t.indexOf("no_index")&&(t='".indexOn": "'+e.getQueryParams().getIndex().toString()+'"',e=e.path.toString(),Zs("Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding "+t+" at "+e+" to your security rules for better performance.")))},Eu.prototype.refreshAuthToken=function(t){this.authToken_=t,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},function(){}),this.reduceReconnectDelayIfAdminCredential_(t)},Eu.prototype.reduceReconnectDelayIfAdminCredential_=function(t){(t&&40===t.length||function(t){t=Po(t).claims;return"object"==typeof t&&!0===t.admin}(t))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=3e4)},Eu.prototype.tryAuth=function(){var n,t,e,r=this;this.connected_&&this.authToken_&&(t=function(t){t=Po(t).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")}(n=this.authToken_)?"auth":"gauth",e={cred:n},null===this.authOverride_?e.noauth=!0:"object"==typeof this.authOverride_&&(e.authvar=this.authOverride_),this.sendRequest(t,e,function(t){var e=t.s,t=t.d||"error";r.authToken_===n&&("ok"===e?r.invalidAuthTokenCount_=0:r.onAuthRevoked_(e,t))}))},Eu.prototype.unlisten=function(t,e){var n=t.path.toString(),r=t.queryIdentifier();this.log_("Unlisten called for "+n+" "+r),so(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,r)&&this.connected_&&this.sendUnlisten_(n,r,t.queryObject(),e)},Eu.prototype.sendUnlisten_=function(t,e,n,r){this.log_("Unlisten on "+t+" for "+e);t={p:t};r&&(t.q=n,t.t=r),this.sendRequest("n",t)},Eu.prototype.onDisconnectPut=function(t,e,n){this.connected_?this.sendOnDisconnect_("o",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:e,onComplete:n})},Eu.prototype.onDisconnectMerge=function(t,e,n){this.connected_?this.sendOnDisconnect_("om",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:e,onComplete:n})},Eu.prototype.onDisconnectCancel=function(t,e){this.connected_?this.sendOnDisconnect_("oc",t,null,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:e})},Eu.prototype.sendOnDisconnect_=function(t,e,n,r){n={p:e,d:n};this.log_("onDisconnect "+t,n),this.sendRequest(t,n,function(t){r&&setTimeout(function(){r(t.s,t.d)},Math.floor(0))})},Eu.prototype.put=function(t,e,n,r){this.putInternal("p",t,e,n,r)},Eu.prototype.merge=function(t,e,n,r){this.putInternal("m",t,e,n,r)},Eu.prototype.putInternal=function(t,e,n,r,i){n={p:e,d:n};void 0!==i&&(n.h=i),this.outstandingPuts_.push({action:t,request:n,onComplete:r}),this.outstandingPutCount_++;r=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(r):this.log_("Buffering put: "+e)},Eu.prototype.sendPut_=function(e){var n=this,r=this.outstandingPuts_[e].action,t=this.outstandingPuts_[e].request,i=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest(r,t,function(t){n.log_(r+" response",t),delete n.outstandingPuts_[e],n.outstandingPutCount_--,0===n.outstandingPutCount_&&(n.outstandingPuts_=[]),i&&i(t.s,t.d)})},Eu.prototype.reportStats=function(t){var e=this;this.connected_&&(t={c:t},this.log_("reportStats",t),this.sendRequest("s",t,function(t){"ok"!==t.s&&(t=t.d,e.log_("reportStats","Error sending stats: "+t))}))},Eu.prototype.onDataMessage_=function(t){if("r"in t){this.log_("from server: "+Ro(t));var e=t.r,n=this.requestCBHash_[e];n&&(delete this.requestCBHash_[e],n(t.b))}else{if("error"in t)throw"A server-side error has occurred: "+t.error;"a"in t&&this.onDataPush_(t.a,t.b)}},Eu.prototype.onDataPush_=function(t,e){this.log_("handleServerMessage",t,e),"d"===t?this.onDataUpdate_(e.p,e.d,!1,e.t):"m"===t?this.onDataUpdate_(e.p,e.d,!0,e.t):"c"===t?this.onListenRevoked_(e.p,e.q):"ac"===t?this.onAuthRevoked_(e.s,e.d):"sd"===t?this.onSecurityDebugPacket_(e):Fs("Unrecognized action received from server: "+Ro(t)+"\nAre you using the latest client?")},Eu.prototype.onReady_=function(t,e){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=(new Date).getTime(),this.handleTimestamp_(t),this.lastSessionId=e,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)},Eu.prototype.scheduleConnect_=function(t){var e=this;so(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(function(){e.establishConnectionTimer_=null,e.establishConnection_()},Math.floor(t))},Eu.prototype.onVisible_=function(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=_u,this.realtime_||this.scheduleConnect_(0)),this.visible_=t},Eu.prototype.onOnline_=function(t){t?(this.log_("Browser went online."),this.reconnectDelay_=_u,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())},Eu.prototype.onRealtimeDisconnect_=function(){var t;this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()&&(this.visible_?this.lastConnectionEstablishedTime_&&(3e4<(new Date).getTime()-this.lastConnectionEstablishedTime_&&(this.reconnectDelay_=_u),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime()),t=(new Date).getTime()-this.lastConnectionAttemptTime_,t=Math.max(0,this.reconnectDelay_-t),t=Math.random()*t,this.log_("Trying to reconnect in "+t+"ms"),this.scheduleConnect_(t),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)),this.onConnectStatus_(!1)},Eu.prototype.establishConnection_=function(){var e,n,r,i,o,s,a,u,c,t,h=this;this.shouldReconnect_()&&(this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null,e=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+Eu.nextConnectionId_++,s=(o=this).lastSessionId,a=!1,u=null,c=function(){u?u.close():(a=!0,r())},this.realtime_={close:c,sendRequest:function(t){so(u,"sendRequest call when we're not connected not allowed."),u.sendRequest(t)}},t=this.forceTokenRefresh_,this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(t).then(function(t){a?Xs("getToken() completed but was canceled"):(Xs("getToken() completed. Creating connection."),o.authToken_=t&&t.accessToken,u=new Ka(i,o.repoInfo_,o.applicationId_,e,n,r,function(t){Zs(t+" ("+o.repoInfo_.toString()+")"),o.interrupt("server_kill")},s))}).then(null,function(t){o.log_("Failed to get token: "+t),a||(h.repoInfo_.nodeAdmin&&Zs(t),c())}))},Eu.prototype.interrupt=function(t){Xs("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())},Eu.prototype.resume=function(t){Xs("Resuming connection for reason: "+t),delete this.interruptReasons_[t],xo(this.interruptReasons_)&&(this.reconnectDelay_=_u,this.realtime_||this.scheduleConnect_(0))},Eu.prototype.handleTimestamp_=function(t){t-=(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:t})},Eu.prototype.cancelSentTransactions_=function(){for(var t=0;to.lastWriteId,"Stacking an older write on top of newer ones"),void 0===u&&(u=!0),o.allWrites.push({path:s,snap:a,writeId:r,visible:u}),u&&(o.visibleWrites=Nh(o.visibleWrites,s,a)),o.lastWriteId=r,i?Ml(t,new uh(eh(),e,n)):[]}function kl(t,e,n,r){var i,o,s;i=t.pendingWriteTree_,o=e,s=n,so((r=r)>i.lastWriteId,"Stacking an older merge on top of newer ones"),i.allWrites.push({path:o,children:s,writeId:r,visible:!0}),i.visibleWrites=Ah(i.visibleWrites,o,s),i.lastWriteId=r;n=Th.fromObject(n);return Ml(t,new hh(eh(),e,n))}function Rl(t,e,n){void 0===n&&(n=!1);var r=function(t,e){for(var n=0;nEf/3&&zo(t)>Ef)throw new Error(r+"contains a string greater than "+Ef+" utf8 bytes "+gu(i)+" ('"+t.substring(0,50)+"...')");if(t&&"object"==typeof t){var o=!1,s=!1;if(ia(t,function(t,e){if(".value"===t)o=!0;else if(".priority"!==t&&".sv"!==t&&(s=!0,!ff(t)))throw new Error(r+" contains an invalid key ("+t+") "+gu(i)+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');var n;n=t,0<(t=i).parts_.length&&(t.byteLength_+=1),t.parts_.push(n),t.byteLength_+=zo(n),vu(t),Sf(r,e,i),e=(t=i).parts_.pop(),t.byteLength_-=zo(e),0=Df?(a=!0,e="maxretry",f.concat(Rl(u.serverSyncTree_,o.currentWriteId,!0))):(n=Xf(u,o.path,p),o.currentInputSnapshot=n,void 0!==(i=c[t].update(n.val()))?(Sf("transaction failed: Data returned ",i,o.path),r=pc(i),"object"==typeof i&&null!=i&&Oo(i,".priority")||(r=r.updatePriority(n.getPriority())),s=o.currentWriteId,i=Uf(u),i=ef(r,n,i),o.currentOutputSnapshotRaw=r,o.currentOutputSnapshotResolved=i,o.currentWriteId=Bf(u),p.splice(p.indexOf(s),1),(f=f.concat(Al(u.serverSyncTree_,o.path,i,o.currentWriteId,o.applyLocally))).concat(Rl(u.serverSyncTree_,s,!0))):(a=!0,e="nodata",f.concat(Rl(u.serverSyncTree_,o.currentWriteId,!0))))),Rf(u.eventQueue_,h,f),f=[],a&&(c[t].status=2,a=c[t].unwatcher,setTimeout(a,Math.floor(0)),c[t].onComplete&&("nodata"===e?l.push(function(){return c[t].onComplete(null,!1,c[t].currentInputSnapshot)}):l.push(function(){return c[t].onComplete(new Error(e),!1,null)})))}(t);ep(u,u.transactionQueueTree_);for(t=0;t.firebaseio.com instead"),r&&"undefined"!==r||"localhost"===n.domain||$s("Cannot parse Firebase url. Please use https://.firebaseio.com"),n.secure||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&Zs("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");t="ws"===n.scheme||"wss"===n.scheme;return{repoInfo:new wa(n.host,n.secure,r,e,t,"",r!==n.subdomain),path:new Za(n.pathString)}},op=function(t){var e,n,r,i="",o="",s="",a="",u="",c=!0,h="https",l=443;return"string"==typeof t&&(0<=(r=t.indexOf("//"))&&(h=t.substring(0,r-1),t=t.substring(r+2)),-1===(e=t.indexOf("/"))&&(e=t.length),-1===(n=t.indexOf("?"))&&(n=t.length),i=t.substring(0,Math.min(e,n)),e=t.length?void 0:t)&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var G="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},jp={},qp=G||self;function Vp(){}function Bp(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function Kp(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Wp="closure_uid_"+(1e9*Math.random()>>>0),Hp=0;function Gp(t,e,n){return t.call.apply(t.bind,arguments)}function zp(e,n,t){if(!e)throw Error();if(2parseFloat(Id)){dd=String(Td);break t}}dd=Id}var Ed={};function Sd(a){return t=a,e=function(){for(var t=0,e=od(String(dd)).split("."),n=od(String(a)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i>>0);function Xd(e){return"function"==typeof e?e:(e[Yd]||(e[Yd]=function(t){return e.handleEvent(t)}),e[Yd])}function Jd(){$p.call(this),this.c=new Fd(this),(this.J=this).C=null}function $d(t,e){var n,r=t.C;if(r)for(n=[];r;r=r.C)n.push(r);if(t=t.J,r=e.type||e,"string"==typeof e?e=new Rd(e,t):e instanceof Rd?e.target=e.target||t:(s=e,fd(e=new Rd(r,t),s)),s=!0,n)for(var i=n.length-1;0<=i;i--)var o=e.a=n[i],s=Zd(o,r,!0,e)&&s;if(s=Zd(o=e.a=t,r,!0,e)&&s,s=Zd(o,r,!1,e)&&s,n)for(i=0;ia.length?Wv:(a=a.substr(o,i),r.D=o+i,a)));if(a==Wv){4==e&&(t.h=4,Pv(14),s=!1),Ev(t.c,t.f,null,"[Incomplete Response]");break}if(a==Kv){t.h=4,Pv(15),Ev(t.c,t.f,n,"[Invalid Chunk]"),s=!1;break}Ev(t.c,t.f,a,null),Zv(t,a)}4==e&&0==n.length&&(t.h=1,Pv(16),s=!1),t.b=t.b&&s,s?0>4&15).toString(16)+(15&t).toString(16)}og.prototype.toString=function(){var t=[],e=this.f;e&&t.push(dg(e,gg,!0),":");var n=this.c;return!n&&"file"!=e||(t.push("//"),(e=this.j)&&t.push(dg(e,gg,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.h)&&t.push(":",String(n))),(n=this.g)&&(this.c&&"/"!=n.charAt(0)&&t.push("/"),t.push(dg(n,"/"==n.charAt(0)?mg:yg,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",dg(n,wg)),t.join("")};var gg=/[#\/\?@]/g,yg=/[#\?:]/g,mg=/[#\?]/g,bg=/[#\?@]/g,wg=/#/g;function _g(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function Ig(n){n.a||(n.a=new eg,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n2*t.c&&ng(t)))}function Eg(t,e){return Ig(t),e=Cg(t,e),rg(t.a.b,e)}function Sg(t,e,n){Tg(t,e),0=t.f}function Pg(t){return t.b?1:t.a?t.a.size:0}function Og(t,e){return t.b?t.b==e:t.a&&t.a.has(e)}function Dg(t,e){t.a?t.a.add(e):t.b=e}function xg(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function Lg(t){var e,n;if(null!=t.b)return t.c.concat(t.b.s);if(null==t.a||0===t.a.size)return nd(t.c);var r=t.c;try{for(var i=Up(t.a.values()),o=i.next();!o.done;o=i.next())var s=o.value,r=r.concat(s.s)}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function Mg(){}function Fg(){this.a=new Mg}function Ug(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}Ag.prototype.cancel=function(){var e,t;if(this.c=Lg(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=Up(this.a.values()),r=n.next();!r.done;r=n.next())r.value.cancel()}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.a.clear()}},Mg.prototype.stringify=function(t){return qp.JSON.stringify(t,void 0)},Mg.prototype.parse=function(t){return qp.JSON.parse(t,void 0)};var jg=qp.JSON.parse;function qg(t){Jd.call(this),this.headers=new eg,this.H=t||null,this.b=!1,this.s=this.a=null,this.B="",this.h=0,this.f="",this.g=this.A=this.l=this.u=!1,this.o=0,this.m=null,this.I=Vg,this.D=this.F=!1}Jp(qg,Jd);var Vg="",Bg=/^https?$/i,Kg=["POST","PUT"];function Wg(t){return"content-type"==t.toLowerCase()}function Hg(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,Gg(t),Qg(t)}function Gg(t){t.u||(t.u=!0,$d(t,"complete"),$d(t,"error"))}function zg(t){if(t.b&&void 0!==jp&&(!t.s[1]||4!=Xg(t)||2!=t.W()))if(t.l&&4==Xg(t))fv(t.za,0,t);else if($d(t,"readystatechange"),4==Xg(t)){t.b=!1;try{var e,n,r,i,o=t.W();t:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var s=!0;break t;default:s=!1}(e=s)||((n=0===o)&&(!(i=String(t.B).match(ig)[1]||null)&&qp.self&&qp.self.location&&(i=(r=qp.self.location.protocol).substr(0,r.length-1)),n=!Bg.test(i?i.toLowerCase():"")),e=n);if(e)$d(t,"complete"),$d(t,"success");else{t.h=6;try{var a=2=r.b.f-(r.h?1:0)||(r.h?(r.g=i.s.concat(r.g),0):1==r.v||2==r.v||r.u>=(r.La?0:r.Ma)||(r.h=Dv(Qp(r.Ba,r,i),dy(r,r.u)),r.u++,0))))&&(2!=s||!cy(t)))switch(o&&0e.length?1:0},gm),am=(Xi(vm,sm=Ga),vm.prototype.construct=function(t,e,n){return new vm(t,e,n)},vm.prototype.canonicalString=function(){return this.toArray().join("/")},vm.prototype.toString=function(){return this.canonicalString()},vm.fromString=function(){for(var t=[],e=0;et.length&&Hy(),void 0===n?n=t.length-e:n>t.length-e&&Hy(),this.segments=t,this.offset=e,this.len=n}lm.EMPTY_BYTE_STRING=new lm("");var ym=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function mm(t){if(Gy(!!t),"string"!=typeof t)return{seconds:bm(t.seconds),nanos:bm(t.nanos)};var e=0,n=ym.exec(t);Gy(!!n),n[1]&&(n=((n=n[1])+"000000000").substr(0,9),e=Number(n));t=new Date(t);return{seconds:Math.floor(t.getTime()/1e3),nanos:e}}function bm(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function wm(t){return"string"==typeof t?lm.fromBase64String(t):lm.fromUint8Array(t)}function _m(t){return"server_timestamp"===(null===(t=((null===(t=null==t?void 0:t.mapValue)||void 0===t?void 0:t.fields)||{}).__type__)||void 0===t?void 0:t.stringValue)}function Im(t){t=mm(t.mapValue.fields.__local_write_time__.timestampValue);return new $y(t.seconds,t.nanos)}function Tm(t){return null==t}function Em(t){return 0===t&&1/t==-1/0}function Sm(t){return"number"==typeof t&&Number.isInteger(t)&&!Em(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}var Cm=(Nm.fromPath=function(t){return new Nm(am.fromString(t))},Nm.fromName=function(t){return new Nm(am.fromString(t).popFirst(5))},Nm.prototype.hasCollectionId=function(t){return 2<=this.path.length&&this.path.get(this.path.length-2)===t},Nm.prototype.isEqual=function(t){return null!==t&&0===am.comparator(this.path,t.path)},Nm.prototype.toString=function(){return this.path.toString()},Nm.comparator=function(t,e){return am.comparator(t.path,e.path)},Nm.isDocumentKey=function(t){return t.length%2==0},Nm.fromSegments=function(t){return new Nm(new am(t.slice()))},Nm);function Nm(t){this.path=t}function Am(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?_m(t)?4:10:Hy()}function km(r,i){var t,e,n=Am(r);if(n!==Am(i))return!1;switch(n){case 0:return!0;case 1:return r.booleanValue===i.booleanValue;case 4:return Im(r).isEqual(Im(i));case 3:return function(t){if("string"==typeof r.timestampValue&&"string"==typeof t.timestampValue&&r.timestampValue.length===t.timestampValue.length)return r.timestampValue===t.timestampValue;var e=mm(r.timestampValue),t=mm(t.timestampValue);return e.seconds===t.seconds&&e.nanos===t.nanos}(i);case 5:return r.stringValue===i.stringValue;case 6:return e=i,wm(r.bytesValue).isEqual(wm(e.bytesValue));case 7:return r.referenceValue===i.referenceValue;case 8:return t=i,bm((e=r).geoPointValue.latitude)===bm(t.geoPointValue.latitude)&&bm(e.geoPointValue.longitude)===bm(t.geoPointValue.longitude);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return bm(t.integerValue)===bm(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){t=bm(t.doubleValue),e=bm(e.doubleValue);return t===e?Em(t)===Em(e):isNaN(t)&&isNaN(e)}return!1}(r,i);case 9:return Xy(r.arrayValue.values||[],i.arrayValue.values||[],km);case 10:return function(){var t,e=r.mapValue.fields||{},n=i.mapValue.fields||{};if(nm(e)!==nm(n))return!1;for(t in e)if(e.hasOwnProperty(t)&&(void 0===n[t]||!km(e[t],n[t])))return!1;return!0}();default:return Hy()}}function Rm(t,e){return void 0!==(t.values||[]).find(function(t){return km(t,e)})}function Pm(t,e){var n,r,i,o=Am(t),s=Am(e);if(o!==s)return Yy(o,s);switch(o){case 0:return 0;case 1:return Yy(t.booleanValue,e.booleanValue);case 2:return r=e,i=bm(t.integerValue||t.doubleValue),r=bm(r.integerValue||r.doubleValue),i":return 0=":return 0<=t;default:return Hy()}},Jm.prototype.g=function(){return 0<=["<","<=",">",">=","!=","not-in"].indexOf(this.op)},Jm);function Jm(t,e,n){var r=this;return(r=Ym.call(this)||this).field=t,r.op=e,r.value=n,r}var $m,Zm,tb,eb=(Xi(sb,tb=Xm),sb.prototype.matches=function(t){t=Cm.comparator(t.key,this.key);return this.m(t)},sb),nb=(Xi(ob,Zm=Xm),ob.prototype.matches=function(e){return this.keys.some(function(t){return t.isEqual(e.key)})},ob),rb=(Xi(ib,$m=Xm),ib.prototype.matches=function(e){return!this.keys.some(function(t){return t.isEqual(e.key)})},ib);function ib(t,e){var n=this;return(n=$m.call(this,t,"not-in",e)||this).keys=ab(0,e),n}function ob(t,e){var n=this;return(n=Zm.call(this,t,"in",e)||this).keys=ab(0,e),n}function sb(t,e,n){var r=this;return(r=tb.call(this,t,e,n)||this).key=Cm.fromName(n.referenceValue),r}function ab(t,e){return((null===(e=e.arrayValue)||void 0===e?void 0:e.values)||[]).map(function(t){return Cm.fromName(t.referenceValue)})}var ub,cb,hb,lb,fb=(Xi(wb,lb=Xm),wb.prototype.matches=function(t){t=t.data.field(this.field);return Mm(t)&&Rm(t.arrayValue,this.value)},wb),pb=(Xi(bb,hb=Xm),bb.prototype.matches=function(t){t=t.data.field(this.field);return null!==t&&Rm(this.value.arrayValue,t)},bb),db=(Xi(mb,cb=Xm),mb.prototype.matches=function(t){if(Rm(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;t=t.data.field(this.field);return null!==t&&!Rm(this.value.arrayValue,t)},mb),vb=(Xi(yb,ub=Xm),yb.prototype.matches=function(t){var e=this,t=t.data.field(this.field);return!(!Mm(t)||!t.arrayValue.values)&&t.arrayValue.values.some(function(t){return Rm(e.value.arrayValue,t)})},yb),gb=function(t,e){this.position=t,this.before=e};function yb(t,e){return ub.call(this,t,"array-contains-any",e)||this}function mb(t,e){return cb.call(this,t,"not-in",e)||this}function bb(t,e){return hb.call(this,t,"in",e)||this}function wb(t,e){return lb.call(this,t,"array-contains",e)||this}function _b(t){return(t.before?"b":"a")+":"+t.position.map(Dm).join(",")}var Ib=function(t,e){void 0===e&&(e="asc"),this.field=t,this.dir=e};function Tb(t,e,n){for(var r=0,i=0;i":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},f_=function(t,e){this.databaseId=t,this.I=e};function p_(t,e){return t.I?new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+e.nanoseconds).slice(-9)+"Z":{seconds:""+e.seconds,nanos:e.nanoseconds}}function d_(t,e){return t.I?e.toBase64():e.toUint8Array()}function v_(t){return Gy(!!t),Zy.fromTimestamp((t=mm(t),new $y(t.seconds,t.nanos)))}function g_(t,e){return new am(["projects",t.projectId,"databases",t.database]).child("documents").child(e).canonicalString()}function y_(t){t=am.fromString(t);return Gy(F_(t)),t}function m_(t,e){return g_(t.databaseId,e.path)}function b_(t,e){e=y_(e);if(e.get(1)!==t.databaseId.projectId)throw new Fy(My.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+e.get(1)+" vs "+t.databaseId.projectId);if(e.get(3)!==t.databaseId.database)throw new Fy(My.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+e.get(3)+" vs "+t.databaseId.database);return new Cm(T_(e))}function w_(t,e){return g_(t.databaseId,e)}function __(t){t=y_(t);return 4===t.length?am.emptyPath():T_(t)}function I_(t){return new am(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function T_(t){return Gy(4";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return Hy()}}(),t.fieldFilter.value)}function M_(t){switch(t.unaryFilter.op){case"IS_NAN":var e=x_(t.unaryFilter.field);return Xm.create(e,"==",{doubleValue:NaN});case"IS_NULL":e=x_(t.unaryFilter.field);return Xm.create(e,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var n=x_(t.unaryFilter.field);return Xm.create(n,"!=",{doubleValue:NaN});case"IS_NOT_NULL":n=x_(t.unaryFilter.field);return Xm.create(n,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return Hy()}}function F_(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)}function U_(t){for(var e="",n=0;n",t),this.store.put(t));return II(t)},_I.prototype.add=function(t){return Vy("SimpleDb","ADD",this.store.name,t,t),II(this.store.add(t))},_I.prototype.get=function(e){var n=this;return II(this.store.get(e)).next(function(t){return void 0===t&&(t=null),Vy("SimpleDb","GET",n.store.name,e,t),t})},_I.prototype.delete=function(t){return Vy("SimpleDb","DELETE",this.store.name,t),II(this.store.delete(t))},_I.prototype.count=function(){return Vy("SimpleDb","COUNT",this.store.name),II(this.store.count())},_I.prototype.Nt=function(t,e){var e=this.cursor(this.options(t,e)),n=[];return this.xt(e,function(t,e){n.push(e)}).next(function(){return n})},_I.prototype.Ft=function(t,e){Vy("SimpleDb","DELETE ALL",this.store.name);e=this.options(t,e);e.kt=!1;e=this.cursor(e);return this.xt(e,function(t,e,n){return n.delete()})},_I.prototype.Ot=function(t,e){e?n=t:(n={},e=t);var n=this.cursor(n);return this.xt(n,e)},_I.prototype.$t=function(r){var t=this.cursor({});return new uI(function(n,e){t.onerror=function(t){t=EI(t.target.error);e(t)},t.onsuccess=function(t){var e=t.target.result;e?r(e.primaryKey,e.value).next(function(t){t?e.continue():n()}):n()}})},_I.prototype.xt=function(t,i){var o=[];return new uI(function(r,e){t.onerror=function(t){e(t.target.error)},t.onsuccess=function(t){var e,n=t.target.result;n?(e=new lI(n),(t=i(n.primaryKey,n.value,e))instanceof uI&&(t=t.catch(function(t){return e.done(),uI.reject(t)}),o.push(t)),e.isDone?r():null===e.Dt?n.continue():n.continue(e.Dt)):r()}}).next(function(){return uI.waitFor(o)})},_I.prototype.options=function(t,e){var n;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},_I.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.kt?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},_I);function _I(t){this.store=t}function II(t){return new uI(function(e,n){t.onsuccess=function(t){t=t.target.result;e(t)},t.onerror=function(t){t=EI(t.target.error);n(t)}})}var TI=!1;function EI(t){var e=hI._t(po());if(12.2<=e&&e<13){e="An internal error was encountered in the Indexed Database server";if(0<=t.message.indexOf(e)){var n=new Fy("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '"+e+"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");return TI||(TI=!0,setTimeout(function(){throw n},0)),n}}return t}var SI,CI=(Xi(NI,SI=Ga),NI);function NI(t,e){var n=this;return(n=SI.call(this)||this).Mt=t,n.currentSequenceNumber=e,n}function AI(t,e){return hI.It(t.Mt,e)}var kI=(LI.prototype.applyToRemoteDocument=function(t,e){for(var n,r,i,o,s,a,u=e.mutationResults,c=0;c=i),o=BI(r.R,e)),n.done()}).next(function(){return o})},cT.prototype.getHighestUnacknowledgedBatchId=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),r=-1;return lT(t).Ot({index:W_.userMutationsIndex,range:e,reverse:!0},function(t,e,n){r=e.batchId,n.done()}).next(function(){return r})},cT.prototype.getAllMutationBatches=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return lT(t).Nt(W_.userMutationsIndex,n).next(function(t){return t.map(function(t){return BI(e.R,t)})})},cT.prototype.getAllMutationBatchesAffectingDocumentKey=function(o,s){var a=this,t=H_.prefixForPath(this.userId,s.path),t=IDBKeyRange.lowerBound(t),u=[];return fT(o).Ot({range:t},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=q_(i);if(r===a.userId&&s.path.isEqual(i))return lT(o).get(t).next(function(t){if(!t)throw Hy();Gy(t.userId===a.userId),u.push(BI(a.R,t))});n.done()}).next(function(){return u})},cT.prototype.getAllMutationBatchesAffectingDocumentKeys=function(e,t){var s=this,a=new Vw(Yy),n=[];return t.forEach(function(o){var t=H_.prefixForPath(s.userId,o.path),t=IDBKeyRange.lowerBound(t),t=fT(e).Ot({range:t},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=q_(i);r===s.userId&&o.path.isEqual(i)?a=a.add(t):n.done()});n.push(t)}),uI.waitFor(n).next(function(){return s.Wt(e,a)})},cT.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var o=this,s=e.path,a=s.length+1,e=H_.prefixForPath(this.userId,s),e=IDBKeyRange.lowerBound(e),u=new Vw(Yy);return fT(t).Ot({range:e},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=q_(i);r===o.userId&&s.isPrefixOf(i)?i.length===a&&(u=u.add(t)):n.done()}).next(function(){return o.Wt(t,u)})},cT.prototype.Wt=function(e,t){var n=this,r=[],i=[];return t.forEach(function(t){i.push(lT(e).get(t).next(function(t){if(null===t)throw Hy();Gy(t.userId===n.userId),r.push(BI(n.R,t))}))}),uI.waitFor(i).next(function(){return r})},cT.prototype.removeMutationBatch=function(e,n){var r=this;return sT(e.Mt,this.userId,n).next(function(t){return e.addOnCommittedListener(function(){r.Gt(n.batchId)}),uI.forEach(t,function(t){return r.referenceDelegate.markPotentiallyOrphaned(e,t)})})},cT.prototype.Gt=function(t){delete this.Qt[t]},cT.prototype.performConsistencyCheck=function(e){var i=this;return this.checkEmpty(e).next(function(t){if(!t)return uI.resolve();var t=IDBKeyRange.lowerBound(H_.prefixForUser(i.userId)),r=[];return fT(e).Ot({range:t},function(t,e,n){t[0]===i.userId?(t=q_(t[1]),r.push(t)):n.done()}).next(function(){Gy(0===r.length)})})},cT.prototype.containsKey=function(t,e){return hT(t,this.userId,e)},cT.prototype.zt=function(t){var e=this;return pT(t).get(this.userId).next(function(t){return t||new K_(e.userId,-1,"")})},cT);function cT(t,e,n,r){this.userId=t,this.R=e,this.Ut=n,this.referenceDelegate=r,this.Qt={}}function hT(t,o,e){var e=H_.prefixForPath(o,e.path),s=e[1],e=IDBKeyRange.lowerBound(e),a=!1;return fT(t).Ot({range:e,kt:!0},function(t,e,n){var r=t[0],i=t[1];t[2],r===o&&i===s&&(a=!0),n.done()}).next(function(){return a})}function lT(t){return AI(t,W_.store)}function fT(t){return AI(t,H_.store)}function pT(t){return AI(t,K_.store)}var dT=(yT.prototype.next=function(){return this.Ht+=2,this.Ht},yT.Jt=function(){return new yT(0)},yT.Yt=function(){return new yT(-1)},yT),vT=(gT.prototype.allocateTargetId=function(n){var r=this;return this.Xt(n).next(function(t){var e=new dT(t.highestTargetId);return t.highestTargetId=e.next(),r.Zt(n,t).next(function(){return t.highestTargetId})})},gT.prototype.getLastRemoteSnapshotVersion=function(t){return this.Xt(t).next(function(t){return Zy.fromTimestamp(new $y(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))})},gT.prototype.getHighestSequenceNumber=function(t){return this.Xt(t).next(function(t){return t.highestListenSequenceNumber})},gT.prototype.setTargetsMetadata=function(e,n,r){var i=this;return this.Xt(e).next(function(t){return t.highestListenSequenceNumber=n,r&&(t.lastRemoteSnapshotVersion=r.toTimestamp()),n>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=n),i.Zt(e,t)})},gT.prototype.addTargetData=function(e,n){var r=this;return this.te(e,n).next(function(){return r.Xt(e).next(function(t){return t.targetCount+=1,r.ee(n,t),r.Zt(e,t)})})},gT.prototype.updateTargetData=function(t,e){return this.te(t,e)},gT.prototype.removeTargetData=function(e,t){var n=this;return this.removeMatchingKeysForTargetId(e,t.targetId).next(function(){return mT(e).delete(t.targetId)}).next(function(){return n.Xt(e)}).next(function(t){return Gy(0e.highestTargetId&&(e.highestTargetId=t.targetId,n=!0),t.sequenceNumber>e.highestListenSequenceNumber&&(e.highestListenSequenceNumber=t.sequenceNumber,n=!0),n},gT.prototype.getTargetCount=function(t){return this.Xt(t).next(function(t){return t.targetCount})},gT.prototype.getTargetData=function(t,r){var e=Gm(r),e=IDBKeyRange.bound([e,Number.NEGATIVE_INFINITY],[e,Number.POSITIVE_INFINITY]),i=null;return mT(t).Ot({range:e,index:J_.queryTargetsIndexName},function(t,e,n){e=KI(e);zm(r,e.target)&&(i=e,n.done())}).next(function(){return i})},gT.prototype.addMatchingKeys=function(n,t,r){var i=this,o=[],s=wT(n);return t.forEach(function(t){var e=U_(t.path);o.push(s.put(new $_(r,e))),o.push(i.referenceDelegate.addReference(n,r,t))}),uI.waitFor(o)},gT.prototype.removeMatchingKeys=function(n,t,r){var i=this,o=wT(n);return uI.forEach(t,function(t){var e=U_(t.path);return uI.waitFor([o.delete([r,e]),i.referenceDelegate.removeReference(n,r,t)])})},gT.prototype.removeMatchingKeysForTargetId=function(t,e){t=wT(t),e=IDBKeyRange.bound([e],[e+1],!1,!0);return t.delete(e)},gT.prototype.getMatchingKeysForTargetId=function(t,e){var e=IDBKeyRange.bound([e],[e+1],!1,!0),t=wT(t),r=Yw();return t.Ot({range:e,kt:!0},function(t,e,n){t=q_(t[1]),t=new Cm(t);r=r.add(t)}).next(function(){return r})},gT.prototype.containsKey=function(t,e){var e=U_(e.path),e=IDBKeyRange.bound([e],[Jy(e)],!1,!0),i=0;return wT(t).Ot({index:$_.documentTargetsIndex,kt:!0,range:e},function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())}).next(function(){return 0h.params.maximumSequenceNumbersToCollect?(Vy("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+h.params.maximumSequenceNumbersToCollect+" from "+t),h.params.maximumSequenceNumbersToCollect):t,s=Date.now(),h.nthSequenceNumber(e,i)}).next(function(t){return r=t,a=Date.now(),h.removeTargets(e,r,n)}).next(function(t){return o=t,u=Date.now(),h.removeOrphanedDocuments(e,r)}).next(function(t){return c=Date.now(),qy()<=as.DEBUG&&Vy("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(s-l)+"ms\n\tDetermined least recently used "+i+" in "+(a-s)+"ms\n\tRemoved "+o+" targets in "+(u-a)+"ms\n\tRemoved "+t+" documents in "+(c-u)+"ms\nTotal Duration: "+(c-l)+"ms"),uI.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:o,documentsRemoved:t})})},AT),CT=(NT.prototype.he=function(t){var n=this.de(t);return this.db.getTargetCache().getTargetCount(t).next(function(e){return n.next(function(t){return e+t})})},NT.prototype.de=function(t){var e=0;return this.le(t,function(t){e++}).next(function(){return e})},NT.prototype.forEachTarget=function(t,e){return this.db.getTargetCache().forEachTarget(t,e)},NT.prototype.le=function(t,n){return this.we(t,function(t,e){return n(e)})},NT.prototype.addReference=function(t,e,n){return PT(t,n)},NT.prototype.removeReference=function(t,e,n){return PT(t,n)},NT.prototype.removeTargets=function(t,e,n){return this.db.getTargetCache().removeTargets(t,e,n)},NT.prototype.markPotentiallyOrphaned=PT,NT.prototype._e=function(t,e){return r=e,i=!1,pT(n=t).$t(function(t){return hT(n,t,r).next(function(t){return t&&(i=!0),uI.resolve(!t)})}).next(function(){return i});var n,r,i},NT.prototype.removeOrphanedDocuments=function(n,r){var i=this,o=this.db.getRemoteDocumentCache().newChangeBuffer(),s=[],a=0;return this.we(n,function(e,t){t<=r&&(t=i._e(n,e).next(function(t){if(!t)return a++,o.getEntry(n,e).next(function(){return o.removeEntry(e),wT(n).delete([0,U_(e.path)])})}),s.push(t))}).next(function(){return uI.waitFor(s)}).next(function(){return o.apply(n)}).next(function(){return a})},NT.prototype.removeTarget=function(t,e){e=e.withSequenceNumber(t.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(t,e)},NT.prototype.updateLimboDocument=PT,NT.prototype.we=function(t,r){var i,t=wT(t),o=Dy.o;return t.Ot({index:$_.documentTargetsIndex},function(t,e){var n=t[0],t=(t[1],e.path),e=e.sequenceNumber;0===n?(o!==Dy.o&&r(new Cm(q_(i)),o),o=e,i=t):o=Dy.o}).next(function(){o!==Dy.o&&r(new Cm(q_(i)),o)})},NT.prototype.getCacheSize=function(t){return this.db.getRemoteDocumentCache().getSize(t)},NT);function NT(t,e){this.db=t,this.garbageCollector=new ST(this,e)}function AT(t,e){this.ae=t,this.params=e}function kT(t,e){this.garbageCollector=t,this.asyncQueue=e,this.oe=!1,this.ce=null}function RT(t){this.ne=t,this.buffer=new Vw(IT),this.se=0}function PT(t,e){return wT(t).put((t=t.currentSequenceNumber,new $_(0,U_(e.path),t)))}var OT,DT=(jT.prototype.get=function(t){var e=this.mapKeyFn(t),e=this.inner[e];if(void 0!==e)for(var n=0,r=e;n "+n),1))},QT.prototype.We=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.ke=function(){t.Se.enqueueAndForget(function(){return t.inForeground="visible"===t.document.visibilityState,t.je()})},this.document.addEventListener("visibilitychange",this.ke),this.inForeground="visible"===this.document.visibilityState)},QT.prototype.an=function(){this.ke&&(this.document.removeEventListener("visibilitychange",this.ke),this.ke=null)},QT.prototype.Ge=function(){var t,e=this;"function"==typeof(null===(t=this.window)||void 0===t?void 0:t.addEventListener)&&(this.Fe=function(){e.un(),e.Se.enqueueAndForget(function(){return e.shutdown()})},this.window.addEventListener("unload",this.Fe))},QT.prototype.hn=function(){this.Fe&&(this.window.removeEventListener("unload",this.Fe),this.Fe=null)},QT.prototype.cn=function(t){try{var e=null!==(null===(e=this.Ke)||void 0===e?void 0:e.getItem(this.on(t)));return Vy("IndexedDbPersistence","Client '"+t+"' "+(e?"is":"is not")+" zombied in LocalStorage"),e}catch(t){return By("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},QT.prototype.un=function(){if(this.Ke)try{this.Ke.setItem(this.on(this.clientId),String(Date.now()))}catch(t){By("Failed to set zombie client id.",t)}},QT.prototype.ln=function(){if(this.Ke)try{this.Ke.removeItem(this.on(this.clientId))}catch(t){}},QT.prototype.on=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},QT);function QT(t,e,n,r,i,o,s,a,u,c){if(this.allowTabSynchronization=t,this.persistenceKey=e,this.clientId=n,this.Se=i,this.window=o,this.document=s,this.De=u,this.Ce=c,this.Ne=null,this.xe=!1,this.isPrimary=!1,this.networkEnabled=!0,this.Fe=null,this.inForeground=!1,this.ke=null,this.Oe=null,this.$e=Number.NEGATIVE_INFINITY,this.Me=function(t){return Promise.resolve()},!QT.yt())throw new Fy(My.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new CT(this,r),this.Le=e+"main",this.R=new OI(a),this.Be=new hI(this.Le,11,new KT(this.R)),this.qe=new vT(this.referenceDelegate,this.R),this.Ut=new $I,this.Ue=(e=this.R,a=this.Ut,new xT(e,a)),this.Qe=new GI,this.window&&this.window.localStorage?this.Ke=this.window.localStorage:(this.Ke=null,!1===c&&By("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}function YT(t){return AI(t,V_.store)}function XT(t){return AI(t,eI.store)}function JT(t,e){var n=t.projectId;return t.isDefaultDatabase||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}function $T(t,e){this.progress=t,this.wn=e}var ZT=(sE.prototype.mn=function(e,n){var r=this;return this._n.getAllMutationBatchesAffectingDocumentKey(e,n).next(function(t){return r.yn(e,n,t)})},sE.prototype.yn=function(t,e,r){return this.Ue.getEntry(t,e).next(function(t){for(var e=0,n=r;ee?this._n[e]:null)},jE.prototype.getHighestUnacknowledgedBatchId=function(){return uI.resolve(0===this._n.length?-1:this.ss-1)},jE.prototype.getAllMutationBatches=function(t){return uI.resolve(this._n.slice())},jE.prototype.getAllMutationBatchesAffectingDocumentKey=function(t,e){var n=this,r=new TE(e,0),e=new TE(e,Number.POSITIVE_INFINITY),i=[];return this.rs.forEachInRange([r,e],function(t){t=n.os(t.ns);i.push(t)}),uI.resolve(i)},jE.prototype.getAllMutationBatchesAffectingDocumentKeys=function(t,e){var n=this,r=new Vw(Yy);return e.forEach(function(t){var e=new TE(t,0),t=new TE(t,Number.POSITIVE_INFINITY);n.rs.forEachInRange([e,t],function(t){r=r.add(t.ns)})}),uI.resolve(this.us(r))},jE.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var n=e.path,r=n.length+1,e=n;Cm.isDocumentKey(e)||(e=e.child(""));var e=new TE(new Cm(e),0),i=new Vw(Yy);return this.rs.forEachWhile(function(t){var e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(i=i.add(t.ns)),!0)},e),uI.resolve(this.us(i))},jE.prototype.us=function(t){var e=this,n=[];return t.forEach(function(t){t=e.os(t);null!==t&&n.push(t)}),n},jE.prototype.removeMutationBatch=function(n,r){var i=this;Gy(0===this.hs(r.batchId,"removed")),this._n.shift();var o=this.rs;return uI.forEach(r.mutations,function(t){var e=new TE(t.key,r.batchId);return o=o.delete(e),i.referenceDelegate.markPotentiallyOrphaned(n,t.key)}).next(function(){i.rs=o})},jE.prototype.Gt=function(t){},jE.prototype.containsKey=function(t,e){var n=new TE(e,0),n=this.rs.firstAfterOrEqual(n);return uI.resolve(e.isEqual(n&&n.key))},jE.prototype.performConsistencyCheck=function(t){return this._n.length,uI.resolve()},jE.prototype.hs=function(t,e){return this.cs(t)},jE.prototype.cs=function(t){return 0===this._n.length?0:t-this._n[0].batchId},jE.prototype.os=function(t){t=this.cs(t);return t<0||t>=this._n.length?null:this._n[t]},jE),SE=(UE.prototype.addEntry=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,i=this.ls(e);return this.docs=this.docs.insert(r,{document:e.clone(),size:i,readTime:n}),this.size+=i-o,this.Ut.addToCollectionParentIndex(t,r.path.popLast())},UE.prototype.removeEntry=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},UE.prototype.getEntry=function(t,e){var n=this.docs.get(e);return uI.resolve(n?n.document.clone():Bm.newInvalidDocument(e))},UE.prototype.getEntries=function(t,e){var n=this,r=Kw;return e.forEach(function(t){var e=n.docs.get(t);r=r.insert(t,e?e.document.clone():Bm.newInvalidDocument(t))}),uI.resolve(r)},UE.prototype.getDocumentsMatchingQuery=function(t,e,n){for(var r=Kw,i=new Cm(e.path.child("")),o=this.docs.getIteratorFrom(i);o.hasNext();){var s=o.getNext(),a=s.key,u=s.value,s=u.document,u=u.readTime;if(!e.path.isPrefixOf(a.path))break;u.compareTo(n)<=0||jb(e,s)&&(r=r.insert(s.key,s.clone()))}return uI.resolve(r)},UE.prototype.fs=function(t,e){return uI.forEach(this.docs,function(t){return e(t)})},UE.prototype.newChangeBuffer=function(t){return new CE(this)},UE.prototype.getSize=function(t){return uI.resolve(this.size)},UE),CE=(Xi(FE,wE=Sn),FE.prototype.applyChanges=function(n){var r=this,i=[];return this.changes.forEach(function(t,e){e.document.isValidDocument()?i.push(r.Ie.addEntry(n,e.document,r.getReadTime(t))):r.Ie.removeEntry(t)}),uI.waitFor(i)},FE.prototype.getFromCache=function(t,e){return this.Ie.getEntry(t,e)},FE.prototype.getAllFromCache=function(t,e){return this.Ie.getEntries(t,e)},FE),NE=(ME.prototype.forEachTarget=function(t,n){return this.ds.forEach(function(t,e){return n(e)}),uI.resolve()},ME.prototype.getLastRemoteSnapshotVersion=function(t){return uI.resolve(this.lastRemoteSnapshotVersion)},ME.prototype.getHighestSequenceNumber=function(t){return uI.resolve(this.ws)},ME.prototype.allocateTargetId=function(t){return this.highestTargetId=this.ys.next(),uI.resolve(this.highestTargetId)},ME.prototype.setTargetsMetadata=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.ws&&(this.ws=e),uI.resolve()},ME.prototype.te=function(t){this.ds.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.ys=new dT(e),this.highestTargetId=e),t.sequenceNumber>this.ws&&(this.ws=t.sequenceNumber)},ME.prototype.addTargetData=function(t,e){return this.te(e),this.targetCount+=1,uI.resolve()},ME.prototype.updateTargetData=function(t,e){return this.te(e),uI.resolve()},ME.prototype.removeTargetData=function(t,e){return this.ds.delete(e.target),this._s.Zn(e.targetId),--this.targetCount,uI.resolve()},ME.prototype.removeTargets=function(n,r,i){var o=this,s=0,a=[];return this.ds.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.ds.delete(t),a.push(o.removeMatchingKeysForTargetId(n,e.targetId)),s++)}),uI.waitFor(a).next(function(){return s})},ME.prototype.getTargetCount=function(t){return uI.resolve(this.targetCount)},ME.prototype.getTargetData=function(t,e){e=this.ds.get(e)||null;return uI.resolve(e)},ME.prototype.addMatchingKeys=function(t,e,n){return this._s.Jn(e,n),uI.resolve()},ME.prototype.removeMatchingKeys=function(e,t,n){this._s.Xn(t,n);var r=this.persistence.referenceDelegate,i=[];return r&&t.forEach(function(t){i.push(r.markPotentiallyOrphaned(e,t))}),uI.waitFor(i)},ME.prototype.removeMatchingKeysForTargetId=function(t,e){return this._s.Zn(e),uI.resolve()},ME.prototype.getMatchingKeysForTargetId=function(t,e){e=this._s.es(e);return uI.resolve(e)},ME.prototype.containsKey=function(t,e){return uI.resolve(this._s.containsKey(e))},ME),AE=(LE.prototype.start=function(){return Promise.resolve()},LE.prototype.shutdown=function(){return this.xe=!1,Promise.resolve()},Object.defineProperty(LE.prototype,"started",{get:function(){return this.xe},enumerable:!1,configurable:!0}),LE.prototype.setDatabaseDeletedListener=function(){},LE.prototype.setNetworkEnabled=function(){},LE.prototype.getIndexManager=function(){return this.Ut},LE.prototype.getMutationQueue=function(t){var e=this.gs[t.toKey()];return e||(e=new EE(this.Ut,this.referenceDelegate),this.gs[t.toKey()]=e),e},LE.prototype.getTargetCache=function(){return this.qe},LE.prototype.getRemoteDocumentCache=function(){return this.Ue},LE.prototype.getBundleCache=function(){return this.Qe},LE.prototype.runTransaction=function(t,e,n){var r=this;Vy("MemoryPersistence","Starting transaction:",t);var i=new kE(this.Ne.next());return this.referenceDelegate.Es(),n(i).next(function(t){return r.referenceDelegate.Ts(i).next(function(){return t})}).toPromise().then(function(t){return i.raiseOnCommittedEvent(),t})},LE.prototype.Is=function(e,n){return uI.or(Object.values(this.gs).map(function(t){return function(){return t.containsKey(e,n)}}))},LE),kE=(Xi(xE,bE=Ga),xE),RE=(DE.bs=function(t){return new DE(t)},Object.defineProperty(DE.prototype,"vs",{get:function(){if(this.Rs)return this.Rs;throw Hy()},enumerable:!1,configurable:!0}),DE.prototype.addReference=function(t,e,n){return this.As.addReference(n,e),this.vs.delete(n.toString()),uI.resolve()},DE.prototype.removeReference=function(t,e,n){return this.As.removeReference(n,e),this.vs.add(n.toString()),uI.resolve()},DE.prototype.markPotentiallyOrphaned=function(t,e){return this.vs.add(e.toString()),uI.resolve()},DE.prototype.removeTarget=function(t,e){var n=this;this.As.Zn(e.targetId).forEach(function(t){return n.vs.add(t.toString())});var r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(t,e.targetId).next(function(t){t.forEach(function(t){return n.vs.add(t.toString())})}).next(function(){return r.removeTargetData(t,e)})},DE.prototype.Es=function(){this.Rs=new Set},DE.prototype.Ts=function(n){var r=this,i=this.persistence.getRemoteDocumentCache().newChangeBuffer();return uI.forEach(this.vs,function(t){var e=Cm.fromPath(t);return r.Ps(n,e).next(function(t){t||i.removeEntry(e)})}).next(function(){return r.Rs=null,i.apply(n)})},DE.prototype.updateLimboDocument=function(t,e){var n=this;return this.Ps(t,e).next(function(t){t?n.vs.delete(e.toString()):n.vs.add(e.toString())})},DE.prototype.ps=function(t){return 0},DE.prototype.Ps=function(t,e){var n=this;return uI.or([function(){return uI.resolve(n.As.containsKey(e))},function(){return n.persistence.getTargetCache().containsKey(t,e)},function(){return n.persistence.Is(t,e)}])},DE),PE=(OE.prototype.isAuthenticated=function(){return null!=this.uid},OE.prototype.toKey=function(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"},OE.prototype.isEqual=function(t){return t.uid===this.uid},OE);function OE(t){this.uid=t}function DE(t){this.persistence=t,this.As=new IE,this.Rs=null}function xE(t){var e=this;return(e=bE.call(this)||this).currentSequenceNumber=t,e}function LE(t,e){var n=this;this.gs={},this.Ne=new Dy(0),this.xe=!1,this.xe=!0,this.referenceDelegate=t(this),this.qe=new NE(this),this.Ut=new XI,this.Ue=(t=this.Ut,new SE(t,function(t){return n.referenceDelegate.ps(t)})),this.R=new OI(e),this.Qe=new _E(this.R)}function ME(t){this.persistence=t,this.ds=new DT(Gm,zm),this.lastRemoteSnapshotVersion=Zy.min(),this.highestTargetId=0,this.ws=0,this._s=new IE,this.targetCount=0,this.ys=dT.Jt()}function FE(t){var e=this;return(e=wE.call(this)||this).Ie=t,e}function UE(t,e){this.Ut=t,this.ls=e,this.docs=new xw(Cm.comparator),this.size=0}function jE(t,e){this.Ut=t,this.referenceDelegate=e,this._n=[],this.ss=1,this.rs=new Vw(TE.Gn)}function qE(t,e){this.key=t,this.ns=e}function VE(){this.Wn=new Vw(TE.Gn),this.zn=new Vw(TE.Hn)}function BE(t){this.R=t,this.Kn=new Map,this.jn=new Map}function KE(t,e){return"firestore_clients_"+t+"_"+e}function WE(t,e,n){n="firestore_mutations_"+t+"_"+n;return e.isAuthenticated()&&(n+="_"+e.uid),n}function HE(t,e){return"firestore_targets_"+t+"_"+e}PE.UNAUTHENTICATED=new PE(null),PE.GOOGLE_CREDENTIALS=new PE("google-credentials-uid"),PE.FIRST_PARTY=new PE("first-party-uid");var GE,zE=(gS.Vs=function(t,e,n){var r,i=JSON.parse(n),o="object"==typeof i&&-1!==["pending","acknowledged","rejected"].indexOf(i.state)&&(void 0===i.error||"object"==typeof i.error);return o&&i.error&&(o="string"==typeof i.error.message&&"string"==typeof i.error.code)&&(r=new Fy(i.error.code,i.error.message)),o?new gS(t,e,i.state,r):(By("SharedClientState","Failed to parse mutation state for ID '"+e+"': "+n),null)},gS.prototype.Ss=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},gS),QE=(vS.Vs=function(t,e){var n,r=JSON.parse(e),i="object"==typeof r&&-1!==["not-current","current","rejected"].indexOf(r.state)&&(void 0===r.error||"object"==typeof r.error);return i&&r.error&&(i="string"==typeof r.error.message&&"string"==typeof r.error.code)&&(n=new Fy(r.error.code,r.error.message)),i?new vS(t,r.state,n):(By("SharedClientState","Failed to parse target state for ID '"+t+"': "+e),null)},vS.prototype.Ss=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},vS),YE=(dS.Vs=function(t,e){for(var n=JSON.parse(e),r="object"==typeof n&&n.activeTargetIds instanceof Array,i=Xw,o=0;r&&othis.Bi&&(this.qi=this.Bi)},xS.prototype.Gi=function(){null!==this.Ui&&(this.Ui.skipDelay(),this.Ui=null)},xS.prototype.cancel=function(){null!==this.Ui&&(this.Ui.cancel(),this.Ui=null)},xS.prototype.Wi=function(){return(Math.random()-.5)*this.qi},xS),Sn=(DS.prototype.tr=function(){return 1===this.state||2===this.state||4===this.state},DS.prototype.er=function(){return 2===this.state},DS.prototype.start=function(){3!==this.state?this.auth():this.nr()},DS.prototype.stop=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return this.tr()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},DS.prototype.sr=function(){this.state=0,this.Zi.reset()},DS.prototype.ir=function(){var t=this;this.er()&&null===this.Xi&&(this.Xi=this.Se.enqueueAfterDelay(this.zi,6e4,function(){return t.rr()}))},DS.prototype.cr=function(t){this.ur(),this.stream.send(t)},DS.prototype.rr=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return this.er()?[2,this.close(0)]:[2]})})},DS.prototype.ur=function(){this.Xi&&(this.Xi.cancel(),this.Xi=null)},DS.prototype.close=function(e,n){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return this.ur(),this.Zi.cancel(),this.Yi++,3!==e?this.Zi.reset():n&&n.code===My.RESOURCE_EXHAUSTED?(By(n.toString()),By("Using maximum backoff delay to prevent overloading the backend."),this.Zi.Ki()):n&&n.code===My.UNAUTHENTICATED&&this.Ji.invalidateToken(),null!==this.stream&&(this.ar(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.Ri(n)];case 1:return t.sent(),[2]}})})},DS.prototype.ar=function(){},DS.prototype.auth=function(){var n=this;this.state=1;var t=this.hr(this.Yi),e=this.Yi;this.Ji.getToken().then(function(t){n.Yi===e&&n.lr(t)},function(e){t(function(){var t=new Fy(My.UNKNOWN,"Fetching auth token failed: "+e.message);return n.dr(t)})})},DS.prototype.lr=function(t){var e=this,n=this.hr(this.Yi);this.stream=this.wr(t),this.stream.Ii(function(){n(function(){return e.state=2,e.listener.Ii()})}),this.stream.Ri(function(t){n(function(){return e.dr(t)})}),this.stream.onMessage(function(t){n(function(){return e.onMessage(t)})})},DS.prototype.nr=function(){var t=this;this.state=4,this.Zi.ji(function(){return $i(t,void 0,void 0,function(){return Zi(this,function(t){return this.state=0,this.start(),[2]})})})},DS.prototype.dr=function(t){return Vy("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},DS.prototype.hr=function(e){var n=this;return function(t){n.Se.enqueueAndForget(function(){return n.Yi===e?t():(Vy("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},DS),SS=(Xi(OS,TS=Sn),OS.prototype.wr=function(t){return this.Hi.$i("Listen",t)},OS.prototype.onMessage=function(t){this.Zi.reset();var e=function(t,e){if("targetChange"in e){e.targetChange;var n="NO_CHANGE"===(o=e.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===o?1:"REMOVE"===o?2:"CURRENT"===o?3:"RESET"===o?4:Hy(),r=e.targetChange.targetIds||[],i=(s=e.targetChange.resumeToken,t.I?(Gy(void 0===s||"string"==typeof s),lm.fromBase64String(s||"")):(Gy(void 0===s||s instanceof Uint8Array),lm.fromUint8Array(s||new Uint8Array))),o=(a=e.targetChange.cause)&&(u=void 0===(c=a).code?My.UNKNOWN:Dw(c.code),new Fy(u,c.message||"")),s=new e_(n,r,i,o||null)}else if("documentChange"in e){e.documentChange,(n=e.documentChange).document,n.document.name,n.document.updateTime;var r=b_(t,n.document.name),i=v_(n.document.updateTime),a=new qm({mapValue:{fields:n.document.fields}}),u=(o=Bm.newFoundDocument(r,i,a),n.targetIds||[]),c=n.removedTargetIds||[];s=new Zw(u,c,o.key,o)}else if("documentDelete"in e)e.documentDelete,(n=e.documentDelete).document,r=b_(t,n.document),i=n.readTime?v_(n.readTime):Zy.min(),a=Bm.newNoDocument(r,i),o=n.removedTargetIds||[],s=new Zw([],o,a.key,a);else if("documentRemove"in e)e.documentRemove,(n=e.documentRemove).document,r=b_(t,n.document),i=n.removedTargetIds||[],s=new Zw([],i,r,null);else{if(!("filter"in e))return Hy();e.filter;e=e.filter;e.targetId,n=e.count||0,r=new Ew(n),i=e.targetId,s=new t_(i,r)}return s}(this.R,t),t=function(t){if(!("targetChange"in t))return Zy.min();t=t.targetChange;return(!t.targetIds||!t.targetIds.length)&&t.readTime?v_(t.readTime):Zy.min()}(t);return this.listener._r(e,t)},OS.prototype.mr=function(t){var e,n,r,i={};i.database=I_(this.R),i.addTarget=(e=this.R,(r=Qm(r=(n=t).target)?{documents:A_(e,r)}:{query:k_(e,r)}).targetId=n.targetId,0this.query.limit;){var n=Ab(this.query)?h.last():h.first(),h=h.delete(n.key),c=c.delete(n.key);a.track({type:1,doc:n})}return{fo:h,mo:a,Nn:l,mutatedKeys:c}},RC.prototype.yo=function(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations},RC.prototype.applyChanges=function(t,e,n){var o=this,r=this.fo;this.fo=t.fo,this.mutatedKeys=t.mutatedKeys;var i=t.mo.jr();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.lo(t.doc,e.doc);function n(t){switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Hy()}}var r,i}),this.po(n);var s=e?this.Eo():[],n=0===this.ho.size&&this.current?1:0,e=n!==this.ao;return this.ao=n,0!==i.length||e?{snapshot:new sC(this.query,t.fo,r,i,t.mutatedKeys,0==n,e,!1),To:s}:{To:s}},RC.prototype.zr=function(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({fo:this.fo,mo:new oC,mutatedKeys:this.mutatedKeys,Nn:!1},!1)):{To:[]}},RC.prototype.Io=function(t){return!this.uo.has(t)&&!!this.fo.has(t)&&!this.fo.get(t).hasLocalMutations},RC.prototype.po=function(t){var e=this;t&&(t.addedDocuments.forEach(function(t){return e.uo=e.uo.add(t)}),t.modifiedDocuments.forEach(function(t){}),t.removedDocuments.forEach(function(t){return e.uo=e.uo.delete(t)}),this.current=t.current)},RC.prototype.Eo=function(){var e=this;if(!this.current)return[];var n=this.ho;this.ho=Yw(),this.fo.forEach(function(t){e.Io(t.key)&&(e.ho=e.ho.add(t.key))});var r=[];return n.forEach(function(t){e.ho.has(t)||r.push(new EC(t))}),this.ho.forEach(function(t){n.has(t)||r.push(new TC(t))}),r},RC.prototype.Ao=function(t){this.uo=t.Bn,this.ho=Yw();t=this._o(t.documents);return this.applyChanges(t,!0)},RC.prototype.Ro=function(){return sC.fromInitialDocuments(this.query,this.fo,this.mutatedKeys,0===this.ao)},RC),CC=function(t,e,n){this.query=t,this.targetId=e,this.view=n},NC=function(t){this.key=t,this.bo=!1},AC=(Object.defineProperty(kC.prototype,"isPrimaryClient",{get:function(){return!0===this.Oo},enumerable:!1,configurable:!0}),kC);function kC(t,e,n,r,i,o){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.vo={},this.Po=new DT(Fb,Mb),this.Vo=new Map,this.So=new Set,this.Do=new xw(Cm.comparator),this.Co=new Map,this.No=new IE,this.xo={},this.Fo=new Map,this.ko=dT.Yt(),this.onlineState="Unknown",this.Oo=void 0}function RC(t,e){this.query=t,this.uo=e,this.ao=null,this.current=!1,this.ho=Yw(),this.mutatedKeys=Yw(),this.lo=qb(t),this.fo=new iC(this.lo)}function PC(i,o,s,a){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return i.$o=function(t,e,n){return function(r,i,o,s){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return(e=i.view._o(o)).Nn?[4,vE(r.localStore,i.query,!1).then(function(t){t=t.documents;return i.view._o(t,e)})]:[3,2];case 1:e=t.sent(),t.label=2;case 2:return n=s&&s.targetChanges.get(i.targetId),n=i.view.applyChanges(e,r.isPrimaryClient,n),[2,(VC(r,i.targetId,n.To),n.snapshot)]}})})}(i,t,e,n)},[4,vE(i.localStore,o,!0)];case 1:return n=t.sent(),r=new SC(o,n.Bn),e=r._o(n.documents),n=$w.createSynthesizedTargetChangeForCurrentChange(s,a&&"Offline"!==i.onlineState),n=r.applyChanges(e,i.isPrimaryClient,n),VC(i,s,n.To),r=new CC(o,s,r),[2,(i.Po.set(o,r),i.Vo.has(s)?i.Vo.get(s).push(o):i.Vo.set(s,[o]),n.snapshot)]}})})}function OC(f,p,d){return $i(this,void 0,void 0,function(){var s,l;return Zi(this,function(t){switch(t.label){case 0:l=XC(f),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,(i=l.localStore,a=p,c=i,h=$y.now(),o=a.reduce(function(t,e){return t.add(e.key)},Yw()),c.persistence.runTransaction("Locally write mutations","readwrite",function(s){return c.Mn.pn(s,o).next(function(t){u=t;for(var e=[],n=0,r=a;n, or >=) must be on the same field. But you have inequality filters on '"+n.toString()+"' and '"+e.field.toString()+"'");n=Rb(t);null!==n&&tR(0,e.field,n)}t=function(t,e){for(var n=0,r=t.filters;ns.length)throw new Fy(My.INVALID_ARGUMENT,"Too many arguments provided to "+r+"(). The number of arguments must be less than or equal to the number of orderBy() clauses");for(var a=[],u=0;u, or >=) on field '"+e.toString()+"' and so you must also use '"+e.toString()+"' as your first argument to orderBy(), but your first orderBy() is on field '"+n.toString()+"' instead.")}eR.prototype.convertValue=function(t,e){switch(void 0===e&&(e="none"),Am(t)){case 0:return null;case 1:return t.booleanValue;case 2:return bm(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(wm(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw Hy()}},eR.prototype.convertObject=function(t,n){var r=this,i={};return rm(t.fields||{},function(t,e){i[t]=r.convertValue(e,n)}),i},eR.prototype.convertGeoPoint=function(t){return new NA(bm(t.latitude),bm(t.longitude))},eR.prototype.convertArray=function(t,e){var n=this;return(t.values||[]).map(function(t){return n.convertValue(t,e)})},eR.prototype.convertServerTimestamp=function(t,e){switch(e){case"previous":var n=function t(e){e=e.mapValue.fields.__previous_value__;return _m(e)?t(e):e}(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Im(t));default:return null}},eR.prototype.convertTimestamp=function(t){t=mm(t);return new $y(t.seconds,t.nanos)},eR.prototype.convertDocumentKey=function(t,e){var n=am.fromString(t);Gy(F_(n));t=new ON(n.get(1),n.get(3)),n=new Cm(n.popFirst(5));return t.isEqual(e)||By("Document "+n+" contains a document reference within a different database ("+t.projectId+"/"+t.database+") which is not supported. It will be treated as a reference in the current database ("+e.projectId+"/"+e.database+") instead."),n},Sn=eR;function eR(){}function nR(t,e,n){return t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e}var rR,iR=(Xi(aR,rR=Sn),aR.prototype.convertBytes=function(t){return new SA(t)},aR.prototype.convertReference=function(t){t=this.convertDocumentKey(t,this.firestore._databaseId);return new tA(this.firestore,null,t)},aR),oR=(sR.prototype.set=function(t,e,n){this._verifyNotCommitted();t=uR(t,this._firestore),e=nR(t._converter,e,n),n=BA(this._dataReader,"WriteBatch.set",t._key,e,null!==t._converter,n);return this._mutations.push(n.toMutation(t._key,cw.none())),this},sR.prototype.update=function(t,e,n){for(var r=[],i=3;i=s.createTime+6048e5?[2,function(i,o,s){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,5]),[4,function(o,s){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:return[4,JO(o)];case 1:e=t.sent(),n=$O(s.subscriptionOptions),n={method:"PATCH",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(XO(o.appConfig)+"/"+s.token,n)];case 3:return[4,t.sent().json()];case 4:return r=t.sent(),[3,6];case 5:throw i=t.sent(),PO.create("token-update-failed",{errorInfo:i});case 6:if(r.error)throw i=r.error.message,PO.create("token-update-failed",{errorInfo:i});if(!r.token)throw PO.create("token-update-no-token");return[2,r.token]}})})}(o,i)];case 1:return e=t.sent(),n=Ji(Ji({},i),{token:e,createTime:Date.now()}),[4,zO(o,n)];case 2:return t.sent(),[2,e];case 3:return r=t.sent(),[4,tD(o,s)];case 4:throw t.sent(),r;case 5:return[2]}})})}({token:s.token,createTime:Date.now(),subscriptionOptions:a},c,h)]:[2,s.token];case 9:return[2]}var e,n,r,i,o})})}function tD(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,GO(n)];case 1:return(e=t.sent())?[4,YO(n,e.token)]:[3,4];case 2:return t.sent(),[4,function(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return e=QO(r),[4,HO()];case 1:return n=t.sent(),[4,(n=n.transaction(KO,"readwrite")).objectStore(KO).delete(e)];case 2:return t.sent(),[4,n.complete];case 3:return t.sent(),[2]}})})}(n)];case 3:t.sent(),t.label=4;case 4:return[4,r.pushManager.getSubscription()];case 5:return(e=t.sent())?[2,e.unsubscribe()]:[2,!0]}})})}function eD(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,function(o,s){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:return[4,JO(o)];case 1:e=t.sent(),n=$O(s),n={method:"POST",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(XO(o.appConfig),n)];case 3:return[4,t.sent().json()];case 4:return r=t.sent(),[3,6];case 5:throw i=t.sent(),PO.create("token-subscribe-failed",{errorInfo:i});case 6:if(r.error)throw i=r.error.message,PO.create("token-subscribe-failed",{errorInfo:i});if(!r.token)throw PO.create("token-subscribe-no-token");return[2,r.token]}})})}(n,r)];case 1:return e=t.sent(),e={token:e,createTime:Date.now(),subscriptionOptions:r},[4,zO(n,e)];case 2:return t.sent(),[2,e.token]}})})}function nD(t){var e={from:t.from,collapseKey:t.collapse_key};return function(t,e){if(!e.notification)return;t.notification={};var n=e.notification.title;n&&(t.notification.title=n);n=e.notification.body;n&&(t.notification.body=n);e=e.notification.image;e&&(t.notification.image=e)}(e,t),function(t,e){if(!e.data)return;t.data=e.data}(e,t),function(t,e){if(!e.fcmOptions)return;t.fcmOptions={};var n=e.fcmOptions.link;n&&(t.fcmOptions.link=n);e=e.fcmOptions.analytics_label;e&&(t.fcmOptions.analyticsLabel=e)}(e,t),e}function rD(t){return"object"==typeof t&&t&&LO in t}function iD(e){return new Promise(function(t){setTimeout(t,e)})}var oD=(Object.defineProperty(sD.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),sD.prototype.setBackgroundMessageHandler=function(t){if(this.isOnBackgroundMessageUsed=!1,!t||"function"!=typeof t)throw PO.create("invalid-bg-handler");this.bgMessageHandler=t},sD.prototype.onBackgroundMessage=function(t){var e=this;return this.isOnBackgroundMessageUsed=!0,this.bgMessageHandler=t,function(){e.bgMessageHandler=null}},sD.prototype.getToken=function(){var n;return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return this.vapidKey?[3,2]:[4,GO(this.firebaseDependencies)];case 1:e=t.sent(),this.vapidKey=null!==(n=null===(n=null==e?void 0:e.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==n?n:OO,t.label=2;case 2:return[2,ZO(this.firebaseDependencies,self.registration,this.vapidKey)]}})})},sD.prototype.deleteToken=function(){return tD(this.firebaseDependencies,self.registration)},sD.prototype.requestPermission=function(){throw PO.create("only-available-in-window")},sD.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw PO.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw PO.create("invalid-vapid-key");this.vapidKey=t},sD.prototype.useServiceWorker=function(){throw PO.create("only-available-in-window")},sD.prototype.onMessage=function(){throw PO.create("only-available-in-window")},sD.prototype.onTokenRefresh=function(){throw PO.create("only-available-in-window")},sD.prototype.onPush=function(a){return $i(this,void 0,void 0,function(){var i,o,s;return Zi(this,function(t){switch(t.label){case 0:return(s=function(t){var e=t.data;if(!e)return null;try{return e.json()}catch(t){return null}}(a))?[4,aD()]:(console.debug("FirebaseMessaging: failed to get parsed MessagePayload from the PushEvent. Skip handling the push."),[2]);case 1:return(i=t.sent(),i.some(function(t){return"visible"===t.visibilityState&&!t.url.startsWith("chrome-extension://")}))?[2,function(t,e){var n,r;e.isFirebaseMessaging=!0,e.messageType=RO.PUSH_RECEIVED;try{for(var i=to(t),o=i.next();!o.done;o=i.next())o.value.postMessage(e)}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}(i,s)]:(o=!1,s.notification?[4,function(t){var e=t.actions,n=Notification.maxActions;e&&n&&e.length>n&&console.warn("This browser only supports "+n+" actions. The remaining actions will not be displayed.");return self.registration.showNotification(null!==(n=t.title)&&void 0!==n?n:"",t)}(((r=Ji({},(e=s).notification)).data=((n={})[xO]=e,n),r))]:[3,3]);case 2:t.sent(),o=!0,t.label=3;case 3:return!0===o&&!1===this.isOnBackgroundMessageUsed?[2]:(this.bgMessageHandler&&(s=nD(s),"function"==typeof this.bgMessageHandler?this.bgMessageHandler(s):this.bgMessageHandler.next(s)),[4,iD(1e3)]);case 4:return t.sent(),[2]}var e,n,r})})},sD.prototype.onSubChange=function(n){var r;return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return n.newSubscription?[3,2]:[4,tD(this.firebaseDependencies,self.registration)];case 1:return t.sent(),[2];case 2:return[4,GO(this.firebaseDependencies)];case 3:return e=t.sent(),[4,tD(this.firebaseDependencies,self.registration)];case 4:return t.sent(),[4,ZO(this.firebaseDependencies,self.registration,null!==(r=null===(r=null==e?void 0:e.subscriptionOptions)||void 0===r?void 0:r.vapidKey)&&void 0!==r?r:OO)];case 5:return t.sent(),[2]}})})},sD.prototype.onNotificationClick=function(s){var a;return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return(e=null===(a=null===(a=s.notification)||void 0===a?void 0:a.data)||void 0===a?void 0:a[xO])?s.action?[2]:(s.stopImmediatePropagation(),s.notification.close(),(n=function(t){var e,n=null!==(e=null===(e=t.fcmOptions)||void 0===e?void 0:e.link)&&void 0!==e?e:null===(n=t.notification)||void 0===n?void 0:n.click_action;if(n)return n;return rD(t.data)?self.location.origin:null}(e))?(r=new URL(n,self.location.href),i=new URL(self.location.origin),r.host!==i.host?[2]:[4,function(u){return $i(this,void 0,void 0,function(){var e,n,r,i,o,s,a;return Zi(this,function(t){switch(t.label){case 0:return[4,aD()];case 1:e=t.sent();try{for(n=to(e),r=n.next();!r.done;r=n.next())if(i=r.value,o=new URL(i.url,self.location.href),u.host===o.host)return[2,i]}catch(t){s={error:t}}finally{try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(s)throw s.error}}return[2,null]}})})}(r)]):[2]):[2];case 1:return(o=t.sent())?[3,4]:[4,self.clients.openWindow(n)];case 2:return o=t.sent(),[4,iD(3e3)];case 3:return t.sent(),[3,6];case 4:return[4,o.focus()];case 5:o=t.sent(),t.label=6;case 6:return o?(e.messageType=RO.NOTIFICATION_CLICKED,e.isFirebaseMessaging=!0,[2,o.postMessage(e)]):[2]}})})},sD);function sD(t){var e=this;this.firebaseDependencies=t,this.isOnBackgroundMessageUsed=null,this.vapidKey=null,this.bgMessageHandler=null,self.addEventListener("push",function(t){t.waitUntil(e.onPush(t))}),self.addEventListener("pushsubscriptionchange",function(t){t.waitUntil(e.onSubChange(t))}),self.addEventListener("notificationclick",function(t){t.waitUntil(e.onNotificationClick(t))})}function aD(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}var uD=(Object.defineProperty(cD.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),cD.prototype.messageEventListener=function(i){return $i(this,void 0,void 0,function(){var n,r;return Zi(this,function(t){switch(t.label){case 0:return(n=i.data).isFirebaseMessaging?(this.onMessageCallback&&n.messageType===RO.PUSH_RECEIVED&&("function"==typeof this.onMessageCallback?this.onMessageCallback((delete(e=Object.assign({},n)).messageType,delete e.isFirebaseMessaging,e)):this.onMessageCallback.next(Object.assign({},n))),rD(r=n.data)&&"1"===r["google.c.a.e"]?[4,this.logEvent(n.messageType,r)]:[3,2]):[2];case 1:t.sent(),t.label=2;case 2:return[2]}var e})})},cD.prototype.getVapidKey=function(){return this.vapidKey},cD.prototype.getSwReg=function(){return this.swRegistration},cD.prototype.getToken=function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return"default"!==Notification.permission?[3,2]:[4,Notification.requestPermission()];case 1:t.sent(),t.label=2;case 2:if("granted"!==Notification.permission)throw PO.create("permission-blocked");return[4,this.updateVapidKey(null==e?void 0:e.vapidKey)];case 3:return t.sent(),[4,this.updateSwReg(null==e?void 0:e.serviceWorkerRegistration)];case 4:return t.sent(),[2,ZO(this.firebaseDependencies,this.swRegistration,this.vapidKey)]}})})},cD.prototype.updateVapidKey=function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return e?this.vapidKey=e:this.vapidKey||(this.vapidKey=OO),[2]})})},cD.prototype.updateSwReg=function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return e||this.swRegistration?[3,2]:[4,this.registerDefaultSw()];case 1:t.sent(),t.label=2;case 2:if(!e&&this.swRegistration)return[2];if(!(e instanceof ServiceWorkerRegistration))throw PO.create("invalid-sw-registration");return this.swRegistration=e,[2]}})})},cD.prototype.registerDefaultSw=function(){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=this,[4,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"})];case 1:return e.swRegistration=t.sent(),this.swRegistration.update().catch(function(){}),[3,3];case 2:throw e=t.sent(),PO.create("failed-service-worker-registration",{browserErrorMessage:e.message});case 3:return[2]}})})},cD.prototype.deleteToken=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return this.swRegistration?[3,2]:[4,this.registerDefaultSw()];case 1:t.sent(),t.label=2;case 2:return[2,tD(this.firebaseDependencies,this.swRegistration)]}})})},cD.prototype.requestPermission=function(){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return"granted"===Notification.permission?[2]:[4,Notification.requestPermission()];case 1:if("granted"===(e=t.sent()))return[2];throw"denied"===e?PO.create("permission-blocked"):PO.create("permission-default")}})})},cD.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw PO.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw PO.create("invalid-vapid-key");this.vapidKey=t},cD.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw PO.create("invalid-sw-registration");if(this.swRegistration)throw PO.create("use-sw-after-get-token");this.swRegistration=t},cD.prototype.onMessage=function(t){var e=this;return this.onMessageCallback=t,function(){e.onMessageCallback=null}},cD.prototype.setBackgroundMessageHandler=function(){throw PO.create("only-available-in-sw")},cD.prototype.onBackgroundMessage=function(){throw PO.create("only-available-in-sw")},cD.prototype.onTokenRefresh=function(){return function(){}},cD.prototype.logEvent=function(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(t){switch(t){case RO.NOTIFICATION_CLICKED:return"notification_open";case RO.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(n),[4,this.firebaseDependencies.analyticsProvider.get()];case 1:return t.sent().logEvent(e,{message_id:r[LO],message_name:r["google.c.a.c_l"],message_time:r["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)}),[2]}})})},cD);function cD(t){var e=this;this.firebaseDependencies=t,this.vapidKey=null,this.onMessageCallback=null,navigator.serviceWorker.addEventListener("message",function(t){return e.messageEventListener(t)})}function hD(t){return PO.create("missing-app-config-values",{valueName:t})}Sn={isSupported:lD};function lD(){return self&&"ServiceWorkerGlobalScope"in self?"indexedDB"in self&&null!==indexedDB&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey"):"indexedDB"in window&&null!==indexedDB&&navigator.cookieEnabled&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}Xl.INTERNAL.registerComponent(new ts("messaging",function(t){var e=t.getProvider("app").getImmediate(),t={app:e,appConfig:function(t){var e,n;if(!t||!t.options)throw hD("App Configuration Object");if(!t.name)throw hD("App Name");var r=t.options;try{for(var i=to(["projectId","apiKey","appId","messagingSenderId"]),o=i.next();!o.done;o=i.next()){var s=o.value;if(!r[s])throw hD(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return{appName:t.name,projectId:r.projectId,apiKey:r.apiKey,appId:r.appId,senderId:r.messagingSenderId}}(e),installations:t.getProvider("installations").getImmediate(),analyticsProvider:t.getProvider("analytics-internal")};if(!lD())throw PO.create("unsupported-browser");return new(self&&"ServiceWorkerGlobalScope"in self?oD:uD)(t)},"PUBLIC").setServiceProps(Sn));var fD,pD="firebasestorage.googleapis.com",dD="storageBucket",vD=(Xi(gD,fD=Eo),gD.prototype._codeEquals=function(t){return yD(t)===this.code},Object.defineProperty(gD.prototype,"message",{get:function(){return this.customData.serverResponse?this.message+"\n"+this.customData.serverResponse:this.message},enumerable:!1,configurable:!0}),Object.defineProperty(gD.prototype,"serverResponse",{get:function(){return this.customData.serverResponse},set:function(t){this.customData.serverResponse=t},enumerable:!1,configurable:!0}),gD);function gD(t,e){t=fD.call(this,yD(t),"Firebase Storage: "+e+" ("+yD(t)+")")||this;return t.customData={serverResponse:null},Object.setPrototypeOf(t,gD.prototype),t}function yD(t){return"storage/"+t}function mD(){return new vD("unknown","An unknown error occurred, please check the error payload for server response.")}function bD(){return new vD("canceled","User canceled the upload/download.")}function wD(){return new vD("cannot-slice-blob","Cannot slice blob for upload. Please retry the upload.")}function _D(t){return new vD("invalid-argument",t)}function ID(){return new vD("app-deleted","The Firebase app was deleted.")}function TD(t){return new vD("invalid-root-operation","The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function ED(t,e){return new vD("invalid-format","String does not match format '"+t+"': "+e)}function SD(t){throw new vD("internal-error","Internal error: "+t)}var CD={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"},ND=function(t,e){this.data=t,this.contentType=e||null};function AD(t,e){switch(t){case CD.RAW:return new ND(kD(e));case CD.BASE64:case CD.BASE64URL:return new ND(RD(t,e));case CD.DATA_URL:return new ND(function(t){t=new PD(t);return t.base64?RD(CD.BASE64,t.rest):function(t){var e;try{e=decodeURIComponent(t)}catch(t){throw ED(CD.DATA_URL,"Malformed data URL.")}return kD(e)}(t.rest)}(e),new PD(e).contentType)}throw mD()}function kD(t){for(var e=[],n=0;n>6,128|63&r):55296==(64512&r)?n>18,128|r>>12&63,128|r>>6&63,128|63&r)):e.push(239,191,189):56320==(64512&r)?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|63&r)}return new Uint8Array(e)}function RD(e,t){switch(e){case CD.BASE64:var n=-1!==t.indexOf("-"),r=-1!==t.indexOf("_");if(n||r)throw ED(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break;case CD.BASE64URL:r=-1!==t.indexOf("+"),n=-1!==t.indexOf("/");if(r||n)throw ED(e,"Invalid character '"+(r?"+":"/")+"' found: is it base64 encoded?");t=t.replace(/-/g,"+").replace(/_/g,"/")}var i;try{i=atob(t)}catch(t){throw ED(e,"Invalid character found")}for(var o=new Uint8Array(i.length),s=0;s][;base64],");var n,r=e[1]||null;null!=r&&(this.base64=(n=";base64",(e=r).length>=n.length&&e.substring(e.length-n.length)===n),this.contentType=this.base64?r.substring(0,r.length-";base64".length):r),this.rest=t.substring(t.indexOf(",")+1)};var OD,DD={STATE_CHANGED:"state_changed"},xD={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function LD(t){switch(t){case"running":case"pausing":case"canceling":return xD.RUNNING;case"paused":return xD.PAUSED;case"success":return xD.SUCCESS;case"canceled":return xD.CANCELED;case"error":default:return xD.ERROR}}(Ga=OD=OD||{})[Ga.NO_ERROR=0]="NO_ERROR",Ga[Ga.NETWORK_ERROR=1]="NETWORK_ERROR",Ga[Ga.ABORT=2]="ABORT";var MD=(FD.prototype.send=function(t,e,n,r){if(this.sent_)throw SD("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(e,t,!0),void 0!==r)for(var i in r)r.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,r[i].toString());return void 0!==n?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_},FD.prototype.getErrorCode=function(){if(!this.sent_)throw SD("cannot .getErrorCode() before sending");return this.errorCode_},FD.prototype.getStatus=function(){if(!this.sent_)throw SD("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}},FD.prototype.getResponseText=function(){if(!this.sent_)throw SD("cannot .getResponseText() before sending");return this.xhr_.responseText},FD.prototype.abort=function(){this.xhr_.abort()},FD.prototype.getResponseHeader=function(t){return this.xhr_.getResponseHeader(t)},FD.prototype.addUploadProgressListener=function(t){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",t)},FD.prototype.removeUploadProgressListener=function(t){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",t)},FD);function FD(){var e=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=OD.NO_ERROR,this.sendPromise_=new Promise(function(t){e.xhr_.addEventListener("abort",function(){e.errorCode_=OD.ABORT,t(e)}),e.xhr_.addEventListener("error",function(){e.errorCode_=OD.NETWORK_ERROR,t(e)}),e.xhr_.addEventListener("load",function(){t(e)})})}var UD=(jD.prototype.createXhrIo=function(){return new MD},jD);function jD(){}var qD=(Object.defineProperty(VD.prototype,"path",{get:function(){return this.path_},enumerable:!1,configurable:!0}),Object.defineProperty(VD.prototype,"isRoot",{get:function(){return 0===this.path.length},enumerable:!1,configurable:!0}),VD.prototype.fullServerUrl=function(){var t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)},VD.prototype.bucketOnlyServerUrl=function(){return"/b/"+encodeURIComponent(this.bucket)+"/o"},VD.makeFromBucketSpec=function(e){var t;try{t=VD.makeFromUrl(e)}catch(t){return new VD(e,"")}if(""===t.path)return t;throw new vD("invalid-default-bucket","Invalid default bucket '"+e+"'.")},VD.makeFromUrl=function(t){var e=null,n="([A-Za-z0-9.\\-_]+)";var r=new RegExp("^gs://"+n+"(/(.*))?$","i");function i(t){t.path_=decodeURIComponent(t.path)}for(var o=pD.replace(/[.]/g,"\\."),s=[{regex:r,indices:{bucket:1,path:3},postModify:function(t){"/"===t.path.charAt(t.path.length-1)&&(t.path_=t.path_.slice(0,-1))}},{regex:new RegExp("^https?://"+o+"/v[A-Za-z0-9_]+/b/"+n+"/o(/([^?#]*).*)?$","i"),indices:{bucket:1,path:3},postModify:i},{regex:new RegExp("^https?://(?:storage.googleapis.com|storage.cloud.google.com)/"+n+"/([^?#]*)","i"),indices:{bucket:1,path:2},postModify:i}],a=0;ai&&r.push(e.charAt(i));return r.join("")}var wL,_L,IL=(TL.prototype.getAppId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!t)throw dL.create("no app id");return t},TL.prototype.getProjectId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!t)throw dL.create("no project id");return t},TL.prototype.getApiKey=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!t)throw dL.create("no api key");return t},TL.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},TL.getInstance=function(){return gL=void 0===gL?new TL:gL},TL);function TL(){this.instrumentationEnabled=!0,this.dataCollectionEnabled=!0,this.loggingEnabled=!1,this.tracesSamplingRate=1,this.networkRequestsSamplingRate=1,this.logEndPointUrl="https://firebaselogging.googleapis.com/v0cc/log?format=json_proto",this.flTransportEndpointUrl=bL("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=bL("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}(Sn=_L=_L||{})[Sn.UNKNOWN=0]="UNKNOWN",Sn[Sn.VISIBLE=1]="VISIBLE",Sn[Sn.HIDDEN=2]="HIDDEN";var EL=["firebase_","google_","ga_"],SL=new RegExp("^[a-zA-Z]\\w*$");function CL(){switch(yL.getInstance().document.visibilityState){case"visible":return _L.VISIBLE;case"hidden":return _L.HIDDEN;default:return _L.UNKNOWN}}var NL="0.0.1",AL={loggingEnabled:!0},kL="FIREBASE_INSTALLATIONS_AUTH";function RL(t){var n,e=function(){var t=yL.getInstance().localStorage;if(!t)return;var e=t.getItem(pL);if(!e||!function(t){return Number(t)>Date.now()}(e))return;var n=t.getItem(fL);if(!n)return;try{return JSON.parse(n)}catch(t){return}}();return e?(OL(e),Promise.resolve()):(n=t,function(){var t=IL.getInstance().installationsService.getToken();return t.then(function(t){}),t}().then(function(t){var e="https://firebaseremoteconfig.googleapis.com/v1/projects/"+IL.getInstance().getProjectId()+"/namespaces/fireperf:fetch?key="+IL.getInstance().getApiKey(),t=new Request(e,{method:"POST",headers:{Authorization:kL+" "+t},body:JSON.stringify({app_instance_id:n,app_instance_id_token:t,app_id:IL.getInstance().getAppId(),app_version:hL,sdk_version:NL})});return fetch(t).then(function(t){if(t.ok)return t.json();throw dL.create("RC response not ok")})}).catch(function(){vL.info(PL)}).then(OL).then(function(t){var e=yL.getInstance().localStorage;if(!t||!e)return;e.setItem(fL,JSON.stringify(t)),e.setItem(pL,String(Date.now()+60*IL.getInstance().configTimeToLive*60*1e3))},function(){}))}var PL="Could not fetch config, will use default configs";function OL(t){if(!t)return t;var e=IL.getInstance(),n=t.entries||{};return e.loggingEnabled=void 0!==n.fpr_enabled?"true"===String(n.fpr_enabled):AL.loggingEnabled,n.fpr_log_source&&(e.logSource=Number(n.fpr_log_source)),n.fpr_log_endpoint_url&&(e.logEndPointUrl=n.fpr_log_endpoint_url),n.fpr_log_transport_key&&(e.transportKey=n.fpr_log_transport_key),void 0!==n.fpr_vc_network_request_sampling_rate&&(e.networkRequestsSamplingRate=Number(n.fpr_vc_network_request_sampling_rate)),void 0!==n.fpr_vc_trace_sampling_rate&&(e.tracesSamplingRate=Number(n.fpr_vc_trace_sampling_rate)),e.logTraceAfterSampling=DL(e.tracesSamplingRate),e.logNetworkAfterSampling=DL(e.networkRequestsSamplingRate),t}function DL(t){return Math.random()<=t}var xL,LL=1;function ML(){return LL=2,xL=xL||function(){var n=yL.getInstance().document;return new Promise(function(t){var e;n&&"complete"!==n.readyState?(e=function(){"complete"===n.readyState&&(n.removeEventListener("readystatechange",e),t())},n.addEventListener("readystatechange",e)):t()})}().then(function(){return(t=IL.getInstance().installationsService.getId()).then(function(t){wL=t}),t;var t}).then(RL).then(FL,FL)}function FL(){LL=3}var UL,jL=1e4,qL=5500,VL=3,BL=1e3,KL=VL,WL=[],HL=!1;function GL(t){setTimeout(function(){var t,e;if(0!==KL)return WL.length?(t=WL.splice(0,BL),e=t.map(function(t){return{source_extension_json_proto3:t.message,event_time_ms:String(t.eventTime)}}),void function(t,r){return function(t){var e=IL.getInstance().getFlTransportFullUrl();return fetch(e,{method:"POST",body:JSON.stringify(t)})}(t).then(function(t){return t.ok||vL.info("Call to Firebase backend failed."),t.json()}).then(function(t){var e=Number(t.nextRequestWaitMillis),n=jL;isNaN(e)||(n=Math.max(e,n));t=t.logResponseDetails;Array.isArray(t)&&0 with the name of a component - i.e. auth, database, etc):\n\nhttps://www.gstatic.com/firebasejs/5.0.0/firebase-.js\n"),Xl.registerVersion("firebase","8.3.2","cdn"),Xl}); //# sourceMappingURL=firebase.js.map