!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).firebase=e()}(this,function(){"use strict";!function(t){if(!t.fetch){var e="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,s="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),r="FormData"in t,i="ArrayBuffer"in t;if(i)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=function(t){return t&&DataView.prototype.isPrototypeOf(t)},u=ArrayBuffer.isView||function(t){return t&&-1i;)c(r,n=e[i++])&&(~Lt(o,n)||o.push(n));return o}function dt(t,e){for(var n=Vt(e),r=b.f,i=Ot.f,o=0;o"+t+""}var ne,re={IteratorPrototype:mt,BUGGY_SAFARI_ITERATORS:Zt},ie=Object.keys||function(t){return pt(t,Mt)},oe=f?Object.defineProperties:function(t,e){d(t);for(var n,r=ie(e),i=r.length,o=0;o=n.length?{value:void 0,done:!0}:(t=Ce(n,r),e.index+=t.length,{value:t,done:!1})});var Oe={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},Re=i("unscopables"),Pe=Array.prototype;null==Pe[Re]&&b.f(Pe,Re,{configurable:!0,value:ve(null)});function De(t){Pe[Re][t]=!0}var xe="Array Iterator",Le=J.set,Me=J.getterFor(xe),Fe=de(Array,"Array",function(t,e){Le(this,{type:xe,target:ut(t),index:0,kind:e})},function(){var t=Me(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");me.Arguments=me.Array,De("keys"),De("values"),De("entries");var Ue=i("iterator"),je=i("toStringTag"),Ve=Fe.values;for(var qe in Oe){var Be=m[qe],We=Be&&Be.prototype;if(We){if(We[Ue]!==Ve)try{w(We,Ue,Ve)}catch(au){We[Ue]=Ve}if(We[je]||w(We,je,qe),Oe[qe])for(var He in Fe)if(We[He]!==Fe[He])try{w(We,He,Fe[He])}catch(au){We[He]=Fe[He]}}}function Ge(t,e,n){for(var r in e)Z(t,r,e[r],n);return t}function ze(t){var e=ht(t),n=b.f;f&&e&&!e[tn]&&n(e,tn,{configurable:!0,get:function(){return this}})}function Ke(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}function Qe(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t}function Ye(t){return void 0!==t&&(me.Array===t||nn[en]===t)}function Xe(r,i,t){if(Ke(r),void 0===i)return r;switch(t){case 0:return function(){return r.call(i)};case 1:return function(t){return r.call(i,t)};case 2:return function(t,e){return r.call(i,t,e)};case 3:return function(t,e,n){return r.call(i,t,e,n)}}return function(){return r.apply(i,arguments)}}function $e(t){if(null!=t)return t[rn]||t["@@iterator"]||me[rt(t)]}function Je(e,t,n,r){try{return r?t(d(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&d(i.call(e)),t}}var Ze=m.Promise,tn=i("species"),en=i("iterator"),nn=Array.prototype,rn=i("iterator"),on=e(function(t){function p(t,e){this.stopped=t,this.result=e}(t.exports=function(t,e,n,r,i){var o,s,a,u,c,h,l,f=Xe(e,n,r?2:1);if(i)o=t;else{if("function"!=typeof(s=$e(t)))throw TypeError("Target is not iterable");if(Ye(s)){for(a=0,u=lt(t.length);an;){var r,i,o,s=d[n++],a=e?s.ok:s.fail,u=s.resolve,c=s.reject,h=s.domain;try{a?(e||(2===f.rejection&&xr(l,f),f.rejection=1),!0===a?r=t:(h&&h.enter(),r=a(t),h&&(h.exit(),o=!0)),r===s.promise?c(wr("Promise-chain cycle")):(i=ir(r))?i.call(r,u,c):u(r)):c(t)}catch(t){h&&!o&&h.exit(),c(t)}}f.reactions=[],f.notified=!1,p&&!f.rejection&&Pr(l,f)})}}function sr(t,e,n){var r,i;Ar?((r=Er.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),m.dispatchEvent(r)):r={promise:e,reason:n},(i=m["on"+t])?i(r):t===kr&&function(t,e){var n=m.console;n&&n.error&&(1===arguments.length?n.error(t):n.error(t,e))}("Unhandled promise rejection",n)}function ar(e,n,r,i){return function(t){e(n,r,t,i)}}function ur(t,e,n,r){e.done||(e.done=!0,r&&(e=r),e.value=n,e.state=2,or(t,e,!0))}var cr,hr,lr,fr,pr=Jn&&+Jn,dr=jn.set,vr=i("species"),yr="Promise",gr=J.get,mr=J.set,br=J.getterFor(yr),_r=Ze,wr=m.TypeError,Er=m.document,Tr=m.process,Ir=ht("fetch"),Sr=tr.f,Cr=Sr,Nr="process"==$(Tr),Ar=!!(Er&&Er.createEvent&&m.dispatchEvent),kr="unhandledrejection",Or=zt(yr,function(){if(!(V(_r)!==String(_r))){if(66===pr)return!0;if(!Nr&&"function"!=typeof PromiseRejectionEvent)return!0}if(51<=pr&&/native code/.test(_r))return!1;function t(t){t(function(){},function(){})}var e=_r.resolve(1);return(e.constructor={})[vr]=t,!(e.then(function(){})instanceof t)}),Rr=Or||!hn(function(t){_r.all(t).catch(function(){})}),Pr=function(n,r){dr.call(m,function(){var t,e=r.value;if(Dr(r)&&(t=Xn(function(){Nr?Tr.emit("unhandledRejection",e,n):sr(kr,n,e)}),r.rejection=Nr||Dr(r)?2:1,t.error))throw t.value})},Dr=function(t){return 1!==t.rejection&&!t.parent},xr=function(t,e){dr.call(m,function(){Nr?Tr.emit("rejectionHandled",t):sr("rejectionhandled",t,e.value)})},Lr=function(n,r,t,e){if(!r.done){r.done=!0,e&&(r=e);try{if(n===t)throw wr("Promise can't be resolved itself");var i=ir(t);i?Zn(function(){var e={done:!1};try{i.call(t,ar(Lr,n,e,r),ar(ur,n,e,r))}catch(t){ur(n,e,t,r)}}):(r.value=t,r.state=1,or(n,r,!1))}catch(t){ur(n,{done:!1},t,r)}}};Or&&(_r=function(t){Qe(this,_r,yr),Ke(t),cr.call(this);var e=gr(this);try{t(ar(Lr,this,e),ar(ur,this,e))}catch(t){ur(this,e,t)}},(cr=function(){mr(this,{type:yr,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Ge(_r.prototype,{then:function(t,e){var n=br(this),r=Sr(ln(this,_r));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=Nr?Tr.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&or(this,n,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),hr=function(){var t=new cr,e=gr(t);this.promise=t,this.resolve=ar(Lr,t,e),this.reject=ar(ur,t,e)},tr.f=Sr=function(t){return t===_r||t===lr?new hr:Cr(t)},"function"==typeof Ze&&(fr=Ze.prototype.then,Z(Ze.prototype,"then",function(t,e){var n=this;return new _r(function(t,e){fr.call(n,t,e)}).then(t,e)},{unsafe:!0}),"function"==typeof Ir&&yt({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return Yn(_r,Ir.apply(m,arguments))}}))),yt({global:!0,wrap:!0,forced:Or},{Promise:_r}),le(_r,yr,!1),ze(yr),lr=ht(yr),yt({target:yr,stat:!0,forced:Or},{reject:function(t){var e=Sr(this);return e.reject.call(void 0,t),e.promise}}),yt({target:yr,stat:!0,forced:Or},{resolve:function(t){return Yn(this,t)}}),yt({target:yr,stat:!0,forced:Rr},{all:function(t){var a=this,e=Sr(a),u=e.resolve,c=e.reject,n=Xn(function(){var r=Ke(a.resolve),i=[],o=0,s=1;on(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=Sr(n),i=r.reject,e=Xn(function(){var e=Ke(n.resolve);on(t,function(t){e.call(n,t).then(r.resolve,i)})});return e.error&&i(e.value),r.promise}}),yt({target:"Promise",stat:!0},{allSettled:function(t){var a=this,e=tr.f(a),u=e.resolve,n=e.reject,r=Xn(function(){var r=Ke(a.resolve),i=[],o=0,s=1;on(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 Mr=!!Ze&&y(function(){Ze.prototype.finally.call({then:function(){}},function(){})});yt({target:"Promise",proto:!0,real:!0,forced:Mr},{finally:function(e){var n=ln(this,ht("Promise")),t="function"==typeof e;return this.then(t?function(t){return Yn(n,e()).then(function(){return t})}:e,t?function(t){return Yn(n,e()).then(function(){throw t})}:e)}}),"function"!=typeof Ze||Ze.prototype.finally||Z(Ze.prototype,"finally",ht("Promise").prototype.finally);Rt.Promise;var Fr=J.set,Ur=J.getterFor("AggregateError"),jr=function(t,e){var n=this;if(!(n instanceof jr))return new jr(t,e);_e&&(n=_e(new Error(e),$t(n)));var r=[];return on(t,r.push,r),f?Fr(n,{errors:r,type:"AggregateError"}):n.errors=r,void 0!==e&&w(n,"message",String(e)),n};jr.prototype=ve(Error.prototype,{constructor:_(5,jr),message:_(5,""),name:_(5,"AggregateError")}),f&&b.f(jr.prototype,"errors",{get:function(){return Ur(this).errors},configurable:!0}),yt({global:!0},{AggregateError:jr}),yt({target:"Promise",stat:!0},{try:function(t){var e=tr.f(this),n=Xn(t);return(n.error?e.reject:e.resolve)(n.value),e.promise}});var Vr="No one promise resolved";yt({target:"Promise",stat:!0},{any:function(t){var u=this,e=tr.f(u),c=e.resolve,h=e.reject,n=Xn(function(){var r=Ke(u.resolve),i=[],o=0,s=1,a=!1;on(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(ht("AggregateError"))(i,Vr)))})}),--s||h(new(ht("AggregateError"))(i,Vr))});return n.error&&h(n.value),e.promise}});function qr(t,e){var n;return Gr(t)&&("function"==typeof(n=t.constructor)&&(n===Array||Gr(n.prototype))||g(n)&&null===(n=n[zr]))&&(n=void 0),new(void 0===n?Array:n)(0===e?0:e)}function Br(p){var d=1==p,v=2==p,y=3==p,g=4==p,m=6==p,b=5==p||m;return function(t,e,n,r){for(var i,o,s=gt(t),a=At(s),u=Xe(e,n,3),c=lt(a.length),h=0,l=r||qr,f=d?l(t,c):v?l(t,0):void 0;h>>=1)&&(e+=e))1&r&&(n+=e);return n}});ei("String","repeat");function oo(t){if(g(t)){var e=t[uo];return void 0!==e?!!e:Gr(t)}}var so,ao=i("species"),uo=i("isConcatSpreadable"),co=9007199254740991,ho="Maximum allowed index exceeded",lo=51<=pr||!y(function(){var t=[];return t[uo]=!1,t.concat()[0]!==t}),fo=(so="concat",51<=pr||!y(function(){var t=[];return(t.constructor={})[ao]=function(){return{foo:1}},1!==t[so](Boolean).foo}));yt({target:"Array",proto:!0,forced:!lo||!fo},{concat:function(t){var e,n,r,i,o,s=gt(this),a=qr(s,0),u=0;for(e=-1,r=arguments.length;es[0]&&e[1]=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ns(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 Rs(t){try{return Ls.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}var Ps={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},Ds=function(t,e){if(!t)throw xs(e)},xs=function(t){return new Error("Firebase Database ("+Ps.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)},Ls={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,l=(3&o)<<4|a>>4,f=(15&a)<<2|c>>6,p=63&c;u||(p=64,s||(f=64)),r.push(n[h],n[l],n[f],n[p])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Os(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&s))}else{o=t[n++];var a=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&a)}}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;if(r.push(c),64!==a){var h=s<<4&240|a>>2;if(r.push(h),64!==u){var l=a<<6&192|u;r.push(l)}}}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 Ms(t){return Fs(void 0,t)}function Fs(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)&&(t[n]=Fs(t[n],e[n]));return t}var Us=(js.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))}},js);function js(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}function Vs(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function qs(){return"undefined"!=typeof window&&(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Vs())}function Bs(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function Ws(){return!0===Ps.NODE_ADMIN}var Hs,Gs=(Es(zs,Hs=Error),zs);function zs(t,e){var n=Hs.call(this,e)||this;return n.code=t,n.name="FirebaseError",Object.setPrototypeOf(n,zs.prototype),Error.captureStackTrace&&Error.captureStackTrace(n,Ks.prototype.create),n}var Ks=(Qs.prototype.create=function(t){for(var e=[],n=1;n"})):"Error",u=this.serviceName+": "+a+" ("+o+").",c=new Gs(o,u),h=0,l=Object.keys(i);h>>31)}var o,s,a=this.chain_[0],u=this.chain_[1],c=this.chain_[2],h=this.chain_[3],l=this.chain_[4];for(r=0;r<80;r++)s=r<40?r<20?(o=h^u&(c^h),1518500249):(o=u^c^h,1859775393):r<60?(o=u&c|h&(u|c),2400959708):(o=u^c^h,3395469782),i=(a<<5|a>>>27)+o+l+s+n[r]&4294967295,l=h,h=c,c=4294967295&(u<<30|u>>>2),u=a,a=i;this.chain_[0]=this.chain_[0]+a&4294967295,this.chain_[1]=this.chain_[1]+u&4294967295,this.chain_[2]=this.chain_[2]+c&4294967295,this.chain_[3]=this.chain_[3]+h&4294967295,this.chain_[4]=this.chain_[4]+l&4294967295},ia.prototype.update=function(t,e){if(null!=t){void 0===e&&(e=t.length);for(var n=e-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r>i&255,++r;return t},ia);function ia(){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?")}var i=t+" failed: ";return i+=r+" argument "}function la(t,e,n,r){if((!r||n)&&"function"!=typeof n)throw new Error(ha(t,e,r)+"must be a valid function.")}function fa(t,e,n,r){if((!r||n)&&("object"!=typeof n||null===n))throw new Error(ha(t,e,r)+"must be a valid context object.")}function pa(t){for(var e=0,n=0;n=(null!=o?o:t.logLevel)&&s({level:Ta[e].toLowerCase(),message:i,args:n,type:t.name})}},n=0,r=Sa;n>>0),i=0;function y(t,e,n){return t.call.apply(t.bind,arguments)}function g(e,n,t){if(!e)throw Error();if(2/g,J=/"/g,Z=/'/g,tt=/\x00/g,et=/[\x00&<>"']/;function nt(t,e){return-1!=t.indexOf(e)}function rt(t,e){return t"}else o=void 0===t?"undefined":null===t?"null":typeof t;R("Argument is not a %s (or a non-Element, non-Location mock); got: %s",e,o)}}function pt(t,e){this.a=t===yt&&e||"",this.b=vt}function dt(t){return t instanceof pt&&t.constructor===pt&&t.b===vt?t.a:(R("expected object of type Const, got '"+t+"'"),"type_error:Const")}pt.prototype.ra=!0,pt.prototype.qa=function(){return this.a},pt.prototype.toString=function(){return"Const{"+this.a+"}"};var vt={},yt={},gt=new pt(yt,"");function mt(t,e){this.a=t===It&&e||"",this.b=Tt}function bt(t){return t instanceof mt&&t.constructor===mt&&t.b===Tt?t.a:(R("expected object of type TrustedResourceUrl, got '"+t+"' of type "+n(t)),"type_error:TrustedResourceUrl")}function _t(t,n){var r=dt(t);if(!Et.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return t=r.replace(wt,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))}),new mt(It,t)}mt.prototype.ra=!0,mt.prototype.qa=function(){return this.a.toString()},mt.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var wt=/%{(\w+)}/g,Et=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,Tt={},It={};function St(t,e){this.a=t===Ot&&e||"",this.b=kt}function Ct(t){return t instanceof St&&t.constructor===St&&t.b===kt?t.a:(R("expected object of type SafeUrl, got '"+t+"' of type "+n(t)),"type_error:SafeUrl")}St.prototype.ra=!0,St.prototype.qa=function(){return this.a.toString()},St.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var Nt=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function At(t){return t instanceof St?t:(t="object"==typeof t&&t.ra?t.qa():String(t),Nt.test(t)||(t="about:invalid#zClosurez"),new St(Ot,t))}var kt={},Ot={};function Rt(){this.a="",this.b=Dt}function Pt(t){return t instanceof Rt&&t.constructor===Rt&&t.b===Dt?t.a:(R("expected object of type SafeHtml, got '"+t+"' of type "+n(t)),"type_error:SafeHtml")}Rt.prototype.ra=!0,Rt.prototype.qa=function(){return this.a.toString()},Rt.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var Dt={};function xt(t){var e=new Rt;return e.a=t,e}xt("");var Lt=xt("");function Mt(t,e){for(var n=t.split("%s"),r="",i=Array.prototype.slice.call(arguments,1);i.length&&1")&&(t=t.replace($,">")),-1!=t.indexOf('"')&&(t=t.replace(J,""")),-1!=t.indexOf("'")&&(t=t.replace(Z,"'")),-1!=t.indexOf("\0")&&(t=t.replace(tt,"�"))),t}function Ut(t){return Ut[" "](t),t}xt("
"),Ut[" "]=a;var jt,Vt,qt=st("Opera"),Bt=st("Trident")||st("MSIE"),Wt=st("Edge"),Ht=Wt||Bt,Gt=st("Gecko")&&!(nt(K.toLowerCase(),"webkit")&&!st("Edge"))&&!(st("Trident")||st("MSIE"))&&!st("Edge"),zt=nt(K.toLowerCase(),"webkit")&&!st("Edge");function Kt(){var t=l.document;return t?t.documentMode:void 0}t:{var Qt="",Yt=(Vt=K,Gt?/rv:([^\);]+)(\)|;)/.exec(Vt):Wt?/Edge\/([\d\.]+)/.exec(Vt):Bt?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Vt):zt?/WebKit\/(\S+)/.exec(Vt):qt?/(?:Version)[ \/]?(\S+)/.exec(Vt):void 0);if(Yt&&(Qt=Yt?Yt[1]:""),Bt){var Xt=Kt();if(null!=Xt&&Xt>parseFloat(Qt)){jt=String(Xt);break t}}jt=Qt}var $t,Jt={};function Zt(a){return t=a,e=function(){for(var t=0,e=Q(String(jt)).split("."),n=Q(String(a)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i"),o=o.join("")}return o=ae(i,o),s&&("string"==typeof s?o.className=s:Array.isArray(s)?o.className=s.join(" "):ne(o,s)),2>>0);function pn(e){return d(e)?e:(e[fn]||(e[fn]=function(t){return e.handleEvent(t)}),e[fn])}function dn(){Me.call(this),this.u=new Xe(this),(this.Yb=this).eb=null}function vn(t,e,n,r,i){t.u.add(String(e),n,!1,r,i)}function yn(t,e,n,r,i){t.u.add(String(e),n,!0,r,i)}function gn(t,e,n,r){if(!(e=t.u.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o>4&15).toString(16)+(15&t).toString(16)}Cn.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Ln(e,Fn,!0),":");var n=this.b;return!n&&"file"!=e||(t.push("//"),(e=this.i)&&t.push(Ln(e,Fn,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.l)&&t.push(":",String(n))),(n=this.c)&&(this.b&&"/"!=n.charAt(0)&&t.push("/"),t.push(Ln(n,"/"==n.charAt(0)?jn:Un,!0))),(n=this.a.toString())&&t.push("?",n),(n=this.g)&&t.push("#",Ln(n,qn)),t.join("")},Cn.prototype.resolve=function(t){var e=new Cn(this),n=!!t.f;n?Nn(e,t.f):n=!!t.i,n?e.i=t.i:n=!!t.b,n?e.b=t.b:n=null!=t.l;var r=t.c;if(n)An(e,t.l);else if(n=!!t.c){if("/"!=r.charAt(0))if(this.b&&!this.c)r="/"+r;else{var i=e.c.lastIndexOf("/");-1!=i&&(r=e.c.substr(0,i+1)+r)}if(".."==(i=r)||"."==i)r="";else if(nt(i,"./")||nt(i,"/.")){r=0==i.lastIndexOf("/",0),i=i.split("/");for(var o=[],s=0;s2*t.c&&Tn(t)))}function zn(t,e){return Wn(t),e=Yn(t,e),In(t.a.b,e)}function Kn(t,e,n){Gn(t,e),0'),r=s.document)&&(r.write(Pt(t)),r.close())):(s=r.open(Ct(e),n,s))&&t.noopener&&(s.opener=null),s)try{s.focus()}catch(t){}return s}var ar=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ur=/^[^@]+@[^@]+$/;function cr(){var e=null;return new ve(function(t){"complete"==l.document.readyState?t():(e=function(){t()},rn(window,"load",e))}).o(function(t){throw on(window,"load",e),t})}function hr(t){return t=t||_r(),!("file:"!==Sr()&&"ionic:"!==Sr()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function lr(){var t=l.window;try{return t&&t!=t.top}catch(t){return}}function fr(){return void 0!==l.WorkerGlobalScope&&"function"==typeof l.importScripts}function pr(){return Kl.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":Kl.INTERNAL.hasOwnProperty("node")?"Node":fr()?"Worker":"Browser"}function dr(){var t=pr();return"ReactNative"===t||"Node"===t}var vr="Firefox",yr="Chrome";function gr(t){var e=t.toLowerCase();return nt(e,"opera/")||nt(e,"opr/")||nt(e,"opios/")?"Opera":nt(e,"iemobile")?"IEMobile":nt(e,"msie")||nt(e,"trident/")?"IE":nt(e,"edge/")?"Edge":nt(e,"firefox/")?vr:nt(e,"silk/")?"Silk":nt(e,"blackberry")?"Blackberry":nt(e,"webos")?"Webos":!nt(e,"safari/")||nt(e,"chrome/")||nt(e,"crios/")||nt(e,"android")?!nt(e,"chrome/")&&!nt(e,"crios/")||nt(e,"edge/")?nt(e,"android")?"Android":(t=t.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==t.length?t[1]:"Other":yr:"Safari"}var mr={jd:"FirebaseCore-web",ld:"FirebaseUI-web"};function br(t,e){e=e||[];var n,r=[],i={};for(n in mr)i[mr[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+=String.fromCharCode(t)}),e}function xi(t){var e=Mi(t);if(!(e&&e.sub&&e.iss&&e.aud&&e.exp))throw Error("Invalid JWT");this.g=t,this.c=e.exp,this.h=e.sub,this.a=e.provider_id||e.firebase&&e.firebase.sign_in_provider||null,this.f=e.firebase&&e.firebase.tenant||null,this.b=!!e.is_anonymous||"anonymous"==this.a}function Li(t){try{return new xi(t)}catch(t){return null}}function Mi(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 Auth section -> Sign in method tab.",t):"http"==r||"https"==r?n=Mt("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",w.call(this,e,n)}function Uo(t,e,n){w.call(this,t,n),(t=e||{}).Gb&&qr(this,"email",t.Gb),t.da&&qr(this,"phoneNumber",t.da),t.credential&&qr(this,"credential",t.credential),t.Wb&&qr(this,"tenantId",t.Wb)}function jo(t){if(t.code){var e=t.code||"";0==e.indexOf(I)&&(e=e.substring(I.length));var n={credential:Oo(t),Wb:t.tenantId};if(t.email)n.Gb=t.email;else if(t.phoneNumber)n.da=t.phoneNumber;else if(!n.credential)return new w(e,t.message||void 0);return new Uo(e,n,t.message)}return null}function Vo(){}function qo(t){return t.c||(t.c=t.b())}function Bo(){}function Wo(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.c:e.a?t(e.a):(R("Root logger has no level set."),null)}(this).value)for(d(e)&&(e=e()),t=new Ko(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var ts,es={},ns=null;function rs(t){var e;if(ns||(ns=new Qo(""),(es[""]=ns).c=Jo),!(e=es[t])){e=new Qo(t);var n=t.lastIndexOf("."),r=t.substr(n+1);(n=rs(t.substr(0,n))).b||(n.b={}),(n.b[r]=e).a=n,es[t]=e}return e}function is(t,e){t&&t.log(Zo,e,void 0)}function os(t){this.f=t}function ss(t){dn.call(this),this.s=t,this.readyState=as,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.i=new Headers,this.b=null,this.m="GET",this.g="",this.a=!1,this.h=rs("goog.net.FetchXmlHttp"),this.l=this.c=this.f=null}e(os,Vo),os.prototype.a=function(){return new ss(this.f)},os.prototype.b=(ts={},function(){return ts}),e(ss,dn);var as=0;function us(t){t.c.read().then(t.nc.bind(t)).catch(t.Sa.bind(t))}function cs(t,e){e&&t.f&&(t.status=t.f.status,t.statusText=t.f.statusText),t.readyState=4,t.f=null,t.c=null,t.l=null,hs(t)}function hs(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function ls(t){dn.call(this),this.headers=new En,this.D=t||null,this.c=!1,this.B=this.a=null,this.h=this.P=this.l="",this.f=this.O=this.i=this.N=!1,this.g=0,this.s=null,this.m=fs,this.w=this.R=!1}(t=ss.prototype).open=function(t,e){if(this.readyState!=as)throw this.abort(),Error("Error reopening a connection");this.m=t,this.g=e,this.readyState=1,hs(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.i,method:this.m,credentials:void 0,cache:void 0};t&&(e.body=t),this.s.fetch(new Request(this.g,e)).then(this.sc.bind(this),this.Sa.bind(this))},t.abort=function(){this.response=this.responseText="",this.i=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&4!=this.readyState&&(this.a=!1,cs(this,!1)),this.readyState=as},t.sc=function(t){this.a&&(this.f=t,this.b||(this.b=t.headers,this.readyState=2,hs(this)),this.a&&(this.readyState=3,hs(this),this.a&&("arraybuffer"===this.responseType?t.arrayBuffer().then(this.qc.bind(this),this.Sa.bind(this)):void 0!==l.ReadableStream&&"body"in t?(this.response=this.responseText="",this.c=t.body.getReader(),this.l=new TextDecoder,us(this)):t.text().then(this.rc.bind(this),this.Sa.bind(this)))))},t.nc=function(t){if(this.a){var e=this.l.decode(t.value?t.value:new Uint8Array(0),{stream:!t.done});e&&(this.response=this.responseText+=e),t.done?cs(this,!0):hs(this),3==this.readyState&&us(this)}},t.rc=function(t){this.a&&(this.response=this.responseText=t,cs(this,!0))},t.qc=function(t){this.a&&(this.response=t,cs(this,!0))},t.Sa=function(t){var e=this.h;e&&e.log($o,"Failed to fetch url "+this.g,t instanceof Error?t:Error(t)),this.a&&cs(this,!0)},t.setRequestHeader=function(t,e){this.i.append(t,e)},t.getResponseHeader=function(t){return this.b?this.b.get(t.toLowerCase())||"":((t=this.h)&&t.log($o,"Attempting to get response header but no headers have been received for url: "+this.g,void 0),"")},t.getAllResponseHeaders=function(){if(!this.b){var t=this.h;return t&&t.log($o,"Attempting to get all response headers but no headers have been received for url: "+this.g,void 0),""}t=[];for(var 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")},e(ls,dn);var fs="";ls.prototype.b=rs("goog.net.XhrIo");var ps=/^https?$/i,ds=["POST","PUT"];function vs(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.P=n,e.N=!1,e.c=!0,e.a=e.D?e.D.a():Lo.a(),e.B=e.D?qo(e.D):qo(Lo),e.a.onreadystatechange=m(e.Sb,e);try{is(e.b,Is(e,"Opening Xhr")),e.O=!0,e.a.open(n,String(t),!0),e.O=!1}catch(t){return is(e.b,Is(e,"Error opening Xhr: "+t.message)),void gs(e,t)}t=r||"";var o,s=new En(e.headers);i&&function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(h(t)||"string"==typeof t)U(t,e,void 0);else for(var n=wn(t),r=_n(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|Xu[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 sc(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 pc(t,e){for(var n=0;nt.f&&(t.a=t.f),e)}function nh(t){this.c=t,this.b=this.a=null}function rh(t){return t.b&&1e3*t.b.c||0}function ih(t,e){var n=e.refreshToken;t.b=Li(e[Hs]||""),t.a=n}function oh(e,t){return r=e.c,i=t,new ve(function(e,n){"refresh_token"==i.grant_type&&i.refresh_token||"authorization_code"==i.grant_type&&i.code?$s(r,r.u+"?key="+encodeURIComponent(r.c),function(t){t?t.error?n(Ya(t)):t.access_token&&t.refresh_token?e(t):n(new w("internal-error")):n(new w("network-request-failed"))},"POST",Hn(i).toString(),r.g,r.m.get()):n(new w("internal-error"))}).then(function(t){return e.b=Li(t.access_token),e.a=t.refresh_token,{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 sh(t,e){this.a=t||null,this.b=e||null,Br(this,{lastSignInTime:Lr(e||null),creationTime:Lr(t||null)})}function ah(t,e,n,r,i,o){Br(this,{uid:t,displayName:r||null,photoURL:i||null,email:n||null,phoneNumber:o||null,providerId:e})}function uh(t,e,n){var r;this.N=[],this.l=t.apiKey,this.m=t.appName,this.s=t.authDomain||null,t=Kl.SDK_VERSION?br(Kl.SDK_VERSION):null,this.a=new Bs(this.l,N(T),t),this.b=new nh(this.a),vh(this,e[Hs]),ih(this.b,e),qr(this,"refreshToken",this.b.a),mh(this,n||{}),dn.call(this),this.P=!1,this.s&&Tr()&&(this.i=Pc(this.s,this.l,this.m)),this.R=[],this.h=null,this.B=(r=this,new th(function(){return r.I(!0)},function(t){return!(!t||"auth/network-request-failed"!=t.code)},function(){var t=rh(r.b)-_()-3e5;return 0rh(this)-3e4?this.a?oh(this,{grant_type:"refresh_token",refresh_token:this.a}):Ee(null):Ee({accessToken:this.b.toString(),refreshToken:this.a})},sh.prototype.v=function(){return{lastLoginAt:this.b,createdAt:this.a}},e(uh,dn),uh.prototype.va=function(t){this.oa=t,Ys(this.a,t)},uh.prototype.ja=function(){return this.oa},uh.prototype.Ea=function(){return z(this.W)},uh.prototype.Ma=function(){this.B.b&&(this.B.stop(),this.B.start())},qr(uh.prototype,"providerId","firebase"),(t=uh.prototype).reload=function(){var t=this;return xh(this,_h(this).then(function(){return Ch(t).then(function(){return yh(t)}).then(bh)}))},t.mc=function(t){return this.I(t).then(function(t){return new Bc(t)})},t.I=function(t){var e=this;return xh(this,_h(this).then(function(){return e.b.getToken(t)}).then(function(t){if(!t)throw new w("internal-error");return t.accessToken!=e.xa&&(vh(e,t.accessToken),e.dispatchEvent(new $c("tokenChanged"))),Ih(e,"refreshToken",t.refreshToken),t.accessToken}))},t.Ic=function(t){if(!(t=t.users)||!t.length)throw new w("internal-error");mh(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=(r=(r=t).providerUserInfo)&&r.length?V(r,function(t){return new ah(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)}):[],n=0;n=Ol.length)throw new w("internal-error","Argument validator received an unsupported number of arguments.");n=Ol[i],r=(r?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.J+".";break t}r=null}}if(r)throw new w("argument-error",t+" failed: "+r)}(t=_l.prototype).Ga=function(){var e=this;return this.f?this.f:this.f=Cl(this,Ee().then(function(){if(Ir()&&!fr())return cr();throw new w("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")}).then(function(){return e.m.g(e.w())}).then(function(t){return e.g=t,Ka(e.s,Oa,{})}).then(function(t){e.a[Tl]=t.recaptchaSiteKey}).o(function(t){throw e.f=null,t}))},t.render=function(){Nl(this);var n=this;return Cl(this,this.Ga().then(function(){if(null===n.c){var t=n.u;if(!n.i){var e=ee(t);t=se("DIV"),e.appendChild(t)}n.c=n.g.render(t,n.a)}return n.c}))},t.verify=function(){Nl(this);var i=this;return Cl(this,this.render().then(function(e){return new ve(function(n){var t=i.g.getResponse(e);if(t)n(t);else{var 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(){Nl(this),null!==this.c&&this.g.reset(this.c)},t.clear=function(){Nl(this),this.D=!0,this.m.c();for(var t=0;t>6|192:(i<65536?e[n++]=i>>12|224:(e[n++]=i>>18|240,e[n++]=i>>12&63|128),e[n++]=i>>6&63|128),e[n++]=63&i|128)}return e}(t),n=new ra;n.update(e);var r=n.digest();return Ls.encodeByteArray(r)}function iu(t,e){Ds(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(gu.logLevel=Ta.VERBOSE,_u=gu.log.bind(gu),e&&yu.set("logging_enabled",!0)):"function"==typeof t?_u=t:(_u=null,yu.remove("logging_enabled"))}function ou(){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))));var s=[];for(o=52;o;--o)s.push(r%2?1:0),r=Math.floor(r/2);for(o=11;o;--o)s.push(n%2?1:0),n=Math.floor(n/2);s.push(e?1:0),s.reverse();var a=s.join(""),u="";for(o=0;o<64;o+=8){var c=parseInt(a.substr(o,8),2).toString(16);1===c.length&&(c="0"+c),u+=c}return u.toLowerCase()}function Au(t){try{t()}catch(e){setTimeout(function(){var t=e.stack||"";throw cu("Exception was thrown by user callback.",t),e},Math.floor(0))}}function ku(t,e){var n=setTimeout(t,e);return"object"==typeof n&&n.unref&&n.unref(),n}var Ou=new RegExp("^-?(0*)\\d{1,10}$"),Ru=function(t){if(Ou.test(t)){var e=Number(t);if(-2147483648<=e&&e<=2147483647)return e}return null},Pu=(Object.defineProperty(Du,"Empty",{get:function(){return new Du("")},enumerable:!0,configurable:!0}),Du.prototype.getFront=function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]},Du.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},Du.prototype.popFront=function(){var t=this.pieceNum_;return t=this.pieces_.length)return null;for(var t=[],e=this.pieceNum_;e=this.pieces_.length},Du.relativePath=function(t,e){var n=t.getFront(),r=e.getFront();if(null===n)return e;if(n===r)return Du.relativePath(t.popFront(),e.popFront());throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")},Du.comparePaths=function(t,e){for(var n=t.slice(),r=e.slice(),i=0;it.getLength())return!1;for(;eLu.MAX_PATH_LENGTH_BYTES)throw new Error(this.errorPrefix_+"has a key path longer than "+Lu.MAX_PATH_LENGTH_BYTES+" bytes ("+this.byteLength_+").");if(this.parts_.length>Lu.MAX_PATH_DEPTH)throw new Error(this.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Lu.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},Lu.prototype.toErrorString=function(){return 0===this.parts_.length?"":"in property '"+this.parts_.join(".")+"'"},Lu);function Lu(t,e){this.errorPrefix_=e,this.parts_=t.slice(),this.byteLength_=Math.max(1,this.parts_.length);for(var n=0;n"),t},Vu.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},Vu);function Vu(t,e,n,r,i,o){void 0===i&&(i=""),void 0===o&&(o=!1),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.persistenceKey=i,this.includeNamespaceInQueryParams=o,this.host=t.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=vu.get("host:"+t)||this.host}function qu(t){var e=Zu(t),n=e.namespace;"firebase.com"===e.domain&&uu(e.host+" is no longer supported. Please use .firebaseio.com instead"),n&&"undefined"!==n||"localhost"===e.domain||uu("Cannot parse Firebase url. Please use https://.firebaseio.com"),e.secure||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&cu("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");var r="ws"===e.scheme||"wss"===e.scheme;return{repoInfo:new ju(e.host,e.secure,n,r,"",n!==e.subdomain),path:new Pu(e.pathString)}}function Bu(t){return"string"==typeof t&&0!==t.length&&!tc.test(t)}function Wu(t){return"string"==typeof t&&0!==t.length&&!ec.test(t)}function Hu(t){return null===t||"string"==typeof t||"number"==typeof t&&!hu(t)||t&&"object"==typeof t&&Zs(t,".sv")}function Gu(t,e,n,r,i){i&&void 0===n||rc(ha(t,e,i),n,r)}function zu(t,e,n,r,i){if(!i||void 0!==n){var o=ha(t,e,i);if(!n||"object"!=typeof n||Array.isArray(n))throw new Error(o+" must be an object containing the children to replace.");var s=[];Cu(n,function(t,e){var n=new Pu(t);if(rc(o,e,r.child(n)),".priority"===n.getBack()&&!Hu(e))throw new Error(o+"contains an invalid value for '"+n.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");s.push(n)}),function(t,e){var n,r;for(n=0;nnc/3&&pa(t)>nc)throw new Error(n+"contains a string greater than "+nc+" utf8 bytes "+r.toErrorString()+" ('"+t.substring(0,50)+"...')");if(t&&"object"==typeof t){var i=!1,o=!1;if(Cu(t,function(t,e){if(".value"===t)i=!0;else if(".priority"!==t&&".sv"!==t&&(o=!0,!Bu(t)))throw new Error(n+" contains an invalid key ("+t+") "+r.toErrorString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');r.push(t),rc(n,e,r),r.pop()}),i&&o)throw new Error(n+' contains ".value" child '+r.toErrorString()+" in addition to actual children.")}},ic=(oc.prototype.cancel=function(t){ca("OnDisconnect.cancel",0,1,arguments.length),la("OnDisconnect.cancel",1,t,!0);var e=new Us;return this.repo_.onDisconnectCancel(this.path_,e.wrapCallback(t)),e.promise},oc.prototype.remove=function(t){ca("OnDisconnect.remove",0,1,arguments.length),$u("OnDisconnect.remove",this.path_),la("OnDisconnect.remove",1,t,!0);var e=new Us;return this.repo_.onDisconnectSet(this.path_,null,e.wrapCallback(t)),e.promise},oc.prototype.set=function(t,e){ca("OnDisconnect.set",1,2,arguments.length),$u("OnDisconnect.set",this.path_),Gu("OnDisconnect.set",1,t,this.path_,!1),la("OnDisconnect.set",2,e,!0);var n=new Us;return this.repo_.onDisconnectSet(this.path_,t,n.wrapCallback(e)),n.promise},oc.prototype.setWithPriority=function(t,e,n){ca("OnDisconnect.setWithPriority",2,3,arguments.length),$u("OnDisconnect.setWithPriority",this.path_),Gu("OnDisconnect.setWithPriority",1,t,this.path_,!1),Ku("OnDisconnect.setWithPriority",2,e,!1),la("OnDisconnect.setWithPriority",3,n,!0);var r=new Us;return this.repo_.onDisconnectSetWithPriority(this.path_,t,e,r.wrapCallback(n)),r.promise},oc.prototype.update=function(t,e){if(ca("OnDisconnect.update",1,2,arguments.length),$u("OnDisconnect.update",this.path_),Array.isArray(t)){for(var n={},r=0;rthis.lastWriteId_,"Stacking an older write on top of newer ones"),void 0===r&&(r=!0),this.allWrites_.push({path:t,snap:e,writeId:n,visible:r}),r&&(this.visibleWrites_=this.visibleWrites_.addWrite(t,e)),this.lastWriteId_=n},Tl.prototype.addMerge=function(t,e,n){Ds(n>this.lastWriteId_,"Stacking an older merge on top of newer ones"),this.allWrites_.push({path:t,children:e,writeId:n,visible:!0}),this.visibleWrites_=this.visibleWrites_.addWrites(t,e),this.lastWriteId_=n},Tl.prototype.getWrite=function(t){for(var e=0;edocument.domain="'+document.domain+'";<\/script>');var o=""+i+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(o),this.myIFrame.doc.close()}catch(t){ou("frame writing exception"),t.stack&&ou(t.stack),ou(t)}}var sf="";var af=null;"undefined"!=typeof MozWebSocket?af=MozWebSocket:"undefined"!=typeof WebSocket&&(af=WebSocket);var uf=(cf.connectionURL_=function(t,e,n){var r={v:"5"};return"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf(Mu)&&(r.r="f"),e&&(r.s=e),n&&(r.ls=n),t.connectionURL(Fu,r)},cf.prototype.open=function(t,e){var n=this;this.onDisconnect=e,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,vu.set("previous_websocket_failure",!0);try{if(Ws()){var r=Ps.NODE_ADMIN?"AdminNode":"Node",i={headers:{"User-Agent":"Firebase/5/"+sf+"/"+process.platform+"/"+r}},o=process.env,s=0===this.connURL.indexOf("wss://")?o.HTTPS_PROXY||o.https_proxy:o.HTTP_PROXY||o.http_proxy;s&&(i.proxy={origin:s}),this.mySock=new af(this.connURL,[],i)}else this.mySock=new af(this.connURL)}catch(t){this.log_("Error instantiating WebSocket.");var a=t.message||t.data;return a&&this.log_(a),void this.onClosed_()}this.mySock.onopen=function(){n.log_("Websocket connected."),n.everConnected_=!0},this.mySock.onclose=function(){n.log_("Websocket connection was disconnected."),n.mySock=null,n.onClosed_()},this.mySock.onmessage=function(t){n.handleIncomingFrame(t)},this.mySock.onerror=function(t){n.log_("WebSocket error. Closing connection.");var e=t.message||t.data;e&&n.log_(e),n.onClosed_()}},cf.prototype.start=function(){},cf.forceDisallow=function(){cf.forceDisallow_=!0},cf.isAvailable=function(){var t=!1;if("undefined"!=typeof navigator&&navigator.userAgent){var e=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);e&&1=Tf.MAX_TRANSACTION_RETRIES_)c=!0,h="maxretry",i=i.concat(this.serverSyncTree_.ackUserWrite(a.currentWriteId,!0));else{var l=this.getLatestState_(a.path,o);a.currentInputSnapshot=l;var f=t[s].update(l.val());if(void 0!==f){rc("transaction failed: Data returned ",f,a.path);var p=ih(f);"object"==typeof f&&null!=f&&Zs(f,".priority")||(p=p.updatePriority(l.getPriority()));var d=a.currentWriteId,v=this.generateServerValues(),y=Ah(p,l,v);a.currentOutputSnapshotRaw=p,a.currentOutputSnapshotResolved=y,a.currentWriteId=this.getNextWriteId_(),o.splice(o.indexOf(d),1),i=(i=i.concat(this.serverSyncTree_.applyUserOverwrite(a.path,y,a.currentWriteId,a.applyLocally))).concat(this.serverSyncTree_.ackUserWrite(d,!0))}else c=!0,h="nodata",i=i.concat(this.serverSyncTree_.ackUserWrite(a.currentWriteId,!0))}if(this.eventQueue_.raiseEventsForChangedPath(e,i),i=[],c&&(t[s].status=xf.COMPLETED,n=t[s].unwatcher,setTimeout(n,Math.floor(0)),t[s].onComplete))if("nodata"===h){var g=new Pf(this,t[s].path),m=t[s].currentInputSnapshot,b=new hh(m,g,Rc);r.push(t[s].onComplete.bind(null,null,!1,b))}else r.push(t[s].onComplete.bind(null,new Error(h),!1,null))}this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_);for(s=0;s=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}Xf=(Yf=Kl).SDK_VERSION,sf=Xf,Yf.INTERNAL.registerComponent(new da("database",function(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal");return qf.getInstance().databaseFromApp(n,r,e)},"PUBLIC").setServiceProps({Reference:Pf,Query:wh,Database:Wf,DataSnapshot:hh,enableLogging:iu,INTERNAL:Kf,ServerValue:tp,TEST_ACCESS:Zf}).setMultipleInstances(!0)),Yf.registerVersion("@firebase/database","0.6.3");var np,rp="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ip=ip||{},op=rp||self;function sp(){}function ap(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&void 0===t.call)return"object";return e}function up(t){var e=ap(t);return"array"==e||"object"==e&&"number"==typeof t.length}function cp(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var hp="closure_uid_"+(1e9*Math.random()>>>0),lp=0;function fp(t,e,n){return t.call.apply(t.bind,arguments)}function pp(e,n,t){if(!e)throw Error();if(2parseFloat(Hp)){Lp=String(zp);break t}}Lp=Hp}var Kp,Qp={};function Yp(a){return t=a,e=function(){for(var t=0,e=Sp(String(Lp)).split("."),n=Sp(String(a)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i>>0);function wd(e){return"function"==ap(e)?e:(e[_d]||(e[_d]=function(t){return e.handleEvent(t)}),e[_d])}function Ed(){mp.call(this),this.c=new ud(this),(this.J=this).A=null}function Td(t,e,n,r){if(!(e=t.c.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;oe.length?fv:(e=e.substr(r,n),t.w=r+n,e))}function gv(t){t.P=yp()+t.N,mv(t,t.N)}function mv(t,e){if(null!=t.h)throw Error("WatchDog timer not null");t.h=Jd(dp(t.Qa,t),e)}function bv(t){t.h&&(op.clearTimeout(t.h),t.h=null)}function _v(t){0==t.g.u||t.l||xy(t.g,t)}function wv(t){bv(t);var e=t.D;e&&"function"==typeof e.da&&e.da(),t.D=null,Md(t.O),Wd(t.G),t.a&&(e=t.a,t.a=null,e.abort(),e.da())}function Ev(t,e){try{var n=t.g;if(0!=n.u&&(n.a==t||ey(n.b,t)))if(n.A=t.H,!t.o&&ey(n.b,t)&&3==n.u){try{var r=n.ja.a.parse(e)}catch(t){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.i){if(n.a){if(!(n.a.s+3e3>4&15).toString(16)+(15&t).toString(16)}Av.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Fv(e,jv,!0),":");var n=this.c;return!n&&"file"!=e||(t.push("//"),(e=this.j)&&t.push(Fv(e,jv,!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(Fv(n,"/"==n.charAt(0)?qv:Vv,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",Fv(n,Wv)),t.join("")};var jv=/[#\/\?@]/g,Vv=/[#\?:]/g,qv=/[#\?]/g,Bv=/[#\?@]/g,Wv=/#/g;function Hv(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function Gv(n){n.a||(n.a=new Iv,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n2*t.c&&Sv(t)))}function Kv(t,e){return Gv(t),e=Yv(t,e),Cv(t.a.b,e)}function Qv(t,e,n){zv(t,e),0=t.f}function ty(t){return t.b?1:t.a?t.a.size:0}function ey(t,e){return t.b?t.b==e:t.a&&t.a.has(e)}function ny(t,e){t.a?t.a.add(e):t.b=e}function ry(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function iy(t){var e,n;if(null!=t.b)return t.c.concat(t.b.i);if(null==t.a||0===t.a.size)return Ep(t.c);var r=t.c;try{for(var i=ep(t.a.values()),o=i.next();!o.done;o=i.next()){var s=o.value;r=r.concat(s.i)}}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 oy(){}function sy(){this.a=new oy}function ay(t,r,e){var i=e||"";try{Tv(t,function(t,e){var n=t;cp(t)&&(n=Id(t)),r.push(i+e+"="+encodeURIComponent(n))})}catch(t){throw r.push(i+"type="+encodeURIComponent("_badmap")),t}}function uy(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}$v.prototype.cancel=function(){var e,t;if(this.c=iy(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=ep(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()}},oy.prototype.stringify=function(t){return op.JSON.stringify(t,void 0)},oy.prototype.parse=function(t){return op.JSON.parse(t,void 0)};var cy=op.JSON.parse;function hy(t){Ed.call(this),this.headers=new Iv,this.G=t||null,this.b=!1,this.s=this.a=null,this.D="",this.h=0,this.f="",this.g=this.w=this.l=this.v=!1,this.o=0,this.m=null,this.H=ly,this.B=this.F=!1}gp(hy,Ed);var ly="",fy=/^https?$/i,py=["POST","PUT"];function dy(t){return"content-type"==t.toLowerCase()}function vy(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,yy(t),my(t)}function yy(t){t.v||(t.v=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function gy(t){if(t.b&&void 0!==ip&&(!t.s[1]||4!=_y(t)||2!=t.S()))if(t.l&&4==_y(t))Fd(t.va,0,t);else if(t.dispatchEvent("readystatechange"),4==_y(t)){t.b=!1;try{var e,n=t.S();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var o=String(t.D).match(Nv)[1]||null;if(!o&&op.self&&op.self.location){var s=op.self.location.protocol;o=s.substr(0,s.length-1)}i=!fy.test(o?o.toLowerCase():"")}e=i}if(e)t.dispatchEvent("complete"),t.dispatchEvent("success");else{t.h=6;try{var a=2<_y(t)?t.a.statusText:""}catch(t){a=""}t.f=a+" ["+t.S()+"]",yy(t)}}finally{my(t)}}}function my(t,e){if(t.a){by(t);var n=t.a,r=t.s[0]?sp:null;t.a=null,t.s=null,e||t.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){}}}function by(t){t.a&&t.B&&(t.a.ontimeout=null),t.m&&(op.clearTimeout(t.m),t.m=null)}function _y(t){return t.a?t.a.readyState:0}function wy(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}var i;r||(i="",Op(n,function(t,e){i+=e,i+=":",i+=t,i+="\r\n"}),n=i,"string"==typeof t?null!=n&&encodeURIComponent(String(n)):xv(t,e,n))}function Ey(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Ty(t){this.f=[],this.R=this.ea=this.v=this.P=this.a=this.ha=this.s=this.N=this.h=this.F=this.j=null,this.Fa=this.H=0,this.Ca=Ey("failFast",!1,t),this.U=this.l=this.i=this.g=this.c=null,this.W=!0,this.A=this.ia=this.G=-1,this.J=this.m=this.o=0,this.Ba=Ey("baseRetryDelayMs",5e3,t),this.Ga=Ey("retryDelaySeedMs",1e4,t),this.Da=Ey("forwardChannelMaxRetries",2,t),this.ga=Ey("forwardChannelRequestTimeoutMs",2e4,t),this.Ea=t&&t.nb||void 0,this.D=void 0,this.w=t&&t.supportsCrossDomainXhr||!1,this.B="",this.b=new $v(t&&t.concurrentRequestLimit),this.ja=new sy,this.fa=t&&t.fastHandshake||!1,t&&t.forceLongPolling&&(this.W=!1),this.O=void 0}function Iy(t){if(Sy(t),3==t.u){var e=t.H++,n=kv(t.v);xv(n,"SID",t.B),xv(n,"RID",e),xv(n,"TYPE","terminate"),ky(t,n),(e=new cv(t,e,void 0)).B=2,e.f=Lv(kv(n)),n=!1,op.navigator&&op.navigator.sendBeacon&&(n=op.navigator.sendBeacon(e.f.toString(),"")),!n&&op.Image&&((new Image).src=e.f,n=!0),n||(e.a=jy(e.g,null),e.a.$(e.f)),e.s=yp(),gv(e)}Fy(t)}function Sy(t){t.a&&(t.a.cancel(),t.a=null),t.i&&(op.clearTimeout(t.i),t.i=null),Dy(t),t.b.cancel(),t.g&&("number"==typeof t.g&&op.clearTimeout(t.g),t.g=null)}function Cy(t,e){t.f.push(new Xv(t.Fa++,e)),3==t.u&&Ny(t)}function Ny(t){Zv(t.b)||t.g||(t.g=!0,Rd(t.xa,t),t.o=0)}function Ay(t,e){var n;n=e?e.W:t.H++;var r=kv(t.v);xv(r,"SID",t.B),xv(r,"RID",n),xv(r,"AID",t.G),ky(t,r),t.h&&t.j&&wy(r,t.h,t.j),n=new cv(t,n,t.o+1),null===t.h&&(n.m=t.j),e&&(t.f=e.i.concat(t.f)),e=Oy(t,n,1e3),n.setTimeout(Math.round(.5*t.ga)+Math.round(.5*t.ga*Math.random())),ny(t.b,n),pv(n,r,e)}function ky(t,n){t.c&&Tv({},function(t,e){xv(n,e,t)})}function Oy(t,e,n){n=Math.min(t.f.length,n);var r=t.c?dp(t.c.Ha,t.c,t):null;t:for(var i=t.f,o=-1;;){var s=["count="+n];-1==o?0=t.b.f-(t.g?1:0))){if(t.g)return t.f=e.i.concat(t.f),1;if(!(1==t.u||2==t.u||t.o>=(t.Ca?0:t.Da)))return t.g=Jd(dp(t.xa,t,e),Ly(t,t.o)),t.o++,1}}(t,e)||2==r&&Py(t)))switch(n&&0e.length?1:0},vg),pg=(Es(dg,ng=fg),dg.prototype.$=function(t,e,n){return new dg(t,e,n)},dg.prototype.j=function(){return this.W().join("/")},dg.prototype.toString=function(){return this.j()},dg.K=function(t){if(0<=t.indexOf("//"))throw new og(ig.INVALID_ARGUMENT,"Invalid path ("+t+"). Paths must not contain // in them.");return new dg(t.split("/").filter(function(t){return 0t.length&&A_(),void 0===n?n=t.length-e:n>t.length-e&&A_(),this.segments=t,this.offset=e,this.F=n}function yg(t){this.timestamp=t}function gg(t,e){if(this.seconds=t,(this.nanoseconds=e)<0)throw new og(ig.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(1e9<=e)throw new og(ig.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new og(ig.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(253402300800<=t)throw new og(ig.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}function mg(t,e){this.P=t,this.V=e}function bg(t,e){this.P=t,this.V=e,this.type="FirstParty",this.user=Zy.h}function _g(t){var e=this;this.I=null,this.currentUser=Zy.UNAUTHENTICATED,this.R=!1,this.A=0,this.u=null,this.forceRefresh=!1,this.I=function(){e.A++,e.currentUser=e.m(),e.R=!0,e.u&&e.u(e.currentUser)},this.A=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.I):(this.I(null),t.get().then(function(t){e.auth=t,e.I&&e.auth.addAuthTokenListener(e.I)},function(){}))}function wg(){this.u=null}function Eg(t,e){var n=this;return(n=rg.call(this,e)||this).code=t,n.message=e,n.name="FirebaseError",n.toString=function(){return n.name+": [code="+n.code+"]: "+n.message},n}pg.G=new pg([]);var Tg,Ig=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Sg=(Es(Cg,Tg=fg),Cg.prototype.$=function(t,e,n){return new Cg(t,e,n)},Cg.H=function(t){return Ig.test(t)},Cg.prototype.j=function(){return this.W().map(function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),Cg.H(t)||(t="`"+t+"`"),t}).join(".")},Cg.prototype.toString=function(){return this.j()},Cg.prototype.Y=function(){return 1===this.length&&"__name__"===this.get(0)},Cg.J=function(){return new Cg(["__name__"])},Cg.X=function(t){for(var e=[],n="",r=0,i=function(){if(0===n.length)throw new og(ig.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");e.push(n),n=""},o=!1;r=Number.MIN_SAFE_INTEGER}function Fg(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function Ug(t){var e=zg(t.mapValue.fields.__local_write_time__.timestampValue);return new hg(e.seconds,e.nanos)}Pg.ht=new Pg("");var jg=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Vg(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?Fg(t)?4:10:A_()}function qg(i,t){var e,n,r,o=Vg(i);if(o!==Vg(t))return!1;switch(o){case 0:return!0;case 1:return i.booleanValue===t.booleanValue;case 4:return Ug(i).isEqual(Ug(t));case 3:return function(t){if("string"==typeof i.timestampValue&&"string"==typeof t.timestampValue&&i.timestampValue.length===t.timestampValue.length)return i.timestampValue===t.timestampValue;var e=zg(i.timestampValue),n=zg(t.timestampValue);return e.seconds===n.seconds&&e.nanos===n.nanos}(t);case 5:return i.stringValue===t.stringValue;case 6:return r=t,Qg(i.bytesValue).isEqual(Qg(r.bytesValue));case 7:return i.referenceValue===t.referenceValue;case 8:return n=t,Kg((e=i).geoPointValue.latitude)===Kg(n.geoPointValue.latitude)&&Kg(e.geoPointValue.longitude)===Kg(n.geoPointValue.longitude);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Kg(t.integerValue)===Kg(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){var n=Kg(t.doubleValue),r=Kg(e.doubleValue);return n===r?Lg(n)===Lg(r):isNaN(n)&&isNaN(r)}return!1}(i,t);case 9:return x_(i.arrayValue.values||[],t.arrayValue.values||[],qg);case 10:return function(t){var e=i.mapValue.fields||{},n=t.mapValue.fields||{};if(kg(e)!==kg(n))return!1;for(var r in e)if(e.hasOwnProperty(r)&&(void 0===n[r]||!qg(e[r],n[r])))return!1;return!0}(t);default:return A_()}}function Bg(t,e){return void 0!==(t.values||[]).find(function(t){return qg(t,e)})}function Wg(t,e){var n,r,i,o,s,a,u,c,h,l,f=Vg(t),p=Vg(e);if(f!==p)return D_(f,p);switch(f){case 0:return 0;case 1:return D_(t.booleanValue,e.booleanValue);case 2:return c=e,h=Kg(t.integerValue||t.doubleValue),l=Kg(c.integerValue||c.doubleValue),h":return 0=":return 0<=t;default:return A_()}},_b.prototype.ue=function(){return 0<=["<","<=",">",">="].indexOf(this.op)},_b.prototype.canonicalId=function(){return this.field.j()+this.op.toString()+Gg(this.value)},_b.prototype.isEqual=function(t){return t instanceof _b&&this.op===t.op&&this.field.isEqual(t.field)&&qg(this.value,t.value)},_b.prototype.toString=function(){return this.field.j()+" "+this.op+" "+Gg(this.value)},_b),ib=(Es(bb,Km=rb),bb.prototype.matches=function(t){var e=Ng.N(t.key,this.key);return this.de(e)},bb),ob=(Es(mb,zm=rb),mb.prototype.matches=function(e){return this.keys.some(function(t){return t.isEqual(e.key)})},mb),sb=(Es(gb,Gm=rb),gb.prototype.matches=function(t){var e=t.field(this.field);return $g(e)&&Bg(e.arrayValue,this.value)},gb),ab=(Es(yb,Hm=rb),yb.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&Bg(this.value.arrayValue,e)},yb),ub=(Es(vb,Wm=rb),vb.prototype.matches=function(t){var e=this,n=t.field(this.field);return!(!$g(n)||!n.arrayValue.values)&&n.arrayValue.values.some(function(t){return Bg(e.value.arrayValue,t)})},vb),cb=(db.prototype.canonicalId=function(){return(this.before?"b":"a")+":"+this.position.map(function(t){return Gg(t)}).join(",")},db.prototype.le=function(t,e){for(var n=0,r=0;r":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","array-contains-any":"ARRAY_CONTAINS_ANY"},g_=(m_.prototype.ni=function(t){var e=void 0===t.code?ig.UNKNOWN:Nb(t.code);return new og(e,t.message||"")},m_.prototype.ri=function(t){return this.options.hi||xg(t)?t:{value:t}},m_.prototype.oi=function(t){var e;return xg(e="object"==typeof t?t.value:t)?null:e},m_.prototype._t=function(t){return{integerValue:""+t}},m_.prototype.lt=function(t){if(this.options.hi){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Lg(t)?"-0":t}},m_.prototype.ai=function(t){return Mg(t)?this._t(t):this.lt(t)},m_.prototype.C=function(t){return this.options.hi?new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+t.nanoseconds).slice(-9)+"Z":{seconds:""+t.seconds,nanos:t.nanoseconds}},m_.prototype.v=function(t){var e=zg(t);return new hg(e.seconds,e.nanos)},m_.prototype.ui=function(t){return this.options.hi?t.toBase64():t.toUint8Array()},m_.prototype.ci=function(t){return this.options.hi?(k_(void 0===t||"string"==typeof t),Pg.fromBase64String(t||"")):(k_(void 0===t||t instanceof Uint8Array),Pg.fromUint8Array(t||new Uint8Array))},m_.prototype.toVersion=function(t){return this.C(t.C())},m_.prototype.fromVersion=function(t){return k_(!!t),lg.v(this.v(t))},m_.prototype._i=function(t,e){return this.li(e||this.ii).child("documents").child(t).j()},m_.prototype.di=function(t){var e=pg.K(t);return k_(b_(e)),e},m_.prototype.fi=function(t){return this._i(t.path)},m_.prototype.Z=function(t){var e=this.di(t);return k_(e.get(1)===this.ii.projectId),k_(!e.get(3)&&!this.ii.database||e.get(3)===this.ii.database),new Ng(this.Ti(e))},m_.prototype.Ei=function(t){return this._i(t)},m_.prototype.Ii=function(t){var e=this.di(t);return 4===e.length?pg.G:this.Ti(e)},Object.defineProperty(m_.prototype,"wi",{get:function(){return new pg(["projects",this.ii.projectId,"databases",this.ii.database]).j()},enumerable:!0,configurable:!0}),m_.prototype.li=function(t){return new pg(["projects",t.projectId,"databases",t.database])},m_.prototype.Ti=function(t){return k_(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"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return A_()}},m_.prototype.hn=function(t){return{fieldPath:t.j()}},m_.prototype.on=function(t){return Sg.X(t.fieldPath)},m_.prototype.Zi=function(t){return{field:this.hn(t.field),direction:this.en(t.dir)}},m_.prototype.tn=function(t){return new hb(this.on(t.field),this.sn(t.direction))},m_.prototype.Xi=function(t){return rb.create(this.on(t.fieldFilter.field),this.rn(t.fieldFilter.op),t.fieldFilter.value)},m_.prototype.Yi=function(t){if("=="===t.op){if(Zg(t.value))return{unaryFilter:{field:this.hn(t.field),op:"IS_NAN"}};if(Jg(t.value))return{unaryFilter:{field:this.hn(t.field),op:"IS_NULL"}}}return{fieldFilter:{field:this.hn(t.field),op:this.nn(t.op),value:t.value}}},m_.prototype.Ji=function(t){switch(t.unaryFilter.op){case"IS_NAN":var e=this.on(t.unaryFilter.field);return rb.create(e,"==",{doubleValue:NaN});case"IS_NULL":var n=this.on(t.unaryFilter.field);return rb.create(n,"==",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return A_()}},m_.prototype.Si=function(t){var e=[];return t.fields.forEach(function(t){return e.push(t.j())}),{fieldPaths:e}},m_.prototype.$i=function(t){var e=t.fieldPaths||[];return new ym(e.map(function(t){return Sg.X(t)}))},m_);function m_(t,e){this.ii=t,this.options=e}function b_(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)}var __=(E_.an=function(t){E_.platform&&A_(),E_.platform=t},E_.nt=function(){return E_.platform||A_(),E_.platform},E_),w_=new Ra("@firebase/firestore");function E_(){}function T_(){return w_.logLevel}function I_(t){w_.logLevel=t}function S_(t){for(var e=[],n=1;nthis.Rr&&(this.Ar=this.Rr)},sw.prototype.br=function(){null!==this.mr&&(this.mr.vr(),this.mr=null)},sw.prototype.cancel=function(){null!==this.mr&&(this.mr.cancel(),this.mr=null)},sw.prototype.pr=function(){return(Math.random()-.5)*this.Ar},sw);function sw(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this.Tr=t,this.Er=e,this.Ir=n,this.wr=r,this.Rr=i,this.Ar=0,this.mr=null,this.Pr=Date.now(),this.reset()}function aw(t){for(var e="",n=0;nt.highestListenSequenceNumber&&(t.highestListenSequenceNumber=n),i.uh(e,t)})},Aw.prototype.fh=function(e,n){var r=this;return this.Th(e,n).next(function(){return r.ah(e).next(function(t){return t.targetCount+=1,r.Eh(n,t),r.uh(e,t)})})},Aw.prototype.Ih=function(t,e){return this.Th(t,e)},Aw.prototype.wh=function(e,t){var n=this;return this.Rh(e,t.targetId).next(function(){return Ow(e).delete(t.targetId)}).next(function(){return n.ah(e)}).next(function(t){return k_(0e.highestTargetId&&(e.highestTargetId=t.targetId,n=!0),t.sequenceNumber>e.highestListenSequenceNumber&&(e.highestListenSequenceNumber=t.sequenceNumber,n=!0),n},Aw.prototype.Vh=function(t){return this.ah(t).next(function(t){return t.targetCount})},Aw.prototype.gh=function(t,i){var o=this,e=i.canonicalId(),n=IDBKeyRange.bound([e,Number.NEGATIVE_INFINITY],[e,Number.POSITIVE_INFINITY]),s=null;return Ow(t).Ur({range:n,index:fE.queryTargetsIndexName},function(t,e,n){var r=o.serializer.mh(e);i.isEqual(r.target)&&(s=r,n.done())}).next(function(){return s})},Aw.prototype.ph=function(n,t,r){var i=this,o=[],s=Pw(n);return t.forEach(function(t){var e=aw(t.path);o.push(s.put(new pE(r,e))),o.push(i.hh.yh(n,r,t))}),q_.vn(o)},Aw.prototype.bh=function(n,t,r){var i=this,o=Pw(n);return q_.forEach(t,function(t){var e=aw(t.path);return q_.vn([o.delete([r,e]),i.hh.vh(n,r,t)])})},Aw.prototype.Rh=function(t,e){var n=Pw(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return n.delete(r)},Aw.prototype.Sh=function(t,e){var n=IDBKeyRange.bound([e],[e+1],!1,!0),r=Pw(t),o=Kb();return r.Ur({range:n,Dh:!0},function(t,e,n){var r=hw(t[1]),i=new Ng(r);o=o.add(i)}).next(function(){return o})},Aw.prototype.Ch=function(t,e){var n=aw(e.path),r=IDBKeyRange.bound([n],[L_(n)],!1,!0),i=0;return Pw(t).Ur({index:pE.documentTargetsIndex,Dh:!0,range:r},function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())}).next(function(){return 0 "+n),1))},Uw.prototype.eo=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.Qh=function(){t.Tr.uo(function(){return t.inForeground="visible"===t.document.visibilityState,t.to()})},this.document.addEventListener("visibilitychange",this.Qh),this.inForeground="visible"===this.document.visibilityState)},Uw.prototype.Vo=function(){this.Qh&&(this.document.removeEventListener("visibilitychange",this.Qh),this.Qh=null)},Uw.prototype.so=function(){var t=this;"function"==typeof this.window.addEventListener&&(this.Uh=function(){t.Po(),t.Tr.uo(function(){return t.mo()})},this.window.addEventListener("unload",this.Uh))},Uw.prototype.po=function(){this.Uh&&(this.window.removeEventListener("unload",this.Uh),this.Uh=null)},Uw.prototype.Ao=function(t){try{var e=null!==this.Jh.getItem(this.Ro(t));return S_("IndexedDbPersistence","Client '"+t+"' "+(e?"is":"is not")+" zombied in LocalStorage"),e}catch(t){return C_("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},Uw.prototype.Po=function(){try{this.Jh.setItem(this.Ro(this.clientId),String(Date.now()))}catch(t){C_("Failed to set zombie client id.",t)}},Uw.prototype.yo=function(){try{this.Jh.removeItem(this.Ro(this.clientId))}catch(t){}},Uw.prototype.Ro=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},Uw);function Uw(t,e,n,r,i,o,s,a){if(this.allowTabSynchronization=t,this.persistenceKey=e,this.clientId=n,this.Tr=o,this.xh=a,this.Bh=null,this.qh=!1,this.isPrimary=!1,this.networkEnabled=!0,this.Uh=null,this.inForeground=!1,this.Qh=null,this.Wh=null,this.jh=Number.NEGATIVE_INFINITY,this.Kh=function(t){return Promise.resolve()},!Uw.Gh())throw new og(ig.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");if(this.hh=new Ww(this,i),this.zh=e+Uw.Hh,this.serializer=new xw(s),this.document=r.document,this.Yh=new Nw(this.hh,this.serializer),this.jn=new pw,this.Qn=new bw(this.serializer,this.jn),!r.window||!r.window.localStorage)throw new og(ig.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");this.window=r.window,this.Jh=this.window.localStorage}function jw(t,e){var n=this;return(n=Dw.call(this)||this).Mh=t,n.Oh=e,n}function Vw(t){this.Fh=t}function qw(t){return Fw.Nr(t,nE.store)}function Bw(t){return Fw.Nr(t,gE.store)}Fw.Hh="main";var Ww=(Hw.prototype.Lo=function(t){var n=this.Mo(t);return this.db.Do().Vh(t).next(function(e){return n.next(function(t){return e+t})})},Hw.prototype.Mo=function(t){var e=0;return this.Oo(t,function(t){e++}).next(function(){return e})},Hw.prototype.js=function(t,e){return this.db.Do().js(t,e)},Hw.prototype.Oo=function(t,n){return this.xo(t,function(t,e){return n(e)})},Hw.prototype.yh=function(t,e,n){return Gw(t,n)},Hw.prototype.vh=function(t,e,n){return Gw(t,n)},Hw.prototype.Ah=function(t,e,n){return this.db.Do().Ah(t,e,n)},Hw.prototype.Bo=function(t,e){return Gw(t,e)},Hw.prototype.qo=function(t,e){return r=e,i=!1,Jw(n=t).Uo(function(t){return Qw(n,t,r).next(function(t){return t&&(i=!0),q_.resolve(!t)})}).next(function(){return i});var n,r,i},Hw.prototype.Qo=function(r,i){var o=this,s=this.db.Co().Yr(),a=[],u=0;return this.xo(r,function(e,t){if(t<=i){var n=o.qo(r,e).next(function(t){if(!t)return u++,s.Ln(r,e).next(function(){return s.kn(e),Pw(r).delete([0,aw(e.path)])})});a.push(n)}}).next(function(){return q_.vn(a)}).next(function(){return s.apply(r)}).next(function(){return u})},Hw.prototype.removeTarget=function(t,e){var n=e.Ie(t.Oh);return this.db.Do().Ih(t,n)},Hw.prototype.Wo=function(t,e){return Gw(t,e)},Hw.prototype.xo=function(t,o){var s,e=Pw(t),a=K_.dr;return e.Ur({index:pE.documentTargetsIndex},function(t,e){var n=t[0],r=(t[1],e.path),i=e.sequenceNumber;0===n?(a!==K_.dr&&o(new Ng(hw(s)),a),a=i,s=r):a=K_.dr}).next(function(){a!==K_.dr&&o(new Ng(hw(s)),a)})},Hw.prototype.jo=function(t){return this.db.Co().Zr(t)},Hw);function Hw(t,e){this.db=t,this.ko=new zE(this,e)}function Gw(t,e){return Pw(t).put((n=e,r=t.Oh,new pE(0,aw(n.path),r)));var n,r}var zw=(Kw.So=function(t,e,n,r){return k_(""!==t.uid),new Kw(t.t()?t.uid:"",e,n,r)},Kw.prototype.Go=function(t){var r=!0,e=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return Xw(t).Ur({index:oE.userMutationsIndex,range:e},function(t,e,n){r=!1,n.done()}).next(function(){return r})},Kw.prototype.zo=function(e,t,n){return this.Ho(e).next(function(t){return t.lastStreamToken=n.toBase64(),Jw(e).put(t)})},Kw.prototype.Yo=function(t){return this.Ho(t).next(function(t){return Pg.fromBase64String(t.lastStreamToken)})},Kw.prototype.Jo=function(e,n){return this.Ho(e).next(function(t){return t.lastStreamToken=n.toBase64(),Jw(e).put(t)})},Kw.prototype.Xo=function(c,h,l,f){var p=this,d=$w(c),v=Xw(c);return v.add({}).next(function(t){k_("number"==typeof t);for(var e=new j_(t,h,l,f),n=p.serializer.kh(p.userId,e),r=[],i=new Lb(function(t,e){return D_(t.j(),e.j())}),o=0,s=f;o=i),o=r.serializer.Lh(e)),n.done()}).next(function(){return o})},Kw.prototype.sa=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),r=-1;return Xw(t).Ur({index:oE.userMutationsIndex,range:e,reverse:!0},function(t,e,n){r=e.batchId,n.done()}).next(function(){return r})},Kw.prototype.ia=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return Xw(t).Fr(oE.userMutationsIndex,n).next(function(t){return t.map(function(t){return e.serializer.Lh(t)})})},Kw.prototype.Gn=function(a,u){var c=this,t=sE.prefixForPath(this.userId,u.path),e=IDBKeyRange.lowerBound(t),h=[];return $w(a).Ur({range:e},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=hw(i);if(r===c.userId&&u.path.isEqual(s))return Xw(a).get(o).next(function(t){if(!t)throw A_();k_(t.userId===c.userId),h.push(c.serializer.Lh(t))});n.done()}).next(function(){return h})},Kw.prototype.Xn=function(r,t){var u=this,c=new Lb(D_),i=[];return t.forEach(function(a){var t=sE.prefixForPath(u.userId,a.path),e=IDBKeyRange.lowerBound(t),n=$w(r).Ur({range:e},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=hw(i);r===u.userId&&a.path.isEqual(s)?c=c.add(o):n.done()});i.push(n)}),q_.vn(i).next(function(){return u.na(r,c)})},Kw.prototype.nr=function(t,e){var a=this,u=e.path,c=u.length+1,n=sE.prefixForPath(this.userId,u),r=IDBKeyRange.lowerBound(n),h=new Lb(D_);return $w(t).Ur({range:r},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=hw(i);r===a.userId&&u.q(s)?s.length===c&&(h=h.add(o)):n.done()}).next(function(){return a.na(t,h)})},Kw.prototype.na=function(e,t){var n=this,r=[],i=[];return t.forEach(function(t){i.push(Xw(e).get(t).next(function(t){if(null===t)throw A_();k_(t.userId===n.userId),r.push(n.serializer.Lh(t))}))}),q_.vn(i).next(function(){return r})},Kw.prototype.ra=function(e,n){var r=this;return Yw(e.Mh,this.userId,n).next(function(t){return e.qn(function(){r.ha(n.batchId)}),q_.forEach(t,function(t){return r.hh.Bo(e,t)})})},Kw.prototype.ha=function(t){delete this.Ko[t]},Kw.prototype.oa=function(n){var o=this;return this.Go(n).next(function(t){if(!t)return q_.resolve();var e=IDBKeyRange.lowerBound(sE.prefixForUser(o.userId)),i=[];return $w(n).Ur({range:e},function(t,e,n){if(t[0]===o.userId){var r=hw(t[1]);i.push(r)}else n.done()}).next(function(){k_(0===i.length)})})},Kw.prototype.Ch=function(t,e){return Qw(t,this.userId,e)},Kw.prototype.Ho=function(t){var e=this;return Jw(t).get(this.userId).next(function(t){return t||new iE(e.userId,-1,"")})},Kw);function Kw(t,e,n,r){this.userId=t,this.serializer=e,this.jn=n,this.hh=r,this.Ko={}}function Qw(t,o,e){var n=sE.prefixForPath(o,e.path),s=n[1],r=IDBKeyRange.lowerBound(n),a=!1;return $w(t).Ur({range:r,Dh:!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 Yw(t,e,n){var r=t.store(oE.store),i=t.store(sE.store),o=[],s=IDBKeyRange.only(n.batchId),a=0,u=r.Ur({range:s},function(t,e,n){return a++,n.delete()});o.push(u.next(function(){k_(1===a)}));for(var c=[],h=0,l=n.mutations;h",t),this.store.put(t)))},kE.prototype.add=function(t){return S_("SimpleDb","ADD",this.store.name,t,t),RE(this.store.add(t))},kE.prototype.get=function(e){var n=this;return RE(this.store.get(e)).next(function(t){return void 0===t&&(t=null),S_("SimpleDb","GET",n.store.name,e,t),t})},kE.prototype.delete=function(t){return S_("SimpleDb","DELETE",this.store.name,t),RE(this.store.delete(t))},kE.prototype.count=function(){return S_("SimpleDb","COUNT",this.store.name),RE(this.store.count())},kE.prototype.Fr=function(t,e){var n=this.cursor(this.options(t,e)),r=[];return this.wa(n,function(t,e){r.push(e)}).next(function(){return r})},kE.prototype.Ra=function(t,e){S_("SimpleDb","DELETE ALL",this.store.name);var n=this.options(t,e);n.Dh=!1;var r=this.cursor(n);return this.wa(r,function(t,e,n){return n.delete()})},kE.prototype.Ur=function(t,e){var n;e?n=t:(n={},e=t);var r=this.cursor(n);return this.wa(r,e)},kE.prototype.Uo=function(i){var t=this.cursor({});return new q_(function(n,r){t.onerror=function(t){var e=DE(t.target.error);r(e)},t.onsuccess=function(t){var e=t.target.result;e?i(e.primaryKey,e.value).next(function(t){t?e.continue():n()}):n()}})},kE.prototype.wa=function(t,s){var a=[];return new q_(function(o,e){t.onerror=function(t){e(t.target.error)},t.onsuccess=function(t){var e=t.target.result;if(e){var n=new wE(e),r=s(e.primaryKey,e.value,n);if(r instanceof q_){var i=r.catch(function(t){return n.done(),q_.reject(t)});a.push(i)}n.Pn?o():null===n.Ea?e.continue():e.continue(n.Ea)}else o()}}).next(function(){return q_.vn(a)})},kE.prototype.options=function(t,e){var n=void 0;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},kE.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.Dh?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},kE);function kE(t){this.store=t}function OE(t){var n=this;this.transaction=t,this.aborted=!1,this.Ia=new iw,this.transaction.oncomplete=function(){n.Ia.resolve()},this.transaction.onabort=function(){t.error?n.Ia.reject(new EE(t.error)):n.Ia.resolve()},this.transaction.onerror=function(t){var e=DE(t.target.error);n.Ia.reject(new EE(e))}}function RE(t){return new q_(function(n,r){t.onsuccess=function(t){var e=t.target.result;n(e)},t.onerror=function(t){var e=DE(t.target.error);r(e)}})}var PE=!1;function DE(t){var e=_E.aa(Vs());if(12.2<=e&&e<13){var n="An internal error was encountered in the Indexed Database server";if(0<=t.message.indexOf(n)){var r=new og("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '"+n+"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");return PE||(PE=!0,setTimeout(function(){throw r},0)),r}}return t}var xE=(FE.ga=function(t,e,n,r,i){var o=new FE(t,e,Date.now()+n,r,i);return o.start(n),o},FE.prototype.start=function(t){var e=this;this.pa=setTimeout(function(){return e.ya()},t)},FE.prototype.vr=function(){return this.ya()},FE.prototype.cancel=function(t){null!==this.pa&&(this.clearTimeout(),this.Va.reject(new og(ig.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},FE.prototype.ya=function(){var e=this;this.Aa.uo(function(){return null!==e.pa?(e.clearTimeout(),e.op().then(function(t){return e.Va.resolve(t)})):Promise.resolve()})},FE.prototype.clearTimeout=function(){null!==this.pa&&(this.Pa(this),clearTimeout(this.pa),this.pa=null)},FE),LE=(Object.defineProperty(ME.prototype,"La",{get:function(){return this.Sa},enumerable:!0,configurable:!0}),ME.prototype.uo=function(t){this.enqueue(t)},ME.prototype.Ma=function(t){this.Oa(),this.xa(t)},ME.prototype.Ba=function(t){return this.Oa(),this.xa(t)},ME.prototype.qa=function(n){return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.Oa(),this.Sa?[3,2]:(this.Sa=!0,(e=__.nt().window)&&e.removeEventListener("visibilitychange",this.ka),[4,this.Ba(n)]);case 1:t.sent(),t.label=2;case 2:return[2]}})})},ME.prototype.enqueue=function(t){return this.Oa(),this.Sa?new Promise(function(t){}):this.xa(t)},ME.prototype.Ua=function(i){var t=this;this.Oa(),this.Sa||(this.va=this.va.then(function(){var n=new iw,r=function(){return Is(t,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,i()];case 1:return t.sent(),n.resolve(),this.$a.reset(),[3,3];case 2:if(!CE(e=t.sent()))throw n.resolve(),e;return S_("AsyncQueue","Operation failed with retryable error: "+e),this.$a.gr(r),[3,3];case 3:return[2]}})})};return t.uo(r),n.promise}))},ME.prototype.xa=function(t){var e=this,n=this.ba.then(function(){return e.Fa=!0,t().catch(function(t){throw e.Ca=t,e.Fa=!1,C_("INTERNAL UNHANDLED ERROR: ",t.stack||t.message||""),t}).then(function(t){return e.Fa=!1,t})});return this.ba=n},ME.prototype.yr=function(t,e,n){var r=this;this.Oa(),-1h.Tu.ru?(S_("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+h.Tu.ru+" from "+t),h.Tu.ru):t,s=Date.now(),h.Au(e,i)}).next(function(t){return r=t,a=Date.now(),h.Ah(e,r,n)}).next(function(t){return o=t,u=Date.now(),h.Qo(e,r)}).next(function(t){return c=Date.now(),T_()<=Ta.DEBUG&&S_("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"),q_.resolve({Za:!0,tu:i,eu:o,su:t})})},YE),KE=(QE.prototype.start=function(){return Promise.resolve()},QE.prototype.Du=function(i){return Is(this,void 0,void 0,function(){var e,m,n,r=this;return Ss(this,function(t){switch(t.label){case 0:return e=this.Wn,m=this.vu,[4,this.persistence.runTransaction("Handle user change","readonly",function(y){var g;return r.Wn.ia(y).next(function(t){return g=t,e=r.persistence.vo(i),m=new G_(r.bu,e,r.persistence.Fo()),e.ia(y)}).next(function(t){for(var e=[],n=[],r=Kb(),i=0,o=g;i=this.xu||0r)throw new og(ig.INVALID_ARGUMENT,"Function "+t+"() requires between "+n+" and "+r+" arguments, but was called with "+ET(e.length,"argument")+".")}function cT(t,e,n,r){dT(t,e,wT(n)+" argument",r)}function hT(t,e,n,r){void 0!==r&&cT(t,e,n,r)}function lT(t,e,n,r){dT(t,e,n+" option",r)}function fT(t,e,n,r){void 0!==r&&lT(t,e,n,r)}function pT(t,e,n,r,u){void 0!==r&&function(t,e,n){for(var r=[],i=0,o=u;ithis.query.limit;){var n=this.query.oe()?l.last():l.first();l=l.delete(n.key),h=h.delete(n.key),u.track({type:1,doc:n})}return{md:l,gd:u,yd:f,ns:h}},uS.prototype.pd=function(t,e){return t.At&&e.hasCommittedMutations&&!e.At},uS.prototype.xn=function(t,e,n){var o=this,r=this.md;this.md=t.md,this.ns=t.ns;var i=t.gd.es();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.query.se(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 A_()}}var r,i}),this.bd(n);var s=e?this.vd():[],a=0===this.Ad.size&&this.fs?1:0,u=a!==this.Rd;return this.Rd=a,0!==i.length||u?{snapshot:new e_(this.query,t.md,r,i,t.ns,0==a,u,!1),Sd:s}:{Sd:s}},uS.prototype.Dd=function(t){return this.fs&&"Offline"===t?(this.fs=!1,this.xn({md:this.md,gd:new t_,ns:this.ns,yd:!1},!1)):{Sd:[]}},uS.prototype.Cd=function(t){return!this.wd.has(t)&&!!this.md.has(t)&&!this.md.get(t).At},uS.prototype.bd=function(t){var e=this;t&&(t.Ts.forEach(function(t){return e.wd=e.wd.add(t)}),t.Es.forEach(function(t){}),t.Is.forEach(function(t){return e.wd=e.wd.delete(t)}),this.fs=t.fs)},uS.prototype.vd=function(){var e=this;if(!this.fs)return[];var n=this.Ad;this.Ad=Kb(),this.md.forEach(function(t){e.Cd(t.key)&&(e.Ad=e.Ad.add(t.key))});var r=[];return n.forEach(function(t){e.Ad.has(t)||r.push(new PI(t))}),this.Ad.forEach(function(t){n.has(t)||r.push(new RI(t))}),r},uS.prototype.Fd=function(t){this.wd=t.Ku,this.Ad=Kb();var e=this.Vd(t.documents);return this.xn(e,!0)},uS.prototype.Nd=function(){return e_.os(this.query,this.md,this.ns,0===this.Rd)},uS),zI=(aS.prototype.Ld=function(){this.Md()},aS.prototype.Md=function(){var t=this;this.$a.gr(function(){return Is(t,void 0,void 0,function(){var e,n,r=this;return Ss(this,function(t){return e=this.$d.ml(),(n=this.Od(e))&&n.then(function(t){r.Aa.uo(function(){return e.commit().then(function(){r.Va.resolve(t)}).catch(function(t){r.xd(t)})})}).catch(function(t){r.xd(t)}),[2]})})})},aS.prototype.Od=function(t){try{var e=this.updateFunction(t);return!xg(e)&&e.catch&&e.then?e:(this.Va.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.Va.reject(t),null}},aS.prototype.xd=function(t){var e=this;0i?this.Wn[i]:null)},eS.prototype.sa=function(){return q_.resolve(0===this.Wn.length?-1:this.Uf-1)},eS.prototype.ia=function(t){return q_.resolve(this.Wn.slice())},eS.prototype.Gn=function(t,e){var n=this,r=new nT(e,0),i=new nT(e,Number.POSITIVE_INFINITY),o=[];return this.Qf.Ke([r,i],function(t){var e=n.jf(t.oc);o.push(e)}),q_.resolve(o)},eS.prototype.Xn=function(t,e){var r=this,i=new Lb(D_);return e.forEach(function(t){var e=new nT(t,0),n=new nT(t,Number.POSITIVE_INFINITY);r.Qf.Ke([e,n],function(t){i=i.add(t.oc)})}),q_.resolve(this.Gf(i))},eS.prototype.nr=function(t,e){var n=e.path,r=n.length+1,i=n;Ng.et(i)||(i=i.child(""));var o=new nT(new Ng(i),0),s=new Lb(D_);return this.Qf.Ge(function(t){var e=t.key.path;return!!n.q(e)&&(e.length===r&&(s=s.add(t.oc)),!0)},o),q_.resolve(this.Gf(s))},eS.prototype.Gf=function(t){var n=this,r=[];return t.forEach(function(t){var e=n.jf(t);null!==e&&r.push(e)}),r},eS.prototype.ra=function(n,r){var i=this;k_(0===this.Wf(r.batchId,"removed")),this.Wn.shift();var o=this.Qf;return q_.forEach(r.mutations,function(t){var e=new nT(t.key,r.batchId);return o=o.delete(e),i.hh.Bo(n,t.key)}).next(function(){i.Qf=o})},eS.prototype.ha=function(t){},eS.prototype.Ch=function(t,e){var n=new nT(e,0),r=this.Qf.ze(n);return q_.resolve(e.isEqual(r&&r.key))},eS.prototype.oa=function(t){return this.Wn.length,q_.resolve()},eS.prototype.Wf=function(t,e){return this.Kf(t)},eS.prototype.Kf=function(t){return 0===this.Wn.length?0:t-this.Wn[0].batchId},eS.prototype.jf=function(t){var e=this.Kf(t);return e<0||e>=this.Wn.length?null:this.Wn[e]},eS),ZI=(tS.prototype.Nn=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,s=this.zf(e);return this.docs=this.docs.Ae(r,{Mr:e,size:s,readTime:n}),this.size+=s-o,this.jn.Dr(t,r.path.L())},tS.prototype.kn=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},tS.prototype.Ln=function(t,e){var n=this.docs.get(e);return q_.resolve(n?n.Mr:null)},tS.prototype.getEntries=function(t,e){var n=this,r=qb();return e.forEach(function(t){var e=n.docs.get(t);r=r.Ae(t,e?e.Mr:null)}),q_.resolve(r)},tS.prototype.Zn=function(t,e,n){for(var r=Wb(),i=new Ng(e.path.child("")),o=this.docs.ve(i);o.$e();){var s=o.Ne(),a=s.key,u=s.value,c=u.Mr,h=u.readTime;if(!e.path.q(a.path))break;h.S(n)<=0||c instanceof Jm&&e.matches(c)&&(r=r.Ae(c.key,c))}return q_.resolve(r)},tS.prototype.Hf=function(t,e){return q_.forEach(this.docs,function(t){return e(t)})},tS.prototype.Yr=function(t){return new tS.Jr(this)},tS.prototype.Zr=function(t){return q_.resolve(this.size)},tS);function tS(t,e){this.jn=t,this.zf=e,this.docs=new Ab(Ng.N),this.size=0}function eS(t,e){this.jn=t,this.hh=e,this.Wn=[],this.Uf=1,this.lastStreamToken=Pg.ht,this.Qf=new Lb(nT.Xu)}function nS(){}function rS(t,e,n){this.query=t,this.Ff=e,this.Nf=!1,this.$f=null,this.onlineState="Unknown",this.options=n||{}}function iS(t){this.ol=t,this.yf=new U_(function(t){return t.canonicalId()}),this.onlineState="Unknown",this.bf=new Set,this.ol.subscribe(this)}function oS(t,e,n,r,i){var o=this;return(o=MI.call(this,t,e,n,r,i)||this).N_=t,o.Rf=void 0,o}function sS(t,e,n,r,i){this.N_=t,this.$d=e,this.Ud=n,this.currentUser=r,this.Qd=i,this.Wd=null,this.jd=new U_(function(t){return t.canonicalId()}),this.Kd=new Map,this.Gd=[],this.zd=new Ab(Ng.N),this.Hd=new Map,this.Yd=new eT,this.Jd={},this.Xd=new Map,this.Zd=Cw.rh(),this.onlineState="Unknown"}function aS(t,e,n,r){this.Aa=t,this.$d=e,this.updateFunction=n,this.Va=r,this.kd=5,this.$a=new ow(this.Aa,"transaction_retry")}function uS(t,e){this.query=t,this.wd=e,this.Rd=null,this.fs=!1,this.Ad=Kb(),this.ns=Kb(),this.md=new Zb(t.se.bind(t))}function cS(){this.Ed=new BI,this.Id={},this.ol=null,this.g_=null,this.ur=null}function hS(t,e,n,r,i){if(this.Tr=t,this.platform=e,this.persistenceKey=n,this.vl=r,this.ol=null,this.g_=null,this.ur=null,this.Sl=this.Dl.bind(this),this.Cl=new Ab(D_),this.ro=!1,this.Fl=[],!hS.Gh(this.platform))throw new og(ig.UNIMPLEMENTED,"LocalStorage is not available on this platform.");var o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.platform.window.localStorage,this.currentUser=i,this.Nl=AI(this.persistenceKey,this.vl),this.$l="firestore_sequence_number_"+this.persistenceKey,this.Cl=this.Cl.Ae(this.vl,new BI),this.kl=new RegExp("^firestore_clients_"+o+"_([^_]*)$"),this.Ll=new RegExp("^firestore_mutations_"+o+"_(\\d+)(?:_(.*))?$"),this.Ml=new RegExp("^firestore_targets_"+o+"_(\\d+)$"),this.Ol="firestore_online_state_"+this.persistenceKey,this.platform.window.addEventListener("storage",this.Sl)}function lS(){this.activeTargetIds=Yb()}function fS(t,e){this.clientId=t,this.onlineState=e}function pS(t,e){this.clientId=t,this.activeTargetIds=e}function dS(t,e,n){this.targetId=t,this.state=e,this.error=n}function vS(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r}function yS(t){var e=this;return(e=FI.call(this)||this).th=t,e}ZI.Jr=(Es(yS,FI=B_),yS.prototype.xn=function(n){var r=this,i=[];return this.Dn.forEach(function(t,e){e?i.push(r.th.Nn(n,e,r.readTime)):r.th.kn(t)}),q_.vn(i)},yS.prototype.Mn=function(t,e){return this.th.Ln(t,e)},yS.prototype.On=function(t,e){return this.th.getEntries(t,e)},yS);var gS,mS,bS=(xS.prototype.js=function(t,n){return this.Yf.forEach(function(t,e){return n(e)}),q_.resolve()},xS.prototype._h=function(t){return q_.resolve(this.lastRemoteSnapshotVersion)},xS.prototype.lh=function(t){return q_.resolve(this.Jf)},xS.prototype.oh=function(t){return this.highestTargetId=this.Zf.next(),q_.resolve(this.highestTargetId)},xS.prototype.dh=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.Jf&&(this.Jf=e),q_.resolve()},xS.prototype.Th=function(t){this.Yf.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.Zf=new Cw(e),this.highestTargetId=e),t.sequenceNumber>this.Jf&&(this.Jf=t.sequenceNumber)},xS.prototype.fh=function(t,e){return this.Th(e),this.targetCount+=1,q_.resolve()},xS.prototype.Ih=function(t,e){return this.Th(e),q_.resolve()},xS.prototype.wh=function(t,e){return this.Yf.delete(e.target),this.Xf.nc(e.targetId),--this.targetCount,q_.resolve()},xS.prototype.Ah=function(n,r,i){var o=this,s=0,a=[];return this.Yf.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.Yf.delete(t),a.push(o.Rh(n,e.targetId)),s++)}),q_.vn(a).next(function(){return s})},xS.prototype.Vh=function(t){return q_.resolve(this.targetCount)},xS.prototype.gh=function(t,e){var n=this.Yf.get(e)||null;return q_.resolve(n)},xS.prototype.ph=function(t,e,n){return this.Xf.ec(e,n),q_.resolve()},xS.prototype.bh=function(e,t,n){this.Xf.ic(t,n);var r=this.persistence.hh,i=[];return r&&t.forEach(function(t){i.push(r.Bo(e,t))}),q_.vn(i)},xS.prototype.Rh=function(t,e){return this.Xf.nc(e),q_.resolve()},xS.prototype.Sh=function(t,e){var n=this.Xf.hc(e);return q_.resolve(n)},xS.prototype.Ch=function(t,e){return q_.resolve(this.Xf.Ch(e))},xS),_S=(DS.prototype.start=function(){return Promise.resolve()},DS.prototype.mo=function(){return this.qh=!1,Promise.resolve()},Object.defineProperty(DS.prototype,"ro",{get:function(){return this.qh},enumerable:!0,configurable:!0}),DS.prototype.ho=function(){},DS.prototype.Fo=function(){return this.jn},DS.prototype.vo=function(t){var e=this.tT[t.s()];return e||(e=new JI(this.jn,this.hh),this.tT[t.s()]=e),e},DS.prototype.Do=function(){return this.Yh},DS.prototype.Co=function(){return this.Qn},DS.prototype.runTransaction=function(t,e,n){var r=this;S_("MemoryPersistence","Starting transaction:",t);var i=new wS(this.Bh.next());return this.hh.sT(),n(i).next(function(t){return r.hh.iT(i).next(function(){return t})}).yn().then(function(t){return i.Un(),t})},DS.prototype.nT=function(e,n){return q_.Sn(Object.values(this.tT).map(function(t){return function(){return t.Ch(e,n)}}))},DS),wS=(Es(PS,mS=H_),PS),ES=(RS.oT=function(t){return new RS(t)},Object.defineProperty(RS.prototype,"aT",{get:function(){if(this.hT)return this.hT;throw A_()},enumerable:!0,configurable:!0}),RS.prototype.yh=function(t,e,n){return this.rT.yh(n,e),this.aT.delete(n),q_.resolve()},RS.prototype.vh=function(t,e,n){return this.rT.vh(n,e),this.aT.add(n),q_.resolve()},RS.prototype.Bo=function(t,e){return this.aT.add(e),q_.resolve()},RS.prototype.removeTarget=function(t,e){var n=this;this.rT.nc(e.targetId).forEach(function(t){return n.aT.add(t)});var r=this.persistence.Do();return r.Sh(t,e.targetId).next(function(t){t.forEach(function(t){return n.aT.add(t)})}).next(function(){return r.wh(t,e)})},RS.prototype.sT=function(){this.hT=new Set},RS.prototype.iT=function(t){var n=this,r=this.persistence.Co().Yr();return q_.forEach(this.aT,function(e){return n.uT(t,e).next(function(t){t||r.kn(e)})}).next(function(){return n.hT=null,r.apply(t)})},RS.prototype.Wo=function(t,e){var n=this;return this.uT(t,e).next(function(t){t?n.aT.delete(e):n.aT.add(e)})},RS.prototype.eT=function(t){return 0},RS.prototype.uT=function(t,e){var n=this;return q_.Sn([function(){return q_.resolve(n.rT.Ch(e))},function(){return n.persistence.Do().Ch(t,e)},function(){return n.persistence.nT(t,e)}])},RS),TS=(OS.prototype.initialize=function(n){return Is(this,void 0,void 0,function(){var e=this;return Ss(this,function(t){switch(t.label){case 0:return this.Ud=this.cT(n),this.persistence=this._T(n),[4,this.persistence.start()];case 1:return t.sent(),this.lT=this.dT(n),this.N_=this.fT(n),this.$d=this.TT(n),this.ol=this.ET(n),this.IT=this.wT(n),this.Ud.g_=function(t){return e.ol.Dd(t,1)},this.$d.ol=this.ol,[4,this.N_.start()];case 2:return t.sent(),[4,this.Ud.start()];case 3:return t.sent(),[4,this.$d.start()];case 4:return t.sent(),[4,this.$d.Vl(this.ol.tf)];case 5:return t.sent(),[2]}})})},OS.prototype.wT=function(t){return new YI(this.ol)},OS.prototype.dT=function(t){return null},OS.prototype.fT=function(t){return new KE(this.persistence,new $I,t.RT)},OS.prototype._T=function(t){return new _S(ES.oT)},OS.prototype.TT=function(t){var e=this;return new _I(this.N_,t.T_,t.Aa,function(t){return e.ol.Dd(t,0)},t.platform.AT())},OS.prototype.cT=function(t){return new HI},OS.prototype.ET=function(t){return new KI(this.N_,this.$d,this.Ud,t.RT,t.Qd)},OS.prototype.clearPersistence=function(t){throw new og(ig.FAILED_PRECONDITION,"You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.")},OS),IS=(Es(kS,gS=TS),kS.prototype.initialize=function(e){return Is(this,void 0,void 0,function(){var n=this;return Ss(this,function(t){switch(t.label){case 0:return[4,gS.prototype.initialize.call(this,e)];case 1:return t.sent(),[4,this.persistence.no(function(e){return Is(n,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,this.ol.Vl(e)];case 1:return t.sent(),this.lT&&(e&&!this.lT.ro?this.lT.start(this.N_):e||this.lT.stop()),[2]}})})})];case 2:return t.sent(),[2]}})})},kS.prototype.fT=function(t){return new JE(this.persistence,new $I,t.RT)},kS.prototype.ET=function(t){var e=new QI(this.N_,this.$d,this.Ud,t.RT,t.Qd);return this.Ud instanceof WI&&(this.Ud.ol=e),e},kS.prototype.dT=function(t){var e=this.persistence.hh.ko;return new GE(e,t.Aa)},kS.prototype._T=function(t){var e=Fw.$o(t.mT),n=t.platform.bc(t.mT.ii);return new Fw(t.PT.synchronizeTabs,e,t.clientId,t.platform,BE.hu(t.PT.cacheSizeBytes),t.Aa,n,this.Ud)},kS.prototype.cT=function(t){if(t.PT.VT&&t.PT.synchronizeTabs){if(!WI.Gh(t.platform))throw new og(ig.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var e=Fw.$o(t.mT);return new WI(t.Aa,t.platform,e,t.clientId,t.RT)}return new HI},kS.prototype.clearPersistence=function(t){var e=Fw.$o(t);return Fw.clearPersistence(e)},kS),SS=(AS.prototype.start=function(e,n){var r=this;this.gT();var i=new iw,o=new iw,s=!1;return this.credentials.l(function(t){if(!s)return s=!0,S_("FirestoreClient","Initializing. user=",t.uid),r.pT(e,n,t,o).then(i.resolve,i.reject);r.Aa.Ua(function(){return r.Pl(t)})}),this.Aa.uo(function(){return i.promise}),o.promise},AS.prototype.enableNetwork=function(){var t=this;return this.gT(),this.Aa.enqueue(function(){return t.ol.enableNetwork()})},AS.prototype.pT=function(u,c,h,l){return Is(this,void 0,void 0,function(){var r,i,o,s,a=this;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,this.platform.yT(this.mT)];case 1:return r=t.sent(),i=this.platform.bc(this.mT.ii),e=r,n=this.credentials,o=new gI(e,n,i),[4,u.initialize({Aa:this.Aa,mT:this.mT,platform:this.platform,T_:o,clientId:this.clientId,RT:h,Qd:100,PT:c})];case 2:return t.sent(),this.persistence=u.persistence,this.Ud=u.Ud,this.N_=u.N_,this.$d=u.$d,this.ol=u.ol,this.lT=u.lT,this.bT=u.IT,this.persistence.ho(function(){return Is(a,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,this.terminate()];case 1:return t.sent(),[2]}})})}),l.resolve(),[3,4];case 3:if(s=t.sent(),l.reject(s),!this.vT(s))throw s;return[2,(console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+s),this.pT(new TS,{VT:!1},h,l))];case 4:return[2]}var e,n})})},AS.prototype.vT=function(t){return"FirebaseError"===t.name?t.code===ig.FAILED_PRECONDITION||t.code===ig.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code},AS.prototype.gT=function(){if(this.Aa.La)throw new og(ig.FAILED_PRECONDITION,"The client has already been terminated.")},AS.prototype.Pl=function(t){return this.Aa.Wa(),S_("FirestoreClient","Credential Changed. Current user: "+t.uid),this.ol.Pl(t)},AS.prototype.disableNetwork=function(){var t=this;return this.gT(),this.Aa.enqueue(function(){return t.ol.disableNetwork()})},AS.prototype.terminate=function(){var t=this;return this.Aa.qa(function(){return Is(t,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.lT&&this.lT.stop(),[4,this.$d.mo()];case 1:return t.sent(),[4,this.Ud.mo()];case 2:return t.sent(),[4,this.persistence.mo()];case 3:return t.sent(),this.credentials.T(),[2]}})})})},AS.prototype.waitForPendingWrites=function(){var t=this;this.gT();var e=new iw;return this.Aa.uo(function(){return t.ol.lf(e)}),e.promise},AS.prototype.listen=function(t,e,n){var r=this;this.gT();var i=new XI(t,e,n);return this.Aa.uo(function(){return r.bT.listen(i)}),i},AS.prototype.rl=function(t){var e=this;this.ST||this.Aa.uo(function(){return e.bT.rl(t)})},AS.prototype.DT=function(o){return Is(this,void 0,void 0,function(){var i,e=this;return Ss(this,function(t){switch(t.label){case 0:return this.gT(),i=new iw,[4,this.Aa.enqueue(function(){return Is(e,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.N_.Uu(o)];case 1:return(e=t.sent())instanceof Jm?i.resolve(e):e instanceof Zm?i.resolve(null):i.reject(new og(ig.UNAVAILABLE,"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)")),[3,3];case 2:return n=t.sent(),r=UE(n,"Failed to get document '"+o+" from cache"),i.reject(r),[3,3];case 3:return[2]}})})})];case 1:return[2,(t.sent(),i.promise)]}})})},AS.prototype.CT=function(u){return Is(this,void 0,void 0,function(){var a,e=this;return Ss(this,function(t){switch(t.label){case 0:return this.gT(),a=new iw,[4,this.Aa.enqueue(function(){return Is(e,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.N_.ju(u,!0)];case 1:return e=t.sent(),n=new GI(u,e.Ku),r=n.Vd(e.documents),i=n.xn(r,!1),a.resolve(i.snapshot),[3,3];case 2:return o=t.sent(),s=UE(o,"Failed to execute query '"+u+" against cache"),a.reject(s),[3,3];case 3:return[2]}})})})];case 1:return[2,(t.sent(),a.promise)]}})})},AS.prototype.write=function(t){var e=this;this.gT();var n=new iw;return this.Aa.uo(function(){return e.ol.write(t,n)}),n.promise},AS.prototype.ii=function(){return this.mT.ii},AS.prototype.Df=function(t){var e=this;this.gT(),this.Aa.uo(function(){return e.bT.Df(t),Promise.resolve()})},AS.prototype.Cf=function(t){var e=this;this.ST||this.Aa.uo(function(){return e.bT.Cf(t),Promise.resolve()})},Object.defineProperty(AS.prototype,"ST",{get:function(){return this.Aa.La},enumerable:!0,configurable:!0}),AS.prototype.transaction=function(t){var e=this;this.gT();var n=new iw;return this.Aa.uo(function(){return e.ol.runTransaction(e.Aa,t,n),Promise.resolve()}),n.promise},AS),CS=(NS.prototype.next=function(t){this.FT(this.observer.next,t)},NS.prototype.error=function(t){this.FT(this.observer.error,t)},NS.prototype.NT=function(){this.muted=!0},NS.prototype.FT=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},NS);function NS(t){this.observer=t,this.muted=!1}function AS(t,e,n,r){this.platform=t,this.mT=e,this.credentials=n,this.Aa=r,this.clientId=R_.cn()}function kS(){return null!==gS&&gS.apply(this,arguments)||this}function OS(){}function RS(t){this.persistence=t,this.rT=new eT,this.hT=null}function PS(t){var e=this;return(e=mS.call(this)||this).Oh=t,e}function DS(t){var e=this;this.tT={},this.Bh=new K_(0),this.qh=!1,this.qh=!0,this.hh=t(this),this.Yh=new bS(this),this.jn=new lw,this.Qn=new ZI(this.jn,function(t){return e.hh.eT(t)})}function xS(t){this.persistence=t,this.Yf=new U_(function(t){return t.canonicalId()}),this.lastRemoteSnapshotVersion=lg.min(),this.highestTargetId=0,this.Jf=0,this.Xf=new eT,this.targetCount=0,this.Zf=Cw.nh()}function LS(i){return function(){if("object"==typeof i&&null!==i)for(var t=i,e=0,n=["next","error","complete"];e=",">","array-contains","in","array-contains-any"],e),o=uI("Query.where",t);if(o.Y()){if("array-contains"===i||"array-contains-any"===i)throw new og(ig.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+i+"' queries on FieldPath.documentId().");if("in"===i){this.wE(n,i);for(var s=[],a=0,u=n;ar.length)throw new og(ig.INVALID_ARGUMENT,"Too many arguments provided to "+t+"(). The number of arguments must be less than or equal to the number of Query.orderBy() clauses");for(var i=[],o=0;o, or >=) must be on the same field. But you have inequality filters on '"+o.toString()+"' and '"+t.field.toString()+"'");var s=this.IE.Kt();null!==s&&this.yE(t.field,s)}else if(i||r){var a=null;if(i&&(a=this.IE.ce(n)),null===a&&r&&(a=this.IE.ce(e)),null!=a)throw a===t.op?new og(ig.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+t.op.toString()+"' filter."):new og(ig.INVALID_ARGUMENT,"Invalid query. You cannot use '"+t.op.toString()+"' filters with '"+a.toString()+"' filters.")}}},ZS.prototype.mE=function(t){if(null===this.IE.Kt()){var e=this.IE.jt();null!==e&&this.yE(e,t.field)}},ZS.prototype.yE=function(t,e){if(!e.isEqual(t))throw new og(ig.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+t.toString()+"' and so you must also use '"+t.toString()+"' as your first Query.orderBy(), but your first Query.orderBy() is on field '"+e.toString()+"' instead.")},ZS),YS=(Object.defineProperty(JS.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e},enumerable:!0,configurable:!0}),Object.defineProperty(JS.prototype,"empty",{get:function(){return this.vE.docs.B()},enumerable:!0,configurable:!0}),Object.defineProperty(JS.prototype,"size",{get:function(){return this.vE.docs.size},enumerable:!0,configurable:!0}),JS.prototype.forEach=function(e,n){var r=this;uT("QuerySnapshot.forEach",arguments,1,2),cT("QuerySnapshot.forEach","function",1,e),this.vE.docs.forEach(function(t){e.call(n,r.CE(t))})},Object.defineProperty(JS.prototype,"query",{get:function(){return new QS(this.bE,this.hE,this.aE)},enumerable:!0,configurable:!0}),JS.prototype.docChanges=function(t){t&&(mT("QuerySnapshot.docChanges",t,["includeMetadataChanges"]),fT("QuerySnapshot.docChanges","boolean","includeMetadataChanges",t.includeMetadataChanges));var e=!(!t||!t.includeMetadataChanges);if(e&&this.vE.hs)throw new og(ig.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this.SE&&this.DE===e||(this.SE=function(i,e,o,s){if(o.ss.B()){var n=0;return o.docChanges.map(function(t){var e=new KS(i,t.doc.key,t.doc,o.fromCache,o.ns.has(t.doc.key),s);return t.doc,{type:"added",doc:e,oldIndex:-1,newIndex:n++}})}var a=o.ss;return o.docChanges.filter(function(t){return e||3!==t.type}).map(function(t){var e=new KS(i,t.doc.key,t.doc,o.fromCache,o.ns.has(t.doc.key),s),n=-1,r=-1;return 0!==t.type&&(n=a.indexOf(t.doc.key),a=a.delete(t.doc.key)),1!==t.type&&(r=(a=a.add(t.doc)).indexOf(t.doc.key)),{type:function(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return A_()}}(t.type),doc:e,oldIndex:n,newIndex:r}})}(this.hE,e,this.vE,this.aE),this.DE=e),this.SE},JS.prototype.isEqual=function(t){if(!(t instanceof JS))throw bT("isEqual","QuerySnapshot",1,t);return this.hE===t.hE&&this.bE.isEqual(t.bE)&&this.vE.isEqual(t.vE)&&this.aE===t.aE},JS.prototype.CE=function(t){return new KS(this.hE,t.key,t,this.metadata.fromCache,this.vE.ns.has(t.key),this.aE)},JS),XS=(Es($S,MS=QS),Object.defineProperty($S.prototype,"id",{get:function(){return this.IE.path.O()},enumerable:!0,configurable:!0}),Object.defineProperty($S.prototype,"parent",{get:function(){var t=this.IE.path.L();return t.B()?null:new HS(new Ng(t),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty($S.prototype,"path",{get:function(){return this.IE.path.j()},enumerable:!0,configurable:!0}),$S.prototype.doc=function(t){if(uT("CollectionReference.doc",arguments,0,1),0===arguments.length&&(t=R_.cn()),cT("CollectionReference.doc","non-empty string",1,t),""===t)throw new og(ig.INVALID_ARGUMENT,"Document path must be a non-empty string");var e=pg.K(t);return HS.nE(this.IE.path.child(e),this.firestore,this.aE)},$S.prototype.add=function(t){sT("CollectionReference.add",arguments,1),cT("CollectionReference.add","object",1,this.aE?this.aE.toFirestore(t):t);var e=this.doc();return e.set(t).then(function(){return e})},$S.prototype.withConverter=function(t){return new $S(this.FE,this.firestore,t)},$S);function $S(t,e,n){var r=this;if(((r=MS.call(this,nb.Wt(t),e,n)||this).FE=t).length%2!=1)throw new og(ig.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t.j()+" has "+t.length);return r}function JS(t,e,n,r){this.hE=t,this.bE=e,this.vE=n,this.aE=r,this.SE=null,this.DE=null,this.metadata=new GS(n.hasPendingWrites,n.fromCache)}function ZS(t,e,n){this.IE=t,this.firestore=e,this.aE=n}function tC(){return null!==FS&&FS.apply(this,arguments)||this}function eC(t,e,n,r,i,o){this.hE=t,this.kc=e,this.fE=n,this.TE=r,this.EE=i,this.aE=o}function nC(t,e){this.hasPendingWrites=t,this.fromCache=e}function rC(t,e,n){this.kc=t,this.firestore=e,this.aE=n,this.jT=this.firestore.WT()}function iC(t){this.hE=t,this.uE=[],this.cE=!1}function oC(t,e){this.hE=t,this.oE=e}function sC(t,e,n){var r=this;if(void 0===n&&(n=new TS),this.UT=null,this.QT=new LE,this.INTERNAL={delete:function(){return Is(r,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.WT(),[4,this.jT.terminate()];case 1:return t.sent(),[2]}})})}},"object"==typeof t.options){var i=t;this.UT=i,this.$c=sC.KT(i),this.GT=i.name,this.zT=new ag(e)}else{var o=t;if(!o.projectId)throw new og(ig.INVALID_ARGUMENT,"Must provide projectId");this.$c=new F_(o.projectId,o.database),this.GT="[DEFAULT]",this.zT=new sg}this.HT=n,this.YT=new VS({})}function aC(t){var e,n,r,i;if(void 0===t.host){if(void 0!==t.ssl)throw new og(ig.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else lT("settings","non-empty string","host",t.host),this.host=t.host,fT("settings","boolean","ssl",t.ssl),this.ssl=null===(e=t.ssl)||void 0===e||e;if(mT("settings",t,["host","ssl","credentials","timestampsInSnapshots","cacheSizeBytes","experimentalForceLongPolling","ignoreUndefinedProperties"]),fT("settings","object","credentials",t.credentials),this.credentials=t.credentials,fT("settings","boolean","timestampsInSnapshots",t.timestampsInSnapshots),fT("settings","boolean","ignoreUndefinedProperties",t.ignoreUndefinedProperties),!0===t.timestampsInSnapshots?C_("The setting 'timestampsInSnapshots: true' is no longer required and should be removed."):!1===t.timestampsInSnapshots&&C_("Support for 'timestampsInSnapshots: false' will be removed soon. You must update your code to handle Timestamp objects."),this.timestampsInSnapshots=null===(n=t.timestampsInSnapshots)||void 0===n||n,this.ignoreUndefinedProperties=null!==(r=t.ignoreUndefinedProperties)&&void 0!==r&&r,fT("settings","number","cacheSizeBytes",t.cacheSizeBytes),void 0===t.cacheSizeBytes)this.cacheSizeBytes=BE._u;else{if(t.cacheSizeBytes!==jS&&t.cacheSizeBytes() instead."),CC=dC(ST,"Use Blob.fromUint8Array() or Blob.fromBase64String() instead."),NC={Firestore:yC,GeoPoint:qT,Timestamp:hg,Blob:CC,Transaction:gC,WriteBatch:mC,DocumentReference:bC,DocumentSnapshot:_C,Query:EC,QueryDocumentSnapshot:wC,QuerySnapshot:TC,CollectionReference:IC,FieldPath:CT,FieldValue:SC,setLogLevel:qS.setLogLevel,CACHE_SIZE_UNLIMITED:jS},AC=(FC.prototype.B_=function(t){},FC.prototype.mo=function(){},FC),kC=(MC.prototype.B_=function(t){this.ME.push(t)},MC.prototype.mo=function(){window.removeEventListener("online",this.NE),window.removeEventListener("offline",this.kE)},MC.prototype.OE=function(){window.addEventListener("online",this.NE),window.addEventListener("offline",this.kE)},MC.prototype.$E=function(){S_("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.ME;t=u.createTime+6048e5?[2,function(i,o,s){return Is(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,5]),[4,function(a,u){return Is(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return[4,kA(a)];case 1:e=t.sent(),n=OA(u.subscriptionOptions),r={method:"PATCH",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(AA(a.appConfig)+"/"+u.token,r)];case 3:return[4,t.sent().json()];case 4:return i=t.sent(),[3,6];case 5:throw o=t.sent(),uA.create("token-update-failed",{errorInfo:o});case 6:if(i.error)throw s=i.error.message,uA.create("token-update-failed",{errorInfo:s});if(!i.token)throw uA.create("token-update-no-token");return[2,i.token]}})})}(o,i)];case 1:return e=t.sent(),n=Ts({token:e,createTime:Date.now()},i),[4,wA(o,n)];case 2:return t.sent(),[2,e];case 3:return r=t.sent(),[4,xA(o,s)];case 4:throw t.sent(),r;case 5:return[2]}})})}({token:u.token,createTime:Date.now(),subscriptionOptions:c},l,f)]:[2,u.token];case 9:return[2]}var e,n,r,i,o,s})})}function xA(r,i){return Is(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,_A(r)];case 1:return(e=t.sent())?[4,NA(r,e.token)]:[3,4];case 2:return t.sent(),[4,function(i){return Is(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return e=EA(i),[4,bA()];case 1:return n=t.sent(),[4,(r=n.transaction(gA,"readwrite")).objectStore(gA).delete(e)];case 2:return t.sent(),[4,r.complete];case 3:return t.sent(),[2]}})})}(r)];case 3:t.sent(),t.label=4;case 4:return[4,i.pushManager.getSubscription()];case 5:return(n=t.sent())?[2,n.unsubscribe()]:[2,!0]}})})}function LA(r,i){return Is(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,function(a,u){return Is(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return[4,kA(a)];case 1:e=t.sent(),n=OA(u),r={method:"POST",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(AA(a.appConfig),r)];case 3:return[4,t.sent().json()];case 4:return i=t.sent(),[3,6];case 5:throw o=t.sent(),uA.create("token-subscribe-failed",{errorInfo:o});case 6:if(i.error)throw s=i.error.message,uA.create("token-subscribe-failed",{errorInfo:s});if(!i.token)throw uA.create("token-subscribe-no-token");return[2,i.token]}})})}(r,i)];case 1:return e=t.sent(),n={token:e,createTime:Date.now(),subscriptionOptions:i},[4,wA(r,n)];case 2:return t.sent(),[2,n.token]}})})}function MA(t){return"object"==typeof t&&t&&CA in t}(PA=RA=RA||{}).PUSH_RECEIVED="push-received",PA.NOTIFICATION_CLICKED="notification-clicked";var FA=(Object.defineProperty(UA.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!0,configurable:!0}),UA.prototype.getToken=function(){return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.vapidKey||(this.vapidKey=TA),[4,this.getServiceWorkerRegistration()];case 1:return e=t.sent(),"default"!==Notification.permission?[3,3]:[4,Notification.requestPermission()];case 2:t.sent(),t.label=3;case 3:if("granted"!==Notification.permission)throw uA.create("permission-blocked");return[2,DA(this.firebaseDependencies,e,this.vapidKey)]}})})},UA.prototype.deleteToken=function(){return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return e=t.sent(),[2,xA(this.firebaseDependencies,e)]}})})},UA.prototype.requestPermission=function(){return Is(this,void 0,void 0,function(){var e;return Ss(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?uA.create("permission-blocked"):uA.create("permission-default")}})})},UA.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw uA.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw uA.create("invalid-vapid-key");this.vapidKey=t},UA.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw uA.create("invalid-sw-registration");if(this.swRegistration)throw uA.create("use-sw-after-get-token");this.swRegistration=t},UA.prototype.onMessage=function(t){var e=this;return this.onMessageCallback="function"==typeof t?t:t.next,function(){e.onMessageCallback=null}},UA.prototype.setBackgroundMessageHandler=function(){throw uA.create("only-available-in-sw")},UA.prototype.onTokenRefresh=function(){return function(){}},UA.prototype.getServiceWorkerRegistration=function(){return Is(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:if(this.swRegistration)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),e=this,[4,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"})];case 2:return e.swRegistration=t.sent(),this.swRegistration.update().catch(function(){}),[3,4];case 3:throw n=t.sent(),uA.create("failed-service-worker-registration",{browserErrorMessage:n.message});case 4:return[2,this.swRegistration]}})})},UA.prototype.messageEventListener=function(o){var s;return Is(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:return null!==(s=o.data)&&void 0!==s&&s.firebaseMessaging?(e=o.data.firebaseMessaging,n=e.type,r=e.payload,this.onMessageCallback&&n===RA.PUSH_RECEIVED&&this.onMessageCallback(r),MA(i=r.data)&&"1"===i["google.c.a.e"]?[4,this.logEvent(n,i)]:[3,2]):[2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},UA.prototype.logEvent=function(n,r){return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return e=function(t){switch(t){case RA.NOTIFICATION_CLICKED:return"notification_open";case RA.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[CA],message_name:r["google.c.a.c_l"],message_time:r["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)}),[2]}})})},UA);function UA(t){var e=this;this.firebaseDependencies=t,this.vapidKey=null,this.onMessageCallback=null,navigator.serviceWorker.addEventListener("message",function(t){return e.messageEventListener(t)})}var jA=(Object.defineProperty(VA.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!0,configurable:!0}),VA.prototype.setBackgroundMessageHandler=function(t){if(!t||"function"!=typeof t)throw uA.create("invalid-bg-handler");this.bgMessageHandler=t},VA.prototype.getToken=function(){var n,r;return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.vapidKey?[3,2]:[4,_A(this.firebaseDependencies)];case 1:e=t.sent(),this.vapidKey=null!==(r=null===(n=null==e?void 0:e.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==r?r:TA,t.label=2;case 2:return[2,DA(this.firebaseDependencies,self.registration,this.vapidKey)]}})})},VA.prototype.deleteToken=function(){return xA(this.firebaseDependencies,self.registration)},VA.prototype.requestPermission=function(){throw uA.create("only-available-in-window")},VA.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw uA.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw uA.create("invalid-vapid-key");this.vapidKey=t},VA.prototype.useServiceWorker=function(){throw uA.create("only-available-in-window")},VA.prototype.onMessage=function(){throw uA.create("only-available-in-window")},VA.prototype.onTokenRefresh=function(){throw uA.create("only-available-in-window")},VA.prototype.onPush=function(i){return Is(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return(e=function(t){var e=t.data;if(!e)return null;try{return e.json()}catch(t){return null}}(i))?[4,qA()]:[2];case 1:return(n=t.sent()).some(function(t){return"visible"===t.visibilityState&&!t.url.startsWith("chrome-extension://")})?[2,function(t,e){var n,r,i=BA(RA.PUSH_RECEIVED,e);try{for(var o=Cs(t),s=o.next();!s.done;s=o.next())s.value.postMessage(i)}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}(n,e)]:(r=function(t){var e;if(t&&"object"==typeof t.notification){var n=Ts({},t.notification);return n.data=Ts(Ts({},t.notification.data),((e={})[SA]=t,e)),n}}(e))?[4,function(t){var e,n=null!==(e=t.title)&&void 0!==e?e:"",r=t.actions,i=Notification.maxActions;return r&&i&&r.length>i&&console.warn("This browser only supports "+i+" actions. The remaining actions will not be displayed."),self.registration.showNotification(n,t)}(r)]:[3,3];case 2:return t.sent(),[3,5];case 3:return this.bgMessageHandler?[4,this.bgMessageHandler(e)]:[3,5];case 4:t.sent(),t.label=5;case 5:return[2]}})})},VA.prototype.onSubChange=function(n){var r,i;return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return n.newSubscription?[3,2]:[4,xA(this.firebaseDependencies,self.registration)];case 1:return t.sent(),[2];case 2:return[4,_A(this.firebaseDependencies)];case 3:return e=t.sent(),[4,xA(this.firebaseDependencies,self.registration)];case 4:return t.sent(),[4,DA(this.firebaseDependencies,self.registration,null!==(i=null===(r=null==e?void 0:e.subscriptionOptions)||void 0===r?void 0:r.vapidKey)&&void 0!==i?i:TA)];case 5:return t.sent(),[2]}})})},VA.prototype.onNotificationClick=function(s){var a,u;return Is(this,void 0,void 0,function(){var n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return!(n=null===(u=null===(a=s.notification)||void 0===a?void 0:a.data)||void 0===u?void 0:u[SA])||s.action?[2]:(s.stopImmediatePropagation(),s.notification.close(),(r=function(t){var e,n,r,i=null!==(n=null===(e=t.fcmOptions)||void 0===e?void 0:e.link)&&void 0!==n?n:null===(r=t.notification)||void 0===r?void 0:r.click_action;return i||(MA(t.data)?self.location.origin:null)}(n))?[4,function(u){return Is(this,void 0,void 0,function(){var e,n,r,i,o,s,a;return Ss(this,function(t){switch(t.label){case 0:return e=new URL(u,self.location.href),[4,qA()];case 1:n=t.sent();try{for(r=Cs(n),i=r.next();!i.done;i=r.next())if(o=i.value,new URL(o.url,self.location.href).host===e.host)return[2,o]}catch(t){s={error:t}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(s)throw s.error}}return[2,null]}})})}(r)]:[2]);case 1:return(i=t.sent())?[3,4]:[4,self.clients.openWindow(r)];case 2:return i=t.sent(),[4,(e=3e3,new Promise(function(t){setTimeout(t,e)}))];case 3:return t.sent(),[3,6];case 4:return[4,i.focus()];case 5:i=t.sent(),t.label=6;case 6:return i?(o=BA(RA.NOTIFICATION_CLICKED,n),[2,i.postMessage(o)]):[2]}var e})})},VA);function VA(t){var e=this;this.firebaseDependencies=t,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 qA(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function BA(t,e){return{firebaseMessaging:{type:t,payload:e}}}var WA={isSupported:HA};function HA(){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")}Kl.INTERNAL.registerComponent(new da("messaging",function(t){var e=t.getProvider("app").getImmediate(),n={app:e,appConfig:function(t){var e,n;if(!t||!t.options)throw cA("App Configuration Object");if(!t.name)throw cA("App Name");var r=t.options;try{for(var i=Cs(["projectId","apiKey","appId","messagingSenderId"]),o=i.next();!o.done;o=i.next()){var s=o.value;if(!r[s])throw cA(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(!HA())throw uA.create("unsupported-browser");return new(self&&"ServiceWorkerGlobalScope"in self?jA:FA)(n)},"PUBLIC").setServiceProps(WA));var GA="firebasestorage.googleapis.com",zA=(KA.prototype.codeProp=function(){return this.code},KA.prototype.codeEquals=function(t){return YA(t)===this.codeProp()},KA.prototype.serverResponseProp=function(){return this.serverResponse_},KA.prototype.setServerResponseProp=function(t){this.serverResponse_=t},Object.defineProperty(KA.prototype,"name",{get:function(){return this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(KA.prototype,"code",{get:function(){return this.code_},enumerable:!0,configurable:!0}),Object.defineProperty(KA.prototype,"message",{get:function(){return this.message_},enumerable:!0,configurable:!0}),Object.defineProperty(KA.prototype,"serverResponse",{get:function(){return this.serverResponse_},enumerable:!0,configurable:!0}),KA);function KA(t,e){this.code_=YA(t),this.message_="Firebase Storage: "+e,this.serverResponse_=null,this.name_="FirebaseError"}var QA={UNKNOWN:"unknown",OBJECT_NOT_FOUND:"object-not-found",BUCKET_NOT_FOUND:"bucket-not-found",PROJECT_NOT_FOUND:"project-not-found",QUOTA_EXCEEDED:"quota-exceeded",UNAUTHENTICATED:"unauthenticated",UNAUTHORIZED:"unauthorized",RETRY_LIMIT_EXCEEDED:"retry-limit-exceeded",INVALID_CHECKSUM:"invalid-checksum",CANCELED:"canceled",INVALID_EVENT_NAME:"invalid-event-name",INVALID_URL:"invalid-url",INVALID_DEFAULT_BUCKET:"invalid-default-bucket",NO_DEFAULT_BUCKET:"no-default-bucket",CANNOT_SLICE_BLOB:"cannot-slice-blob",SERVER_FILE_WRONG_SIZE:"server-file-wrong-size",NO_DOWNLOAD_URL:"no-download-url",INVALID_ARGUMENT:"invalid-argument",INVALID_ARGUMENT_COUNT:"invalid-argument-count",APP_DELETED:"app-deleted",INVALID_ROOT_OPERATION:"invalid-root-operation",INVALID_FORMAT:"invalid-format",INTERNAL_ERROR:"internal-error"};function YA(t){return"storage/"+t}function XA(){return new zA(QA.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function $A(){return new zA(QA.CANCELED,"User canceled the upload/download.")}function JA(){return new zA(QA.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function ZA(t,e,n){return new zA(QA.INVALID_ARGUMENT,"Invalid argument in `"+e+"` at index "+t+": "+n)}function tk(){return new zA(QA.APP_DELETED,"The Firebase app was deleted.")}function ek(t,e){return new zA(QA.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function nk(t){throw new zA(QA.INTERNAL_ERROR,"Internal error: "+t)}var rk={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};function ik(t){switch(t){case rk.RAW:case rk.BASE64:case rk.BASE64URL:case rk.DATA_URL:return;default:throw"Expected one of the event types: ["+rk.RAW+", "+rk.BASE64+", "+rk.BASE64URL+", "+rk.DATA_URL+"]."}}var ok=function(t,e){this.data=t,this.contentType=e||null};function sk(t,e){switch(t){case rk.RAW:return new ok(ak(e));case rk.BASE64:case rk.BASE64URL:return new ok(uk(t,e));case rk.DATA_URL:return new ok((n=new ck(e)).base64?uk(rk.BASE64,n.rest):function(t){var e;try{e=decodeURIComponent(t)}catch(t){throw ek(rk.DATA_URL,"Malformed data URL.")}return ak(e)}(n.rest),new ck(e).contentType)}var n;throw XA()}function ak(t){for(var e=[],n=0;n>6,128|63&r);else if(55296==(64512&r))if(n>18,128|r>>12&63,128|r>>6&63,128|63&r);else e.push(239,191,189);else 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 uk(e,t){switch(e){case rk.BASE64:var n=-1!==t.indexOf("-"),r=-1!==t.indexOf("_");if(n||r)throw ek(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break;case rk.BASE64URL:var i=-1!==t.indexOf("+"),o=-1!==t.indexOf("/");if(i||o)throw ek(e,"Invalid character '"+(i?"+":"/")+"' found: is it base64 encoded?");t=t.replace(/-/g,"+").replace(/_/g,"/")}var s;try{s=atob(t)}catch(t){throw ek(e,"Invalid character found")}for(var a=new Uint8Array(s.length),u=0;u][;base64],");var n,r,i=e[1]||null;null!=i&&(this.base64=(r=";base64",(n=i).length>=r.length&&n.substring(n.length-r.length)===r),this.contentType=this.base64?i.substring(0,i.length-";base64".length):i),this.rest=t.substring(t.indexOf(",")+1)};var hk,lk,fk={STATE_CHANGED:"state_changed"},pk="running",dk="pausing",vk="paused",yk="success",gk="canceling",mk="canceled",bk="error",_k={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function wk(t){switch(t){case pk:case dk:case gk:return _k.RUNNING;case vk:return _k.PAUSED;case yk:return _k.SUCCESS;case mk:return _k.CANCELED;case bk:default:return _k.ERROR}}function Ek(t){return null!=t}function Tk(t){return void 0!==t}function Ik(t){return"function"==typeof t}function Sk(t){return"object"==typeof t}function Ck(t){return"string"==typeof t||t instanceof String}function Nk(t){return"number"==typeof t||t instanceof Number}function Ak(t){return kk()&&t instanceof Blob}function kk(){return"undefined"!=typeof Blob}(lk=hk=hk||{})[lk.NO_ERROR=0]="NO_ERROR",lk[lk.NETWORK_ERROR=1]="NETWORK_ERROR",lk[lk.ABORT=2]="ABORT";var Ok=(Rk.prototype.send=function(t,e,n,r){if(this.sent_)throw nk("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(e,t,!0),Ek(r))for(var i in r)r.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,r[i].toString());return Ek(n)?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_},Rk.prototype.getErrorCode=function(){if(!this.sent_)throw nk("cannot .getErrorCode() before sending");return this.errorCode_},Rk.prototype.getStatus=function(){if(!this.sent_)throw nk("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}},Rk.prototype.getResponseText=function(){if(!this.sent_)throw nk("cannot .getResponseText() before sending");return this.xhr_.responseText},Rk.prototype.abort=function(){this.xhr_.abort()},Rk.prototype.getResponseHeader=function(t){return this.xhr_.getResponseHeader(t)},Rk.prototype.addUploadProgressListener=function(t){Ek(this.xhr_.upload)&&this.xhr_.upload.addEventListener("progress",t)},Rk.prototype.removeUploadProgressListener=function(t){Ek(this.xhr_.upload)&&this.xhr_.upload.removeEventListener("progress",t)},Rk);function Rk(){var e=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=hk.NO_ERROR,this.sendPromise_=new Promise(function(t){e.xhr_.addEventListener("abort",function(){e.errorCode_=hk.ABORT,t(e)}),e.xhr_.addEventListener("error",function(){e.errorCode_=hk.NETWORK_ERROR,t(e)}),e.xhr_.addEventListener("load",function(){t(e)})})}var Pk=(Dk.prototype.createXhrIo=function(){return new Ok},Dk);function Dk(){}function xk(){for(var t=[],e=0;ei&&r.push(e.charAt(i));return r.join("")}var lR,fR,pR,dR=(vR.prototype.getAppId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!t)throw aR.create("no app id");return t},vR.prototype.getProjectId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!t)throw aR.create("no project id");return t},vR.prototype.getApiKey=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!t)throw aR.create("no api key");return t},vR.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},vR.getInstance=function(){return void 0===tR&&(tR=new vR),tR},vR);function vR(){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=hR("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=hR("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}function yR(){return lR}(pR=fR=fR||{})[pR.UNKNOWN=0]="UNKNOWN",pR[pR.VISIBLE=1]="VISIBLE",pR[pR.HIDDEN=2]="HIDDEN";var gR=["firebase_","google_","ga_"],mR=new RegExp("^[a-zA-Z]\\w*$");function bR(){switch(uR.getInstance().document.visibilityState){case"visible":return fR.VISIBLE;case"hidden":return fR.HIDDEN;default:return fR.UNKNOWN}}var _R=new Ra(oR);_R.logLevel=Ta.INFO;var wR="0.0.1",ER={loggingEnabled:!0},TR="FIREBASE_INSTALLATIONS_AUTH";function IR(t){var r,e=function(){var t=uR.getInstance().localStorage;if(!t)return;var e=t.getItem(iR);if(!e||!function(t){return Number(t)>Date.now()}(e))return;var n=t.getItem(rR);if(!n)return;try{return JSON.parse(n)}catch(t){return}}();return e?(CR(e),Promise.resolve()):(r=t,function(){var t=dR.getInstance().installationsService.getToken();return t.then(function(t){}),t}().then(function(t){var e="https://firebaseremoteconfig.googleapis.com/v1/projects/"+dR.getInstance().getProjectId()+"/namespaces/fireperf:fetch?key="+dR.getInstance().getApiKey(),n=new Request(e,{method:"POST",headers:{Authorization:TR+" "+t},body:JSON.stringify({app_instance_id:r,app_instance_id_token:t,app_id:dR.getInstance().getAppId(),app_version:eR,sdk_version:wR})});return fetch(n).then(function(t){if(t.ok)return t.json();throw aR.create("RC response not ok")})}).catch(function(){_R.info(SR)}).then(CR).then(function(t){return function(t){var e=uR.getInstance().localStorage;if(!t||!e)return;e.setItem(rR,JSON.stringify(t)),e.setItem(iR,String(Date.now()+60*dR.getInstance().configTimeToLive*60*1e3))}(t)},function(){}))}var SR="Could not fetch config, will use default configs";function CR(t){if(!t)return t;var e=dR.getInstance(),n=t.entries||{};return e.loggingEnabled=void 0!==n.fpr_enabled?"true"===String(n.fpr_enabled):ER.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=NR(e.tracesSamplingRate),e.logNetworkAfterSampling=NR(e.networkRequestsSamplingRate),t}function NR(t){return Math.random()<=t}var AR,kR=1;function OR(){return kR=2,AR=AR||function(){var n=uR.getInstance().document;return new Promise(function(t){if(n&&"complete"!==n.readyState){var e=function(){"complete"===n.readyState&&(n.removeEventListener("readystatechange",e),t())};n.addEventListener("readystatechange",e)}else t()})}().then(function(){return(t=dR.getInstance().installationsService.getId()).then(function(t){lR=t}),t;var t}).then(function(t){return IR(t)}).then(function(){return RR()},function(){return RR()})}function RR(){kR=3}var PR,DR=1e4,xR=5500,LR=3,MR=LR,FR=[],UR=!1;function jR(t){setTimeout(function(){if(0!==MR)return FR.length?void function(){var t=ks(FR);FR=[];var e=t.map(function(t){return{source_extension_json_proto3:t.message,event_time_ms:String(t.eventTime)}});(function(t,i){return function(t){var e=dR.getInstance().getFlTransportFullUrl();return fetch(e,{method:"POST",body:JSON.stringify(t)})}(t).then(function(t){return t.ok||_R.info("Call to Firebase backend failed."),t.json()}).then(function(t){var e=Number(t.nextRequestWaitMillis),n=DR;isNaN(e)||(n=Math.max(e,n));var r=t.logResponseDetails;Array.isArray(r)&&0 with the name of a component - i.e. auth, database, etc):\n\nhttps://www.gstatic.com/firebasejs/5.0.0/firebase-.js\n"),Kl.registerVersion("firebase","7.14.6","cdn"),Kl}); //# sourceMappingURL=firebase.js.map