/*! For license information please see index.bundle.js.LICENSE.txt */
(()=>{var t,e,n={70482:(t,e,n)=>{"use strict";n.r(e),n.d(e,{factory:()=>D,getGlobalVars:()=>N,registerAnalytics:()=>M,resetGlobalVars:()=>A,settings:()=>R});var r,i,o=n(70655),a=n(5752),s=(n(90426),n(14594)),u=n(31313),c=n(79730),l="https://www.googletagmanager.com/gtag/js";!function(t){t.EVENT="event",t.SET="set",t.CONFIG="config"}(r||(r={})),function(t){t.ADD_SHIPPING_INFO="add_shipping_info",t.ADD_PAYMENT_INFO="add_payment_info",t.ADD_TO_CART="add_to_cart",t.ADD_TO_WISHLIST="add_to_wishlist",t.BEGIN_CHECKOUT="begin_checkout",t.CHECKOUT_PROGRESS="checkout_progress",t.EXCEPTION="exception",t.GENERATE_LEAD="generate_lead",t.LOGIN="login",t.PAGE_VIEW="page_view",t.PURCHASE="purchase",t.REFUND="refund",t.REMOVE_FROM_CART="remove_from_cart",t.SCREEN_VIEW="screen_view",t.SEARCH="search",t.SELECT_CONTENT="select_content",t.SELECT_ITEM="select_item",t.SELECT_PROMOTION="select_promotion",t.SET_CHECKOUT_OPTION="set_checkout_option",t.SHARE="share",t.SIGN_UP="sign_up",t.TIMING_COMPLETE="timing_complete",t.VIEW_CART="view_cart",t.VIEW_ITEM="view_item",t.VIEW_ITEM_LIST="view_item_list",t.VIEW_PROMOTION="view_promotion",t.VIEW_SEARCH_RESULTS="view_search_results"}(i||(i={}));var f,h=new s.Logger("@firebase/analytics");function p(t,e,n,i,a,s){return(0,o.__awaiter)(this,void 0,void 0,(function(){var u,c,l,f;return(0,o.__generator)(this,(function(o){switch(o.label){case 0:u=i[a],o.label=1;case 1:return o.trys.push([1,7,,8]),u?[4,e[u]]:[3,3];case 2:return o.sent(),[3,6];case 3:return[4,Promise.all(n)];case 4:return c=o.sent(),(l=c.find((function(t){return t.measurementId===a})))?[4,e[l.appId]]:[3,6];case 5:o.sent(),o.label=6;case 6:return[3,8];case 7:return f=o.sent(),h.error(f),[3,8];case 8:return t(r.CONFIG,a,s),[2]}}))}))}function d(t,e,n,i,a){return(0,o.__awaiter)(this,void 0,void 0,(function(){var s,u,c,l,f,p,d,v;return(0,o.__generator)(this,(function(o){switch(o.label){case 0:return o.trys.push([0,4,,5]),s=[],a&&a.send_to?(u=a.send_to,Array.isArray(u)||(u=[u]),[4,Promise.all(n)]):[3,2];case 1:for(c=o.sent(),l=function(t){var n=c.find((function(e){return e.measurementId===t})),r=n&&e[n.appId];if(!r)return s=[],"break";s.push(r)},f=0,p=u;f
0){var e=t.map((function(t,e){return"("+(e+1)+") "+t})).join(" "),n=y.create("invalid-analytics-context",{errorInfo:e});h.warn(n.message)}}();var n=t.options.appId;if(!n)throw y.create("no-app-id");if(!t.options.apiKey){if(!t.options.measurementId)throw y.create("no-api-key");h.warn('The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID '+t.options.measurementId+' provided in the "measurementId" field in the local Firebase config.')}if(null!=I[n])throw y.create("already-exists",{id:n});if(!P){(function(){for(var t=window.document.getElementsByTagName("script"),e=0,n=Object.values(t);e{"use strict";var r=n(25108);Object.defineProperty(e,"__esModule",{value:!0});var i,o,a=n(70655),s=n(31313),u=n(79730),c=n(14594),l=((i={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",i["bad-app-name"]="Illegal App name: '{$appName}",i["duplicate-app"]="Firebase App named '{$appName}' already exists",i["app-deleted"]="Firebase App named '{$appName}' already deleted",i["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",i["invalid-log-argument"]="First argument to `onLog` must be null or a function.",i),f=new s.ErrorFactory("app","Firebase",l),h="@firebase/app",p="[DEFAULT]",d=((o={})[h]="fire-core",o["@firebase/analytics"]="fire-analytics",o["@firebase/auth"]="fire-auth",o["@firebase/database"]="fire-rtdb",o["@firebase/functions"]="fire-fn",o["@firebase/installations"]="fire-iid",o["@firebase/messaging"]="fire-fcm",o["@firebase/performance"]="fire-perf",o["@firebase/remote-config"]="fire-rc",o["@firebase/storage"]="fire-gcs",o["@firebase/firestore"]="fire-fst",o["fire-js"]="fire-js",o["firebase-wrapper"]="fire-js-all",o),v=new c.Logger("@firebase/app"),y=function(){function t(t,e,n){var r,i,o=this;this.firebase_=n,this.isDeleted_=!1,this.name_=e.name,this.automaticDataCollectionEnabled_=e.automaticDataCollectionEnabled||!1,this.options_=s.deepCopy(t),this.container=new u.ComponentContainer(e.name),this._addComponent(new u.Component("app",(function(){return o}),"PUBLIC"));try{for(var c=a.__values(this.firebase_.INTERNAL.components.values()),l=c.next();!l.done;l=c.next()){var f=l.value;this._addComponent(f)}}catch(t){r={error:t}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}return Object.defineProperty(t.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(t){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!1,configurable:!0}),t.prototype.delete=function(){var t=this;return new Promise((function(e){t.checkDestroyed_(),e()})).then((function(){return t.firebase_.INTERNAL.removeApp(t.name_),Promise.all(t.container.getProviders().map((function(t){return t.delete()})))})).then((function(){t.isDeleted_=!0}))},t.prototype._getService=function(t,e){return void 0===e&&(e=p),this.checkDestroyed_(),this.container.getProvider(t).getImmediate({identifier:e})},t.prototype._removeServiceInstance=function(t,e){void 0===e&&(e=p),this.container.getProvider(t).clearInstance(e)},t.prototype._addComponent=function(t){try{this.container.addComponent(t)}catch(e){v.debug("Component "+t.name+" failed to register with FirebaseApp "+this.name,e)}},t.prototype._addOrOverwriteComponent=function(t){this.container.addOrOverwriteComponent(t)},t.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw f.create("app-deleted",{appName:this.name_})},t}();y.prototype.name&&y.prototype.options||y.prototype.delete||r.log("dc");var g=function t(){var e=function(t){var e={},n=new Map,r={__esModule:!0,initializeApp:function(n,i){void 0===i&&(i={}),"object"==typeof i&&null!==i||(i={name:i});var o=i;void 0===o.name&&(o.name=p);var a=o.name;if("string"!=typeof a||!a)throw f.create("bad-app-name",{appName:String(a)});if(s.contains(e,a))throw f.create("duplicate-app",{appName:a});var u=new t(n,o,r);return e[a]=u,u},app:i,registerVersion:function(t,e,n){var r,i=null!==(r=d[t])&&void 0!==r?r:t;n&&(i+="-"+n);var a=i.match(/\s|\//),s=e.match(/\s|\//);if(a||s){var c=['Unable to register library "'+i+'" with version "'+e+'":'];return a&&c.push('library name "'+i+'" contains illegal characters (whitespace or "/")'),a&&s&&c.push("and"),s&&c.push('version name "'+e+'" contains illegal characters (whitespace or "/")'),void v.warn(c.join(" "))}o(new u.Component(i+"-version",(function(){return{library:i,version:e}}),"VERSION"))},setLogLevel:c.setLogLevel,onLog:function(t,e){if(null!==t&&"function"!=typeof t)throw f.create("invalid-log-argument",{appName:name});c.setUserLogHandler(t,e)},apps:null,SDK_VERSION:"7.20.0",INTERNAL:{registerComponent:o,removeApp:function(t){delete e[t]},components:n,useAsService:function(t,e){return"serverAuth"===e?null:e}}};function i(t){if(t=t||p,!s.contains(e,t))throw f.create("no-app",{appName:t});return e[t]}function o(o){var u,c,l=o.name;if(n.has(l))return v.debug("There were multiple attempts to register component "+l+"."),"PUBLIC"===o.type?r[l]:null;if(n.set(l,o),"PUBLIC"===o.type){var h=function(t){if(void 0===t&&(t=i()),"function"!=typeof t[l])throw f.create("invalid-app-argument",{appName:l});return t[l]()};void 0!==o.serviceProps&&s.deepExtend(h,o.serviceProps),r[l]=h,t.prototype[l]=function(){for(var t=[],e=0;e=0&&v.warn("\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n ")}var b=g.initializeApp;g.initializeApp=function(){for(var t=[],e=0;e{var r=n(25108);(function(){var t,e=n(5752).default,i="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){t!=Array.prototype&&t!=Object.prototype&&(t[e]=n.value)},o=function(t){t=["object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof n.g&&n.g,t];for(var e=0;e>>0),_=0;function b(t,e,n){return t.call.apply(t.bind,arguments)}function w(t,e,n){if(!t)throw Error();if(2t.b&&(t.b++,e.next=t.a,t.a=e)}function U(){this.b=this.a=null}k=N("__EID__")?"__EID__":void 0,I(D,Error),D.prototype.name="CustomError",I(L,D),L.prototype.name="AssertionError",j.prototype.get=function(){if(0/g,it=/"/g,ot=/'/g,at=/\x00/g,st=/[\x00&<>"']/;function ut(t,e){return-1!=t.indexOf(e)}function ct(t,e){return te?1:0}t:{var lt=c.navigator;if(lt){var ft=lt.userAgent;if(ft){Z=ft;break t}}Z=""}function ht(t){return ut(Z,t)}function pt(t,e){for(var n in t)e.call(void 0,t[n],n,t)}function dt(t){for(var e in t)return!1;return!0}function vt(t){var e,n={};for(e in t)n[e]=t[e];return n}var yt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function gt(t,e){for(var n,r,i=1;i"}else o=void 0===t?"undefined":null===t?"null":typeof t;M("Argument is not a %s (or a non-Element, non-Location mock); got: %s",e,o)}}function _t(t,e){this.a=t===Et&&e||"",this.b=wt}function bt(t){return t instanceof _t&&t.constructor===_t&&t.b===wt?t.a:(M("expected object of type Const, got '"+t+"'"),"type_error:Const")}_t.prototype.sa=!0,_t.prototype.ra=function(){return this.a},_t.prototype.toString=function(){return"Const{"+this.a+"}"};var wt={},Et={},Tt=new _t(Et,"");function St(t,e){this.a=t===Pt&&e||"",this.b=xt}function It(t){return t instanceof St&&t.constructor===St&&t.b===xt?t.a:(M("expected object of type TrustedResourceUrl, got '"+t+"' of type "+p(t)),"type_error:TrustedResourceUrl")}function Ct(t,e){var n=bt(t);if(!kt.test(n))throw Error("Invalid TrustedResourceUrl format: "+n);return t=n.replace(Ot,(function(t,r){if(!Object.prototype.hasOwnProperty.call(e,r))throw Error('Found marker, "'+r+'", in format string, "'+n+'", but no valid label mapping found in args: '+JSON.stringify(e));return(t=e[r])instanceof _t?bt(t):encodeURIComponent(String(t))})),new St(Pt,t)}St.prototype.sa=!0,St.prototype.ra=function(){return this.a.toString()},St.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var Ot=/%{(\w+)}/g,kt=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,xt={},Pt={};function At(t,e){this.a=t===Mt&&e||"",this.b=Lt}function Nt(t){return t instanceof At&&t.constructor===At&&t.b===Lt?t.a:(M("expected object of type SafeUrl, got '"+t+"' of type "+p(t)),"type_error:SafeUrl")}At.prototype.sa=!0,At.prototype.ra=function(){return this.a.toString()},At.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var Rt=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function Dt(t){return t instanceof At?t:(t="object"==typeof t&&t.sa?t.ra():String(t),Rt.test(t)||(t="about:invalid#zClosurez"),new At(Mt,t))}var Lt={},Mt={};function jt(){this.a="",this.b=Ut}function Ft(t){return t instanceof jt&&t.constructor===jt&&t.b===Ut?t.a:(M("expected object of type SafeHtml, got '"+t+"' of type "+p(t)),"type_error:SafeHtml")}jt.prototype.sa=!0,jt.prototype.ra=function(){return this.a.toString()},jt.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var Ut={};function Vt(t){var e=new jt;return e.a=t,e}Vt("");var qt=Vt("");function Bt(t,e){for(var n=t.split("%s"),r="",i=Array.prototype.slice.call(arguments,1);i.length&&1")&&(t=t.replace(rt,">")),-1!=t.indexOf('"')&&(t=t.replace(it,""")),-1!=t.indexOf("'")&&(t=t.replace(ot,"'")),-1!=t.indexOf("\0")&&(t=t.replace(at,""))),t}function Gt(t){return Gt[" "](t),t}Vt("
"),Gt[" "]=h;var zt,Ht,Kt=ht("Opera"),$t=ht("Trident")||ht("MSIE"),Qt=ht("Edge"),Yt=Qt||$t,Xt=ht("Gecko")&&!(ut(Z.toLowerCase(),"webkit")&&!ht("Edge"))&&!(ht("Trident")||ht("MSIE"))&&!ht("Edge"),Jt=ut(Z.toLowerCase(),"webkit")&&!ht("Edge");function Zt(){var t=c.document;return t?t.documentMode:void 0}t:{var te="",ee=(Ht=Z,Xt?/rv:([^\);]+)(\)|;)/.exec(Ht):Qt?/Edge\/([\d\.]+)/.exec(Ht):$t?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Ht):Jt?/WebKit\/(\S+)/.exec(Ht):Kt?/(?:Version)[ \/]?(\S+)/.exec(Ht):void 0);if(ee&&(te=ee?ee[1]:""),$t){var ne=Zt();if(null!=ne&&ne>parseFloat(te)){zt=String(ne);break t}}zt=te}var re,ie={};function oe(t){return function(t,e){var n=ie;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e()}(t,(function(){for(var e=0,n=tt(String(zt)).split("."),r=tt(String(t)).split("."),i=Math.max(n.length,r.length),o=0;0==e&&o=t.keyCode)&&(t.keyCode=-1)}catch(t){}},Xe.prototype.g=function(){return this.a};var Ze="closure_listenable_"+(1e6*Math.random()|0),tn=0;function en(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.Ua=i,this.key=++tn,this.va=this.Oa=!1}function nn(t){t.va=!0,t.listener=null,t.proxy=null,t.src=null,t.Ua=null}function rn(t){this.src=t,this.a={},this.b=0}function on(t,e){var n=e.type;n in t.a&&Q(t.a[n],e)&&(nn(e),0==t.a[n].length&&(delete t.a[n],t.b--))}function an(t,e,n,r){for(var i=0;ir.keyCode||null!=r.returnValue)){t:{var i=!1;if(0==r.keyCode)try{r.keyCode=-1;break t}catch(t){i=!0}(i||null==r.returnValue)&&(r.returnValue=!0)}for(r=[],i=e.b;i;i=i.parentNode)r.push(i);for(t=t.type,i=r.length-1;0<=i;i--){e.b=r[i];var o=vn(r[i],t,!0,e);n=n&&o}for(i=0;i>>0);function bn(t){return v(t)?t:(t[_n]||(t[_n]=function(e){return t.handleEvent(e)}),t[_n])}function wn(){Be.call(this),this.v=new rn(this),this.$b=this,this.fb=null}function En(t,e,n,r,i){t.v.add(String(e),n,!1,r,i)}function Tn(t,e,n,r,i){t.v.add(String(e),n,!0,r,i)}function Sn(t,e,n,r){if(!(e=t.v.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;oe)throw Error("Bad port number "+e);t.g=e}else t.g=null}function Mn(t,e,n){e instanceof Qn?(t.b=e,function(t,e){e&&!t.f&&(Yn(t),t.c=null,t.a.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(Jn(this,e),tr(this,n,t))}),t)),t.f=e}(t.b,t.i)):(n||(e=Bn(e,Kn)),t.b=new Qn(e,t.i))}function jn(t,e,n){t.b.set(e,n)}function Fn(t,e){return t.b.get(e)}function Un(t){return t instanceof Rn?new Rn(t):new Rn(t,void 0)}function Vn(t,e,n,r){var i=new Rn(null,void 0);return t&&Dn(i,t),e&&(i.a=e),n&&Ln(i,n),r&&(i.c=r),i}function qn(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Bn(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Wn),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Wn(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Rn.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Bn(e,Gn,!0),":");var n=this.a;return(n||"file"==e)&&(t.push("//"),(e=this.l)&&t.push(Bn(e,Gn,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.g)&&t.push(":",String(n))),(n=this.c)&&(this.a&&"/"!=n.charAt(0)&&t.push("/"),t.push(Bn(n,"/"==n.charAt(0)?Hn:zn,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.h)&&t.push("#",Bn(n,$n)),t.join("")},Rn.prototype.resolve=function(t){var e=new Rn(this),n=!!t.f;n?Dn(e,t.f):n=!!t.l,n?e.l=t.l:n=!!t.a,n?e.a=t.a:n=null!=t.g;var r=t.c;if(n)Ln(e,t.g);else if(n=!!t.c){if("/"!=r.charAt(0))if(this.a&&!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(ut(i,"./")||ut(i,"/.")){r=0==i.lastIndexOf("/",0),i=i.split("/");for(var o=[],a=0;a2*t.c&&Pn(t)))}function Zn(t,e){return Yn(t),e=nr(t,e),An(t.a.b,e)}function tr(t,e,n){Jn(t,e),0'),r=a.document)&&(r.write(Ft(t)),r.close())):(a=r.open(Nt(e),n,a))&&t.noopener&&(a.opener=null),a)try{a.focus()}catch(t){}return a}var yr=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,gr=/^[^@]+@[^@]+$/;function mr(){var t=null;return new be((function(e){"complete"==c.document.readyState?e():(t=function(){e()},fn(window,"load",t))})).s((function(e){throw hn(window,"load",t),e}))}function _r(t){return t=t||xr(),!("file:"!==Dr()&&"ionic:"!==Dr()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function br(){var t=c.window;try{return!(!t||t==t.top)}catch(t){return!1}}function wr(){return void 0!==c.WorkerGlobalScope&&"function"==typeof c.importScripts}function Er(){return e.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":e.INTERNAL.hasOwnProperty("node")?"Node":wr()?"Worker":"Browser"}function Tr(){var t=Er();return"ReactNative"===t||"Node"===t}var Sr="Firefox",Ir="Chrome";function Cr(t){var e=t.toLowerCase();return ut(e,"opera/")||ut(e,"opr/")||ut(e,"opios/")?"Opera":ut(e,"iemobile")?"IEMobile":ut(e,"msie")||ut(e,"trident/")?"IE":ut(e,"edge/")?"Edge":ut(e,"firefox/")?Sr:ut(e,"silk/")?"Silk":ut(e,"blackberry")?"Blackberry":ut(e,"webos")?"Webos":!ut(e,"safari/")||ut(e,"chrome/")||ut(e,"crios/")||ut(e,"android")?!ut(e,"chrome/")&&!ut(e,"crios/")||ut(e,"edge/")?ut(e,"android")?"Android":(t=t.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==t.length?t[1]:"Other":Ir:"Safari"}var Or={ld:"FirebaseCore-web",nd:"FirebaseUI-web"};function kr(t,e){e=e||[];var n,r=[],i={};for(n in Or)i[Or[n]]=!0;for(n=0;ne)throw Error("Short delay should be less than long delay!");this.a=t,this.c=e,t=xr(),e=Er(),this.b=pr(t)||"ReactNative"===e}function Wr(){var t=c.document;return!t||void 0===t.visibilityState||"visible"==t.visibilityState}function Gr(t){void 0!==r&&"function"==typeof r.warn&&r.warn(t)}function zr(t){try{var e=new Date(parseInt(t,10));if(!isNaN(e.getTime())&&!/[^0-9]/.test(t))return e.toUTCString()}catch(t){}return null}function Hr(){return!(!Pr("fireauth.oauthhelper",c)&&!Pr("fireauth.iframe",c))}Br.prototype.get=function(){var t=c.navigator;return!t||"boolean"!=typeof t.onLine||!Rr()&&"chrome-extension:"!==Dr()&&void 0===t.connection||t.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};var Kr,$r={};function Qr(t){$r[t]||($r[t]=!0,Gr(t))}try{var Yr={};Object.defineProperty(Yr,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(Yr,"abcd",{configurable:!0,enumerable:!0,value:2}),Kr=2==Yr.abcd}catch(Ht){Kr=!1}function Xr(t,e,n){Kr?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n}):t[e]=n}function Jr(t,e){if(e)for(var n in e)e.hasOwnProperty(n)&&Xr(t,n,e[n])}function Zr(t){var e={};return Jr(e,t),e}function ti(t){var e=t;if("object"==typeof t&&null!=t)for(var n in e="length"in t?[]:{},t)Xr(e,n,ti(t[n]));return e}function ei(t){var e=t&&(t[ai]?"phone":null);if(!(e&&t&&t[oi]))throw new C("internal-error","Internal assert: invalid MultiFactorInfo object");Xr(this,"uid",t[oi]),Xr(this,"displayName",t[ri]||null);var n=null;t[ii]&&(n=new Date(t[ii]).toUTCString()),Xr(this,"enrollmentTime",n),Xr(this,"factorId",e)}function ni(t){try{var e=new si(t)}catch(t){e=null}return e}ei.prototype.w=function(){return{uid:this.uid,displayName:this.displayName,factorId:this.factorId,enrollmentTime:this.enrollmentTime}};var ri="displayName",ii="enrolledAt",oi="mfaEnrollmentId",ai="phoneInfo";function si(t){ei.call(this,t),Xr(this,"phoneNumber",t[ai])}function ui(t){var e={},n=t[hi],r=t[di],i=t[vi];if(t=ni(t[pi]),!i||i!=li&&i!=fi&&!n||i==fi&&!r||i==ci&&!t)throw Error("Invalid checkActionCode response!");i==fi?(e[gi]=n||null,e[_i]=n||null,e[yi]=r):(e[gi]=r||null,e[_i]=r||null,e[yi]=n||null),e[mi]=t||null,Xr(this,wi,i),Xr(this,bi,ti(e))}I(si,ei),si.prototype.w=function(){var t=si.$a.w.call(this);return t.phoneNumber=this.phoneNumber,t};var ci="REVERT_SECOND_FACTOR_ADDITION",li="EMAIL_SIGNIN",fi="VERIFY_AND_CHANGE_EMAIL",hi="email",pi="mfaInfo",di="newEmail",vi="requestType",yi="email",gi="fromEmail",mi="multiFactorInfo",_i="previousEmail",bi="data",wi="operation";function Ei(t){var e=Fn(t=Un(t),Ti)||null,n=Fn(t,Si)||null,r=Fn(t,Oi)||null;if(r=r&&xi[r]||null,!e||!n||!r)throw new C("argument-error",Ti+", "+Si+"and "+Oi+" are required in a valid action code URL.");Jr(this,{apiKey:e,operation:r,code:n,continueUrl:Fn(t,Ii)||null,languageCode:Fn(t,Ci)||null,tenantId:Fn(t,ki)||null})}var Ti="apiKey",Si="oobCode",Ii="continueUrl",Ci="languageCode",Oi="mode",ki="tenantId",xi={recoverEmail:"RECOVER_EMAIL",resetPassword:"PASSWORD_RESET",revertSecondFactorAddition:ci,signIn:li,verifyAndChangeEmail:fi,verifyEmail:"VERIFY_EMAIL"};function Pi(t){try{return new Ei(t)}catch(t){return null}}function Ai(t){var e=t[Mi];if(void 0===e)throw new C("missing-continue-uri");if("string"!=typeof e||"string"==typeof e&&!e.length)throw new C("invalid-continue-uri");this.h=e,this.b=this.a=null,this.g=!1;var n=t[Ni];if(n&&"object"==typeof n){e=n[Ui];var r=n[ji];if(n=n[Fi],"string"==typeof e&&e.length){if(this.a=e,void 0!==r&&"boolean"!=typeof r)throw new C("argument-error",ji+" property must be a boolean when specified.");if(this.g=!!r,void 0!==n&&("string"!=typeof n||"string"==typeof n&&!n.length))throw new C("argument-error",Fi+" property must be a non empty string when specified.");this.b=n||null}else{if(void 0!==e)throw new C("argument-error",Ui+" property must be a non empty string when specified.");if(void 0!==r||void 0!==n)throw new C("missing-android-pkg-name")}}else if(void 0!==n)throw new C("argument-error",Ni+" property must be a non null object when specified.");if(this.f=null,(e=t[Li])&&"object"==typeof e){if("string"==typeof(e=e[Vi])&&e.length)this.f=e;else if(void 0!==e)throw new C("argument-error",Vi+" property must be a non empty string when specified.")}else if(void 0!==e)throw new C("argument-error",Li+" property must be a non null object when specified.");if(void 0!==(e=t[Di])&&"boolean"!=typeof e)throw new C("argument-error",Di+" property must be a boolean when specified.");if(this.c=!!e,void 0!==(t=t[Ri])&&("string"!=typeof t||"string"==typeof t&&!t.length))throw new C("argument-error",Ri+" property must be a non empty string when specified.");this.i=t||null}var Ni="android",Ri="dynamicLinkDomain",Di="handleCodeInApp",Li="iOS",Mi="url",ji="installApp",Fi="minimumVersion",Ui="packageName",Vi="bundleId";function qi(t){var e={};for(var n in e.continueUrl=t.h,e.canHandleCodeInApp=t.c,(e.androidPackageName=t.a)&&(e.androidMinimumVersion=t.b,e.androidInstallApp=t.g),e.iOSBundleId=t.f,e.dynamicLinkDomain=t.i,e)null===e[n]&&delete e[n];return e}var Bi=null;function Wi(t){var e=zi(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,S(),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 Gi(t){try{return new Wi(t)}catch(t){return null}}function zi(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;nn;n++)for(var r=t.concat(e[n].split("")),i=0;i>4),64!=a&&(e(o<<4&240|a>>2),64!=s&&e(a<<6&192|s))}}(t,(function(t){e+=String.fromCharCode(t)})),e}(t))}catch(t){}return null}Wi.prototype.S=function(){return this.f},Wi.prototype.i=function(){return this.b},Wi.prototype.toString=function(){return this.g};var Hi="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),Ki=["client_id","response_type","scope","redirect_uri","state"],$i={md:{Ja:"locale",ua:700,ta:600,fa:"facebook.com",Wa:Ki},od:{Ja:null,ua:500,ta:750,fa:"github.com",Wa:Ki},pd:{Ja:"hl",ua:515,ta:680,fa:"google.com",Wa:Ki},vd:{Ja:"lang",ua:485,ta:705,fa:"twitter.com",Wa:Hi},jd:{Ja:"locale",ua:640,ta:600,fa:"apple.com",Wa:[]}};function Qi(t){for(var e in $i)if($i[e].fa==t)return $i[e];return null}function Yi(t){var e={};e["facebook.com"]=eo,e["google.com"]=ro,e["github.com"]=no,e["twitter.com"]=io;var n=t&&t[Ji];try{if(n)return e[n]?new e[n](t):new to(t);if(void 0!==t[Xi])return new Zi(t)}catch(t){}return null}var Xi="idToken",Ji="providerId";function Zi(t){var e=t[Ji];if(!e&&t[Xi]){var n=Gi(t[Xi]);n&&n.a&&(e=n.a)}if(!e)throw Error("Invalid additional user info!");"anonymous"!=e&&"custom"!=e||(e=null),n=!1,void 0!==t.isNewUser?n=!!t.isNewUser:"identitytoolkit#SignupNewUserResponse"===t.kind&&(n=!0),Xr(this,"providerId",e),Xr(this,"isNewUser",n)}function to(t){Zi.call(this,t),Xr(this,"profile",ti((t=Fr(t.rawUserInfo||"{}"))||{}))}function eo(t){if(to.call(this,t),"facebook.com"!=this.providerId)throw Error("Invalid provider ID!")}function no(t){if(to.call(this,t),"github.com"!=this.providerId)throw Error("Invalid provider ID!");Xr(this,"username",this.profile&&this.profile.login||null)}function ro(t){if(to.call(this,t),"google.com"!=this.providerId)throw Error("Invalid provider ID!")}function io(t){if(to.call(this,t),"twitter.com"!=this.providerId)throw Error("Invalid provider ID!");Xr(this,"username",t.screenName||null)}function oo(t){var e=Un(t),n=Fn(e,"link"),r=Fn(Un(n),"link");return e=Fn(e,"deep_link_id"),Fn(Un(e),"link")||e||r||n||t}function ao(t,e){if(!t&&!e)throw new C("internal-error","Internal assert: no raw session string available");if(t&&e)throw new C("internal-error","Internal assert: unable to determine the session type");this.a=t||null,this.b=e||null,this.type=this.a?so:uo}I(to,Zi),I(eo,to),I(no,to),I(ro,to),I(io,to);var so="enroll",uo="signin";function co(){}function lo(t,e){return t.then((function(t){if(t[Ja]){var n=Gi(t[Ja]);if(!n||e!=n.h)throw new C("user-mismatch");return t}throw new C("user-mismatch")})).s((function(t){throw t&&t.code&&t.code==x+"user-not-found"?new C("user-mismatch"):t}))}function fo(t,e){if(!e)throw new C("internal-error","failed to construct a credential");this.a=e,Xr(this,"providerId",t),Xr(this,"signInMethod",t)}function ho(t){return{pendingToken:t.a,requestUri:"http://localhost"}}function po(t){if(t&&t.providerId&&t.signInMethod&&0==t.providerId.indexOf("saml.")&&t.pendingToken)try{return new fo(t.providerId,t.pendingToken)}catch(t){}return null}function vo(t,e,n){if(this.a=null,e.idToken||e.accessToken)e.idToken&&Xr(this,"idToken",e.idToken),e.accessToken&&Xr(this,"accessToken",e.accessToken),e.nonce&&!e.pendingToken&&Xr(this,"nonce",e.nonce),e.pendingToken&&(this.a=e.pendingToken);else{if(!e.oauthToken||!e.oauthTokenSecret)throw new C("internal-error","failed to construct a credential");Xr(this,"accessToken",e.oauthToken),Xr(this,"secret",e.oauthTokenSecret)}Xr(this,"providerId",t),Xr(this,"signInMethod",n)}function yo(t){var e={};return t.idToken&&(e.id_token=t.idToken),t.accessToken&&(e.access_token=t.accessToken),t.secret&&(e.oauth_token_secret=t.secret),e.providerId=t.providerId,t.nonce&&!t.a&&(e.nonce=t.nonce),e={postBody:Xn(e).toString(),requestUri:"http://localhost"},t.a&&(delete e.postBody,e.pendingToken=t.a),e}function go(t){if(t&&t.providerId&&t.signInMethod){var e={idToken:t.oauthIdToken,accessToken:t.oauthTokenSecret?null:t.oauthAccessToken,oauthTokenSecret:t.oauthTokenSecret,oauthToken:t.oauthTokenSecret&&t.oauthAccessToken,nonce:t.nonce,pendingToken:t.pendingToken};try{return new vo(t.providerId,e,t.signInMethod)}catch(t){}}return null}function mo(t,e){this.Pc=e||[],Jr(this,{providerId:t,isOAuthProvider:!0}),this.Hb={},this.ob=(Qi(t)||{}).Ja||null,this.nb=null}function _o(t){if("string"!=typeof t||0!=t.indexOf("saml."))throw new C("argument-error",'SAML provider IDs must be prefixed with "saml."');mo.call(this,t,[])}function bo(t){mo.call(this,t,Ki),this.a=[]}function wo(){bo.call(this,"facebook.com")}function Eo(t){if(!t)throw new C("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return y(t)&&(e=t.accessToken),(new wo).credential({accessToken:e})}function To(){bo.call(this,"github.com")}function So(t){if(!t)throw new C("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return y(t)&&(e=t.accessToken),(new To).credential({accessToken:e})}function Io(){bo.call(this,"google.com"),this.Ca("profile")}function Co(t,e){var n=t;return y(t)&&(n=t.idToken,e=t.accessToken),(new Io).credential({idToken:n,accessToken:e})}function Oo(){mo.call(this,"twitter.com",Hi)}function ko(t,e){var n=t;if(y(n)||(n={oauthToken:t,oauthTokenSecret:e}),!n.oauthToken||!n.oauthTokenSecret)throw new C("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new vo("twitter.com",n,"twitter.com")}function xo(t,e,n){this.a=t,this.f=e,Xr(this,"providerId","password"),Xr(this,"signInMethod",n===Ao.EMAIL_LINK_SIGN_IN_METHOD?Ao.EMAIL_LINK_SIGN_IN_METHOD:Ao.EMAIL_PASSWORD_SIGN_IN_METHOD)}function Po(t){return t&&t.email&&t.password?new xo(t.email,t.password,t.signInMethod):null}function Ao(){Jr(this,{providerId:"password",isOAuthProvider:!1})}function No(t,e){if(!(e=Ro(e)))throw new C("argument-error","Invalid email link!");return new xo(t,e.code,Ao.EMAIL_LINK_SIGN_IN_METHOD)}function Ro(t){return(t=Pi(t=oo(t)))&&t.operation===li?t:null}function Do(t){if(!(t.cb&&t.bb||t.La&&t.ea))throw new C("internal-error");this.a=t,Xr(this,"providerId","phone"),this.fa="phone",Xr(this,"signInMethod","phone")}function Lo(t){if(t&&"phone"===t.providerId&&(t.verificationId&&t.verificationCode||t.temporaryProof&&t.phoneNumber)){var e={};return G(["verificationId","verificationCode","temporaryProof","phoneNumber"],(function(n){t[n]&&(e[n]=t[n])})),new Do(e)}return null}function Mo(t){return t.a.La&&t.a.ea?{temporaryProof:t.a.La,phoneNumber:t.a.ea}:{sessionInfo:t.a.cb,code:t.a.bb}}function jo(t){try{this.a=t||e.auth()}catch(t){throw new C("argument-error","Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().")}Jr(this,{providerId:"phone",isOAuthProvider:!1})}function Fo(t,e){if(!t)throw new C("missing-verification-id");if(!e)throw new C("missing-verification-code");return new Do({cb:t,bb:e})}function Uo(t){if(t.temporaryProof&&t.phoneNumber)return new Do({La:t.temporaryProof,ea:t.phoneNumber});var e=t&&t.providerId;if(!e||"password"===e)return null;var n=t&&t.oauthAccessToken,r=t&&t.oauthTokenSecret,i=t&&t.nonce,o=t&&t.oauthIdToken,a=t&&t.pendingToken;try{switch(e){case"google.com":return Co(o,n);case"facebook.com":return Eo(n);case"github.com":return So(n);case"twitter.com":return ko(n,r);default:return n||r||o||a?a?0==e.indexOf("saml.")?new fo(e,a):new vo(e,{pendingToken:a,idToken:t.oauthIdToken,accessToken:t.oauthAccessToken},e):new bo(e).credential({idToken:o,accessToken:n,rawNonce:i}):null}}catch(t){return null}}function Vo(t){if(!t.isOAuthProvider)throw new C("invalid-oauth-provider")}function qo(t,e,n,r,i,o,a){if(this.c=t,this.b=e||null,this.g=n||null,this.f=r||null,this.i=o||null,this.h=a||null,this.a=i||null,!this.g&&!this.a)throw new C("invalid-auth-event");if(this.g&&this.a)throw new C("invalid-auth-event");if(this.g&&!this.f)throw new C("invalid-auth-event")}function Bo(t){return(t=t||{}).type?new qo(t.type,t.eventId,t.urlResponse,t.sessionId,t.error&&O(t.error),t.postBody,t.tenantId):null}function Wo(){this.b=null,this.a=[]}ao.prototype.Ha=function(){return this.a?Oe(this.a):Oe(this.b)},ao.prototype.w=function(){return this.type==so?{multiFactorSession:{idToken:this.a}}:{multiFactorSession:{pendingCredential:this.b}}},co.prototype.ja=function(){},co.prototype.b=function(){},co.prototype.c=function(){},co.prototype.w=function(){},fo.prototype.ja=function(t){return _s(t,ho(this))},fo.prototype.b=function(t,e){var n=ho(this);return n.idToken=e,bs(t,n)},fo.prototype.c=function(t,e){return lo(ws(t,ho(this)),e)},fo.prototype.w=function(){return{providerId:this.providerId,signInMethod:this.signInMethod,pendingToken:this.a}},vo.prototype.ja=function(t){return _s(t,yo(this))},vo.prototype.b=function(t,e){var n=yo(this);return n.idToken=e,bs(t,n)},vo.prototype.c=function(t,e){return lo(ws(t,yo(this)),e)},vo.prototype.w=function(){var t={providerId:this.providerId,signInMethod:this.signInMethod};return this.idToken&&(t.oauthIdToken=this.idToken),this.accessToken&&(t.oauthAccessToken=this.accessToken),this.secret&&(t.oauthTokenSecret=this.secret),this.nonce&&(t.nonce=this.nonce),this.a&&(t.pendingToken=this.a),t},mo.prototype.Ka=function(t){return this.Hb=vt(t),this},I(_o,mo),I(bo,mo),bo.prototype.Ca=function(t){return $(this.a,t)||this.a.push(t),this},bo.prototype.Pb=function(){return J(this.a)},bo.prototype.credential=function(t,e){var n;if(!(n=y(t)?{idToken:t.idToken||null,accessToken:t.accessToken||null,nonce:t.rawNonce||null}:{idToken:t||null,accessToken:e||null}).idToken&&!n.accessToken)throw new C("argument-error","credential failed: must provide the ID token and/or the access token.");return new vo(this.providerId,n,this.providerId)},I(wo,bo),Xr(wo,"PROVIDER_ID","facebook.com"),Xr(wo,"FACEBOOK_SIGN_IN_METHOD","facebook.com"),I(To,bo),Xr(To,"PROVIDER_ID","github.com"),Xr(To,"GITHUB_SIGN_IN_METHOD","github.com"),I(Io,bo),Xr(Io,"PROVIDER_ID","google.com"),Xr(Io,"GOOGLE_SIGN_IN_METHOD","google.com"),I(Oo,mo),Xr(Oo,"PROVIDER_ID","twitter.com"),Xr(Oo,"TWITTER_SIGN_IN_METHOD","twitter.com"),xo.prototype.ja=function(t){return this.signInMethod==Ao.EMAIL_LINK_SIGN_IN_METHOD?nu(t,xs,{email:this.a,oobCode:this.f}):nu(t,Xs,{email:this.a,password:this.f})},xo.prototype.b=function(t,e){return this.signInMethod==Ao.EMAIL_LINK_SIGN_IN_METHOD?nu(t,Ps,{idToken:e,email:this.a,oobCode:this.f}):nu(t,Ws,{idToken:e,email:this.a,password:this.f})},xo.prototype.c=function(t,e){return lo(this.ja(t),e)},xo.prototype.w=function(){return{email:this.a,password:this.f,signInMethod:this.signInMethod}},Jr(Ao,{PROVIDER_ID:"password"}),Jr(Ao,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),Jr(Ao,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"}),Do.prototype.ja=function(t){return t.eb(Mo(this))},Do.prototype.b=function(t,e){var n=Mo(this);return n.idToken=e,nu(t,Zs,n)},Do.prototype.c=function(t,e){var n=Mo(this);return n.operation="REAUTH",lo(t=nu(t,tu,n),e)},Do.prototype.w=function(){var t={providerId:"phone"};return this.a.cb&&(t.verificationId=this.a.cb),this.a.bb&&(t.verificationCode=this.a.bb),this.a.La&&(t.temporaryProof=this.a.La),this.a.ea&&(t.phoneNumber=this.a.ea),t},jo.prototype.eb=function(t,e){var n=this.a.a;return Oe(e.verify()).then((function(r){if("string"!=typeof r)throw new C("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");if("recaptcha"===e.type){var i,o=y(t)?t.session:null,a=y(t)?t.phoneNumber:t;return i=o&&o.type==so?o.Ha().then((function(t){return function(t,e){return nu(t,zs,e).then((function(t){return t.phoneSessionInfo.sessionInfo}))}(n,{idToken:t,phoneEnrollmentInfo:{phoneNumber:a,recaptchaToken:r}})})):o&&o.type==uo?o.Ha().then((function(e){return function(t,e){return nu(t,Hs,e).then((function(t){return t.phoneResponseInfo.sessionInfo}))}(n,{mfaPendingCredential:e,mfaEnrollmentId:t.multiFactorHint&&t.multiFactorHint.uid||t.multiFactorUid,phoneSignInInfo:{recaptchaToken:r}})})):function(t,e){return nu(t,qs,e)}(n,{phoneNumber:a,recaptchaToken:r}),i.then((function(t){return"function"==typeof e.reset&&e.reset(),t}),(function(t){throw"function"==typeof e.reset&&e.reset(),t}))}throw new C("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.')}))},Jr(jo,{PROVIDER_ID:"phone"}),Jr(jo,{PHONE_SIGN_IN_METHOD:"phone"}),qo.prototype.getUid=function(){var t=[];return t.push(this.c),this.b&&t.push(this.b),this.f&&t.push(this.f),this.h&&t.push(this.h),t.join("-")},qo.prototype.S=function(){return this.h},qo.prototype.w=function(){return{type:this.c,eventId:this.b,urlResponse:this.g,sessionId:this.f,postBody:this.i,tenantId:this.h,error:this.a&&this.a.w()}};var Go,zo=null;function Ho(t){var e="unauthorized-domain",n=void 0,r=Un(t);t=r.a,"chrome-extension"==(r=r.f)?n=Bt("This chrome extension ID (chrome-extension://%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",t):"http"==r||"https"==r?n=Bt("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",C.call(this,e,n)}function Ko(t,e,n){C.call(this,t,n),(t=e||{}).Ib&&Xr(this,"email",t.Ib),t.ea&&Xr(this,"phoneNumber",t.ea),t.credential&&Xr(this,"credential",t.credential),t.Yb&&Xr(this,"tenantId",t.Yb)}function $o(t){if(t.code){var e=t.code||"";0==e.indexOf(x)&&(e=e.substring(x.length));var n={credential:Uo(t),Yb:t.tenantId};if(t.email)n.Ib=t.email;else if(t.phoneNumber)n.ea=t.phoneNumber;else if(!n.credential)return new C(e,t.message||void 0);return new Ko(e,n,t.message)}return null}function Qo(){}function Yo(t){return t.c||(t.c=t.b())}function Xo(){}function Jo(t){if(!t.f&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],n=0;n=ca(this).value)for(v(e)&&(e=e()),t=new na(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var la={},fa=null;function ha(t){var e;if(fa||(fa=new ra(""),la[""]=fa,fa.c=sa),!(e=la[t])){e=new ra(t);var n=t.lastIndexOf("."),r=t.substr(n+1);(n=ha(t.substr(0,n))).b||(n.b={}),n.b[r]=e,e.a=n,la[t]=e}return e}function pa(t,e){t&&t.log(ua,e,void 0)}function da(t){this.f=t}function va(t){wn.call(this),this.o=t,this.readyState=ya,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=ha("goog.net.FetchXmlHttp"),this.l=this.c=this.f=null}I(da,Qo),da.prototype.a=function(){return new va(this.f)},da.prototype.b=function(t){return function(){return t}}({}),I(va,wn);var ya=0;function ga(t){t.c.read().then(t.oc.bind(t)).catch(t.Ta.bind(t))}function ma(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,_a(t)}function _a(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function ba(t){wn.call(this),this.headers=new xn,this.O=t||null,this.c=!1,this.A=this.a=null,this.h=this.P=this.l="",this.f=this.N=this.i=this.G=!1,this.g=0,this.o=null,this.m=wa,this.u=this.R=!1}(t=va.prototype).open=function(t,e){if(this.readyState!=ya)throw this.abort(),Error("Error reopening a connection");this.m=t,this.g=e,this.readyState=1,_a(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.o.fetch(new Request(this.g,e)).then(this.tc.bind(this),this.Ta.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,ma(this,!1)),this.readyState=ya},t.tc=function(t){this.a&&(this.f=t,this.b||(this.b=t.headers,this.readyState=2,_a(this)),this.a&&(this.readyState=3,_a(this),this.a&&("arraybuffer"===this.responseType?t.arrayBuffer().then(this.rc.bind(this),this.Ta.bind(this)):void 0!==c.ReadableStream&&"body"in t?(this.response=this.responseText="",this.c=t.body.getReader(),this.l=new TextDecoder,ga(this)):t.text().then(this.sc.bind(this),this.Ta.bind(this)))))},t.oc=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?ma(this,!0):_a(this),3==this.readyState&&ga(this)}},t.sc=function(t){this.a&&(this.response=this.responseText=t,ma(this,!0))},t.rc=function(t){this.a&&(this.response=t,ma(this,!0))},t.Ta=function(t){var e=this.h;e&&e.log(aa,"Failed to fetch url "+this.g,t instanceof Error?t:Error(t)),this.a&&ma(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(aa,"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(aa,"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")},I(ba,wn);var wa="";ba.prototype.b=ha("goog.net.XhrIo");var Ea=/^https?$/i,Ta=["POST","PUT"];function Sa(t){return"content-type"==t.toLowerCase()}function Ia(t,e){t.c=!1,t.a&&(t.f=!0,t.a.abort(),t.f=!1),t.h=e,Ca(t),ka(t)}function Ca(t){t.G||(t.G=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function Oa(t){if(t.c&&void 0!==u)if(t.A[1]&&4==Pa(t)&&2==Aa(t))pa(t.b,Na(t,"Local request error detected and ignored"));else if(t.i&&4==Pa(t))In(t.Ub,0,t);else if(t.dispatchEvent("readystatechange"),4==Pa(t)){pa(t.b,Na(t,"Request complete")),t.c=!1;try{var e,n=Aa(t);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.l).match(Nn)[1]||null;if(!o&&c.self&&c.self.location){var a=c.self.location.protocol;o=a.substr(0,a.length-1)}i=!Ea.test(o?o.toLowerCase():"")}e=i}if(e)t.dispatchEvent("complete"),t.dispatchEvent("success");else{try{var s=2=e.l&&e.cancel())}this.u?this.u.call(this.o,this):this.m=!0,this.a||(t=new Va(this),La(this),Da(this,!1,t))}},Ra.prototype.v=function(t,e){this.i=!1,Da(this,t,e)},Ra.prototype.then=function(t,e,n){var r,i,o=new be((function(t,e){r=t,i=e}));return Ma(this,r,(function(t){t instanceof Va?o.cancel():i(t)})),o.then(t,e,n)},Ra.prototype.$goog_Thenable=!0,I(Ua,D),Ua.prototype.message="Deferred has already fired",Ua.prototype.name="AlreadyCalledError",I(Va,D),Va.prototype.message="Deferred was canceled",Va.prototype.name="CanceledError",qa.prototype.c=function(){throw delete Ba[this.a],this.b};var Ba={};function Wa(t){var e={},n=e.document||document,r=It(t).toString(),i=pe(document,"SCRIPT"),o={Vb:i,Ma:void 0},a=new Ra(o),s=null,u=null!=e.timeout?e.timeout:5e3;return 0t||$t&&re&&!(9e?null:"string"==typeof t?t.charAt(e):t[e]}(o.Y()),r=c.FormData&&e instanceof c.FormData,!$(Ta,n)||i||r||o.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),o.forEach((function(t,e){this.a.setRequestHeader(e,t)}),t),t.m&&(t.a.responseType=t.m),"withCredentials"in t.a&&t.a.withCredentials!==t.R&&(t.a.withCredentials=t.R);try{xa(t),0e;e++){i=0|n[e-15],r=0|n[e-2];var o=(0|n[e-16])+((i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3)|0,a=(0|n[e-7])+((r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)|0;n[e]=o+a|0}r=0|t.a[0],i=0|t.a[1];var s=0|t.a[2],u=0|t.a[3],c=0|t.a[4],l=0|t.a[5],f=0|t.a[6];for(o=0|t.a[7],e=0;64>e;e++){var h=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&i^r&s^i&s)|0;a=(o=o+((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))|0)+((a=(a=c&l^~c&f)+(0|oc[e])|0)+(0|n[e])|0)|0,o=f,f=l,l=c,c=u+a|0,u=s,s=i,i=r,r=a+h|0}t.a[0]=t.a[0]+r|0,t.a[1]=t.a[1]+i|0,t.a[2]=t.a[2]+s|0,t.a[3]=t.a[3]+u|0,t.a[4]=t.a[4]+c|0,t.a[5]=t.a[5]+l|0,t.a[6]=t.a[6]+f|0,t.a[7]=t.a[7]+o|0}function vc(t,e,n){void 0===n&&(n=e.length);var r=0,i=t.c;if("string"==typeof e)for(;r=o&&o==(0|o)))throw Error("message must be a byte array");t.f[i++]=o,i==t.b&&(dc(t),i=0)}}t.c=i,t.g+=n}uc.prototype.reset=function(){this.g=this.c=0,this.a=c.Int32Array?new Int32Array(this.h):J(this.h)};var yc=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function gc(){uc.call(this,8,mc)}I(gc,uc);var mc=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function _c(t,e,n,r,i,o){this.m=t,this.i=e,this.l=n,this.v=r||null,this.u=i||null,this.o=o,this.h=e+":"+n,this.A=new sc,this.g=new ic(this.h),this.f=null,this.b=[],this.a=this.c=null}function bc(t){return new C("invalid-cordova-configuration",t)}function wc(t,e){for(var n=0;ne.c?vc(e,pc,56-e.c):vc(e,pc,e.b-(e.c-56));for(var r=63;56<=r;r--)e.f[r]=255&n,n/=256;for(dc(e),r=n=0;r>i&255;return function(t){return H(t,(function(t){return 1<(t=t.toString(16)).length?t:"0"+t})).join("")}(t)}(o),l.sessionId=o;var f=gu(t.m,t.i,t.l,e,n,null,r,t.v,l,t.u,i,t.o);return t.la().then((function(){var e=t.h;return t.A.a.set(ac,a.w(),e)})).then((function(){var e=Pr("cordova.plugins.browsertab.isAvailable",c);if("function"!=typeof e)throw new C("invalid-cordova-configuration");var n=null;e((function(e){if(e){if("function"!=typeof(n=Pr("cordova.plugins.browsertab.openUrl",c)))throw new C("invalid-cordova-configuration");n(f)}else{if("function"!=typeof(n=Pr("cordova.InAppBrowser.open",c)))throw new C("invalid-cordova-configuration");e=xr(),t.a=n(f,e.match(/(iPad|iPhone|iPod).*OS 7_\d/i)||e.match(/(iPad|iPhone|iPod).*OS 8_\d/i)?"_blank":"_system","location=yes")}}))}))}(i,t,e,n,r)})).then((function(){return new be((function(t,e){s=function(){var e=Pr("cordova.plugins.browsertab.close",c);return t(),"function"==typeof e&&e(),i.a&&"function"==typeof i.a.close&&(i.a.close(),i.a=null),!1},i.Ea(s),u=function(){a||(a=Cn(2e3).then((function(){e(new C("redirect-cancelled-by-user"))})))},l=function(){Wr()&&u()},o.addEventListener("resume",u,!1),xr().toLowerCase().match(/android/)||o.addEventListener("visibilitychange",l,!1)})).s((function(t){return Tc(i).then((function(){throw t}))}))})).na((function(){u&&o.removeEventListener("resume",u,!1),l&&o.removeEventListener("visibilitychange",l,!1),a&&a.cancel(),s&&i.Ra(s),i.c=null}))},t.Ea=function(t){this.b.push(t),Ec(this).s((function(e){"auth/invalid-cordova-configuration"===e.code&&(e=new qo("unknown",null,null,null,new C("no-auth-event")),t(e))}))},t.Ra=function(t){Y(this.b,(function(e){return e==t}))};var Ic={name:"pendingRedirect",D:"session"};function Cc(t){return nc(t.b,Ic,t.a)}function Oc(t,e,n,r){this.i={},this.u=0,this.O=t,this.m=e,this.v=n,this.G=r,this.h=[],this.f=!1,this.l=E(this.o,this),this.b=new Bc,this.A=new Kc,this.g=new Sc(Vc(this.m,this.v)),this.c={},this.c.unknown=this.b,this.c.signInViaRedirect=this.b,this.c.linkViaRedirect=this.b,this.c.reauthViaRedirect=this.b,this.c.signInViaPopup=this.A,this.c.linkViaPopup=this.A,this.c.reauthViaPopup=this.A,this.a=kc(this.O,this.m,this.v,k,this.G)}function kc(t,n,r,i,o){var a=e.SDK_VERSION||null;return _r()?new _c(t,n,r,a,i,o):new pu(t,n,r,a,i,o)}function xc(t){t.f||(t.f=!0,t.a.Ea(t.l));var e=t.a;return t.a.la().s((function(n){throw t.a==e&&t.reset(),n}))}function Pc(t){t.a.Wb()&&xc(t).s((function(e){var n=new qo("unknown",null,null,null,new C("operation-not-supported-in-this-environment"));Mc(e)&&t.o(n)})),t.a.Sb()||Wc(t.b)}function Ac(t,e){$(t.h,e)||t.h.push(e),t.f||function(t){return t.b.get(Ic,t.a).then((function(t){return"pending"==t}))}(t.g).then((function(e){e?Cc(t.g).then((function(){xc(t).s((function(e){var n=new qo("unknown",null,null,null,new C("operation-not-supported-in-this-environment"));Mc(e)&&t.o(n)}))})):Pc(t)})).s((function(){Pc(t)}))}function Nc(t,e){Y(t.h,(function(t){return t==e}))}Oc.prototype.reset=function(){this.f=!1,this.a.Ra(this.l),this.a=kc(this.O,this.m,this.v,null,this.G),this.i={}},Oc.prototype.o=function(t){if(!t)throw new C("invalid-auth-event");if(6e5<=S()-this.u&&(this.i={},this.u=0),t&&t.getUid()&&this.i.hasOwnProperty(t.getUid()))return!1;for(var e=!1,n=0;nt.f&&(t.a=t.f),e)}(t,e)).then((function(){return function(){var t=c.document,e=null;return Wr()||!t?Oe():new be((function(n){e=function(){Wr()&&(t.removeEventListener("visibilitychange",e,!1),n())},t.addEventListener("visibilitychange",e,!1)})).s((function(n){throw t.removeEventListener("visibilitychange",e,!1),n}))}()})).then((function(){return t.h()})).then((function(){ll(t,!0)})).s((function(e){t.i(e)&&ll(t,!1)}))}function fl(t){this.c=t,this.b=this.a=null}function hl(t){return t.b&&1e3*t.b.c||0}function pl(t,e){var n=e.refreshToken;t.b=Gi(e[Ja]||""),t.a=n}function dl(t,e){this.a=t||null,this.b=e||null,Jr(this,{lastSignInTime:zr(e||null),creationTime:zr(t||null)})}function vl(t,e,n,r,i,o){Jr(this,{uid:t,displayName:r||null,photoURL:i||null,email:n||null,phoneNumber:o||null,providerId:e})}function yl(t,n,r){this.G=[],this.l=t.apiKey,this.m=t.appName,this.o=t.authDomain||null;var i=e.SDK_VERSION?kr(e.SDK_VERSION):null;this.a=new Ya(this.l,N(k),i),t.emulatorConfig&&is(this.a,t.emulatorConfig),this.b=new fl(this.a),Sl(this,n[Ja]),pl(this.b,n),Xr(this,"refreshToken",this.b.a),Ol(this,r||{}),wn.call(this),this.P=!1,this.o&&Nr()&&(this.i=qc(this.o,this.l,this.m)),this.R=[],this.f=null,this.u=function(t){return new cl((function(){return t.I(!0)}),(function(t){return!(!t||"auth/network-request-failed"!=t.code)}),(function(){var e=hl(t.b)-S()-3e5;return 0hl(this)-3e4?this.a?function(t,e){return function(t,e){return new be((function(n,r){"refresh_token"==e.grant_type&&e.refresh_token||"authorization_code"==e.grant_type&&e.code?ss(t,t.l+"?key="+encodeURIComponent(t.c),(function(t){t?t.error?r(iu(t)):t.access_token&&t.refresh_token?n(t):r(new C("internal-error")):r(new C("network-request-failed"))}),"POST",Xn(e).toString(),t.g,t.v.get()):r(new C("internal-error"))}))}(t.c,e).then((function(e){return t.b=Gi(e.access_token),t.a=e.refresh_token,{accessToken:t.b.toString(),refreshToken:t.a}})).s((function(e){throw"auth/user-token-expired"==e.code&&(t.a=null),e}))}(this,{grant_type:"refresh_token",refresh_token:this.a}):Oe(null):Oe({accessToken:this.b.toString(),refreshToken:this.a})},dl.prototype.w=function(){return{lastLoginAt:this.b,createdAt:this.a}},I(yl,wn),yl.prototype.wa=function(t){this.pa=t,rs(this.a,t)},yl.prototype.ka=function(){return this.pa},yl.prototype.Ga=function(){return J(this.X)},yl.prototype.gb=function(){this.u.b&&(this.u.stop(),this.u.start())},Xr(yl.prototype,"providerId","firebase"),(t=yl.prototype).reload=function(){var t=this;return Wl(this,xl(this).then((function(){return Ll(t).then((function(){return Il(t)})).then(kl)})))},t.nc=function(t){return this.I(t).then((function(t){return new Xc(t)}))},t.I=function(t){var e=this;return Wl(this,xl(this).then((function(){return e.b.getToken(t)})).then((function(t){if(!t)throw new C("internal-error");return t.accessToken!=e.ya&&(Sl(e,t.accessToken),e.dispatchEvent(new al("tokenChanged"))),Rl(e,"refreshToken",t.refreshToken),t.accessToken})))},t.Jc=function(t){if(!(t=t.users)||!t.length)throw new C("internal-error");Ol(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=function(t){return(t=t.providerUserInfo)&&t.length?H(t,(function(t){return new vl(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)})):[]}(t),n=0;nthis.A&&(this.A=0),0==this.A&&hf(this)&&Tl(hf(this)),this.removeAuthTokenListener(t)},t.addAuthTokenListener=function(t){var e=this;this.u.push(t),vf(this,this.i.then((function(){e.m||$(e.u,t)&&t(pf(e))})))},t.removeAuthTokenListener=function(t){Y(this.u,(function(e){return e==t}))},t.delete=function(){this.m=!0;for(var t=0;ti||i>=Vf.length)throw new C("internal-error","Argument validator received an unsupported number of arguments.");n=Vf[i],r=(r?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.J+".";break t}r=null}}if(r)throw new C("argument-error",t+" failed: "+r)}(t=Pf.prototype).Ia=function(){var t=this;return this.f?this.f:this.f=Mf(this,Oe().then((function(){if(Rr()&&!wr())return mr();throw new C("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")})).then((function(){return t.v.g(t.u())})).then((function(e){return t.g=e,nu(t.o,Us,{})})).then((function(e){t.a[Rf]=e.recaptchaSiteKey})).s((function(e){throw t.f=null,e})))},t.render=function(){jf(this);var t=this;return Mf(this,this.Ia().then((function(){if(null===t.c){var e=t.m;if(!t.i){var n=se(e);e=function(t,e,n){var r=arguments,i=document,o=String(r[0]),a=r[1];if(!ae&&a&&(a.name||a.type)){if(o=["<",o],a.name&&o.push(' name="',Wt(a.name),'"'),a.type){o.push(' type="',Wt(a.type),'"');var s={};gt(s,a),delete s.type,a=s}o.push(">"),o=o.join("")}return o=pe(i,o),a&&("string"==typeof a?o.className=a:Array.isArray(a)?o.className=a.join(" "):ue(o,a)),2{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(70655),i=n(31313),o=function(){function t(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}return t.prototype.setInstantiationMode=function(t){return this.instantiationMode=t,this},t.prototype.setMultipleInstances=function(t){return this.multipleInstances=t,this},t.prototype.setServiceProps=function(t){return this.serviceProps=t,this},t}(),a="[DEFAULT]",s=function(){function t(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}return t.prototype.get=function(t){void 0===t&&(t=a);var e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){var n=new i.Deferred;this.instancesDeferred.set(e,n);try{var r=this.getOrInitializeService(e);r&&n.resolve(r)}catch(t){}}return this.instancesDeferred.get(e).promise},t.prototype.getImmediate=function(t){var e=r.__assign({identifier:a,optional:!1},t),n=e.identifier,i=e.optional,o=this.normalizeInstanceIdentifier(n);try{var s=this.getOrInitializeService(o);if(!s){if(i)return null;throw Error("Service "+this.name+" is not available")}return s}catch(t){if(i)return null;throw t}},t.prototype.getComponent=function(){return this.component},t.prototype.setComponent=function(t){var e,n;if(t.name!==this.name)throw Error("Mismatching Component "+t.name+" for Provider "+this.name+".");if(this.component)throw Error("Component for "+this.name+" has already been provided");if(this.component=t,function(t){return"EAGER"===t.instantiationMode}(t))try{this.getOrInitializeService(a)}catch(t){}try{for(var i=r.__values(this.instancesDeferred.entries()),o=i.next();!o.done;o=i.next()){var s=r.__read(o.value,2),u=s[0],c=s[1],l=this.normalizeInstanceIdentifier(u);try{var f=this.getOrInitializeService(l);c.resolve(f)}catch(t){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}},t.prototype.clearInstance=function(t){void 0===t&&(t=a),this.instancesDeferred.delete(t),this.instances.delete(t)},t.prototype.delete=function(){return r.__awaiter(this,void 0,void 0,(function(){var t;return r.__generator(this,(function(e){switch(e.label){case 0:return t=Array.from(this.instances.values()),[4,Promise.all(r.__spread(t.filter((function(t){return"INTERNAL"in t})).map((function(t){return t.INTERNAL.delete()})),t.filter((function(t){return"_delete"in t})).map((function(t){return t._delete()}))))];case 1:return e.sent(),[2]}}))}))},t.prototype.isComponentSet=function(){return null!=this.component},t.prototype.getOrInitializeService=function(t){var e=this.instances.get(t);return!e&&this.component&&(e=this.component.instanceFactory(this.container,function(t){return t===a?void 0:t}(t)),this.instances.set(t,e)),e||null},t.prototype.normalizeInstanceIdentifier=function(t){return this.component?this.component.multipleInstances?t:a:t},t}(),u=function(){function t(t){this.name=t,this.providers=new Map}return t.prototype.addComponent=function(t){var e=this.getProvider(t.name);if(e.isComponentSet())throw new Error("Component "+t.name+" has already been registered with "+this.name);e.setComponent(t)},t.prototype.addOrOverwriteComponent=function(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)},t.prototype.getProvider=function(t){if(this.providers.has(t))return this.providers.get(t);var e=new s(t,this);return this.providers.set(t,e),e},t.prototype.getProviders=function(){return Array.from(this.providers.values())},t}();e.Component=o,e.ComponentContainer=u,e.Provider=s},94707:(t,e,n)=>{"use strict";var r=n(34155),i=n(25108);Object.defineProperty(e,"__esModule",{value:!0});var o=n(5752),a=n(70655),s=n(31313),u=n(14594),c=n(79730);function l(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var f,h=l(o),p=function(){function t(t){this.domStorage_=t,this.prefix_="firebase:"}return t.prototype.set=function(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),s.stringify(e))},t.prototype.get=function(t){var e=this.domStorage_.getItem(this.prefixedName_(t));return null==e?null:s.jsonEval(e)},t.prototype.remove=function(t){this.domStorage_.removeItem(this.prefixedName_(t))},t.prototype.prefixedName_=function(t){return this.prefix_+t},t.prototype.toString=function(){return this.domStorage_.toString()},t}(),d=function(){function t(){this.cache_={},this.isInMemoryStorage=!0}return t.prototype.set=function(t,e){null==e?delete this.cache_[t]:this.cache_[t]=e},t.prototype.get=function(t){return s.contains(this.cache_,t)?this.cache_[t]:null},t.prototype.remove=function(t){delete this.cache_[t]},t}(),v=function(t){try{if("undefined"!=typeof window&&void 0!==window[t]){var e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new p(e)}}catch(t){}return new d},y=v("localStorage"),g=v("sessionStorage"),m=new u.Logger("@firebase/database"),_=(f=1,function(){return f++}),b=function(t){var e=s.stringToByteArray(t),n=new s.Sha1;n.update(e);var r=n.digest();return s.base64.encodeByteArray(r)},w=function(){for(var t=[],e=0;en?r.push(t.substring(i,n)):r.push(t.substring(i,i+e));return r};function F(t,e){for(var n in t)t.hasOwnProperty(n)&&e(n,t[n])}var U,V,q,B,W,G,z,H,K,$,Q=function(t){s.assert(!P(t),"Invalid JSON number");var e,n,r,i,o;0===t?(n=0,r=0,e=1/t==-1/0?1:0):(e=t<0,(t=Math.abs(t))>=Math.pow(2,-1022)?(n=(i=Math.min(Math.floor(Math.log(t)/Math.LN2),1023))+1023,r=Math.round(t*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,r=Math.round(t/Math.pow(2,-1074))));var a=[];for(o=52;o;o-=1)a.push(r%2?1:0),r=Math.floor(r/2);for(o=11;o;o-=1)a.push(n%2?1:0),n=Math.floor(n/2);a.push(e?1:0),a.reverse();var u=a.join(""),c="";for(o=0;o<64;o+=8){var l=parseInt(u.substr(o,8),2).toString(16);1===l.length&&(l="0"+l),c+=l}return c.toLowerCase()},Y=new RegExp("^-?(0*)\\d{1,10}$"),X=function(t){if(Y.test(t)){var e=Number(t);if(e>=-2147483648&&e<=2147483647)return e}return null},J=function(t){try{t()}catch(t){setTimeout((function(){var e=t.stack||"";throw x("Exception was thrown by user callback.",e),t}),Math.floor(0))}},Z=function(t,e){var n=setTimeout(t,e);return"object"==typeof n&&n.unref&&n.unref(),n},tt=function(){function t(t,e){if(void 0===e){this.pieces_=t.split("/");for(var n=0,r=0;r0&&(this.pieces_[n]=this.pieces_[r],n++);this.pieces_.length=n,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=e}return Object.defineProperty(t,"Empty",{get:function(){return new t("")},enumerable:!1,configurable:!0}),t.prototype.getFront=function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]},t.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},t.prototype.popFront=function(){var e=this.pieceNum_;return e=this.pieces_.length)return null;for(var e=[],n=this.pieceNum_;n0&&n.push(i[r])}return new t(n,0)},t.prototype.isEmpty=function(){return this.pieceNum_>=this.pieces_.length},t.relativePath=function(e,n){var r=e.getFront(),i=n.getFront();if(null===r)return n;if(r===i)return t.relativePath(e.popFront(),n.popFront());throw new Error("INTERNAL ERROR: innerPath ("+n+") is not within outerPath ("+e+")")},t.comparePaths=function(t,e){for(var n=t.slice(),r=e.slice(),i=0;it.getLength())return!1;for(;e0&&(this.byteLength_+=1),this.parts_.push(t),this.byteLength_+=s.stringLength(t),this.checkValid_()},t.prototype.pop=function(){var t=this.parts_.pop();this.byteLength_-=s.stringLength(t),this.parts_.length>0&&(this.byteLength_-=1)},t.prototype.checkValid_=function(){if(this.byteLength_>t.MAX_PATH_LENGTH_BYTES)throw new Error(this.errorPrefix_+"has a key path longer than "+t.MAX_PATH_LENGTH_BYTES+" bytes ("+this.byteLength_+").");if(this.parts_.length>t.MAX_PATH_DEPTH)throw new Error(this.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+t.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},t.prototype.toErrorString=function(){return 0===this.parts_.length?"":"in property '"+this.parts_.join(".")+"'"},t}(),nt="firebaseio.com",rt="websocket",it="long_polling",ot=function(){function t(t,e,n,r,i,o,a){void 0===i&&(i=!1),void 0===o&&(o=""),void 0===a&&(a=!1),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.nodeAdmin=i,this.persistenceKey=o,this.includeNamespaceInQueryParams=a,this.host=t.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=y.get("host:"+t)||this.host}return t.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()||this.includeNamespaceInQueryParams},t.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},t.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},t.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},t.prototype.updateHost=function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&y.set("host:"+this.host,this.internalHost))},t.prototype.connectionURL=function(t,e){var n;if(s.assert("string"==typeof t,"typeof type must == string"),s.assert("object"==typeof e,"typeof params must == object"),t===rt)n=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(t!==it)throw new Error("Unknown connection type: "+t);n=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(e.ns=this.namespace);var r=[];return F(e,(function(t,e){r.push(t+"="+e)})),n+r.join("&")},t.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},t.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},t}(),at=function(t,e){var n=st(t),r=n.namespace;"firebase.com"===n.domain&&k(n.host+" is no longer supported. Please use .firebaseio.com instead"),r&&"undefined"!==r||"localhost"===n.domain||k("Cannot parse Firebase url. Please use https://.firebaseio.com"),n.secure||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&x("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");var i="ws"===n.scheme||"wss"===n.scheme;return{repoInfo:new ot(n.host,n.secure,r,e,i,"",r!==n.subdomain),path:new tt(n.pathString)}},st=function(t){var e="",n="",r="",i="",o="",s=!0,u="https",c=443;if("string"==typeof t){var l=t.indexOf("//");l>=0&&(u=t.substring(0,l-1),t=t.substring(l+2));var f=t.indexOf("/");-1===f&&(f=t.length);var h=t.indexOf("?");-1===h&&(h=t.length),e=t.substring(0,Math.min(f,h)),f0){var i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(t){}e+="/"+i}return e}(t.substring(f,h)));var p=function(t){var e,n,r={};"?"===t.charAt(0)&&(t=t.substring(1));try{for(var i=a.__values(t.split("&")),o=i.next();!o.done;o=i.next()){var s=o.value;if(0!==s.length){var u=s.split("=");2===u.length?r[decodeURIComponent(u[0])]=decodeURIComponent(u[1]):x("Invalid query segment '"+s+"' in query '"+t+"'")}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}(t.substring(Math.min(t.length,h)));(l=e.indexOf(":"))>=0?(s="https"===u||"wss"===u,c=parseInt(e.substring(l+1),10)):l=e.length;var d=e.slice(0,l);if("localhost"===d.toLowerCase())n="localhost";else if(d.split(".").length<=2)n=d;else{var v=e.indexOf(".");r=e.substring(0,v).toLowerCase(),n=e.substring(v+1),o=r}"ns"in p&&(o=p.ns)}return{host:e,port:c,domain:n,subdomain:r,secure:s,scheme:u,pathString:i,namespace:o}},ut=/[\[\].#$\/\u0000-\u001F\u007F]/,ct=/[\[\].#$\u0000-\u001F\u007F]/,lt=10485760,ft=function(t){return"string"==typeof t&&0!==t.length&&!ut.test(t)},ht=function(t){return"string"==typeof t&&0!==t.length&&!ct.test(t)},pt=function(t){return null===t||"string"==typeof t||"number"==typeof t&&!P(t)||t&&"object"==typeof t&&s.contains(t,".sv")},dt=function(t,e,n,r,i){i&&void 0===n||vt(s.errorPrefix(t,e,i),n,r)},vt=function(t,e,n){var r=n instanceof tt?new et(n,t):n;if(void 0===e)throw new Error(t+"contains undefined "+r.toErrorString());if("function"==typeof e)throw new Error(t+"contains a function "+r.toErrorString()+" with contents = "+e.toString());if(P(e))throw new Error(t+"contains "+e.toString()+" "+r.toErrorString());if("string"==typeof e&&e.length>lt/3&&s.stringLength(e)>lt)throw new Error(t+"contains a string greater than 10485760 utf8 bytes "+r.toErrorString()+" ('"+e.substring(0,50)+"...')");if(e&&"object"==typeof e){var i=!1,o=!1;if(F(e,(function(e,n){if(".value"===e)i=!0;else if(".priority"!==e&&".sv"!==e&&(o=!0,!ft(e)))throw new Error(t+" contains an invalid key ("+e+") "+r.toErrorString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');r.push(e),vt(t,n,r),r.pop()})),i&&o)throw new Error(t+' contains ".value" child '+r.toErrorString()+" in addition to actual children.")}},yt=function(t,e,n,r,i){if(!i||void 0!==n){var o=s.errorPrefix(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 a=[];F(n,(function(t,e){var n=new tt(t);if(vt(o,e,r.child(n)),".priority"===n.getBack()&&!pt(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).");a.push(n)})),function(t,e){var n,r;for(n=0;n=0;e--)r[e]=U.charAt(t%64),t=Math.floor(t/64);s.assert(0===t,"Cannot push at time == 0");var i=r.join("");if(n){for(e=11;e>=0&&63===q[e];e--)q[e]=0;q[e]++}else for(e=0;e<12;e++)q[e]=Math.floor(64*Math.random());for(e=0;e<12;e++)i+=U.charAt(q[e]);return s.assert(20===i.length,"nextPushId: Length should be 20."),i}),kt=function(){function t(t,e){this.name=t,this.node=e}return t.Wrap=function(e,n){return new t(e,n)},t}(),xt=function(){function t(){}return t.prototype.getCompare=function(){return this.compare.bind(this)},t.prototype.indexedValueChanged=function(t,e){var n=new kt(A,t),r=new kt(A,e);return 0!==this.compare(n,r)},t.prototype.minPost=function(){return kt.MIN},t}(),Pt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a.__extends(e,t),Object.defineProperty(e,"__EMPTY_NODE",{get:function(){return B},set:function(t){B=t},enumerable:!1,configurable:!0}),e.prototype.compare=function(t,e){return R(t.name,e.name)},e.prototype.isDefinedOn=function(t){throw s.assertionError("KeyIndex.isDefinedOn not expected to be called.")},e.prototype.indexedValueChanged=function(t,e){return!1},e.prototype.minPost=function(){return kt.MIN},e.prototype.maxPost=function(){return new kt(N,B)},e.prototype.makePost=function(t,e){return s.assert("string"==typeof t,"KeyIndex indexValue must always be a string."),new kt(t,B)},e.prototype.toString=function(){return".key"},e}(xt),At=new Pt,Nt=function(t){return"number"==typeof t?"number:"+Q(t):"string:"+t},Rt=function(t){if(t.isLeafNode()){var e=t.val();s.assert("string"==typeof e||"number"==typeof e||"object"==typeof e&&s.contains(e,".sv"),"Priority must be a string or number.")}else s.assert(t===W||t.isEmpty(),"priority of unexpected type.");s.assert(t===W||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")},Dt=function(){function t(e,n){void 0===n&&(n=t.__childrenNodeConstructor.EMPTY_NODE),this.value_=e,this.priorityNode_=n,this.lazyHash_=null,s.assert(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),Rt(this.priorityNode_)}return Object.defineProperty(t,"__childrenNodeConstructor",{get:function(){return G},set:function(t){G=t},enumerable:!1,configurable:!0}),t.prototype.isLeafNode=function(){return!0},t.prototype.getPriority=function(){return this.priorityNode_},t.prototype.updatePriority=function(e){return new t(this.value_,e)},t.prototype.getImmediateChild=function(e){return".priority"===e?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE},t.prototype.getChild=function(e){return e.isEmpty()?this:".priority"===e.getFront()?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE},t.prototype.hasChild=function(){return!1},t.prototype.getPredecessorChildName=function(t,e){return null},t.prototype.updateImmediateChild=function(e,n){return".priority"===e?this.updatePriority(n):n.isEmpty()&&".priority"!==e?this:t.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(e,n).updatePriority(this.priorityNode_)},t.prototype.updateChild=function(e,n){var r=e.getFront();return null===r?n:n.isEmpty()&&".priority"!==r?this:(s.assert(".priority"!==r||1===e.getLength(),".priority must be the last token in a path"),this.updateImmediateChild(r,t.__childrenNodeConstructor.EMPTY_NODE.updateChild(e.popFront(),n)))},t.prototype.isEmpty=function(){return!1},t.prototype.numChildren=function(){return 0},t.prototype.forEachChild=function(t,e){return!1},t.prototype.val=function(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},t.prototype.hash=function(){if(null===this.lazyHash_){var t="";this.priorityNode_.isEmpty()||(t+="priority:"+Nt(this.priorityNode_.val())+":");var e=typeof this.value_;t+=e+":",t+="number"===e?Q(this.value_):this.value_,this.lazyHash_=b(t)}return this.lazyHash_},t.prototype.getValue=function(){return this.value_},t.prototype.compareTo=function(e){return e===t.__childrenNodeConstructor.EMPTY_NODE?1:e instanceof t.__childrenNodeConstructor?-1:(s.assert(e.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(e))},t.prototype.compareToLeafNode_=function(e){var n=typeof e.value_,r=typeof this.value_,i=t.VALUE_TYPE_ORDER.indexOf(n),o=t.VALUE_TYPE_ORDER.indexOf(r);return s.assert(i>=0,"Unknown leaf type: "+n),s.assert(o>=0,"Unknown leaf type: "+r),i===o?"object"===r?0:this.value_0},t.prototype.peek=function(){if(0===this.nodeStack_.length)return null;var t=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value}},t}(),jt=function(){function t(e,n,r,i,o){this.key=e,this.value=n,this.color=null!=r?r:t.RED,this.left=null!=i?i:Ut.EMPTY_NODE,this.right=null!=o?o:Ut.EMPTY_NODE}return t.prototype.copy=function(e,n,r,i,o){return new t(null!=e?e:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=o?o:this.right)},t.prototype.count=function(){return this.left.count()+1+this.right.count()},t.prototype.isEmpty=function(){return!1},t.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)},t.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},t.prototype.min_=function(){return this.left.isEmpty()?this:this.left.min_()},t.prototype.minKey=function(){return this.min_().key},t.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},t.prototype.insert=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n))).fixUp_()},t.prototype.removeMin_=function(){if(this.left.isEmpty())return Ut.EMPTY_NODE;var t=this;return t.left.isRed_()||t.left.left.isRed_()||(t=t.moveRedLeft_()),(t=t.copy(null,null,null,t.left.removeMin_(),null)).fixUp_()},t.prototype.remove=function(t,e){var n,r;if(e(t,(n=this).key)<0)n.left.isEmpty()||n.left.isRed_()||n.left.left.isRed_()||(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(t,e),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),n.right.isEmpty()||n.right.isRed_()||n.right.left.isRed_()||(n=n.moveRedRight_()),0===e(t,n.key)){if(n.right.isEmpty())return Ut.EMPTY_NODE;r=n.right.min_(),n=n.copy(r.key,r.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(t,e))}return n.fixUp_()},t.prototype.isRed_=function(){return this.color},t.prototype.fixUp_=function(){var t=this;return t.right.isRed_()&&!t.left.isRed_()&&(t=t.rotateLeft_()),t.left.isRed_()&&t.left.left.isRed_()&&(t=t.rotateRight_()),t.left.isRed_()&&t.right.isRed_()&&(t=t.colorFlip_()),t},t.prototype.moveRedLeft_=function(){var t=this.colorFlip_();return t.right.left.isRed_()&&(t=(t=(t=t.copy(null,null,null,null,t.right.rotateRight_())).rotateLeft_()).colorFlip_()),t},t.prototype.moveRedRight_=function(){var t=this.colorFlip_();return t.left.left.isRed_()&&(t=(t=t.rotateRight_()).colorFlip_()),t},t.prototype.rotateLeft_=function(){var e=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)},t.prototype.rotateRight_=function(){var e=this.copy(null,null,t.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)},t.prototype.colorFlip_=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},t.prototype.checkMaxDepth_=function(){var t=this.check_();return Math.pow(2,t)<=this.count()+1},t.prototype.check_=function(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");var t=this.left.check_();if(t!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)},t.RED=!0,t.BLACK=!1,t}(),Ft=function(){function t(){}return t.prototype.copy=function(t,e,n,r,i){return this},t.prototype.insert=function(t,e,n){return new jt(t,e,null)},t.prototype.remove=function(t,e){return this},t.prototype.count=function(){return 0},t.prototype.isEmpty=function(){return!0},t.prototype.inorderTraversal=function(t){return!1},t.prototype.reverseTraversal=function(t){return!1},t.prototype.minKey=function(){return null},t.prototype.maxKey=function(){return null},t.prototype.check_=function(){return 0},t.prototype.isRed_=function(){return!1},t}(),Ut=function(){function t(e,n){void 0===n&&(n=t.EMPTY_NODE),this.comparator_=e,this.root_=n}return t.prototype.insert=function(e,n){return new t(this.comparator_,this.root_.insert(e,n,this.comparator_).copy(null,null,jt.BLACK,null,null))},t.prototype.remove=function(e){return new t(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,jt.BLACK,null,null))},t.prototype.get=function(t){for(var e,n=this.root_;!n.isEmpty();){if(0===(e=this.comparator_(t,n.key)))return n.value;e<0?n=n.left:e>0&&(n=n.right)}return null},t.prototype.getPredecessorKey=function(t){for(var e,n=this.root_,r=null;!n.isEmpty();){if(0===(e=this.comparator_(t,n.key))){if(n.left.isEmpty())return r?r.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}e<0?n=n.left:e>0&&(r=n,n=n.right)}throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")},t.prototype.isEmpty=function(){return this.root_.isEmpty()},t.prototype.count=function(){return this.root_.count()},t.prototype.minKey=function(){return this.root_.minKey()},t.prototype.maxKey=function(){return this.root_.maxKey()},t.prototype.inorderTraversal=function(t){return this.root_.inorderTraversal(t)},t.prototype.reverseTraversal=function(t){return this.root_.reverseTraversal(t)},t.prototype.getIterator=function(t){return new Mt(this.root_,null,this.comparator_,!1,t)},t.prototype.getIteratorFrom=function(t,e){return new Mt(this.root_,t,this.comparator_,!1,e)},t.prototype.getReverseIteratorFrom=function(t,e){return new Mt(this.root_,t,this.comparator_,!0,e)},t.prototype.getReverseIterator=function(t){return new Mt(this.root_,null,this.comparator_,!0,t)},t.EMPTY_NODE=new Ft,t}(),Vt=Math.log(2),qt=function(){function t(t){var e;this.count=(e=t+1,parseInt(Math.log(e)/Vt,10)),this.current_=this.count-1;var n,r=(n=this.count,parseInt(Array(n+1).join("1"),2));this.bits_=t+1&r}return t.prototype.nextBitIsOne=function(){var t=!(this.bits_&1<0;)r.getNext(),i=r.peek();return r},t.prototype.compareTo=function(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===$t?-1:0},t.prototype.withIndex=function(e){if(e===At||this.indexMap_.hasIndex(e))return this;var n=this.indexMap_.addIndex(e,this.children_);return new t(this.children_,this.priorityNode_,n)},t.prototype.isIndexed=function(t){return t===At||this.indexMap_.hasIndex(t)},t.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode())return!1;var e=t;if(this.getPriority().equals(e.getPriority())){if(this.children_.count()===e.children_.count()){for(var n=this.getIterator(Lt),r=e.getIterator(Lt),i=n.getNext(),o=r.getNext();i&&o;){if(i.name!==o.name||!i.node.equals(o.node))return!1;i=n.getNext(),o=r.getNext()}return null===i&&null===o}return!1}return!1},t.prototype.resolveIndex_=function(t){return t===At?null:this.indexMap_.get(t.toString())},t.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,t}(),$t=new(function(t){function e(){return t.call(this,new Ut(Ht),Kt.EMPTY_NODE,Gt.Default)||this}return a.__extends(e,t),e.prototype.compareTo=function(t){return t===this?0:1},e.prototype.equals=function(t){return t===this},e.prototype.getPriority=function(){return this},e.prototype.getImmediateChild=function(t){return Kt.EMPTY_NODE},e.prototype.isEmpty=function(){return!1},e}(Kt));function Qt(t,e){if(void 0===e&&(e=null),null===t)return Kt.EMPTY_NODE;if("object"==typeof t&&".priority"in t&&(e=t[".priority"]),s.assert(null===e||"string"==typeof e||"number"==typeof e||"object"==typeof e&&".sv"in e,"Invalid priority type found: "+typeof e),"object"==typeof t&&".value"in t&&null!==t[".value"]&&(t=t[".value"]),"object"!=typeof t||".sv"in t)return new Dt(t,Qt(e));if(t instanceof Array){var n=Kt.EMPTY_NODE;return F(t,(function(e,r){if(s.contains(t,e)&&"."!==e.substring(0,1)){var i=Qt(r);!i.isLeafNode()&&i.isEmpty()||(n=n.updateImmediateChild(e,i))}})),n.updatePriority(Qt(e))}var r=[],i=!1;if(F(t,(function(t,e){if("."!==t.substring(0,1)){var n=Qt(e);n.isEmpty()||(i=i||!n.getPriority().isEmpty(),r.push(new kt(t,n)))}})),0===r.length)return Kt.EMPTY_NODE;var o=Bt(r,zt,(function(t){return t.name}),Ht);if(i){var a=Bt(r,Lt.getCompare());return new Kt(o,Qt(e),new Gt({".priority":a},{".priority":Lt}))}return new Kt(o,Qt(e),Gt.Default)}Object.defineProperties(kt,{MIN:{value:new kt(A,Kt.EMPTY_NODE)},MAX:{value:new kt(N,$t)}}),Pt.__EMPTY_NODE=Kt.EMPTY_NODE,Dt.__childrenNodeConstructor=Kt,W=$t,H=$t,function(t){z=t}(Qt);var Yt,Xt=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a.__extends(e,t),e.prototype.compare=function(t,e){var n=t.node.compareTo(e.node);return 0===n?R(t.name,e.name):n},e.prototype.isDefinedOn=function(t){return!0},e.prototype.indexedValueChanged=function(t,e){return!t.equals(e)},e.prototype.minPost=function(){return kt.MIN},e.prototype.maxPost=function(){return kt.MAX},e.prototype.makePost=function(t,e){var n=Qt(t);return new kt(e,n)},e.prototype.toString=function(){return".value"},e}(xt)),Jt=function(t){function e(e){var n=t.call(this)||this;return n.indexPath_=e,s.assert(!e.isEmpty()&&".priority"!==e.getFront(),"Can't create PathIndex with empty path or .priority key"),n}return a.__extends(e,t),e.prototype.extractChild=function(t){return t.getChild(this.indexPath_)},e.prototype.isDefinedOn=function(t){return!t.getChild(this.indexPath_).isEmpty()},e.prototype.compare=function(t,e){var n=this.extractChild(t.node),r=this.extractChild(e.node),i=n.compareTo(r);return 0===i?R(t.name,e.name):i},e.prototype.makePost=function(t,e){var n=Qt(t),r=Kt.EMPTY_NODE.updateChild(this.indexPath_,n);return new kt(e,r)},e.prototype.maxPost=function(){var t=Kt.EMPTY_NODE.updateChild(this.indexPath_,$t);return new kt(N,t)},e.prototype.toString=function(){return this.indexPath_.slice().join("/")},e}(xt),Zt=function(){function t(t,e,n){this.node_=t,this.ref_=e,this.index_=n}return t.prototype.val=function(){return s.validateArgCount("DataSnapshot.val",0,0,arguments.length),this.node_.val()},t.prototype.exportVal=function(){return s.validateArgCount("DataSnapshot.exportVal",0,0,arguments.length),this.node_.val(!0)},t.prototype.toJSON=function(){return s.validateArgCount("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},t.prototype.exists=function(){return s.validateArgCount("DataSnapshot.exists",0,0,arguments.length),!this.node_.isEmpty()},t.prototype.child=function(e){s.validateArgCount("DataSnapshot.child",0,1,arguments.length),e=String(e),bt("DataSnapshot.child",1,e,!1);var n=new tt(e),r=this.ref_.child(n);return new t(this.node_.getChild(n),r,Lt)},t.prototype.hasChild=function(t){s.validateArgCount("DataSnapshot.hasChild",1,1,arguments.length),bt("DataSnapshot.hasChild",1,t,!1);var e=new tt(t);return!this.node_.getChild(e).isEmpty()},t.prototype.getPriority=function(){return s.validateArgCount("DataSnapshot.getPriority",0,0,arguments.length),this.node_.getPriority().val()},t.prototype.forEach=function(e){var n=this;if(s.validateArgCount("DataSnapshot.forEach",1,1,arguments.length),s.validateCallback("DataSnapshot.forEach",1,e,!1),this.node_.isLeafNode())return!1;var r=this.node_;return!!r.forEachChild(this.index_,(function(r,i){return e(new t(i,n.ref_.child(r),Lt))}))},t.prototype.hasChildren=function(){return s.validateArgCount("DataSnapshot.hasChildren",0,0,arguments.length),!this.node_.isLeafNode()&&!this.node_.isEmpty()},Object.defineProperty(t.prototype,"key",{get:function(){return this.ref_.getKey()},enumerable:!1,configurable:!0}),t.prototype.numChildren=function(){return s.validateArgCount("DataSnapshot.numChildren",0,0,arguments.length),this.node_.numChildren()},t.prototype.getRef=function(){return s.validateArgCount("DataSnapshot.ref",0,0,arguments.length),this.ref_},Object.defineProperty(t.prototype,"ref",{get:function(){return this.getRef()},enumerable:!1,configurable:!0}),t}(),te=function(){function t(t,e,n,r){this.eventType=t,this.eventRegistration=e,this.snapshot=n,this.prevName=r}return t.prototype.getPath=function(){var t=this.snapshot.getRef();return"value"===this.eventType?t.path:t.getParent().path},t.prototype.getEventType=function(){return this.eventType},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.getPath().toString()+":"+this.eventType+":"+s.stringify(this.snapshot.exportVal())},t}(),ee=function(){function t(t,e,n){this.eventRegistration=t,this.error=e,this.path=n}return t.prototype.getPath=function(){return this.path},t.prototype.getEventType=function(){return"cancel"},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.path.toString()+":cancel"},t}(),ne=function(){function t(t,e,n){this.callback_=t,this.cancelCallback_=e,this.context_=n}return t.prototype.respondsTo=function(t){return"value"===t},t.prototype.createEvent=function(t,e){var n=e.getQueryParams().getIndex();return new te("value",this,new Zt(t.snapshotNode,e.getRef(),n))},t.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){s.assert(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(e,t.error)}}var r=this.callback_;return function(){r.call(e,t.snapshot)}},t.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new ee(this,t,e):null},t.prototype.matches=function(e){return e instanceof t&&(!e.callback_||!this.callback_||e.callback_===this.callback_&&e.context_===this.context_)},t.prototype.hasAnyCallback=function(){return null!==this.callback_},t}(),re=function(){function t(t,e,n){this.callbacks_=t,this.cancelCallback_=e,this.context_=n}return t.prototype.respondsTo=function(t){var e="children_added"===t?"child_added":t;return e="children_removed"===e?"child_removed":e,s.contains(this.callbacks_,e)},t.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new ee(this,t,e):null},t.prototype.createEvent=function(t,e){s.assert(null!=t.childName,"Child events should have a childName.");var n=e.getRef().child(t.childName),r=e.getQueryParams().getIndex();return new te(t.type,this,new Zt(t.snapshotNode,n,r),t.prevName)},t.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){s.assert(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(e,t.error)}}var r=this.callbacks_[t.eventType];return function(){r.call(e,t.snapshot,t.prevName)}},t.prototype.matches=function(e){var n=this;if(e instanceof t){if(!this.callbacks_||!e.callbacks_)return!0;if(this.context_===e.context_){var r=Object.keys(e.callbacks_),i=Object.keys(this.callbacks_),o=r.length;if(o===i.length){if(1===o){var a=r[0],s=i[0];return!(s!==a||e.callbacks_[a]&&this.callbacks_[s]&&e.callbacks_[a]!==this.callbacks_[s])}return i.every((function(t){return e.callbacks_[t]===n.callbacks_[t]}))}}}return!1},t.prototype.hasAnyCallback=function(){return null!==this.callbacks_},t}(),ie=function(){function t(t,e,n,r){this.repo=t,this.path=e,this.queryParams_=n,this.orderByCalled_=r}return Object.defineProperty(t,"__referenceConstructor",{get:function(){return s.assert(Yt,"Reference.ts has not been loaded"),Yt},set:function(t){Yt=t},enumerable:!1,configurable:!0}),t.validateQueryEndpoints_=function(t){var e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===At){var r="Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().",i="Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.";if(t.hasStart()){if(t.getIndexStartName()!==A)throw new Error(r);if("string"!=typeof e)throw new Error(i)}if(t.hasEnd()){if(t.getIndexEndName()!==N)throw new Error(r);if("string"!=typeof n)throw new Error(i)}}else if(t.getIndex()===Lt){if(null!=e&&!pt(e)||null!=n&&!pt(n))throw new Error("Query: When ordering by priority, the first argument passed to startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).")}else if(s.assert(t.getIndex()instanceof Jt||t.getIndex()===Xt,"unknown index type."),null!=e&&"object"==typeof e||null!=n&&"object"==typeof n)throw new Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.")},t.validateLimit_=function(t){if(t.hasStart()&&t.hasEnd()&&t.hasLimit()&&!t.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.")},t.prototype.validateNoPreviousOrderByCall_=function(t){if(!0===this.orderByCalled_)throw new Error(t+": You can't combine multiple orderBy calls.")},t.prototype.getQueryParams=function(){return this.queryParams_},t.prototype.getRef=function(){return s.validateArgCount("Query.ref",0,0,arguments.length),new t.__referenceConstructor(this.repo,this.path)},t.prototype.on=function(e,n,r,i){s.validateArgCount("Query.on",2,4,arguments.length),mt("Query.on",1,e,!1),s.validateCallback("Query.on",2,n,!1);var o=t.getCancelAndContextArgs_("Query.on",r,i);if("value"===e)this.onValueEvent(n,o.cancel,o.context);else{var a={};a[e]=n,this.onChildEvent(a,o.cancel,o.context)}return n},t.prototype.onValueEvent=function(t,e,n){var r=new ne(t,e||null,n||null);this.repo.addEventCallbackForQuery(this,r)},t.prototype.onChildEvent=function(t,e,n){var r=new re(t,e,n);this.repo.addEventCallbackForQuery(this,r)},t.prototype.off=function(t,e,n){s.validateArgCount("Query.off",0,3,arguments.length),mt("Query.off",1,t,!0),s.validateCallback("Query.off",2,e,!0),s.validateContextObject("Query.off",3,n,!0);var r=null,i=null;if("value"===t){var o=e||null;r=new ne(o,null,n||null)}else t&&(e&&((i={})[t]=e),r=new re(i,null,n||null));this.repo.removeEventCallbackForQuery(this,r)},t.prototype.once=function(e,n,r,i){var o=this;s.validateArgCount("Query.once",1,4,arguments.length),mt("Query.once",1,e,!1),s.validateCallback("Query.once",2,n,!0);var a=t.getCancelAndContextArgs_("Query.once",r,i),u=!0,c=new s.Deferred;c.promise.catch((function(){}));var l=function(t){u&&(u=!1,o.off(e,l),n&&n.bind(a.context)(t),c.resolve(t))};return this.on(e,l,(function(t){o.off(e,l),a.cancel&&a.cancel.bind(a.context)(t),c.reject(t)})),c.promise},t.prototype.limitToFirst=function(e){if(s.validateArgCount("Query.limitToFirst",1,1,arguments.length),"number"!=typeof e||Math.floor(e)!==e||e<=0)throw new Error("Query.limitToFirst: First argument must be a positive integer.");if(this.queryParams_.hasLimit())throw new Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new t(this.repo,this.path,this.queryParams_.limitToFirst(e),this.orderByCalled_)},t.prototype.limitToLast=function(e){if(s.validateArgCount("Query.limitToLast",1,1,arguments.length),"number"!=typeof e||Math.floor(e)!==e||e<=0)throw new Error("Query.limitToLast: First argument must be a positive integer.");if(this.queryParams_.hasLimit())throw new Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new t(this.repo,this.path,this.queryParams_.limitToLast(e),this.orderByCalled_)},t.prototype.orderByChild=function(e){if(s.validateArgCount("Query.orderByChild",1,1,arguments.length),"$key"===e)throw new Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.');if("$priority"===e)throw new Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.');if("$value"===e)throw new Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.');bt("Query.orderByChild",1,e,!1),this.validateNoPreviousOrderByCall_("Query.orderByChild");var n=new tt(e);if(n.isEmpty())throw new Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.");var r=new Jt(n),i=this.queryParams_.orderBy(r);return t.validateQueryEndpoints_(i),new t(this.repo,this.path,i,!0)},t.prototype.orderByKey=function(){s.validateArgCount("Query.orderByKey",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByKey");var e=this.queryParams_.orderBy(At);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.orderByPriority=function(){s.validateArgCount("Query.orderByPriority",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByPriority");var e=this.queryParams_.orderBy(Lt);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.orderByValue=function(){s.validateArgCount("Query.orderByValue",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByValue");var e=this.queryParams_.orderBy(Xt);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.startAt=function(e,n){void 0===e&&(e=null),s.validateArgCount("Query.startAt",0,2,arguments.length),dt("Query.startAt",1,e,this.path,!0),_t("Query.startAt",2,n,!0);var r=this.queryParams_.startAt(e,n);if(t.validateLimit_(r),t.validateQueryEndpoints_(r),this.queryParams_.hasStart())throw new Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");return void 0===e&&(e=null,n=null),new t(this.repo,this.path,r,this.orderByCalled_)},t.prototype.endAt=function(e,n){void 0===e&&(e=null),s.validateArgCount("Query.endAt",0,2,arguments.length),dt("Query.endAt",1,e,this.path,!0),_t("Query.endAt",2,n,!0);var r=this.queryParams_.endAt(e,n);if(t.validateLimit_(r),t.validateQueryEndpoints_(r),this.queryParams_.hasEnd())throw new Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new t(this.repo,this.path,r,this.orderByCalled_)},t.prototype.equalTo=function(t,e){if(s.validateArgCount("Query.equalTo",1,2,arguments.length),dt("Query.equalTo",1,t,this.path,!1),_t("Query.equalTo",2,e,!0),this.queryParams_.hasStart())throw new Error("Query.equalTo: Starting point was already set (by another call to startAt or equalTo).");if(this.queryParams_.hasEnd())throw new Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.startAt(t,e).endAt(t,e)},t.prototype.toString=function(){return s.validateArgCount("Query.toString",0,0,arguments.length),this.repo.toString()+this.path.toUrlEncodedString()},t.prototype.toJSON=function(){return s.validateArgCount("Query.toJSON",0,1,arguments.length),this.toString()},t.prototype.queryObject=function(){return this.queryParams_.getQueryObject()},t.prototype.queryIdentifier=function(){var t=this.queryObject(),e=M(t);return"{}"===e?"default":e},t.prototype.isEqual=function(e){if(s.validateArgCount("Query.isEqual",1,1,arguments.length),!(e instanceof t)){var n="Query.isEqual failed: First argument must be an instance of firebase.database.Query.";throw new Error(n)}var r=this.repo===e.repo,i=this.path.equals(e.path),o=this.queryIdentifier()===e.queryIdentifier();return r&&i&&o},t.getCancelAndContextArgs_=function(t,e,n){var r={cancel:null,context:null};if(e&&n)r.cancel=e,s.validateCallback(t,3,r.cancel,!0),r.context=n,s.validateContextObject(t,4,r.context,!0);else if(e)if("object"==typeof e&&null!==e)r.context=e;else{if("function"!=typeof e)throw new Error(s.errorPrefix(t,3,!0)+" must either be a cancel callback or a context object.");r.cancel=e}return r},Object.defineProperty(t.prototype,"ref",{get:function(){return this.getRef()},enumerable:!1,configurable:!0}),t}(),oe=function(){function t(t){this.node_=t}return t.prototype.getImmediateChild=function(e){return new t(this.node_.getImmediateChild(e))},t.prototype.node=function(){return this.node_},t}(),ae=function(){function t(t,e){this.syncTree_=t,this.path_=e}return t.prototype.getImmediateChild=function(e){var n=this.path_.child(e);return new t(this.syncTree_,n)},t.prototype.node=function(){return this.syncTree_.calcCompleteEventCache(this.path_)},t}(),se=function(t,e,n){return t&&"object"==typeof t?(s.assert(".sv"in t,"Unexpected leaf node or priority contents"),"string"==typeof t[".sv"]?ue(t[".sv"],e,n):"object"==typeof t[".sv"]?ce(t[".sv"],e):void s.assert(!1,"Unexpected server value: "+JSON.stringify(t,null,2))):t},ue=function(t,e,n){if("timestamp"===t)return n.timestamp;s.assert(!1,"Unexpected server value: "+t)},ce=function(t,e,n){t.hasOwnProperty("increment")||s.assert(!1,"Unexpected server value: "+JSON.stringify(t,null,2));var r=t.increment;"number"!=typeof r&&s.assert(!1,"Unexpected increment value: "+r);var i=e.node();if(s.assert(null!=i,"Expected ChildrenNode.EMPTY_NODE for nulls"),!i.isLeafNode())return r;var o=i.getValue();return"number"!=typeof o?r:o+r},le=function(t,e,n,r){return he(e,new ae(n,t),r)},fe=function(t,e,n){return he(t,new oe(e),n)};function he(t,e,n){var r,i=t.getPriority().val(),o=se(i,e.getImmediateChild(".priority"),n);if(t.isLeafNode()){var a=t,s=se(a.getValue(),e,n);return s!==a.getValue()||o!==a.getPriority().val()?new Dt(s,Qt(o)):t}var u=t;return r=u,o!==u.getPriority().val()&&(r=r.updatePriority(new Dt(o))),u.forEachChild(Lt,(function(t,i){var o=he(i,e.getImmediateChild(t),n);o!==i&&(r=r.updateImmediateChild(t,o))})),r}var pe,de=function(){function t(){this.value=null,this.children=new Map}return t.prototype.find=function(t){if(null!=this.value)return this.value.getChild(t);if(!t.isEmpty()&&this.children.size>0){var e=t.getFront();return t=t.popFront(),this.children.has(e)?this.children.get(e).find(t):null}return null},t.prototype.remember=function(e,n){if(e.isEmpty())this.value=n,this.children.clear();else if(null!==this.value)this.value=this.value.updateChild(e,n);else{var r=e.getFront();this.children.has(r)||this.children.set(r,new t);var i=this.children.get(r);e=e.popFront(),i.remember(e,n)}},t.prototype.forget=function(t){if(t.isEmpty())return this.value=null,this.children.clear(),!0;if(null!==this.value){if(this.value.isLeafNode())return!1;var e=this.value;this.value=null;var n=this;return e.forEachChild(Lt,(function(t,e){n.remember(new tt(t),e)})),this.forget(t)}if(this.children.size>0){var r=t.getFront();return t=t.popFront(),this.children.has(r)&&this.children.get(r).forget(t)&&this.children.delete(r),0===this.children.size}return!0},t.prototype.forEachTree=function(t,e){null!==this.value?e(t,this.value):this.forEachChild((function(n,r){var i=new tt(t.toString()+"/"+n);r.forEachTree(i,e)}))},t.prototype.forEachChild=function(t){this.children.forEach((function(e,n){t(n,e)}))},t}();!function(t){t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"}(pe||(pe={}));var ve,ye,ge=function(){function t(t,e,n,r){this.fromUser=t,this.fromServer=e,this.queryId=n,this.tagged=r,s.assert(!r||e,"Tagged queries must be from server.")}return t.User=new t(!0,!1,null,!1),t.Server=new t(!1,!0,null,!1),t.forServerTaggedQuery=function(e){return new t(!1,!0,e,!0)},t}(),me=function(){function t(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=pe.ACK_USER_WRITE,this.source=ge.User}return t.prototype.operationForChild=function(e){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return s.assert(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var n=this.affectedTree.subtree(new tt(e));return new t(tt.Empty,n,this.revert)}return s.assert(this.path.getFront()===e,"operationForChild called for unrelated child."),new t(this.path.popFront(),this.affectedTree,this.revert)},t}(),_e=function(){function t(t,e){void 0===e&&(ve||(ve=new Ut(D)),e=ve),this.value=t,this.children=e}return t.fromObject=function(e){var n=t.Empty;return F(e,(function(t,e){n=n.set(new tt(t),e)})),n},t.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},t.prototype.findRootMostMatchingPathAndValue=function(t,e){if(null!=this.value&&e(this.value))return{path:tt.Empty,value:this.value};if(t.isEmpty())return null;var n=t.getFront(),r=this.children.get(n);if(null!==r){var i=r.findRootMostMatchingPathAndValue(t.popFront(),e);return null!=i?{path:new tt(n).child(i.path),value:i.value}:null}return null},t.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,(function(){return!0}))},t.prototype.subtree=function(e){if(e.isEmpty())return this;var n=e.getFront(),r=this.children.get(n);return null!==r?r.subtree(e.popFront()):t.Empty},t.prototype.set=function(e,n){if(e.isEmpty())return new t(n,this.children);var r=e.getFront(),i=(this.children.get(r)||t.Empty).set(e.popFront(),n),o=this.children.insert(r,i);return new t(this.value,o)},t.prototype.remove=function(e){if(e.isEmpty())return this.children.isEmpty()?t.Empty:new t(null,this.children);var n=e.getFront(),r=this.children.get(n);if(r){var i=r.remove(e.popFront()),o=void 0;return o=i.isEmpty()?this.children.remove(n):this.children.insert(n,i),null===this.value&&o.isEmpty()?t.Empty:new t(this.value,o)}return this},t.prototype.get=function(t){if(t.isEmpty())return this.value;var e=t.getFront(),n=this.children.get(e);return n?n.get(t.popFront()):null},t.prototype.setTree=function(e,n){if(e.isEmpty())return n;var r,i=e.getFront(),o=(this.children.get(i)||t.Empty).setTree(e.popFront(),n);return r=o.isEmpty()?this.children.remove(i):this.children.insert(i,o),new t(this.value,r)},t.prototype.fold=function(t){return this.fold_(tt.Empty,t)},t.prototype.fold_=function(t,e){var n={};return this.children.inorderTraversal((function(r,i){n[r]=i.fold_(t.child(r),e)})),e(t,this.value,n)},t.prototype.findOnPath=function(t,e){return this.findOnPath_(t,tt.Empty,e)},t.prototype.findOnPath_=function(t,e,n){var r=!!this.value&&n(e,this.value);if(r)return r;if(t.isEmpty())return null;var i=t.getFront(),o=this.children.get(i);return o?o.findOnPath_(t.popFront(),e.child(i),n):null},t.prototype.foreachOnPath=function(t,e){return this.foreachOnPath_(t,tt.Empty,e)},t.prototype.foreachOnPath_=function(e,n,r){if(e.isEmpty())return this;this.value&&r(n,this.value);var i=e.getFront(),o=this.children.get(i);return o?o.foreachOnPath_(e.popFront(),n.child(i),r):t.Empty},t.prototype.foreach=function(t){this.foreach_(tt.Empty,t)},t.prototype.foreach_=function(t,e){this.children.inorderTraversal((function(n,r){r.foreach_(t.child(n),e)})),this.value&&e(t,this.value)},t.prototype.foreachChild=function(t){this.children.inorderTraversal((function(e,n){n.value&&t(e,n.value)}))},t.Empty=new t(null),t}(),be=function(){function t(t,e){this.source=t,this.path=e,this.type=pe.LISTEN_COMPLETE}return t.prototype.operationForChild=function(e){return this.path.isEmpty()?new t(this.source,tt.Empty):new t(this.source,this.path.popFront())},t}(),we=function(){function t(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=pe.OVERWRITE}return t.prototype.operationForChild=function(e){return this.path.isEmpty()?new t(this.source,tt.Empty,this.snap.getImmediateChild(e)):new t(this.source,this.path.popFront(),this.snap)},t}(),Ee=function(){function t(t,e,n){this.source=t,this.path=e,this.children=n,this.type=pe.MERGE}return t.prototype.operationForChild=function(e){if(this.path.isEmpty()){var n=this.children.subtree(new tt(e));return n.isEmpty()?null:n.value?new we(this.source,tt.Empty,n.value):new t(this.source,tt.Empty,n)}return s.assert(this.path.getFront()===e,"Can't get a merge for a child not on the path of the operation"),new t(this.source,this.path.popFront(),this.children)},t.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},t}(),Te=function(){function t(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}return t.prototype.isFullyInitialized=function(){return this.fullyInitialized_},t.prototype.isFiltered=function(){return this.filtered_},t.prototype.isCompleteForPath=function(t){if(t.isEmpty())return this.isFullyInitialized()&&!this.filtered_;var e=t.getFront();return this.isCompleteForChild(e)},t.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)},t.prototype.getNode=function(){return this.node_},t}(),Se=function(){function t(t,e){this.eventCache_=t,this.serverCache_=e}return t.prototype.updateEventSnap=function(e,n,r){return new t(new Te(e,n,r),this.serverCache_)},t.prototype.updateServerSnap=function(e,n,r){return new t(this.eventCache_,new Te(e,n,r))},t.prototype.getEventCache=function(){return this.eventCache_},t.prototype.getCompleteEventSnap=function(){return this.eventCache_.isFullyInitialized()?this.eventCache_.getNode():null},t.prototype.getServerCache=function(){return this.serverCache_},t.prototype.getCompleteServerSnap=function(){return this.serverCache_.isFullyInitialized()?this.serverCache_.getNode():null},t.Empty=new t(new Te(Kt.EMPTY_NODE,!1,!1),new Te(Kt.EMPTY_NODE,!1,!1)),t}(),Ie=function(){function t(t,e,n,r,i){this.type=t,this.snapshotNode=e,this.childName=n,this.oldSnap=r,this.prevName=i}return t.valueChange=function(e){return new t(t.VALUE,e)},t.childAddedChange=function(e,n){return new t(t.CHILD_ADDED,n,e)},t.childRemovedChange=function(e,n){return new t(t.CHILD_REMOVED,n,e)},t.childChangedChange=function(e,n,r){return new t(t.CHILD_CHANGED,n,e,r)},t.childMovedChange=function(e,n){return new t(t.CHILD_MOVED,n,e)},t.CHILD_ADDED="child_added",t.CHILD_REMOVED="child_removed",t.CHILD_CHANGED="child_changed",t.CHILD_MOVED="child_moved",t.VALUE="value",t}(),Ce=function(){function t(t){this.index_=t}return t.prototype.updateChild=function(t,e,n,r,i,o){s.assert(t.isIndexed(this.index_),"A node must be indexed if only a child is updated");var a=t.getImmediateChild(e);return a.getChild(r).equals(n.getChild(r))&&a.isEmpty()===n.isEmpty()?t:(null!=o&&(n.isEmpty()?t.hasChild(e)?o.trackChildChange(Ie.childRemovedChange(e,a)):s.assert(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?o.trackChildChange(Ie.childAddedChange(e,n)):o.trackChildChange(Ie.childChangedChange(e,n,a))),t.isLeafNode()&&n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.index_))},t.prototype.updateFullNode=function(t,e,n){return null!=n&&(t.isLeafNode()||t.forEachChild(Lt,(function(t,r){e.hasChild(t)||n.trackChildChange(Ie.childRemovedChange(t,r))})),e.isLeafNode()||e.forEachChild(Lt,(function(e,r){if(t.hasChild(e)){var i=t.getImmediateChild(e);i.equals(r)||n.trackChildChange(Ie.childChangedChange(e,r,i))}else n.trackChildChange(Ie.childAddedChange(e,r))}))),e.withIndex(this.index_)},t.prototype.updatePriority=function(t,e){return t.isEmpty()?Kt.EMPTY_NODE:t.updatePriority(e)},t.prototype.filtersNodes=function(){return!1},t.prototype.getIndexedFilter=function(){return this},t.prototype.getIndex=function(){return this.index_},t}(),Oe=function(){function t(){this.changeMap=new Map}return t.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;s.assert(e===Ie.CHILD_ADDED||e===Ie.CHILD_CHANGED||e===Ie.CHILD_REMOVED,"Only child changes supported for tracking"),s.assert(".priority"!==n,"Only non-priority child changes can be tracked.");var r=this.changeMap.get(n);if(r){var i=r.type;if(e===Ie.CHILD_ADDED&&i===Ie.CHILD_REMOVED)this.changeMap.set(n,Ie.childChangedChange(n,t.snapshotNode,r.snapshotNode));else if(e===Ie.CHILD_REMOVED&&i===Ie.CHILD_ADDED)this.changeMap.delete(n);else if(e===Ie.CHILD_REMOVED&&i===Ie.CHILD_CHANGED)this.changeMap.set(n,Ie.childRemovedChange(n,r.oldSnap));else if(e===Ie.CHILD_CHANGED&&i===Ie.CHILD_ADDED)this.changeMap.set(n,Ie.childAddedChange(n,t.snapshotNode));else{if(e!==Ie.CHILD_CHANGED||i!==Ie.CHILD_CHANGED)throw s.assertionError("Illegal combination of changes: "+t+" occurred after "+r);this.changeMap.set(n,Ie.childChangedChange(n,t.snapshotNode,r.oldSnap))}}else this.changeMap.set(n,t)},t.prototype.getChanges=function(){return Array.from(this.changeMap.values())},t}(),ke=new(function(){function t(){}return t.prototype.getCompleteChild=function(t){return null},t.prototype.getChildAfterChild=function(t,e,n){return null},t}()),xe=function(){function t(t,e,n){void 0===n&&(n=null),this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}return t.prototype.getCompleteChild=function(t){var e=this.viewCache_.getEventCache();if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);var n=null!=this.optCompleteServerCache_?new Te(this.optCompleteServerCache_,!0,!1):this.viewCache_.getServerCache();return this.writes_.calcCompleteChild(t,n)},t.prototype.getChildAfterChild=function(t,e,n){var r=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:this.viewCache_.getCompleteServerSnap(),i=this.writes_.calcIndexedSlice(r,e,1,n,t);return 0===i.length?null:i[0]},t}(),Pe=function(t,e){this.viewCache=t,this.changes=e},Ae=function(){function t(t){this.filter_=t}return t.prototype.assertIndexed=function(t){s.assert(t.getEventCache().getNode().isIndexed(this.filter_.getIndex()),"Event snap not indexed"),s.assert(t.getServerCache().getNode().isIndexed(this.filter_.getIndex()),"Server snap not indexed")},t.prototype.applyOperation=function(e,n,r,i){var o,a,u=new Oe;if(n.type===pe.OVERWRITE){var c=n;c.source.fromUser?o=this.applyUserOverwrite_(e,c.path,c.snap,r,i,u):(s.assert(c.source.fromServer,"Unknown source."),a=c.source.tagged||e.getServerCache().isFiltered()&&!c.path.isEmpty(),o=this.applyServerOverwrite_(e,c.path,c.snap,r,i,a,u))}else if(n.type===pe.MERGE){var l=n;l.source.fromUser?o=this.applyUserMerge_(e,l.path,l.children,r,i,u):(s.assert(l.source.fromServer,"Unknown source."),a=l.source.tagged||e.getServerCache().isFiltered(),o=this.applyServerMerge_(e,l.path,l.children,r,i,a,u))}else if(n.type===pe.ACK_USER_WRITE){var f=n;o=f.revert?this.revertUserWrite_(e,f.path,r,i,u):this.ackUserWrite_(e,f.path,f.affectedTree,r,i,u)}else{if(n.type!==pe.LISTEN_COMPLETE)throw s.assertionError("Unknown operation type: "+n.type);o=this.listenComplete_(e,n.path,r,u)}var h=u.getChanges();return t.maybeAddValueEvent_(e,o,h),new Pe(o,h)},t.maybeAddValueEvent_=function(t,e,n){var r=e.getEventCache();if(r.isFullyInitialized()){var i=r.getNode().isLeafNode()||r.getNode().isEmpty(),o=t.getCompleteEventSnap();(n.length>0||!t.getEventCache().isFullyInitialized()||i&&!r.getNode().equals(o)||!r.getNode().getPriority().equals(o.getPriority()))&&n.push(Ie.valueChange(e.getCompleteEventSnap()))}},t.prototype.generateEventCacheAfterServerEvent_=function(t,e,n,r,i){var o=t.getEventCache();if(null!=n.shadowingWrite(e))return t;var a=void 0,u=void 0;if(e.isEmpty())if(s.assert(t.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),t.getServerCache().isFiltered()){var c=t.getCompleteServerSnap(),l=c instanceof Kt?c:Kt.EMPTY_NODE,f=n.calcCompleteEventChildren(l);a=this.filter_.updateFullNode(t.getEventCache().getNode(),f,i)}else{var h=n.calcCompleteEventCache(t.getCompleteServerSnap());a=this.filter_.updateFullNode(t.getEventCache().getNode(),h,i)}else{var p=e.getFront();if(".priority"===p){s.assert(1===e.getLength(),"Can't have a priority with additional path components");var d=o.getNode();u=t.getServerCache().getNode();var v=n.calcEventCacheAfterServerOverwrite(e,d,u);a=null!=v?this.filter_.updatePriority(d,v):o.getNode()}else{var y=e.popFront(),g=void 0;if(o.isCompleteForChild(p)){u=t.getServerCache().getNode();var m=n.calcEventCacheAfterServerOverwrite(e,o.getNode(),u);g=null!=m?o.getNode().getImmediateChild(p).updateChild(y,m):o.getNode().getImmediateChild(p)}else g=n.calcCompleteChild(p,t.getServerCache());a=null!=g?this.filter_.updateChild(o.getNode(),p,g,y,r,i):o.getNode()}}return t.updateEventSnap(a,o.isFullyInitialized()||e.isEmpty(),this.filter_.filtersNodes())},t.prototype.applyServerOverwrite_=function(t,e,n,r,i,o,a){var s,u=t.getServerCache(),c=o?this.filter_:this.filter_.getIndexedFilter();if(e.isEmpty())s=c.updateFullNode(u.getNode(),n,null);else if(c.filtersNodes()&&!u.isFiltered()){var l=u.getNode().updateChild(e,n);s=c.updateFullNode(u.getNode(),l,null)}else{var f=e.getFront();if(!u.isCompleteForPath(e)&&e.getLength()>1)return t;var h=e.popFront(),p=u.getNode().getImmediateChild(f).updateChild(h,n);s=".priority"===f?c.updatePriority(u.getNode(),p):c.updateChild(u.getNode(),f,p,h,ke,null)}var d=t.updateServerSnap(s,u.isFullyInitialized()||e.isEmpty(),c.filtersNodes()),v=new xe(r,d,i);return this.generateEventCacheAfterServerEvent_(d,e,r,v,a)},t.prototype.applyUserOverwrite_=function(t,e,n,r,i,o){var a,s,u=t.getEventCache(),c=new xe(r,t,i);if(e.isEmpty())s=this.filter_.updateFullNode(t.getEventCache().getNode(),n,o),a=t.updateEventSnap(s,!0,this.filter_.filtersNodes());else{var l=e.getFront();if(".priority"===l)s=this.filter_.updatePriority(t.getEventCache().getNode(),n),a=t.updateEventSnap(s,u.isFullyInitialized(),u.isFiltered());else{var f=e.popFront(),h=u.getNode().getImmediateChild(l),p=void 0;if(f.isEmpty())p=n;else{var d=c.getCompleteChild(l);p=null!=d?".priority"===f.getBack()&&d.getChild(f.parent()).isEmpty()?d:d.updateChild(f,n):Kt.EMPTY_NODE}if(h.equals(p))a=t;else{var v=this.filter_.updateChild(u.getNode(),l,p,f,c,o);a=t.updateEventSnap(v,u.isFullyInitialized(),this.filter_.filtersNodes())}}}return a},t.cacheHasChild_=function(t,e){return t.getEventCache().isCompleteForChild(e)},t.prototype.applyUserMerge_=function(e,n,r,i,o,a){var s=this,u=e;return r.foreach((function(r,c){var l=n.child(r);t.cacheHasChild_(e,l.getFront())&&(u=s.applyUserOverwrite_(u,l,c,i,o,a))})),r.foreach((function(r,c){var l=n.child(r);t.cacheHasChild_(e,l.getFront())||(u=s.applyUserOverwrite_(u,l,c,i,o,a))})),u},t.prototype.applyMerge_=function(t,e){return e.foreach((function(e,n){t=t.updateChild(e,n)})),t},t.prototype.applyServerMerge_=function(t,e,n,r,i,o,a){var s=this;if(t.getServerCache().getNode().isEmpty()&&!t.getServerCache().isFullyInitialized())return t;var u,c=t;u=e.isEmpty()?n:_e.Empty.setTree(e,n);var l=t.getServerCache().getNode();return u.children.inorderTraversal((function(e,n){if(l.hasChild(e)){var u=t.getServerCache().getNode().getImmediateChild(e),f=s.applyMerge_(u,n);c=s.applyServerOverwrite_(c,new tt(e),f,r,i,o,a)}})),u.children.inorderTraversal((function(e,n){var u=!t.getServerCache().isCompleteForChild(e)&&null==n.value;if(!l.hasChild(e)&&!u){var f=t.getServerCache().getNode().getImmediateChild(e),h=s.applyMerge_(f,n);c=s.applyServerOverwrite_(c,new tt(e),h,r,i,o,a)}})),c},t.prototype.ackUserWrite_=function(t,e,n,r,i,o){if(null!=r.shadowingWrite(e))return t;var a=t.getServerCache().isFiltered(),s=t.getServerCache();if(null!=n.value){if(e.isEmpty()&&s.isFullyInitialized()||s.isCompleteForPath(e))return this.applyServerOverwrite_(t,e,s.getNode().getChild(e),r,i,a,o);if(e.isEmpty()){var u=_e.Empty;return s.getNode().forEachChild(At,(function(t,e){u=u.set(new tt(t),e)})),this.applyServerMerge_(t,e,u,r,i,a,o)}return t}var c=_e.Empty;return n.foreach((function(t,n){var r=e.child(t);s.isCompleteForPath(r)&&(c=c.set(t,s.getNode().getChild(r)))})),this.applyServerMerge_(t,e,c,r,i,a,o)},t.prototype.listenComplete_=function(t,e,n,r){var i=t.getServerCache(),o=t.updateServerSnap(i.getNode(),i.isFullyInitialized()||e.isEmpty(),i.isFiltered());return this.generateEventCacheAfterServerEvent_(o,e,n,ke,r)},t.prototype.revertUserWrite_=function(t,e,n,r,i){var o;if(null!=n.shadowingWrite(e))return t;var a=new xe(n,t,r),u=t.getEventCache().getNode(),c=void 0;if(e.isEmpty()||".priority"===e.getFront()){var l=void 0;if(t.getServerCache().isFullyInitialized())l=n.calcCompleteEventCache(t.getCompleteServerSnap());else{var f=t.getServerCache().getNode();s.assert(f instanceof Kt,"serverChildren would be complete if leaf node"),l=n.calcCompleteEventChildren(f)}c=this.filter_.updateFullNode(u,l,i)}else{var h=e.getFront(),p=n.calcCompleteChild(h,t.getServerCache());null==p&&t.getServerCache().isCompleteForChild(h)&&(p=u.getImmediateChild(h)),(c=null!=p?this.filter_.updateChild(u,h,p,e.popFront(),a,i):t.getEventCache().getNode().hasChild(h)?this.filter_.updateChild(u,h,Kt.EMPTY_NODE,e.popFront(),a,i):u).isEmpty()&&t.getServerCache().isFullyInitialized()&&(o=n.calcCompleteEventCache(t.getCompleteServerSnap())).isLeafNode()&&(c=this.filter_.updateFullNode(c,o,i))}return o=t.getServerCache().isFullyInitialized()||null!=n.shadowingWrite(tt.Empty),t.updateEventSnap(c,o,this.filter_.filtersNodes())},t}(),Ne=function(){function t(t){this.query_=t,this.index_=this.query_.getQueryParams().getIndex()}return t.prototype.generateEventsForChanges=function(t,e,n){var r=this,i=[],o=[];return t.forEach((function(t){t.type===Ie.CHILD_CHANGED&&r.index_.indexedValueChanged(t.oldSnap,t.snapshotNode)&&o.push(Ie.childMovedChange(t.childName,t.snapshotNode))})),this.generateEventsForType_(i,Ie.CHILD_REMOVED,t,n,e),this.generateEventsForType_(i,Ie.CHILD_ADDED,t,n,e),this.generateEventsForType_(i,Ie.CHILD_MOVED,o,n,e),this.generateEventsForType_(i,Ie.CHILD_CHANGED,t,n,e),this.generateEventsForType_(i,Ie.VALUE,t,n,e),i},t.prototype.generateEventsForType_=function(t,e,n,r,i){var o=this,a=n.filter((function(t){return t.type===e}));a.sort(this.compareChanges_.bind(this)),a.forEach((function(e){var n=o.materializeSingleChange_(e,i);r.forEach((function(r){r.respondsTo(e.type)&&t.push(r.createEvent(n,o.query_))}))}))},t.prototype.materializeSingleChange_=function(t,e){return"value"===t.type||"child_removed"===t.type||(t.prevName=e.getPredecessorChildName(t.childName,t.snapshotNode,this.index_)),t},t.prototype.compareChanges_=function(t,e){if(null==t.childName||null==e.childName)throw s.assertionError("Should only compare child_ events.");var n=new kt(t.childName,t.snapshotNode),r=new kt(e.childName,e.snapshotNode);return this.index_.compare(n,r)},t}(),Re=function(){function t(t,e){this.query_=t,this.eventRegistrations_=[];var n=this.query_.getQueryParams(),r=new Ce(n.getIndex()),i=n.getNodeFilter();this.processor_=new Ae(i);var o=e.getServerCache(),a=e.getEventCache(),s=r.updateFullNode(Kt.EMPTY_NODE,o.getNode(),null),u=i.updateFullNode(Kt.EMPTY_NODE,a.getNode(),null),c=new Te(s,o.isFullyInitialized(),r.filtersNodes()),l=new Te(u,a.isFullyInitialized(),i.filtersNodes());this.viewCache_=new Se(l,c),this.eventGenerator_=new Ne(this.query_)}return t.prototype.getQuery=function(){return this.query_},t.prototype.getServerCache=function(){return this.viewCache_.getServerCache().getNode()},t.prototype.getCompleteServerCache=function(t){var e=this.viewCache_.getCompleteServerSnap();return e&&(this.query_.getQueryParams().loadsAllData()||!t.isEmpty()&&!e.getImmediateChild(t.getFront()).isEmpty())?e.getChild(t):null},t.prototype.isEmpty=function(){return 0===this.eventRegistrations_.length},t.prototype.addEventRegistration=function(t){this.eventRegistrations_.push(t)},t.prototype.removeEventRegistration=function(t,e){var n=[];if(e){s.assert(null==t,"A cancel should cancel all event registrations.");var r=this.query_.path;this.eventRegistrations_.forEach((function(t){var i=t.createCancelEvent(e,r);i&&n.push(i)}))}if(t){for(var i=[],o=0;othis.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},t.prototype.addMerge=function(t,e,n){s.assert(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},t.prototype.getWrite=function(t){for(var e=0;e=0,"removeWrite called with nonexistent writeId.");var r=this.allWrites_[n];this.allWrites_.splice(n,1);for(var i=r.visible,o=!1,a=this.allWrites_.length-1;i&&a>=0;){var u=this.allWrites_[a];u.visible&&(a>=n&&this.recordContainsPath_(u,r.path)?i=!1:r.path.contains(u.path)&&(o=!0)),a--}return!!i&&(o?(this.resetTree_(),!0):(r.snap?this.visibleWrites_=this.visibleWrites_.removeWrite(r.path):F(r.children,(function(t){e.visibleWrites_=e.visibleWrites_.removeWrite(r.path.child(t))})),!0))},t.prototype.getCompleteWriteData=function(t){return this.visibleWrites_.getCompleteNode(t)},t.prototype.calcCompleteEventCache=function(e,n,r,i){if(r||i){var o=this.visibleWrites_.childCompoundWrite(e);if(!i&&o.isEmpty())return n;if(i||null!=n||o.hasCompleteWrite(tt.Empty)){var a=t.layerTree_(this.allWrites_,(function(t){return(t.visible||i)&&(!r||!~r.indexOf(t.writeId))&&(t.path.contains(e)||e.contains(t.path))}),e);return c=n||Kt.EMPTY_NODE,a.apply(c)}return null}var s=this.visibleWrites_.getCompleteNode(e);if(null!=s)return s;var u=this.visibleWrites_.childCompoundWrite(e);if(u.isEmpty())return n;if(null!=n||u.hasCompleteWrite(tt.Empty)){var c=n||Kt.EMPTY_NODE;return u.apply(c)}return null},t.prototype.calcCompleteEventChildren=function(t,e){var n=Kt.EMPTY_NODE,r=this.visibleWrites_.getCompleteNode(t);if(r)return r.isLeafNode()||r.forEachChild(Lt,(function(t,e){n=n.updateImmediateChild(t,e)})),n;if(e){var i=this.visibleWrites_.childCompoundWrite(t);return e.forEachChild(Lt,(function(t,e){var r=i.childCompoundWrite(new tt(t)).apply(e);n=n.updateImmediateChild(t,r)})),i.getCompleteChildren().forEach((function(t){n=n.updateImmediateChild(t.name,t.node)})),n}return this.visibleWrites_.childCompoundWrite(t).getCompleteChildren().forEach((function(t){n=n.updateImmediateChild(t.name,t.node)})),n},t.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n,r){s.assert(n||r,"Either existingEventSnap or existingServerSnap must exist");var i=t.child(e);if(this.visibleWrites_.hasCompleteWrite(i))return null;var o=this.visibleWrites_.childCompoundWrite(i);return o.isEmpty()?r.getChild(e):o.apply(r.getChild(e))},t.prototype.calcCompleteChild=function(t,e,n){var r=t.child(e),i=this.visibleWrites_.getCompleteNode(r);return null!=i?i:n.isCompleteForChild(e)?this.visibleWrites_.childCompoundWrite(r).apply(n.getNode().getImmediateChild(e)):null},t.prototype.shadowingWrite=function(t){return this.visibleWrites_.getCompleteNode(t)},t.prototype.calcIndexedSlice=function(t,e,n,r,i,o){var a,s=this.visibleWrites_.childCompoundWrite(t),u=s.getCompleteNode(tt.Empty);if(null!=u)a=u;else{if(null==e)return[];a=s.apply(e)}if((a=a.withIndex(o)).isEmpty()||a.isLeafNode())return[];for(var c=[],l=o.getCompare(),f=i?a.getReverseIteratorFrom(n,o):a.getIteratorFrom(n,o),h=f.getNext();h&&c.length0?this.lastWriteId_=this.allWrites_[this.allWrites_.length-1].writeId:this.lastWriteId_=-1},t.DefaultFilter_=function(t){return t.visible},t.layerTree_=function(t,e,n){for(var r=Le.Empty,i=0;i0&&!r&&(l?this.listenProvider_.stopListening(t.queryForListening_(e),null):c.forEach((function(e){var n=i.queryToTagMap.get(t.makeQueryKey_(e));i.listenProvider_.stopListening(t.queryForListening_(e),n)}))),this.removeTags_(c)}return s},t.prototype.calcCompleteEventCache=function(t,e){var n=this.pendingWriteTree_,r=this.syncPointTree_.findOnPath(t,(function(e,n){var r=tt.relativePath(e,t),i=n.getCompleteServerCache(r);if(i)return i}));return n.calcCompleteEventCache(t,r,e,!0)},t.prototype.collectDistinctViewsForSubTree_=function(t){return t.fold((function(t,e,n){if(e&&e.hasCompleteView())return[e.getCompleteView()];var r=[];return e&&(r=e.getQueryViews()),F(n,(function(t,e){r=r.concat(e)})),r}))},t.prototype.removeTags_=function(e){for(var n=0;n0&&s.contains(t.statsToReport_,e)&&(n[e]=i,r=!0)})),r&&this.server_.reportStats(n),Z(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},t}(),ze=function(){function t(){this.eventLists_=[],this.recursionDepth_=0}return t.prototype.queueEvents=function(t){for(var e=null,n=0;n0,"Requires a non-empty array")}return t.prototype.trigger=function(t){for(var e=[],n=1;ndocument.domain="'+document.domain+'";<\/script>');var a=""+o+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(a),this.myIFrame.doc.close()}catch(t){I("frame writing exception"),t.stack&&I(t.stack),I(t)}}}return t.createIFrame_=function(){var t=document.createElement("iframe");if(t.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(t);try{t.contentWindow.document||I("No IE domain setting required")}catch(n){var e=document.domain;t.src="javascript:void((function(){document.open();document.domain='"+e+"';document.close();})())"}return t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document),t},t.prototype.close=function(){var t=this;this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout((function(){null!==t.myIFrame&&(document.body.removeChild(t.myIFrame),t.myIFrame=null)}),Math.floor(0)));var e=this.onDisconnect;e&&(this.onDisconnect=null,e())},t.prototype.startLongPoll=function(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.newRequest_(););},t.prototype.newRequest_=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;var t={};t.id=this.myID,t.pw=this.myPW,t.ser=this.currentSerial;for(var e=this.urlFn(t),n="",r=0;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+30+n.length<=1870;){var i=this.pendingSegs.shift();n=n+"&seg"+r+"="+i.seg+"&ts"+r+"="+i.ts+"&d"+r+"="+i.d,r++}return e+=n,this.addLongPollTag_(e,this.currentSerial),!0}return!1},t.prototype.enqueueSegment=function(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.newRequest_()},t.prototype.addLongPollTag_=function(t,e){var n=this;this.outstandingRequests.add(e);var r=function(){n.outstandingRequests.delete(e),n.newRequest_()},i=setTimeout(r,Math.floor(25e3));this.addTag(t,(function(){clearTimeout(i),r()}))},t.prototype.addTag=function(t,e){var n=this;s.isNodeSdk()?this.doNodeLongPoll(t,e):setTimeout((function(){try{if(!n.sendNewPolls)return;var r=n.myIFrame.doc.createElement("script");r.type="text/javascript",r.async=!0,r.src=t,r.onload=r.onreadystatechange=function(){var t=r.readyState;t&&"loaded"!==t&&"complete"!==t||(r.onload=r.onreadystatechange=null,r.parentNode&&r.parentNode.removeChild(r),e())},r.onerror=function(){I("Long-poll script failed to load: "+t),n.sendNewPolls=!1,n.close()},n.myIFrame.doc.body.appendChild(r)}catch(t){}}),Math.floor(1))},t}(),en="",nn=null;"undefined"!=typeof MozWebSocket?nn=MozWebSocket:"undefined"!=typeof WebSocket&&(nn=WebSocket);var rn=function(){function t(e,n,r,i,o){this.connId=e,this.applicationId=r,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=C(this.connId),this.stats_=Be.getCollection(n),this.connURL=t.connectionURL_(n,i,o),this.nodeAdmin=n.nodeAdmin}return t.connectionURL_=function(t,e,n){var r={v:"5"};return!s.isNodeSdk()&&"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf(nt)&&(r.r="f"),e&&(r.s=e),n&&(r.ls=n),t.connectionURL(rt,r)},t.prototype.open=function(t,e){var n=this;this.onDisconnect=e,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,y.set("previous_websocket_failure",!0);try{if(s.isNodeSdk()){var i=this.nodeAdmin?"AdminNode":"Node",o={headers:{"User-Agent":"Firebase/5/"+en+"/"+r.platform+"/"+i,"X-Firebase-GMPID":this.applicationId||""}},a=r.env,u=0===this.connURL.indexOf("wss://")?a.HTTPS_PROXY||a.https_proxy:a.HTTP_PROXY||a.http_proxy;u&&(o.proxy={origin:u}),this.mySock=new nn(this.connURL,[],o)}else o={headers:{"X-Firebase-GMPID":this.applicationId||""}},this.mySock=new nn(this.connURL,[],o)}catch(t){this.log_("Error instantiating WebSocket.");var c=t.message||t.data;return c&&this.log_(c),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_()}},t.prototype.start=function(){},t.forceDisallow=function(){t.forceDisallow_=!0},t.isAvailable=function(){var e=!1;if("undefined"!=typeof navigator&&navigator.userAgent){var n=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);n&&n.length>1&&parseFloat(n[1])<4.4&&(e=!0)}return!e&&null!==nn&&!t.forceDisallow_},t.previouslyFailed=function(){return y.isInMemoryStorage||!0===y.get("previous_websocket_failure")},t.prototype.markConnectionHealthy=function(){y.remove("previous_websocket_failure")},t.prototype.appendFrame_=function(t){if(this.frames.push(t),this.frames.length===this.totalFrames){var e=this.frames.join("");this.frames=null;var n=s.jsonEval(e);this.onMessage(n)}},t.prototype.handleNewFrameCount_=function(t){this.totalFrames=t,this.frames=[]},t.prototype.extractFrameCount_=function(t){if(s.assert(null===this.frames,"We already have a frame buffer"),t.length<=6){var e=Number(t);if(!isNaN(e))return this.handleNewFrameCount_(e),null}return this.handleNewFrameCount_(1),t},t.prototype.handleIncomingFrame=function(t){if(null!==this.mySock){var e=t.data;if(this.bytesReceived+=e.length,this.stats_.incrementCounter("bytes_received",e.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(e);else{var n=this.extractFrameCount_(e);null!==n&&this.appendFrame_(n)}}},t.prototype.send=function(t){this.resetKeepAlive();var e=s.stringify(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);var n=j(e,16384);n.length>1&&this.sendString_(String(n.length));for(var r=0;r0)return this.transports_[0];throw new Error("No transports available")},t.prototype.upgradeTransport=function(){return this.transports_.length>1?this.transports_[1]:null},t}(),an=function(){function t(t,e,n,r,i,o,a,s){this.id=t,this.repoInfo_=e,this.applicationId_=n,this.onMessage_=r,this.onReady_=i,this.onDisconnect_=o,this.onKill_=a,this.lastSessionId=s,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=C("c:"+this.id+":"),this.transportManager_=new on(e),this.log_("Connection created"),this.start_()}return t.prototype.start_=function(){var t=this,e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,void 0,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.conn_),r=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout((function(){t.conn_&&t.conn_.open(n,r)}),Math.floor(0));var i=e.healthyTimeout||0;i>0&&(this.healthyTimeout_=Z((function(){t.healthyTimeout_=null,t.isHealthy_||(t.conn_&&t.conn_.bytesReceived>102400?(t.log_("Connection exceeded healthy timeout but has received "+t.conn_.bytesReceived+" bytes. Marking connection healthy."),t.isHealthy_=!0,t.conn_.markConnectionHealthy()):t.conn_&&t.conn_.bytesSent>10240?t.log_("Connection exceeded healthy timeout but has sent "+t.conn_.bytesSent+" bytes. Leaving connection alive."):(t.log_("Closing unhealthy connection after timeout."),t.close()))}),Math.floor(i)))},t.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},t.prototype.disconnReceiver_=function(t){var e=this;return function(n){t===e.conn_?e.onConnectionLost_(n):t===e.secondaryConn_?(e.log_("Secondary connection lost."),e.onSecondaryConnectionLost_()):e.log_("closing an old connection")}},t.prototype.connReceiver_=function(t){var e=this;return function(n){2!==e.state_&&(t===e.rx_?e.onPrimaryMessageReceived_(n):t===e.secondaryConn_?e.onSecondaryMessageReceived_(n):e.log_("message on old connection"))}},t.prototype.sendRequest=function(t){var e={t:"d",d:t};this.sendData_(e)},t.prototype.tryCleanupConnection=function(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)},t.prototype.onSecondaryControl_=function(t){if("t"in t){var e=t.t;"a"===e?this.upgradeIfSecondaryHealthy_():"r"===e?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):"o"===e&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}},t.prototype.onSecondaryMessageReceived_=function(t){var e=L("t",t),n=L("d",t);if("c"===e)this.onSecondaryControl_(n);else{if("d"!==e)throw new Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(n)}},t.prototype.upgradeIfSecondaryHealthy_=function(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:"p",d:{}}}))},t.prototype.proceedWithUpgrade_=function(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:"a",d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:"n",d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()},t.prototype.onPrimaryMessageReceived_=function(t){var e=L("t",t),n=L("d",t);"c"===e?this.onControl_(n):"d"===e&&this.onDataMessage_(n)},t.prototype.onDataMessage_=function(t){this.onPrimaryResponse_(),this.onMessage_(t)},t.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},t.prototype.onControl_=function(t){var e=L("t",t);if("d"in t){var n=t.d;if("h"===e)this.onHandshake_(n);else if("n"===e){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(var r=0;r3e4&&(this.reconnectDelay_=un),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime());var t=(new Date).getTime()-this.lastConnectionAttemptTime_,e=Math.max(0,this.reconnectDelay_-t);e=Math.random()*e,this.log_("Trying to reconnect in "+e+"ms"),this.scheduleConnect_(e),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)},e.prototype.establishConnection_=function(){var t=this;if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null;var n=this.onDataMessage_.bind(this),r=this.onReady_.bind(this),i=this.onRealtimeDisconnect_.bind(this),o=this.id+":"+e.nextConnectionId_++,a=this,u=this.lastSessionId,c=!1,l=null,f=function(){l?l.close():(c=!0,i())};this.realtime_={close:f,sendRequest:function(t){s.assert(l,"sendRequest call when we're not connected not allowed."),l.sendRequest(t)}};var h=this.forceTokenRefresh_;this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(h).then((function(t){c?I("getToken() completed but was canceled"):(I("getToken() completed. Creating connection."),a.authToken_=t&&t.accessToken,l=new an(o,a.repoInfo_,a.applicationId_,n,r,i,(function(t){x(t+" ("+a.repoInfo_.toString()+")"),a.interrupt("server_kill")}),u))})).then(null,(function(e){a.log_("Failed to get token: "+e),c||(t.repoInfo_.nodeAdmin&&x(e),f())}))}},e.prototype.interrupt=function(t){I("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())},e.prototype.resume=function(t){I("Resuming connection for reason: "+t),delete this.interruptReasons_[t],s.isEmpty(this.interruptReasons_)&&(this.reconnectDelay_=un,this.realtime_||this.scheduleConnect_(0))},e.prototype.handleTimestamp_=function(t){var e=t-(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:e})},e.prototype.cancelSentTransactions_=function(){for(var t=0;t=3&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))},e.prototype.onSecurityDebugPacket_=function(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&i.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))},e.prototype.restoreState_=function(){var t,e,n,r;this.tryAuth();try{for(var i=a.__values(this.listens.values()),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var u=(n=void 0,a.__values(s.values())),c=u.next();!c.done;c=u.next()){var l=c.value;this.sendListen_(l)}}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}for(var f=0;f=200&&u.status<300){try{t=s.jsonEval(u.responseText)}catch(t){x("Failed to parse JSON response for "+a+": "+u.responseText)}n(null,t)}else 401!==u.status&&404!==u.status&&x("Got unsuccessful REST response for "+a+" Status: "+u.status),n(u.status);n=null}},u.open("GET",a,!0),u.send()}))},e}(sn),fn="repo_interrupt",hn=function(){function t(t,e,n,r){var i=this;if(this.repoInfo_=t,this.app=n,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new ze,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=new de,this.persistentConnection_=null,this.stats_=Be.getCollection(t),e||("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0)this.server_=new ln(this.repoInfo_,this.onDataUpdate_.bind(this),r),setTimeout(this.onConnectStatus_.bind(this,!0),0);else{var o=n.options.databaseAuthVariableOverride;if(null!=o){if("object"!=typeof o)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{s.stringify(o)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}this.persistentConnection_=new cn(this.repoInfo_,n.options.appId,this.onDataUpdate_.bind(this),this.onConnectStatus_.bind(this),this.onServerInfoUpdate_.bind(this),r,o),this.server_=this.persistentConnection_}r.addTokenChangeListener((function(t){i.server_.refreshAuthToken(t)})),this.statsReporter_=Be.getOrCreateReporter(t,(function(){return new Ge(i.stats_,i.server_)})),this.transactionsInit_(),this.infoData_=new Ve,this.infoSyncTree_=new Ue({startListening:function(t,e,n,r){var o=[],a=i.infoData_.getNode(t.path);return a.isEmpty()||(o=i.infoSyncTree_.applyServerOverwrite(t.path,a),setTimeout((function(){r("ok")}),0)),o},stopListening:function(){}}),this.updateInfo_("connected",!1),this.serverSyncTree_=new Ue({startListening:function(t,e,n,r){return i.server_.listen(t,n,e,(function(e,n){var o=r(e,n);i.eventQueue_.raiseEventsForChangedPath(t.path,o)})),[]},stopListening:function(t,e){i.server_.unlisten(t,e)}})}return t.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},t.prototype.name=function(){return this.repoInfo_.namespace},t.prototype.serverTime=function(){var t=this.infoData_.getNode(new tt(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+t},t.prototype.generateServerValues=function(){return(t=(t={timestamp:this.serverTime()})||{}).timestamp=t.timestamp||(new Date).getTime(),t;var t},t.prototype.onDataUpdate_=function(t,e,n,r){this.dataUpdateCount++;var i=new tt(t);e=this.interceptServerDataCallback_?this.interceptServerDataCallback_(t,e):e;var o=[];if(r)if(n){var a=s.map(e,(function(t){return Qt(t)}));o=this.serverSyncTree_.applyTaggedQueryMerge(i,a,r)}else{var u=Qt(e);o=this.serverSyncTree_.applyTaggedQueryOverwrite(i,u,r)}else if(n){var c=s.map(e,(function(t){return Qt(t)}));o=this.serverSyncTree_.applyServerMerge(i,c)}else{var l=Qt(e);o=this.serverSyncTree_.applyServerOverwrite(i,l)}var f=i;o.length>0&&(f=this.rerunTransactions_(i)),this.eventQueue_.raiseEventsForChangedPath(f,o)},t.prototype.interceptServerData_=function(t){this.interceptServerDataCallback_=t},t.prototype.onConnectStatus_=function(t){this.updateInfo_("connected",t),!1===t&&this.runOnDisconnectEvents_()},t.prototype.onServerInfoUpdate_=function(t){var e=this;F(t,(function(t,n){e.updateInfo_(t,n)}))},t.prototype.updateInfo_=function(t,e){var n=new tt("/.info/"+t),r=Qt(e);this.infoData_.updateSnapshot(n,r);var i=this.infoSyncTree_.applyServerOverwrite(n,r);this.eventQueue_.raiseEventsForChangedPath(n,i)},t.prototype.getNextWriteId_=function(){return this.nextWriteId_++},t.prototype.setWithPriority=function(t,e,n,r){var i=this;this.log_("set",{path:t.toString(),value:e,priority:n});var o=this.generateServerValues(),a=Qt(e,n),s=this.serverSyncTree_.calcCompleteEventCache(t),u=fe(a,s,o),c=this.getNextWriteId_(),l=this.serverSyncTree_.applyUserOverwrite(t,u,c,!0);this.eventQueue_.queueEvents(l),this.server_.put(t.toString(),a.val(!0),(function(e,n){var o="ok"===e;o||x("set at "+t+" failed: "+e);var a=i.serverSyncTree_.ackUserWrite(c,!o);i.eventQueue_.raiseEventsForChangedPath(t,a),i.callOnCompleteCallback(r,e,n)}));var f=this.abortTransactions_(t);this.rerunTransactions_(f),this.eventQueue_.raiseEventsForChangedPath(f,[])},t.prototype.update=function(t,e,n){var r=this;this.log_("update",{path:t.toString(),value:e});var i=!0,o=this.generateServerValues(),a={};if(F(e,(function(e,n){i=!1,a[e]=le(t.child(e),Qt(n),r.serverSyncTree_,o)})),i)I("update() called with empty data. Don't do anything."),this.callOnCompleteCallback(n,"ok");else{var s=this.getNextWriteId_(),u=this.serverSyncTree_.applyUserMerge(t,a,s);this.eventQueue_.queueEvents(u),this.server_.merge(t.toString(),e,(function(e,i){var o="ok"===e;o||x("update at "+t+" failed: "+e);var a=r.serverSyncTree_.ackUserWrite(s,!o),u=a.length>0?r.rerunTransactions_(t):t;r.eventQueue_.raiseEventsForChangedPath(u,a),r.callOnCompleteCallback(n,e,i)})),F(e,(function(e){var n=r.abortTransactions_(t.child(e));r.rerunTransactions_(n)})),this.eventQueue_.raiseEventsForChangedPath(t,[])}},t.prototype.runOnDisconnectEvents_=function(){var t=this;this.log_("onDisconnectEvents");var e=this.generateServerValues(),n=new de;this.onDisconnect_.forEachTree(tt.Empty,(function(r,i){var o=le(r,i,t.serverSyncTree_,e);n.remember(r,o)}));var r=[];n.forEachTree(tt.Empty,(function(e,n){r=r.concat(t.serverSyncTree_.applyServerOverwrite(e,n));var i=t.abortTransactions_(e);t.rerunTransactions_(i)})),this.onDisconnect_=new de,this.eventQueue_.raiseEventsForChangedPath(tt.Empty,r)},t.prototype.onDisconnectCancel=function(t,e){var n=this;this.server_.onDisconnectCancel(t.toString(),(function(r,i){"ok"===r&&n.onDisconnect_.forget(t),n.callOnCompleteCallback(e,r,i)}))},t.prototype.onDisconnectSet=function(t,e,n){var r=this,i=Qt(e);this.server_.onDisconnectPut(t.toString(),i.val(!0),(function(e,o){"ok"===e&&r.onDisconnect_.remember(t,i),r.callOnCompleteCallback(n,e,o)}))},t.prototype.onDisconnectSetWithPriority=function(t,e,n,r){var i=this,o=Qt(e,n);this.server_.onDisconnectPut(t.toString(),o.val(!0),(function(e,n){"ok"===e&&i.onDisconnect_.remember(t,o),i.callOnCompleteCallback(r,e,n)}))},t.prototype.onDisconnectUpdate=function(t,e,n){var r=this;if(s.isEmpty(e))return I("onDisconnect().update() called with empty data. Don't do anything."),void this.callOnCompleteCallback(n,"ok");this.server_.onDisconnectMerge(t.toString(),e,(function(i,o){"ok"===i&&F(e,(function(e,n){var i=Qt(n);r.onDisconnect_.remember(t.child(e),i)})),r.callOnCompleteCallback(n,i,o)}))},t.prototype.addEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.infoSyncTree_.addEventRegistration(t,e):this.serverSyncTree_.addEventRegistration(t,e),this.eventQueue_.raiseEventsAtPath(t.path,n)},t.prototype.removeEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.infoSyncTree_.removeEventRegistration(t,e):this.serverSyncTree_.removeEventRegistration(t,e),this.eventQueue_.raiseEventsAtPath(t.path,n)},t.prototype.interrupt=function(){this.persistentConnection_&&this.persistentConnection_.interrupt(fn)},t.prototype.resume=function(){this.persistentConnection_&&this.persistentConnection_.resume(fn)},t.prototype.stats=function(t){if(void 0===t&&(t=!1),void 0!==i){var e;t?(this.statsListener_||(this.statsListener_=new We(this.stats_)),e=this.statsListener_.get()):e=this.stats_.get();var n=Object.keys(e).reduce((function(t,e){return Math.max(e.length,t)}),0);F(e,(function(t,e){for(var r=t,o=t.length;o=0)return null!=i&&i.trackChildChange(Ie.childChangedChange(e,n,h)),u.updateImmediateChild(e,n);null!=i&&i.trackChildChange(Ie.childRemovedChange(e,h));var v=u.updateImmediateChild(e,Kt.EMPTY_NODE);return null!=p&&this.rangedFilter_.matches(p)?(null!=i&&i.trackChildChange(Ie.childAddedChange(p.name,p.node)),v.updateImmediateChild(p.name,p.node)):v}return n.isEmpty()?t:f&&o(l,c)>=0?(null!=i&&(i.trackChildChange(Ie.childRemovedChange(l.name,l.node)),i.trackChildChange(Ie.childAddedChange(e,n))),u.updateImmediateChild(e,n).updateImmediateChild(l.name,Kt.EMPTY_NODE)):t},t}(),vn=function(){function t(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=Lt}return t.prototype.hasStart=function(){return this.startSet_},t.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:this.viewFrom_===t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT},t.prototype.getIndexStartValue=function(){return s.assert(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},t.prototype.getIndexStartName=function(){return s.assert(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:A},t.prototype.hasEnd=function(){return this.endSet_},t.prototype.getIndexEndValue=function(){return s.assert(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},t.prototype.getIndexEndName=function(){return s.assert(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:N},t.prototype.hasLimit=function(){return this.limitSet_},t.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},t.prototype.getLimit=function(){return s.assert(this.limitSet_,"Only valid if limit has been set"),this.limit_},t.prototype.getIndex=function(){return this.index_},t.prototype.copy_=function(){var e=new t;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e},t.prototype.limit=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_="",e},t.prototype.limitToFirst=function(e){var n=this.copy_();return n.limitSet_=!0,n.limit_=e,n.viewFrom_=t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT,n},t.prototype.limitToLast=function(e){var n=this.copy_();return n.limitSet_=!0,n.limit_=e,n.viewFrom_=t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT,n},t.prototype.startAt=function(t,e){var n=this.copy_();return n.startSet_=!0,void 0===t&&(t=null),n.indexStartValue_=t,null!=e?(n.startNameSet_=!0,n.indexStartName_=e):(n.startNameSet_=!1,n.indexStartName_=""),n},t.prototype.endAt=function(t,e){var n=this.copy_();return n.endSet_=!0,void 0===t&&(t=null),n.indexEndValue_=t,void 0!==e?(n.endNameSet_=!0,n.indexEndName_=e):(n.endNameSet_=!1,n.indexEndName_=""),n},t.prototype.orderBy=function(t){var e=this.copy_();return e.index_=t,e},t.prototype.getQueryObject=function(){var e=t.WIRE_PROTOCOL_CONSTANTS_,n={};if(this.startSet_&&(n[e.INDEX_START_VALUE]=this.indexStartValue_,this.startNameSet_&&(n[e.INDEX_START_NAME]=this.indexStartName_)),this.endSet_&&(n[e.INDEX_END_VALUE]=this.indexEndValue_,this.endNameSet_&&(n[e.INDEX_END_NAME]=this.indexEndName_)),this.limitSet_){n[e.LIMIT]=this.limit_;var r=this.viewFrom_;""===r&&(r=this.isViewFromLeft()?e.VIEW_FROM_LEFT:e.VIEW_FROM_RIGHT),n[e.VIEW_FROM]=r}return this.index_!==Lt&&(n[e.INDEX]=this.index_.toString()),n},t.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},t.prototype.isDefault=function(){return this.loadsAllData()&&this.index_===Lt},t.prototype.getNodeFilter=function(){return this.loadsAllData()?new Ce(this.getIndex()):this.hasLimit()?new dn(this):new pn(this)},t.prototype.toRestQueryStringParameters=function(){var e,n=t.REST_QUERY_CONSTANTS_,r={};return this.isDefault()||(this.index_===Lt?e=n.PRIORITY_INDEX:this.index_===Xt?e=n.VALUE_INDEX:this.index_===At?e=n.KEY_INDEX:(s.assert(this.index_ instanceof Jt,"Unrecognized index type!"),e=this.index_.toString()),r[n.ORDER_BY]=s.stringify(e),this.startSet_&&(r[n.START_AT]=s.stringify(this.indexStartValue_),this.startNameSet_&&(r[n.START_AT]+=","+s.stringify(this.indexStartName_))),this.endSet_&&(r[n.END_AT]=s.stringify(this.indexEndValue_),this.endNameSet_&&(r[n.END_AT]+=","+s.stringify(this.indexEndName_))),this.limitSet_&&(this.isViewFromLeft()?r[n.LIMIT_TO_FIRST]=this.limit_:r[n.LIMIT_TO_LAST]=this.limit_)),r},t.WIRE_PROTOCOL_CONSTANTS_={INDEX_START_VALUE:"sp",INDEX_START_NAME:"sn",INDEX_END_VALUE:"ep",INDEX_END_NAME:"en",LIMIT:"l",VIEW_FROM:"vf",VIEW_FROM_LEFT:"l",VIEW_FROM_RIGHT:"r",INDEX:"i"},t.REST_QUERY_CONSTANTS_={ORDER_BY:"orderBy",PRIORITY_INDEX:"$priority",VALUE_INDEX:"$value",KEY_INDEX:"$key",START_AT:"startAt",END_AT:"endAt",LIMIT_TO_FIRST:"limitToFirst",LIMIT_TO_LAST:"limitToLast"},t.DEFAULT=new t,t}(),yn=function(t){function e(e,n){if(!(e instanceof hn))throw new Error("new Reference() no longer supported - use app.database().");return t.call(this,e,n,vn.DEFAULT,!1)||this}return a.__extends(e,t),e.prototype.getKey=function(){return s.validateArgCount("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},e.prototype.child=function(t){return s.validateArgCount("Reference.child",1,1,arguments.length),"number"==typeof t?t=String(t):t instanceof tt||(null===this.path.getFront()?wt("Reference.child",1,t,!1):bt("Reference.child",1,t,!1)),new e(this.repo,this.path.child(t))},e.prototype.getParent=function(){s.validateArgCount("Reference.parent",0,0,arguments.length);var t=this.path.parent();return null===t?null:new e(this.repo,t)},e.prototype.getRoot=function(){s.validateArgCount("Reference.root",0,0,arguments.length);for(var t=this;null!==t.getParent();)t=t.getParent();return t},e.prototype.databaseProp=function(){return this.repo.database},e.prototype.set=function(t,e){s.validateArgCount("Reference.set",1,2,arguments.length),Et("Reference.set",this.path),dt("Reference.set",1,t,this.path,!1),s.validateCallback("Reference.set",2,e,!0);var n=new s.Deferred;return this.repo.setWithPriority(this.path,t,null,n.wrapCallback(e)),n.promise},e.prototype.update=function(t,e){if(s.validateArgCount("Reference.update",1,2,arguments.length),Et("Reference.update",this.path),Array.isArray(t)){for(var n={},r=0;r0},t.prototype.isEmpty=function(){return null===this.getValue()&&!this.hasChildren()},t.prototype.forEachChild=function(e){var n=this;F(this.node_.children,(function(r,i){e(new t(r,n,i))}))},t.prototype.forEachDescendant=function(t,e,n){e&&!n&&t(this),this.forEachChild((function(e){e.forEachDescendant(t,!0,n)})),e&&n&&t(this)},t.prototype.forEachAncestor=function(t,e){for(var n=e?this:this.parent();null!==n;){if(t(n))return!0;n=n.parent()}return!1},t.prototype.forEachImmediateDescendantWithValue=function(t){this.forEachChild((function(e){null!==e.getValue()?t(e):e.forEachImmediateDescendantWithValue(t)}))},t.prototype.path=function(){return new tt(null===this.parent_?this.name_:this.parent_.path()+"/"+this.name_)},t.prototype.name=function(){return this.name_},t.prototype.parent=function(){return this.parent_},t.prototype.updateParents_=function(){null!==this.parent_&&this.parent_.updateChild_(this.name_,this)},t.prototype.updateChild_=function(t,e){var n=e.isEmpty(),r=s.contains(this.node_.children,t);n&&r?(delete this.node_.children[t],this.node_.childCount--,this.updateParents_()):n||r||(this.node_.children[t]=e.node_,this.node_.childCount++,this.updateParents_())},t}();!function(t){t[t.RUN=0]="RUN",t[t.SENT=1]="SENT",t[t.COMPLETED=2]="COMPLETED",t[t.SENT_NEEDS_ABORT=3]="SENT_NEEDS_ABORT",t[t.NEEDS_ABORT=4]="NEEDS_ABORT"}(gn||(gn={})),hn.MAX_TRANSACTION_RETRIES_=25,hn.prototype.transactionsInit_=function(){this.transactionQueueTree_=new _n},hn.prototype.startTransaction=function(t,e,n,r){this.log_("transaction on "+t);var i=function(){},o=new yn(this,t);o.on("value",i);var a={path:t,update:e,onComplete:n,status:null,order:_(),applyLocally:r,retryCount:0,unwatcher:function(){o.off("value",i)},abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},u=this.getLatestState_(t);a.currentInputSnapshot=u;var c=a.update(u.val());if(void 0===c){if(a.unwatcher(),a.currentOutputSnapshotRaw=null,a.currentOutputSnapshotResolved=null,a.onComplete){var l=new Zt(a.currentInputSnapshot,new yn(this,a.path),Lt);a.onComplete(null,!1,l)}}else{vt("transaction failed: Data returned ",c,a.path),a.status=gn.RUN;var f=this.transactionQueueTree_.subTree(t),h=f.getValue()||[];h.push(a),f.setValue(h);var p=void 0;"object"==typeof c&&null!==c&&s.contains(c,".priority")?(p=s.safeGet(c,".priority"),s.assert(pt(p),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):p=(this.serverSyncTree_.calcCompleteEventCache(t)||Kt.EMPTY_NODE).getPriority().val();var d=this.generateServerValues(),v=Qt(c,p),y=fe(v,u,d);a.currentOutputSnapshotRaw=v,a.currentOutputSnapshotResolved=y,a.currentWriteId=this.getNextWriteId_();var g=this.serverSyncTree_.applyUserOverwrite(t,y,a.currentWriteId,a.applyLocally);this.eventQueue_.raiseEventsForChangedPath(t,g),this.sendReadyTransactions_()}},hn.prototype.getLatestState_=function(t,e){return this.serverSyncTree_.calcCompleteEventCache(t,e)||Kt.EMPTY_NODE},hn.prototype.sendReadyTransactions_=function(t){var e=this;if(void 0===t&&(t=this.transactionQueueTree_),t||this.pruneCompletedTransactionsBelowNode_(t),null!==t.getValue()){var n=this.buildTransactionQueue_(t);s.assert(n.length>0,"Sending zero length transaction queue"),n.every((function(t){return t.status===gn.RUN}))&&this.sendTransactionQueue_(t.path(),n)}else t.hasChildren()&&t.forEachChild((function(t){e.sendReadyTransactions_(t)}))},hn.prototype.sendTransactionQueue_=function(t,e){for(var n=this,r=e.map((function(t){return t.currentWriteId})),i=this.getLatestState_(t,r),o=i,a=i.hash(),u=0;u=hn.MAX_TRANSACTION_RETRIES_)l=!0,f="maxretry",i=i.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0));else{var h=this.getLatestState_(u.path,o);u.currentInputSnapshot=h;var p=t[a].update(h.val());if(void 0!==p){vt("transaction failed: Data returned ",p,u.path);var d=Qt(p);"object"==typeof p&&null!=p&&s.contains(p,".priority")||(d=d.updatePriority(h.getPriority()));var v=u.currentWriteId,y=this.generateServerValues(),g=fe(d,h,y);u.currentOutputSnapshotRaw=d,u.currentOutputSnapshotResolved=g,u.currentWriteId=this.getNextWriteId_(),o.splice(o.indexOf(v),1),i=(i=i.concat(this.serverSyncTree_.applyUserOverwrite(u.path,g,u.currentWriteId,u.applyLocally))).concat(this.serverSyncTree_.ackUserWrite(v,!0))}else l=!0,f="nodata",i=i.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0))}if(this.eventQueue_.raiseEventsForChangedPath(e,i),i=[],l&&(t[a].status=gn.COMPLETED,n=t[a].unwatcher,setTimeout(n,Math.floor(0)),t[a].onComplete))if("nodata"===f){var m=new yn(this,t[a].path),_=t[a].currentInputSnapshot,b=new Zt(_,m,Lt);r.push(t[a].onComplete.bind(null,null,!1,b))}else r.push(t[a].onComplete.bind(null,new Error(f),!1,null))}for(this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_),a=0;a0?n:null)}t.forEachChild((function(t){e.pruneCompletedTransactionsBelowNode_(t)}))},hn.prototype.abortTransactions_=function(t){var e=this,n=this.getAncestorTransactionNode_(t).path(),r=this.transactionQueueTree_.subTree(t);return r.forEachAncestor((function(t){e.abortTransactionsOnNode_(t)})),this.abortTransactionsOnNode_(r),r.forEachDescendant((function(t){e.abortTransactionsOnNode_(t)})),n},hn.prototype.abortTransactionsOnNode_=function(t){var e=t.getValue();if(null!==e){for(var n=[],r=[],i=-1,o=0;o{"use strict";var r=n(34155),i=n(25108);Object.defineProperty(e,"__esModule",{value:!0});var o=n(70655),a=n(5752),s=n(14594),u=n(31313),c=n(73705),l=n(79730),f=function(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}(a),h={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},p=function(t){function e(e,n){var r=this;return(r=t.call(this,n)||this).code=e,r.message=n,r.name="FirebaseError",r.toString=function(){return r.name+": [code="+r.code+"]: "+r.message},r}return o.__extends(e,t),e}(Error),d=new s.Logger("@firebase/firestore");function v(){return d.logLevel}function y(t){for(var e=[],n=1;nt.length&&b(),void 0===n?n=t.length-e:n>t.length-e&&b(),this.segments=t,this.offset=e,this.t=n}return Object.defineProperty(t.prototype,"length",{get:function(){return this.t},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(e){return 0===t.i(this,e)},t.prototype.child=function(e){var n=this.segments.slice(this.offset,this.limit());return e instanceof t?e.forEach((function(t){n.push(t)})):n.push(e),this.o(n)},t.prototype.limit=function(){return this.offset+this.length},t.prototype.u=function(t){return t=void 0===t?1:t,this.o(this.segments,this.offset+t,this.length-t)},t.prototype.h=function(){return this.o(this.segments,this.offset,this.length-1)},t.prototype.l=function(){return this.segments[this.offset]},t.prototype._=function(){return this.get(this.length-1)},t.prototype.get=function(t){return this.segments[this.offset+t]},t.prototype.m=function(){return 0===this.length},t.prototype.T=function(t){if(t.lengtho)return 1}return t.lengthe.length?1:0},t}(),O=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o.__extends(e,t),e.prototype.o=function(t,n,r){return new e(t,n,r)},e.prototype.R=function(){return this.A().join("/")},e.prototype.toString=function(){return this.R()},e.g=function(){for(var t=[],n=0;n=0)throw new p(h.INVALID_ARGUMENT,"Invalid segment ("+a+"). Paths must not contain // in them.");r.push.apply(r,a.split("/").filter((function(t){return t.length>0})))}return new e(r)},e.P=function(){return new e([])},e}(C),k=/^[_a-zA-Z][_a-zA-Z0-9]*$/,x=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o.__extends(e,t),e.prototype.o=function(t,n,r){return new e(t,n,r)},e.V=function(t){return k.test(t)},e.prototype.R=function(){return this.A().map((function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),e.V(t)||(t="`"+t+"`"),t})).join(".")},e.prototype.toString=function(){return this.R()},e.prototype.p=function(){return 1===this.length&&"__name__"===this.get(0)},e.v=function(){return new e(["__name__"])},e.S=function(t){for(var n=[],r="",i=0,o=function(){if(0===r.length)throw new p(h.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");n.push(r),r=""},a=!1;i=2&&this.path.get(this.path.length-2)===t},t.prototype.isEqual=function(t){return null!==t&&0===O.i(this.path,t.path)},t.prototype.toString=function(){return this.path.toString()},t.i=function(t,e){return O.i(t.path,e.path)},t.F=function(t){return t.length%2==0},t.$=function(e){return new t(new O(e.slice()))},t}();function A(t,e){if(0!==e.length)throw new p(h.INVALID_ARGUMENT,"Function "+t+"() does not support arguments, but was called with "+Q(e.length,"argument")+".")}function N(t,e,n){if(e.length!==n)throw new p(h.INVALID_ARGUMENT,"Function "+t+"() requires "+Q(n,"argument")+", but was called with "+Q(e.length,"argument")+".")}function R(t,e,n){if(e.lengthr)throw new p(h.INVALID_ARGUMENT,"Function "+t+"() requires between "+n+" and "+r+" arguments, but was called with "+Q(e.length,"argument")+".")}function L(t,e,n,r){q(t,e,$(n)+" argument",r)}function M(t,e,n,r){void 0!==r&&L(t,e,n,r)}function j(t,e,n,r){q(t,e,n+" option",r)}function F(t,e,n,r){void 0!==r&&j(t,e,n,r)}function U(t,e,n,r,i){void 0!==r&&function(t,e,n,r,i){for(var o=[],a=0,s=i;a20&&(t=t.substring(0,20)+"..."),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";var e=function(t){if(t.constructor){var e=/function\s+([^\s(]+)\s*\(/.exec(t.constructor.toString());if(e&&e.length>1)return e[1]}return null}(t);return e?"a custom "+e+" object":"an object"}return"function"==typeof t?"a function":b()}function G(t,e,n){if(void 0===n)throw new p(h.INVALID_ARGUMENT,"Function "+t+"() requires a valid "+$(e)+" argument, but it was undefined.")}function z(t,e,n){S(e,(function(e,r){if(n.indexOf(e)<0)throw new p(h.INVALID_ARGUMENT,"Unknown option '"+e+"' passed to function "+t+"(). Available options: "+n.join(", "))}))}function H(t,e,n,r){var i=W(r);return new p(h.INVALID_ARGUMENT,"Function "+t+"() requires its "+$(n)+" argument to be a "+e+", but it was: "+i)}function K(t,e,n){if(n<=0)throw new p(h.INVALID_ARGUMENT,"Function "+t+"() requires its "+$(e)+" argument to be a positive number, but it was: "+n+".")}function $(t){switch(t){case 1:return"first";case 2:return"second";case 3:return"third";default:return t+"th"}}function Q(t,e){return t+" "+e+(1===t?"":"s")}function Y(t){var e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(var r=0;re?1:0}function Z(t,e,n){return t.length===e.length&&t.every((function(t,r){return n(t,e[r])}))}function tt(t){return t+"\0"}var et=function(){function t(t){this.M=t}return t.fromBase64String=function(e){return new t(atob(e))},t.fromUint8Array=function(e){return new t(function(t){for(var e="",n=0;n=1e9)throw new p(h.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new p(h.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new p(h.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}return t.now=function(){return t.fromMillis(Date.now())},t.fromDate=function(e){return t.fromMillis(e.getTime())},t.fromMillis=function(e){var n=Math.floor(e/1e3);return new t(n,1e6*(e-1e3*n))},t.prototype.toDate=function(){return new Date(this.toMillis())},t.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},t.prototype.Y=function(t){return this.seconds===t.seconds?J(this.nanoseconds,t.nanoseconds):J(this.seconds,t.seconds)},t.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},t.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},t.prototype.toJSON=function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}},t.prototype.valueOf=function(){var t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")},t}(),lt=function(){function t(t){this.timestamp=t}return t.J=function(e){return new t(e)},t.min=function(){return new t(new ct(0,0))},t.prototype.L=function(t){return this.timestamp.Y(t.timestamp)},t.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},t.prototype.X=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},t.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},t.prototype.Z=function(){return this.timestamp},t}();function ft(t){return null==t}function ht(t){return 0===t&&1/t==-1/0}function pt(t){return"number"==typeof t&&Number.isInteger(t)&&!ht(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}var dt=function(t,e,n,r,i,o,a){void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o=null),void 0===a&&(a=null),this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=o,this.endAt=a,this.tt=null};function vt(t,e,n,r,i,o,a){return void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o=null),void 0===a&&(a=null),new dt(t,e,n,r,i,o,a)}function yt(t){var e=E(t);if(null===e.tt){var n=e.path.R();null!==e.collectionGroup&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map((function(t){return function(t){return t.field.R()+t.op.toString()+se(t.value)}(t)})).join(","),n+="|ob:",n+=e.orderBy.map((function(t){return(e=t).field.R()+e.dir;var e})).join(","),ft(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=hr(e.startAt)),e.endAt&&(n+="|ub:",n+=hr(e.endAt)),e.tt=n}return e.tt}function gt(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(var n=0;n0&&(e=e.right)}return null},t.prototype.indexOf=function(t){for(var e=0,n=this.root;!n.m();){var r=this.i(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1},t.prototype.m=function(){return this.root.m()},Object.defineProperty(t.prototype,"size",{get:function(){return this.root.size},enumerable:!1,configurable:!0}),t.prototype.ct=function(){return this.root.ct()},t.prototype.ut=function(){return this.root.ut()},t.prototype.ht=function(t){return this.root.ht(t)},t.prototype.forEach=function(t){this.ht((function(e,n){return t(e,n),!1}))},t.prototype.toString=function(){var t=[];return this.ht((function(e,n){return t.push(e+":"+n),!1})),"{"+t.join(", ")+"}"},t.prototype.lt=function(t){return this.root.lt(t)},t.prototype._t=function(){return new Ct(this.root,null,this.i,!1)},t.prototype.ft=function(t){return new Ct(this.root,t,this.i,!1)},t.prototype.dt=function(){return new Ct(this.root,null,this.i,!0)},t.prototype.wt=function(t){return new Ct(this.root,t,this.i,!0)},t}(),Ct=function(){function t(t,e,n,r){this.Tt=r,this.Et=[];for(var i=1;!t.m();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.Tt?t.left:t.right;else{if(0===i){this.Et.push(t);break}this.Et.push(t),t=this.Tt?t.right:t.left}}return t.prototype.It=function(){var t=this.Et.pop(),e={key:t.key,value:t.value};if(this.Tt)for(t=t.left;!t.m();)this.Et.push(t),t=t.right;else for(t=t.right;!t.m();)this.Et.push(t),t=t.left;return e},t.prototype.At=function(){return this.Et.length>0},t.prototype.Rt=function(){if(0===this.Et.length)return null;var t=this.Et[this.Et.length-1];return{key:t.key,value:t.value}},t}(),Ot=function(){function t(e,n,r,i,o){this.key=e,this.value=n,this.color=null!=r?r:t.RED,this.left=null!=i?i:t.EMPTY,this.right=null!=o?o:t.EMPTY,this.size=this.left.size+1+this.right.size}return t.prototype.copy=function(e,n,r,i,o){return new t(null!=e?e:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=o?o:this.right)},t.prototype.m=function(){return!1},t.prototype.ht=function(t){return this.left.ht(t)||t(this.key,this.value)||this.right.ht(t)},t.prototype.lt=function(t){return this.right.lt(t)||t(this.key,this.value)||this.left.lt(t)},t.prototype.min=function(){return this.left.m()?this:this.left.min()},t.prototype.ct=function(){return this.min().key},t.prototype.ut=function(){return this.right.m()?this.key:this.right.ut()},t.prototype.ot=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.copy(null,null,null,r.left.ot(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.ot(t,e,n))).gt()},t.prototype.Pt=function(){if(this.left.m())return t.EMPTY;var e=this;return e.left.yt()||e.left.left.yt()||(e=e.Vt()),(e=e.copy(null,null,null,e.left.Pt(),null)).gt()},t.prototype.remove=function(e,n){var r,i=this;if(n(e,i.key)<0)i.left.m()||i.left.yt()||i.left.left.yt()||(i=i.Vt()),i=i.copy(null,null,null,i.left.remove(e,n),null);else{if(i.left.yt()&&(i=i.bt()),i.right.m()||i.right.yt()||i.right.left.yt()||(i=i.vt()),0===n(e,i.key)){if(i.right.m())return t.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.Pt())}i=i.copy(null,null,null,null,i.right.remove(e,n))}return i.gt()},t.prototype.yt=function(){return this.color},t.prototype.gt=function(){var t=this;return t.right.yt()&&!t.left.yt()&&(t=t.St()),t.left.yt()&&t.left.left.yt()&&(t=t.bt()),t.left.yt()&&t.right.yt()&&(t=t.Dt()),t},t.prototype.Vt=function(){var t=this.Dt();return t.right.left.yt()&&(t=(t=(t=t.copy(null,null,null,null,t.right.bt())).St()).Dt()),t},t.prototype.vt=function(){var t=this.Dt();return t.left.left.yt()&&(t=(t=t.bt()).Dt()),t},t.prototype.St=function(){var e=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)},t.prototype.bt=function(){var e=this.copy(null,null,t.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)},t.prototype.Dt=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},t.prototype.Ct=function(){var t=this.Nt();return Math.pow(2,t)<=this.size+1},t.prototype.Nt=function(){if(this.yt()&&this.left.yt())throw b();if(this.right.yt())throw b();var t=this.left.Nt();if(t!==this.right.Nt())throw b();return t+(this.yt()?0:1)},t}();Ot.EMPTY=null,Ot.RED=!0,Ot.at=!1,Ot.EMPTY=new(function(){function t(){this.size=0}return Object.defineProperty(t.prototype,"key",{get:function(){throw b()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){throw b()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){throw b()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){throw b()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){throw b()},enumerable:!1,configurable:!0}),t.prototype.copy=function(t,e,n,r,i){return this},t.prototype.ot=function(t,e,n){return new Ot(t,e)},t.prototype.remove=function(t,e){return this},t.prototype.m=function(){return!0},t.prototype.ht=function(t){return!1},t.prototype.lt=function(t){return!1},t.prototype.ct=function(){return null},t.prototype.ut=function(){return null},t.prototype.yt=function(){return!1},t.prototype.Ct=function(){return!0},t.prototype.Nt=function(){return 0},t}());var kt=function(){function t(t){this.i=t,this.data=new It(this.i)}return t.prototype.has=function(t){return null!==this.data.get(t)},t.prototype.first=function(){return this.data.ct()},t.prototype.last=function(){return this.data.ut()},Object.defineProperty(t.prototype,"size",{get:function(){return this.data.size},enumerable:!1,configurable:!0}),t.prototype.indexOf=function(t){return this.data.indexOf(t)},t.prototype.forEach=function(t){this.data.ht((function(e,n){return t(e),!1}))},t.prototype.Ft=function(t,e){for(var n=this.data.ft(t[0]);n.At();){var r=n.It();if(this.i(r.key,t[1])>=0)return;e(r.key)}},t.prototype.xt=function(t,e){var n;for(n=void 0!==e?this.data.ft(e):this.data._t();n.At();)if(!t(n.It().key))return},t.prototype.$t=function(t){var e=this.data.ft(t);return e.At()?e.It().key:null},t.prototype._t=function(){return new xt(this.data._t())},t.prototype.ft=function(t){return new xt(this.data.ft(t))},t.prototype.add=function(t){return this.copy(this.data.remove(t).ot(t,!0))},t.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},t.prototype.m=function(){return this.data.m()},t.prototype.kt=function(t){var e=this;return e.size0&&(this.le=!0,this.ue=t)},t.prototype.we=function(){var t=jt(),e=jt(),n=jt();return this.ce.forEach((function(r,i){switch(i){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:b()}})),new Gt(this.ue,this.he,t,e,n)},t.prototype.me=function(){this.le=!1,this.ce=Xt()},t.prototype.Te=function(t,e){this.le=!0,this.ce=this.ce.ot(t,e)},t.prototype.Ee=function(t){this.le=!0,this.ce=this.ce.remove(t)},t.prototype.Ie=function(){this.ae+=1},t.prototype.Ae=function(){this.ae-=1},t.prototype.Re=function(){this.le=!0,this.he=!0},t}(),Qt=function(){function t(t){this.ge=t,this.Pe=new Map,this.ye=At(),this.Ve=Yt(),this.pe=new kt(J)}return t.prototype.be=function(t){for(var e=0,n=t.ie;e0?t.targetIds.forEach(e):this.Pe.forEach((function(t,r){n.Fe(r)&&e(r)}))},t.prototype.$e=function(t){var e=t.targetId,n=t.oe.count,r=this.ke(e);if(r){var i=r.target;if(mt(i))if(0===n){var o=new P(i.path);this.Se(e,o,new Mn(o,lt.min()))}else w(1===n);else this.Me(e)!==n&&(this.xe(e),this.pe=this.pe.add(e))}},t.prototype.Oe=function(t){var e=this,n=new Map;this.Pe.forEach((function(r,i){var o=e.ke(i);if(o){if(r.te&&mt(o.target)){var a=new P(o.target.path);null!==e.ye.get(a)||e.Le(i,a)||e.Se(i,a,new Mn(a,t))}r.fe&&(n.set(i,r.we()),r.me())}}));var r=jt();this.Ve.forEach((function(t,n){var i=!0;n.xt((function(t){var n=e.ke(t);return!n||2===n.et||(i=!1,!1)})),i&&(r=r.add(t))}));var i=new Wt(t,n,this.pe,this.ye,r);return this.ye=At(),this.Ve=Yt(),this.pe=new kt(J),i},t.prototype.ve=function(t,e){if(this.Fe(t)){var n=this.Le(t,e.key)?2:0;this.Ne(t).Te(e.key,n),this.ye=this.ye.ot(e.key,e),this.Ve=this.Ve.ot(e.key,this.Be(e.key).add(t))}},t.prototype.Se=function(t,e,n){if(this.Fe(t)){var r=this.Ne(t);this.Le(t,e)?r.Te(e,1):r.Ee(e),this.Ve=this.Ve.ot(e,this.Be(e).delete(t)),n&&(this.ye=this.ye.ot(e,n))}},t.prototype.removeTarget=function(t){this.Pe.delete(t)},t.prototype.Me=function(t){var e=this.Ne(t).we();return this.ge.qe(t).size+e.ee.size-e.se.size},t.prototype.Ie=function(t){this.Ne(t).Ie()},t.prototype.Ne=function(t){var e=this.Pe.get(t);return e||(e=new $t,this.Pe.set(t,e)),e},t.prototype.Be=function(t){var e=this.Ve.get(t);return e||(e=new kt(J),this.Ve=this.Ve.ot(t,e)),e},t.prototype.Fe=function(t){var e=null!==this.ke(t);return e||y("WatchChangeAggregator","Detected inactive target",t),e},t.prototype.ke=function(t){var e=this.Pe.get(t);return e&&e._e?null:this.ge.Ue(t)},t.prototype.xe=function(t){var e=this;this.Pe.set(t,new $t),this.ge.qe(t).forEach((function(n){e.Se(t,n,null)}))},t.prototype.Le=function(t,e){return this.ge.qe(t).has(e)},t}();function Yt(){return new It(P.i)}function Xt(){return new It(P.i)}function Jt(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 Zt(t){var e=t.mapValue.fields.__previous_value__;return Jt(e)?Zt(e):e}function te(t){var e=ce(t.mapValue.fields.__local_write_time__.timestampValue);return new ct(e.seconds,e.nanos)}var ee=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function ne(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?Jt(t)?4:10:b()}function re(t,e){var n=ne(t);if(n!==ne(e))return!1;switch(n){case 0:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return te(t).isEqual(te(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;var n=ce(t.timestampValue),r=ce(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return fe(t.bytesValue).isEqual(fe(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return le(t.geoPointValue.latitude)===le(e.geoPointValue.latitude)&&le(t.geoPointValue.longitude)===le(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return le(t.integerValue)===le(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){var n=le(t.doubleValue),r=le(e.doubleValue);return n===r?ht(n)===ht(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return Z(t.arrayValue.values||[],e.arrayValue.values||[],re);case 10:return function(t,e){var n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(T(n)!==T(r))return!1;for(var i in n)if(n.hasOwnProperty(i)&&(void 0===r[i]||!re(n[i],r[i])))return!1;return!0}(t,e);default:return b()}}function ie(t,e){return void 0!==(t.values||[]).find((function(t){return re(t,e)}))}function oe(t,e){var n=ne(t),r=ne(e);if(n!==r)return J(n,r);switch(n){case 0:return 0;case 1:return J(t.booleanValue,e.booleanValue);case 2:return function(t,e){var n=le(t.integerValue||t.doubleValue),r=le(e.integerValue||e.doubleValue);return nr?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return ae(t.timestampValue,e.timestampValue);case 4:return ae(te(t),te(e));case 5:return J(t.stringValue,e.stringValue);case 6:return function(t,e){var n=fe(t),r=fe(e);return n.L(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){for(var n=t.split("/"),r=e.split("/"),i=0;i":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},be=function(t,e){this.U=t,this.Qe=e};function we(t){return{integerValue:""+t}}function Ee(t,e){if(t.Qe){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:ht(e)?"-0":e}}function Te(t,e){return pt(e)?we(e):Ee(t,e)}function Se(t,e){return t.Qe?new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+e.nanoseconds).slice(-9)+"Z":{seconds:""+e.seconds,nanos:e.nanoseconds}}function Ie(t,e){return t.Qe?e.toBase64():e.toUint8Array()}function Ce(t,e){return Se(t,e.Z())}function Oe(t){return w(!!t),lt.J(function(t){var e=ce(t);return new ct(e.seconds,e.nanos)}(t))}function ke(t,e){return function(t){return new O(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).R()}function xe(t){var e=O.g(t);return w(Je(e)),e}function Pe(t,e){return ke(t.U,e.path)}function Ae(t,e){var n=xe(e);return w(n.get(1)===t.U.projectId),w(!n.get(3)&&!t.U.database||n.get(3)===t.U.database),new P(Le(n))}function Ne(t,e){return ke(t.U,e)}function Re(t){var e=xe(t);return 4===e.length?O.P():Le(e)}function De(t){return new O(["projects",t.U.projectId,"databases",t.U.database]).R()}function Le(t){return w(t.length>4&&"documents"===t.get(4)),t.u(5)}function Me(t,e,n){return{name:Pe(t,e),fields:n.proto.mapValue.fields}}function je(t,e){var n;if(e instanceof Tn)n={update:Me(t,e.key,e.value)};else if(e instanceof xn)n={delete:Pe(t,e.key)};else if(e instanceof Sn)n={update:Me(t,e.key,e.data),updateMask:Xe(e.We)};else if(e instanceof Cn)n={transform:{document:Pe(t,e.key),fieldTransforms:e.fieldTransforms.map((function(t){return function(t,e){var n=e.transform;if(n instanceof rn)return{fieldPath:e.field.R(),setToServerValue:"REQUEST_TIME"};if(n instanceof on)return{fieldPath:e.field.R(),appendMissingElements:{values:n.elements}};if(n instanceof sn)return{fieldPath:e.field.R(),removeAllFromArray:{values:n.elements}};if(n instanceof cn)return{fieldPath:e.field.R(),increment:n.je};throw b()}(0,t)}))}};else{if(!(e instanceof Pn))return b();n={verify:Pe(t,e.key)}}return e.Ge.Ke||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:Ce(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:b()}(t,e.Ge)),n}function Fe(t,e){var n=e.currentDocument?function(t){return void 0!==t.updateTime?vn.updateTime(Oe(t.updateTime)):void 0!==t.exists?vn.exists(t.exists):vn.ze()}(e.currentDocument):vn.ze();if(e.update){e.update.name;var r=Ae(t,e.update.name),i=new An({mapValue:{fields:e.update.fields}});if(e.updateMask){var o=function(t){var e=t.fieldPaths||[];return new hn(e.map((function(t){return x.S(t)})))}(e.updateMask);return new Sn(r,i,o,n)}return new Tn(r,i,n)}if(e.delete){var a=Ae(t,e.delete);return new xn(a,n)}if(e.transform){var s=Ae(t,e.transform.document),u=e.transform.fieldTransforms.map((function(e){return function(t,e){var n=null;if("setToServerValue"in e)w("REQUEST_TIME"===e.setToServerValue),n=new rn;else if("appendMissingElements"in e){var r=e.appendMissingElements.values||[];n=new on(r)}else if("removeAllFromArray"in e){var i=e.removeAllFromArray.values||[];n=new sn(i)}else"increment"in e?n=new cn(t,e.increment):b();var o=x.S(e.fieldPath);return new pn(o,n)}(t,e)}));return w(!0===n.exists),new Cn(s,u)}if(e.verify){var c=Ae(t,e.verify);return new Pn(c,n)}return b()}function Ue(t,e){return{documents:[Ne(t,e.path)]}}function Ve(t,e){var n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Ne(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Ne(t,r.h()),n.structuredQuery.from=[{collectionId:r._()}]);var i=function(t){if(0!==t.length){var e=t.map((function(t){return function(t){if("=="===t.op){if(ye(t.value))return{unaryFilter:{field:Ke(t.field),op:"IS_NAN"}};if(ve(t.value))return{unaryFilter:{field:Ke(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(ye(t.value))return{unaryFilter:{field:Ke(t.field),op:"IS_NOT_NAN"}};if(ve(t.value))return{unaryFilter:{field:Ke(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Ke(t.field),op:He(t.op),value:t.value}}}(t)}));return 1===e.length?e[0]:{compositeFilter:{op:"AND",filters:e}}}}(e.filters);i&&(n.structuredQuery.where=i);var o=function(t){if(0!==t.length)return t.map((function(t){return function(t){return{field:Ke(t.field),direction:ze(t.dir)}}(t)}))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);var a=function(t,e){return t.Qe||ft(e)?e:{value:e}}(t,e.limit);return null!==a&&(n.structuredQuery.limit=a),e.startAt&&(n.structuredQuery.startAt=We(e.startAt)),e.endAt&&(n.structuredQuery.endAt=We(e.endAt)),n}function qe(t){var e=Re(t.parent),n=t.structuredQuery,r=n.from?n.from.length:0,i=null;if(r>0){w(1===r);var o=n.from[0];o.allDescendants?i=o.collectionId:e=e.child(o.collectionId)}var a=[];n.where&&(a=Be(n.where));var s=[];n.orderBy&&(s=n.orderBy.map((function(t){return function(t){return new vr($e(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t)})));var u=null;n.limit&&(u=function(t){var e;return ft(e="object"==typeof t?t.value:t)?null:e}(n.limit));var c=null;n.startAt&&(c=Ge(n.startAt));var l=null;return n.endAt&&(l=Ge(n.endAt)),Kn(Un(e,i,s,a,u,"F",c,l))}function Be(t){return t?void 0!==t.unaryFilter?[Ye(t)]:void 0!==t.fieldFilter?[Qe(t)]:void 0!==t.compositeFilter?t.compositeFilter.filters.map((function(t){return Be(t)})).reduce((function(t,e){return t.concat(e)})):b():[]}function We(t){return{before:t.before,values:t.position}}function Ge(t){var e=!!t.before,n=t.values||[];return new fr(n,e)}function ze(t){return me[t]}function He(t){return _e[t]}function Ke(t){return{fieldPath:t.R()}}function $e(t){return x.S(t.fieldPath)}function Qe(t){return nr.create($e(t.fieldFilter.field),function(t){switch(t){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return b()}}(t.fieldFilter.op),t.fieldFilter.value)}function Ye(t){switch(t.unaryFilter.op){case"IS_NAN":var e=$e(t.unaryFilter.field);return nr.create(e,"==",{doubleValue:NaN});case"IS_NULL":var n=$e(t.unaryFilter.field);return nr.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var r=$e(t.unaryFilter.field);return nr.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":var i=$e(t.unaryFilter.field);return nr.create(i,"!=",{nullValue:"NULL_VALUE"});default:return b()}}function Xe(t){var e=[];return t.fields.forEach((function(t){return e.push(t.R())})),{fieldPaths:e}}function Je(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}var Ze=function(){this.He=void 0};function tn(t,e,n){return t instanceof rn?function(t,e){var n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof on?an(t,e):t instanceof sn?un(t,e):function(t,e){var n=nn(t,e),r=ln(n)+ln(t.je);return pe(n)&&pe(t.je)?we(r):Ee(t.serializer,r)}(t,e)}function en(t,e,n){return t instanceof on?an(t,e):t instanceof sn?un(t,e):n}function nn(t,e){return t instanceof cn?pe(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}var rn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o.__extends(e,t),e}(Ze),on=function(t){function e(e){var n=this;return(n=t.call(this)||this).elements=e,n}return o.__extends(e,t),e}(Ze);function an(t,e){for(var n=fn(e),r=function(t){n.some((function(e){return re(e,t)}))||n.push(t)},i=0,o=t.elements;i0?t.on[0].field:null}function Gn(t){for(var e=0,n=t.filters;e0?e.on[e.on.length-1].dir:"asc";e.cn.push(new vr(x.v(),u))}}}return e.cn}function Kn(t){var e=E(t);if(!e.un)if("F"===e.an)e.un=vt(e.path,e.collectionGroup,Hn(e),e.filters,e.limit,e.startAt,e.endAt);else{for(var n=[],r=0,i=Hn(e);r0&&(e+=", orderBy: ["+t.orderBy.map((function(t){return(e=t).field.R()+" ("+e.dir+")";var e})).join(", ")+"]"),t.startAt&&(e+=", startAt: "+hr(t.startAt)),t.endAt&&(e+=", endAt: "+hr(t.endAt)),"Target("+e+")"}(Kn(t))+"; limitType="+t.an+")"}function tr(t,e){return function(t,e){var n=e.key.path;return null!==t.collectionGroup?e.key.N(t.collectionGroup)&&t.path.T(n):P.F(t.path)?t.path.isEqual(n):t.path.I(n)}(t,e)&&function(t,e){for(var n=0,r=t.on;n":return t>0;case">=":return t>=0;default:return b()}},e.prototype.hn=function(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0},e}((function(){})),rr=function(t){function e(e,n,r){var i=this;return(i=t.call(this,e,n,r)||this).key=P.C(r.referenceValue),i}return o.__extends(e,t),e.prototype.matches=function(t){var e=P.i(t.key,this.key);return this._n(e)},e}(nr),ir=function(t){function e(e,n){var r=this;return(r=t.call(this,e,"in",n)||this).keys=ar(0,n),r}return o.__extends(e,t),e.prototype.matches=function(t){return this.keys.some((function(e){return e.isEqual(t.key)}))},e}(nr),or=function(t){function e(e,n){var r=this;return(r=t.call(this,e,"not-in",n)||this).keys=ar(0,n),r}return o.__extends(e,t),e.prototype.matches=function(t){return!this.keys.some((function(e){return e.isEqual(t.key)}))},e}(nr);function ar(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((function(t){return P.C(t.referenceValue)}))}var sr=function(t){function e(e,n){return t.call(this,e,"array-contains",n)||this}return o.__extends(e,t),e.prototype.matches=function(t){var e=t.field(this.field);return de(e)&&ie(e.arrayValue,this.value)},e}(nr),ur=function(t){function e(e,n){return t.call(this,e,"in",n)||this}return o.__extends(e,t),e.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&ie(this.value.arrayValue,e)},e}(nr),cr=function(t){function e(e,n){return t.call(this,e,"not-in",n)||this}return o.__extends(e,t),e.prototype.matches=function(t){if(ie(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;var e=t.field(this.field);return null!==e&&!ie(this.value.arrayValue,e)},e}(nr),lr=function(t){function e(e,n){return t.call(this,e,"array-contains-any",n)||this}return o.__extends(e,t),e.prototype.matches=function(t){var e=this,n=t.field(this.field);return!(!de(n)||!n.arrayValue.values)&&n.arrayValue.values.some((function(t){return ie(e.value.arrayValue,t)}))},e}(nr),fr=function(t,e){this.position=t,this.before=e};function hr(t){return(t.before?"b":"a")+":"+t.position.map((function(t){return se(t)})).join(",")}function pr(t,e,n){for(var r=0,i=0;i0&&y("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.En+" ms, delay with jitter: "+n+" ms, last attempt: "+r+" ms ago)"),this.In=this.fn.yn(this.dn,i,(function(){return e.An=Date.now(),t()})),this.En*=this.mn,this.Enthis.Tn&&(this.En=this.Tn)},t.prototype.Vn=function(){null!==this.In&&(this.In.pn(),this.In=null)},t.prototype.cancel=function(){null!==this.In&&(this.In.cancel(),this.In=null)},t.prototype.Pn=function(){return(Math.random()-.5)*this.En},t}(),br=function(){function t(t){var e=this;this.bn=null,this.vn=null,this.result=void 0,this.error=void 0,this.Sn=!1,this.Dn=!1,t((function(t){e.Sn=!0,e.result=t,e.bn&&e.bn(t)}),(function(t){e.Sn=!0,e.error=t,e.vn&&e.vn(t)}))}return t.prototype.catch=function(t){return this.next(void 0,t)},t.prototype.next=function(e,n){var r=this;return this.Dn&&b(),this.Dn=!0,this.Sn?this.error?this.Cn(n,this.error):this.Nn(e,this.result):new t((function(t,i){r.bn=function(n){r.Nn(e,n).next(t,i)},r.vn=function(e){r.Cn(n,e).next(t,i)}}))},t.prototype.Fn=function(){var t=this;return new Promise((function(e,n){t.next(e,n)}))},t.prototype.xn=function(e){try{var n=e();return n instanceof t?n:t.resolve(n)}catch(e){return t.reject(e)}},t.prototype.Nn=function(e,n){return e?this.xn((function(){return e(n)})):t.resolve(n)},t.prototype.Cn=function(e,n){return e?this.xn((function(){return e(n)})):t.reject(n)},t.resolve=function(e){return new t((function(t,n){t(e)}))},t.reject=function(e){return new t((function(t,n){n(e)}))},t.$n=function(e){return new t((function(t,n){var r=0,i=0,o=!1;e.forEach((function(e){++r,e.next((function(){++i,o&&i===r&&t()}),(function(t){return n(t)}))})),o=!0,i===r&&t()}))},t.kn=function(e){for(var n=t.resolve(!1),r=function(e){n=n.next((function(n){return n?t.resolve(n):e()}))},i=0,o=e;i0||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||r||o)},t.Bn=function(){var t;return void 0!==r&&"YES"===(null===(t=r.env)||void 0===t?void 0:t.Un)},t.Qn=function(t,e){return t.store(e)},t.On=function(t){var e=t.match(/i(?:phone|pad|pod) os ([\d_]+)/i),n=e?e[1].split("_").slice(0,2).join("."):"-1";return Number(n)},t.qn=function(t){var e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)},t.prototype.Wn=function(t){return o.__awaiter(this,void 0,void 0,(function(){var e,n=this;return o.__generator(this,(function(r){switch(r.label){case 0:return this.db?[3,2]:(y("SimpleDb","Opening database:",this.name),e=this,[4,new Promise((function(e,r){var i=indexedDB.open(n.name,n.version);i.onsuccess=function(t){var n=t.target.result;e(n)},i.onblocked=function(){r(new Tr(t,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=function(e){var n=e.target.error;"VersionError"===n.name?r(new p(h.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):r(new Tr(t,n))},i.onupgradeneeded=function(t){y("SimpleDb",'Database "'+n.name+'" requires upgrade from version:',t.oldVersion);var e=t.target.result;n.Mn.createOrUpgrade(e,i.transaction,t.oldVersion,n.version).next((function(){y("SimpleDb","Database upgrade to version "+n.version+" complete")}))}}))]);case 1:e.db=r.sent(),r.label=2;case 2:return[2,(this.jn&&(this.db.onversionchange=function(t){return n.jn(t)}),this.db)]}}))}))},t.prototype.Kn=function(t){this.jn=t,this.db&&(this.db.onversionchange=function(e){return t(e)})},t.prototype.runTransaction=function(t,e,n,r){return o.__awaiter(this,void 0,void 0,(function(){var i,a,s,u,c;return o.__generator(this,(function(l){switch(l.label){case 0:i="readonly"===e,a=0,s=function(){var e,s,c,l,f;return o.__generator(this,(function(o){switch(o.label){case 0:++a,o.label=1;case 1:return o.trys.push([1,4,,5]),[4,u.Wn(t)];case 2:return u.db=o.sent(),e=Ir.open(u.db,t,i?"readonly":"readwrite",n),s=r(e).catch((function(t){return e.abort(t),br.reject(t)})).Fn(),c={},s.catch((function(){})),[4,e.Gn];case 3:return[2,(c.value=(o.sent(),s),c)];case 4:return l=o.sent(),f="FirebaseError"!==l.name&&a<3,y("SimpleDb","Transaction failed with error:",l.message,"Retrying:",f),u.close(),f?[3,5]:[2,{value:Promise.reject(l)}];case 5:return[2]}}))},u=this,l.label=1;case 1:return[5,s()];case 2:if("object"==typeof(c=l.sent()))return[2,c.value];l.label=3;case 3:return[3,1];case 4:return[2]}}))}))},t.prototype.close=function(){this.db&&this.db.close(),this.db=void 0},t}(),Er=function(){function t(t){this.zn=t,this.Hn=!1,this.Yn=null}return Object.defineProperty(t.prototype,"Sn",{get:function(){return this.Hn},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Jn",{get:function(){return this.Yn},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cursor",{set:function(t){this.zn=t},enumerable:!1,configurable:!0}),t.prototype.done=function(){this.Hn=!0},t.prototype.Xn=function(t){this.Yn=t},t.prototype.delete=function(){return Or(this.zn.delete())},t}(),Tr=function(t){function e(e,n){var r=this;return(r=t.call(this,h.UNAVAILABLE,"IndexedDB transaction '"+e+"' failed: "+n)||this).name="IndexedDbTransactionError",r}return o.__extends(e,t),e}(p);function Sr(t){return"IndexedDbTransactionError"===t.name}var Ir=function(){function t(t,e){var n=this;this.action=t,this.transaction=e,this.aborted=!1,this.Zn=new mr,this.transaction.oncomplete=function(){n.Zn.resolve()},this.transaction.onabort=function(){e.error?n.Zn.reject(new Tr(t,e.error)):n.Zn.resolve()},this.transaction.onerror=function(e){var r=xr(e.target.error);n.Zn.reject(new Tr(t,r))}}return t.open=function(e,n,r,i){try{return new t(n,e.transaction(i,r))}catch(e){throw new Tr(n,e)}},Object.defineProperty(t.prototype,"Gn",{get:function(){return this.Zn.promise},enumerable:!1,configurable:!0}),t.prototype.abort=function(t){t&&this.Zn.reject(t),this.aborted||(y("SimpleDb","Aborting transaction:",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())},t.prototype.store=function(t){var e=this.transaction.objectStore(t);return new Cr(e)},t}(),Cr=function(){function t(t){this.store=t}return t.prototype.put=function(t,e){var n;return void 0!==e?(y("SimpleDb","PUT",this.store.name,t,e),n=this.store.put(e,t)):(y("SimpleDb","PUT",this.store.name,"",t),n=this.store.put(t)),Or(n)},t.prototype.add=function(t){return y("SimpleDb","ADD",this.store.name,t,t),Or(this.store.add(t))},t.prototype.get=function(t){var e=this;return Or(this.store.get(t)).next((function(n){return void 0===n&&(n=null),y("SimpleDb","GET",e.store.name,t,n),n}))},t.prototype.delete=function(t){return y("SimpleDb","DELETE",this.store.name,t),Or(this.store.delete(t))},t.prototype.count=function(){return y("SimpleDb","COUNT",this.store.name),Or(this.store.count())},t.prototype.ts=function(t,e){var n=this.cursor(this.options(t,e)),r=[];return this.es(n,(function(t,e){r.push(e)})).next((function(){return r}))},t.prototype.ns=function(t,e){y("SimpleDb","DELETE ALL",this.store.name);var n=this.options(t,e);n.ss=!1;var r=this.cursor(n);return this.es(r,(function(t,e,n){return n.delete()}))},t.prototype.rs=function(t,e){var n;e?n=t:(n={},e=t);var r=this.cursor(n);return this.es(r,e)},t.prototype.os=function(t){var e=this.cursor({});return new br((function(n,r){e.onerror=function(t){var e=xr(t.target.error);r(e)},e.onsuccess=function(e){var r=e.target.result;r?t(r.primaryKey,r.value).next((function(t){t?r.continue():n()})):n()}}))},t.prototype.es=function(t,e){var n=[];return new br((function(r,i){t.onerror=function(t){i(t.target.error)},t.onsuccess=function(t){var i=t.target.result;if(i){var o=new Er(i),a=e(i.primaryKey,i.value,o);if(a instanceof br){var s=a.catch((function(t){return o.done(),br.reject(t)}));n.push(s)}o.Sn?r():null===o.Jn?i.continue():i.continue(o.Jn)}else r()}})).next((function(){return br.$n(n)}))},t.prototype.options=function(t,e){var n=void 0;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},t.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.ss?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},t}();function Or(t){return new br((function(e,n){t.onsuccess=function(t){var n=t.target.result;e(n)},t.onerror=function(t){var e=xr(t.target.error);n(e)}}))}var kr=!1;function xr(t){var e=wr.On(u.getUA());if(e>=12.2&&e<13){var n="An internal error was encountered in the Indexed Database server";if(t.message.indexOf(n)>=0){var r=new p("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 kr||(kr=!0,setTimeout((function(){throw r}),0)),r}}return t}function Pr(){return"undefined"!=typeof window?window:null}function Ar(){return"undefined"!=typeof document?document:null}var Nr=function(){function t(t,e,n,r,i){this.cs=t,this.dn=e,this.us=n,this.op=r,this.hs=i,this.ls=new mr,this.then=this.ls.promise.then.bind(this.ls.promise),this.ls.promise.catch((function(t){}))}return t._s=function(e,n,r,i,o){var a=new t(e,n,Date.now()+r,i,o);return a.start(r),a},t.prototype.start=function(t){var e=this;this.fs=setTimeout((function(){return e.ds()}),t)},t.prototype.pn=function(){return this.ds()},t.prototype.cancel=function(t){null!==this.fs&&(this.clearTimeout(),this.ls.reject(new p(h.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},t.prototype.ds=function(){var t=this;this.cs.ws((function(){return null!==t.fs?(t.clearTimeout(),t.op().then((function(e){return t.ls.resolve(e)}))):Promise.resolve()}))},t.prototype.clearTimeout=function(){null!==this.fs&&(this.hs(this),clearTimeout(this.fs),this.fs=null)},t}(),Rr=function(){function t(){var t=this;this.Ts=Promise.resolve(),this.Es=[],this.Is=!1,this.As=[],this.Rs=null,this.gs=!1,this.Ps=[],this.ys=new _r(this,"async_queue_retry"),this.Vs=function(){var e=Ar();e&&y("AsyncQueue","Visibility state changed to ",e.visibilityState),t.ys.Vn()};var e=Ar();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.Vs)}return Object.defineProperty(t.prototype,"ps",{get:function(){return this.Is},enumerable:!1,configurable:!0}),t.prototype.ws=function(t){this.enqueue(t)},t.prototype.bs=function(t){this.vs(),this.Ss(t)},t.prototype.Ds=function(){if(!this.Is){this.Is=!0;var t=Ar();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.Vs)}},t.prototype.enqueue=function(t){return this.vs(),this.Is?new Promise((function(t){})):this.Ss(t)},t.prototype.Cs=function(t){var e=this;this.ws((function(){return e.Es.push(t),e.Ns()}))},t.prototype.Ns=function(){return o.__awaiter(this,void 0,void 0,(function(){var t,e=this;return o.__generator(this,(function(n){switch(n.label){case 0:if(0===this.Es.length)return[3,5];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.Es[0]()];case 2:return n.sent(),this.Es.shift(),this.ys.reset(),[3,4];case 3:if(!Sr(t=n.sent()))throw t;return y("AsyncQueue","Operation failed with retryable error: "+t),[3,4];case 4:this.Es.length>0&&this.ys.gn((function(){return e.Ns()})),n.label=5;case 5:return[2]}}))}))},t.prototype.Ss=function(t){var e=this,n=this.Ts.then((function(){return e.gs=!0,t().catch((function(t){throw e.Rs=t,e.gs=!1,g("INTERNAL UNHANDLED ERROR: ",function(t){var e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}(t)),t})).then((function(t){return e.gs=!1,t}))}));return this.Ts=n,n},t.prototype.yn=function(t,e,n){var r=this;this.vs(),this.Ps.indexOf(t)>-1&&(e=0);var i=Nr._s(this,t,e,n,(function(t){return r.Fs(t)}));return this.As.push(i),i},t.prototype.vs=function(){this.Rs&&b()},t.prototype.xs=function(){},t.prototype.$s=function(){return o.__awaiter(this,void 0,void 0,(function(){var t;return o.__generator(this,(function(e){switch(e.label){case 0:return[4,t=this.Ts];case 1:e.sent(),e.label=2;case 2:if(t!==this.Ts)return[3,0];e.label=3;case 3:return[2]}}))}))},t.prototype.ks=function(t){for(var e=0,n=this.As;e=0&&(a.listeners.splice(s,1),i=0===a.listeners.length),i?[2,(n.Bs.delete(r),n.js(r))]:[2]}))}))}function Ur(t,e){for(var n=E(t),r=!1,i=0,o=e;i0)return!0;var e=this.zs&&this.zs.hasPendingWrites!==t.hasPendingWrites;return!(!t.jt&&!e)&&!0===this.options.includeMetadataChanges},t.prototype.Js=function(t){t=Bt.Gt(t.query,t.docs,t.Wt,t.fromCache),this.Gs=!0,this.Ks.next(t)},t}(),Wr=function(){function t(t){this.uid=t}return t.prototype.Zs=function(){return null!=this.uid},t.prototype.ti=function(){return this.Zs()?"uid:"+this.uid:"anonymous-user"},t.prototype.isEqual=function(t){return t.uid===this.uid},t}();Wr.UNAUTHENTICATED=new Wr(null),Wr.ei=new Wr("google-credentials-uid"),Wr.ni=new Wr("first-party-uid");var Gr=function(){function t(t,e){var n=this;this.previousValue=t,e&&(e.si=function(t){return n.ii(t)},this.ri=function(t){return e.oi(t)})}return t.prototype.ii=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},t.prototype.next=function(){var t=++this.previousValue;return this.ri&&this.ri(t),t},t}();function zr(t,e){return"firestore_clients_"+t+"_"+e}function Hr(t,e,n){var r="firestore_mutations_"+t+"_"+n;return e.Zs()&&(r+="_"+e.uid),r}function Kr(t,e){return"firestore_targets_"+t+"_"+e}Gr.ai=-1;var $r=function(){function t(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r}return t.ci=function(e,n,r){var i=JSON.parse(r),o="object"==typeof i&&-1!==["pending","acknowledged","rejected"].indexOf(i.state)&&(void 0===i.error||"object"==typeof i.error),a=void 0;return o&&i.error&&(o="string"==typeof i.error.message&&"string"==typeof i.error.code)&&(a=new p(i.error.code,i.error.message)),o?new t(e,n,i.state,a):(g("SharedClientState","Failed to parse mutation state for ID '"+n+"': "+r),null)},t.prototype.ui=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},t}(),Qr=function(){function t(t,e,n){this.targetId=t,this.state=e,this.error=n}return t.ci=function(e,n){var r=JSON.parse(n),i="object"==typeof r&&-1!==["not-current","current","rejected"].indexOf(r.state)&&(void 0===r.error||"object"==typeof r.error),o=void 0;return i&&r.error&&(i="string"==typeof r.error.message&&"string"==typeof r.error.code)&&(o=new p(r.error.code,r.error.message)),i?new t(e,r.state,o):(g("SharedClientState","Failed to parse target state for ID '"+e+"': "+n),null)},t.prototype.ui=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},t}(),Yr=function(){function t(t,e){this.clientId=t,this.activeTargetIds=e}return t.ci=function(e,n){for(var r=JSON.parse(n),i="object"==typeof r&&r.activeTargetIds instanceof Array,o=Ut(),a=0;i&&al.params.oo?(y("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+l.params.oo+" from "+e),r=l.params.oo):r=e,o=Date.now(),l.yo(t,r)})).next((function(r){return n=r,a=Date.now(),l.po(t,n,e)})).next((function(e){return i=e,u=Date.now(),l.bo(t,n)})).next((function(t){return c=Date.now(),v()<=s.LogLevel.DEBUG&&y("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(o-f)+"ms\n\tDetermined least recently used "+r+" in "+(a-o)+"ms\n\tRemoved "+i+" targets in "+(u-a)+"ms\n\tRemoved "+t+" documents in "+(c-u)+"ms\nTotal Duration: "+(c-f)+"ms"),br.resolve({Zr:!0,eo:r,no:i,so:t})}))},t}();function di(t){for(var e="",n=0;n0&&(e=yi(e)),e=vi(t.get(n),e);return yi(e)}function vi(t,e){for(var n=e,r=t.length,i=0;i=2),2===e)return w(""===t.charAt(0)&&""===t.charAt(1)),O.P();for(var n=e-2,r=[],i="",o=0;on)&&b(),t.charAt(a+1)){case"":var s=t.substring(o,a),u=void 0;0===i.length?u=s:(u=i+=s,i=""),r.push(u);break;case"":i+=t.substring(o,a),i+="\0";break;case"":i+=t.substring(o,a+1);break;default:b()}o=a+2}return new O(r)}var mi=function(t){this.Co=t};function _i(t,e){if(e.document)return function(t,e,n){var r=Ae(t,e.name),i=Oe(e.updateTime),o=new An({mapValue:{fields:e.fields}});return new Ln(r,i,o,{hasCommittedMutations:!!n})}(t.Co,e.document,!!e.hasCommittedMutations);if(e.noDocument){var n=P.$(e.noDocument.path),r=Si(e.noDocument.readTime);return new Mn(n,r,{hasCommittedMutations:!!e.hasCommittedMutations})}if(e.unknownDocument){var i=P.$(e.unknownDocument.path),o=Si(e.unknownDocument.version);return new jn(i,o)}return b()}function bi(t,e,n){var r=wi(n),i=e.key.path.h().A();if(e instanceof Ln){var o=function(t,e){return{name:Pe(t,e.key),fields:e.rn().mapValue.fields,updateTime:Se(t,e.version.Z())}}(t.Co,e),a=e.hasCommittedMutations;return new Yi(null,null,o,a,r,i)}if(e instanceof Mn){var s=e.key.path.A(),u=Ti(e.version),c=e.hasCommittedMutations;return new Yi(null,new $i(s,u),null,c,r,i)}if(e instanceof jn){var l=e.key.path.A(),f=Ti(e.version);return new Yi(new Qi(l,f),null,null,!0,r,i)}return b()}function wi(t){var e=t.Z();return[e.seconds,e.nanoseconds]}function Ei(t){var e=new ct(t[0],t[1]);return lt.J(e)}function Ti(t){var e=t.Z();return new Wi(e.seconds,e.nanoseconds)}function Si(t){var e=new ct(t.seconds,t.nanoseconds);return lt.J(e)}function Ii(t,e){var n=(e.baseMutations||[]).map((function(e){return Fe(t.Co,e)})),r=e.mutations.map((function(e){return Fe(t.Co,e)})),i=ct.fromMillis(e.localWriteTimeMs);return new ei(e.batchId,i,n,r)}function Ci(t){var e,n,r=Si(t.readTime),i=void 0!==t.lastLimboFreeSnapshotVersion?Si(t.lastLimboFreeSnapshotVersion):lt.min();return void 0!==t.query.documents?(w(1===(n=t.query).documents.length),e=Kn(Vn(Re(n.documents[0])))):e=qe(t.query),new wt(e,t.targetId,0,t.lastListenSequenceNumber,r,i,et.fromBase64String(t.resumeToken))}function Oi(t,e){var n,r=Ti(e.nt),i=Ti(e.lastLimboFreeSnapshotVersion);n=mt(e.target)?Ue(t.Co,e.target):Ve(t.Co,e.target);var o=e.resumeToken.toBase64();return new Ji(e.targetId,yt(e.target),r,o,e.sequenceNumber,i,n)}var ki=function(){function t(t,e,n,r){this.userId=t,this.serializer=e,this.Dr=n,this.No=r,this.Fo={}}return t.xo=function(e,n,r,i){return w(""!==e.uid),new t(e.Zs()?e.uid:"",n,r,i)},t.prototype.$o=function(t){var e=!0,n=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return Ai(t).rs({index:Hi.userMutationsIndex,range:n},(function(t,n,r){e=!1,r.done()})).next((function(){return e}))},t.prototype.ko=function(t,e,n,r){var i=this,o=Ni(t),a=Ai(t);return a.add({}).next((function(s){w("number"==typeof s);for(var u=new ei(s,e,n,r),c=function(t,e,n){var r=n.baseMutations.map((function(e){return je(t.Co,e)})),i=n.mutations.map((function(e){return je(t.Co,e)}));return new Hi(e,n.batchId,n.ar.toMillis(),r,i)}(i.serializer,i.userId,u),l=[],f=new kt((function(t,e){return J(t.R(),e.R())})),h=0,p=r;h=r),o=Ii(n.serializer,e)),i.done()})).next((function(){return o}))},t.prototype.qo=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),n=-1;return Ai(t).rs({index:Hi.userMutationsIndex,range:e,reverse:!0},(function(t,e,r){n=e.batchId,r.done()})).next((function(){return n}))},t.prototype.Uo=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return Ai(t).ts(Hi.userMutationsIndex,n).next((function(t){return t.map((function(t){return Ii(e.serializer,t)}))}))},t.prototype.Nr=function(t,e){var n=this,r=Ki.prefixForPath(this.userId,e.path),i=IDBKeyRange.lowerBound(r),o=[];return Ni(t).rs({range:i},(function(r,i,a){var s=r[0],u=r[1],c=r[2],l=gi(u);if(s===n.userId&&e.path.isEqual(l))return Ai(t).get(c).next((function(t){if(!t)throw b();w(t.userId===n.userId),o.push(Ii(n.serializer,t))}));a.done()})).next((function(){return o}))},t.prototype.Or=function(t,e){var n=this,r=new kt(J),i=[];return e.forEach((function(e){var o=Ki.prefixForPath(n.userId,e.path),a=IDBKeyRange.lowerBound(o),s=Ni(t).rs({range:a},(function(t,i,o){var a=t[0],s=t[1],u=t[2],c=gi(s);a===n.userId&&e.path.isEqual(c)?r=r.add(u):o.done()}));i.push(s)})),br.$n(i).next((function(){return n.Qo(t,r)}))},t.prototype.Wr=function(t,e){var n=this,r=e.path,i=r.length+1,o=Ki.prefixForPath(this.userId,r),a=IDBKeyRange.lowerBound(o),s=new kt(J);return Ni(t).rs({range:a},(function(t,e,o){var a=t[0],u=t[1],c=t[2],l=gi(u);a===n.userId&&r.T(l)?l.length===i&&(s=s.add(c)):o.done()})).next((function(){return n.Qo(t,s)}))},t.prototype.Qo=function(t,e){var n=this,r=[],i=[];return e.forEach((function(e){i.push(Ai(t).get(e).next((function(t){if(null===t)throw b();w(t.userId===n.userId),r.push(Ii(n.serializer,t))})))})),br.$n(i).next((function(){return r}))},t.prototype.Wo=function(t,e){var n=this;return Pi(t.jo,this.userId,e).next((function(r){return t.pr((function(){n.Ko(e.batchId)})),br.forEach(r,(function(e){return n.No.Go(t,e)}))}))},t.prototype.Ko=function(t){delete this.Fo[t]},t.prototype.zo=function(t){var e=this;return this.$o(t).next((function(n){if(!n)return br.resolve();var r=IDBKeyRange.lowerBound(Ki.prefixForUser(e.userId)),i=[];return Ni(t).rs({range:r},(function(t,n,r){if(t[0]===e.userId){var o=gi(t[1]);i.push(o)}else r.done()})).next((function(){w(0===i.length)}))}))},t.prototype.Ho=function(t,e){return xi(t,this.userId,e)},t.prototype.Yo=function(t){var e=this;return Ri(t).get(this.userId).next((function(t){return t||new zi(e.userId,-1,"")}))},t}();function xi(t,e,n){var r=Ki.prefixForPath(e,n.path),i=r[1],o=IDBKeyRange.lowerBound(r),a=!1;return Ni(t).rs({range:o,ss:!0},(function(t,n,r){var o=t[0],s=t[1];t[2],o===e&&s===i&&(a=!0),r.done()})).next((function(){return a}))}function Pi(t,e,n){var r=t.store(Hi.store),i=t.store(Ki.store),o=[],a=IDBKeyRange.only(n.batchId),s=0,u=r.rs({range:a},(function(t,e,n){return s++,n.delete()}));o.push(u.next((function(){w(1===s)})));for(var c=[],l=0,f=n.mutations;l=0&&r<=10);var o=new Ir("createOrUpgrade",e);n<1&&r>=1&&(function(t){t.createObjectStore(Gi.store)}(t),function(t){t.createObjectStore(zi.store,{keyPath:zi.keyPath}),t.createObjectStore(Hi.store,{keyPath:Hi.keyPath,autoIncrement:!0}).createIndex(Hi.userMutationsIndex,Hi.userMutationsKeyPath,{unique:!0}),t.createObjectStore(Ki.store)}(t),no(t),function(t){t.createObjectStore(Yi.store)}(t));var a=br.resolve();return n<3&&r>=3&&(0!==n&&(function(t){t.deleteObjectStore(Zi.store),t.deleteObjectStore(Ji.store),t.deleteObjectStore(to.store)}(t),no(t)),a=a.next((function(){return function(t){var e=t.store(to.store),n=new to(0,0,lt.min().Z(),0);return e.put(to.key,n)}(o)}))),n<4&&r>=4&&(0!==n&&(a=a.next((function(){return function(t,e){return e.store(Hi.store).ts().next((function(n){t.deleteObjectStore(Hi.store),t.createObjectStore(Hi.store,{keyPath:Hi.keyPath,autoIncrement:!0}).createIndex(Hi.userMutationsIndex,Hi.userMutationsKeyPath,{unique:!0});var r=e.store(Hi.store),i=n.map((function(t){return r.put(t)}));return br.$n(i)}))}(t,o)}))),a=a.next((function(){!function(t){t.createObjectStore(ro.store,{keyPath:ro.keyPath})}(t)}))),n<5&&r>=5&&(a=a.next((function(){return i.removeAcknowledgedMutations(o)}))),n<6&&r>=6&&(a=a.next((function(){return function(t){t.createObjectStore(Xi.store)}(t),i.addDocumentGlobal(o)}))),n<7&&r>=7&&(a=a.next((function(){return i.ensureSequenceNumbers(o)}))),n<8&&r>=8&&(a=a.next((function(){return i.createCollectionParentIndex(t,o)}))),n<9&&r>=9&&(a=a.next((function(){!function(t){t.objectStoreNames.contains("remoteDocumentChanges")&&t.deleteObjectStore("remoteDocumentChanges")}(t),function(t){var e=t.objectStore(Yi.store);e.createIndex(Yi.readTimeIndex,Yi.readTimeIndexPath,{unique:!1}),e.createIndex(Yi.collectionReadTimeIndex,Yi.collectionReadTimeIndexPath,{unique:!1})}(e)}))),n<10&&r>=10&&(a=a.next((function(){return i.rewriteCanonicalIds(o)}))),a},t.prototype.addDocumentGlobal=function(t){var e=0;return t.store(Yi.store).rs((function(t,n){e+=Ui(n)})).next((function(){var n=new Xi(e);return t.store(Xi.store).put(Xi.key,n)}))},t.prototype.removeAcknowledgedMutations=function(t){var e=this,n=t.store(zi.store),r=t.store(Hi.store);return n.ts().next((function(n){return br.forEach(n,(function(n){var i=IDBKeyRange.bound([n.userId,-1],[n.userId,n.lastAcknowledgedBatchId]);return r.ts(Hi.userMutationsIndex,i).next((function(r){return br.forEach(r,(function(r){w(r.userId===n.userId);var i=Ii(e.serializer,r);return Pi(t,n.userId,i).next((function(){}))}))}))}))}))},t.prototype.ensureSequenceNumbers=function(t){var e=t.store(Zi.store),n=t.store(Yi.store);return t.store(to.store).get(to.key).next((function(t){var r=[];return n.rs((function(n,i){var o=new O(n),a=function(t){return[0,di(t)]}(o);r.push(e.get(a).next((function(n){return n?br.resolve():function(n){return e.put(new Zi(0,di(n),t.highestListenSequenceNumber))}(o)})))})).next((function(){return br.$n(r)}))}))},t.prototype.createCollectionParentIndex=function(t,e){t.createObjectStore(eo.store,{keyPath:eo.keyPath});var n=e.store(eo.store),r=new qi,i=function(t){if(r.add(t)){var e=t._(),i=t.h();return n.put({collectionId:e,parent:di(i)})}};return e.store(Yi.store).rs({ss:!0},(function(t,e){var n=new O(t);return i(n.h())})).next((function(){return e.store(Ki.store).rs({ss:!0},(function(t,e){t[0];var n=t[1],r=(t[2],gi(n));return i(r.h())}))}))},t.prototype.rewriteCanonicalIds=function(t){var e=this,n=t.store(Ji.store);return n.rs((function(t,r){var i=Ci(r),o=Oi(e.serializer,i);return n.put(o)}))},t}(),Wi=function(t,e){this.seconds=t,this.nanoseconds=e},Gi=function(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n};Gi.store="owner",Gi.key="owner";var zi=function(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n};zi.store="mutationQueues",zi.keyPath="userId";var Hi=function(t,e,n,r,i){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i};Hi.store="mutations",Hi.keyPath="batchId",Hi.userMutationsIndex="userMutationsIndex",Hi.userMutationsKeyPath=["userId","batchId"];var Ki=function(){function t(){}return t.prefixForUser=function(t){return[t]},t.prefixForPath=function(t,e){return[t,di(e)]},t.key=function(t,e,n){return[t,di(e),n]},t}();Ki.store="documentMutations",Ki.PLACEHOLDER=new Ki;var $i=function(t,e){this.path=t,this.readTime=e},Qi=function(t,e){this.path=t,this.version=e},Yi=function(t,e,n,r,i,o){this.unknownDocument=t,this.noDocument=e,this.document=n,this.hasCommittedMutations=r,this.readTime=i,this.parentPath=o};Yi.store="remoteDocuments",Yi.readTimeIndex="readTimeIndex",Yi.readTimeIndexPath="readTime",Yi.collectionReadTimeIndex="collectionReadTimeIndex",Yi.collectionReadTimeIndexPath=["parentPath","readTime"];var Xi=function(t){this.byteSize=t};Xi.store="remoteDocumentGlobal",Xi.key="remoteDocumentGlobalKey";var Ji=function(t,e,n,r,i,o,a){this.targetId=t,this.canonicalId=e,this.readTime=n,this.resumeToken=r,this.lastListenSequenceNumber=i,this.lastLimboFreeSnapshotVersion=o,this.query=a};Ji.store="targets",Ji.keyPath="targetId",Ji.queryTargetsIndexName="queryTargetsIndex",Ji.queryTargetsKeyPath=["canonicalId","targetId"];var Zi=function(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n};Zi.store="targetDocuments",Zi.keyPath=["targetId","path"],Zi.documentTargetsIndex="documentTargetsIndex",Zi.documentTargetsKeyPath=["path","targetId"];var to=function(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r};to.key="targetGlobalKey",to.store="targetGlobal";var eo=function(t,e){this.collectionId=t,this.parent=e};function no(t){t.createObjectStore(Zi.store,{keyPath:Zi.keyPath}).createIndex(Zi.documentTargetsIndex,Zi.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(Ji.store,{keyPath:Ji.keyPath}).createIndex(Ji.queryTargetsIndexName,Ji.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(to.store)}eo.store="collectionParents",eo.keyPath=["collectionId","parent"];var ro=function(t,e,n,r){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=r};ro.store="clientMetadata",ro.keyPath="clientId";var io=o.__spreadArrays(o.__spreadArrays(o.__spreadArrays([zi.store,Hi.store,Ki.store,Yi.store,Ji.store,Gi.store,to.store,Zi.store],[ro.store]),[Xi.store]),[eo.store]),oo=function(){function t(){this.la=new qi}return t.prototype.Mo=function(t,e){var n=this;if(!this.la.has(e)){var r=e._(),i=e.h();t.pr((function(){n.la.add(e)}));var o={collectionId:r,parent:di(i)};return ao(t).put(o)}return br.resolve()},t.prototype.Qr=function(t,e){var n=[],r=IDBKeyRange.bound([e,""],[tt(e),""],!1,!0);return ao(t).ts(r).next((function(t){for(var r=0,i=t;ri.highestListenSequenceNumber&&(i.highestListenSequenceNumber=e),r.Ta(t,i)}))},t.prototype.Ra=function(t,e){var n=this;return this.ga(t,e).next((function(){return n.ma(t).next((function(r){return r.targetCount+=1,n.Pa(e,r),n.Ta(t,r)}))}))},t.prototype.ya=function(t,e){return this.ga(t,e)},t.prototype.Va=function(t,e){var n=this;return this.pa(t,e.targetId).next((function(){return co(t).delete(e.targetId)})).next((function(){return n.ma(t)})).next((function(e){return w(e.targetCount>0),e.targetCount-=1,n.Ta(t,e)}))},t.prototype.po=function(t,e,n){var r=this,i=0,o=[];return co(t).rs((function(a,s){var u=Ci(s);u.sequenceNumber<=e&&null===n.get(u.targetId)&&(i++,o.push(r.Va(t,u)))})).next((function(){return br.$n(o)})).next((function(){return i}))},t.prototype.Ce=function(t,e){return co(t).rs((function(t,n){var r=Ci(n);e(r)}))},t.prototype.ma=function(t){return lo(t).get(to.key).next((function(t){return w(null!==t),t}))},t.prototype.Ta=function(t,e){return lo(t).put(to.key,e)},t.prototype.ga=function(t,e){return co(t).put(Oi(this.serializer,e))},t.prototype.Pa=function(t,e){var n=!1;return t.targetId>e.highestTargetId&&(e.highestTargetId=t.targetId,n=!0),t.sequenceNumber>e.highestListenSequenceNumber&&(e.highestListenSequenceNumber=t.sequenceNumber,n=!0),n},t.prototype.ba=function(t){return this.ma(t).next((function(t){return t.targetCount}))},t.prototype.va=function(t,e){var n=yt(e),r=IDBKeyRange.bound([n,Number.NEGATIVE_INFINITY],[n,Number.POSITIVE_INFINITY]),i=null;return co(t).rs({range:r,index:Ji.queryTargetsIndexName},(function(t,n,r){var o=Ci(n);gt(e,o.target)&&(i=o,r.done())})).next((function(){return i}))},t.prototype.Sa=function(t,e,n){var r=this,i=[],o=fo(t);return e.forEach((function(e){var a=di(e.path);i.push(o.put(new Zi(n,a))),i.push(r.No.Da(t,n,e))})),br.$n(i)},t.prototype.Ca=function(t,e,n){var r=this,i=fo(t);return br.forEach(e,(function(e){var o=di(e.path);return br.$n([i.delete([n,o]),r.No.Na(t,n,e)])}))},t.prototype.pa=function(t,e){var n=fo(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return n.delete(r)},t.prototype.Fa=function(t,e){var n=IDBKeyRange.bound([e],[e+1],!1,!0),r=fo(t),i=jt();return r.rs({range:n,ss:!0},(function(t,e,n){var r=gi(t[1]),o=new P(r);i=i.add(o)})).next((function(){return i}))},t.prototype.Ho=function(t,e){var n=di(e.path),r=IDBKeyRange.bound([n],[tt(n)],!1,!0),i=0;return fo(t).rs({index:Zi.documentTargetsIndex,ss:!0,range:r},(function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())})).next((function(){return i>0}))},t.prototype.Ue=function(t,e){return co(t).get(e).next((function(t){return t?Ci(t):null}))},t}();function co(t){return vo.Qn(t,Ji.store)}function lo(t){return vo.Qn(t,to.store)}function fo(t){return vo.Qn(t,Zi.store)}var ho="Failed to obtain exclusive access to the persistence layer. To allow shared access, make sure to invoke `enablePersistence()` with `synchronizeTabs:true` in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",po=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).jo=e,r.xa=n,r}return o.__extends(e,t),e}(oi),vo=function(){function t(e,n,r,i,o,a,s,u,c,l){if(this.allowTabSynchronization=e,this.persistenceKey=n,this.clientId=r,this.fn=o,this.window=a,this.document=s,this.$a=c,this.ka=l,this.Ma=null,this.Oa=!1,this.isPrimary=!1,this.networkEnabled=!0,this.La=null,this.inForeground=!1,this.Ba=null,this.qa=null,this.Ua=Number.NEGATIVE_INFINITY,this.Qa=function(t){return Promise.resolve()},!t.Ln())throw new p(h.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.No=new mo(this,i),this.Wa=n+"main",this.serializer=new mi(u),this.ja=new wr(this.Wa,10,new Bi(this.serializer)),this.Ka=new uo(this.No,this.serializer),this.Dr=new oo,this.vr=function(t,e){return new Di(t,e)}(this.serializer,this.Dr),this.window&&this.window.localStorage?this.Ga=this.window.localStorage:(this.Ga=null,!1===l&&g("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}return t.Qn=function(t,e){if(t instanceof po)return wr.Qn(t.jo,e);throw b()},t.prototype.start=function(){var t=this;return this.za().then((function(){if(!t.isPrimary&&!t.allowTabSynchronization)throw new p(h.FAILED_PRECONDITION,ho);return t.Ha(),t.Ya(),t.Ja(),t.runTransaction("getHighestListenSequenceNumber","readonly",(function(e){return t.Ka.Ia(e)}))})).then((function(e){t.Ma=new Gr(e,t.$a)})).then((function(){t.Oa=!0})).catch((function(e){return t.ja&&t.ja.close(),Promise.reject(e)}))},t.prototype.Xa=function(t){var e=this;return this.Qa=function(n){return o.__awaiter(e,void 0,void 0,(function(){return o.__generator(this,(function(e){return this.Ei?[2,t(n)]:[2]}))}))},t(this.isPrimary)},t.prototype.Za=function(t){var e=this;this.ja.Kn((function(n){return o.__awaiter(e,void 0,void 0,(function(){return o.__generator(this,(function(e){switch(e.label){case 0:return null===n.newVersion?[4,t()]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))}))},t.prototype.tc=function(t){var e=this;this.networkEnabled!==t&&(this.networkEnabled=t,this.fn.ws((function(){return o.__awaiter(e,void 0,void 0,(function(){return o.__generator(this,(function(t){switch(t.label){case 0:return this.Ei?[4,this.za()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))})))},t.prototype.za=function(){var t=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",(function(e){return go(e).put(new ro(t.clientId,Date.now(),t.networkEnabled,t.inForeground)).next((function(){if(t.isPrimary)return t.ec(e).next((function(e){e||(t.isPrimary=!1,t.fn.Cs((function(){return t.Qa(!1)})))}))})).next((function(){return t.nc(e)})).next((function(n){return t.isPrimary&&!n?t.sc(e).next((function(){return!1})):!!n&&t.ic(e).next((function(){return!0}))}))})).catch((function(e){if(Sr(e))return y("IndexedDbPersistence","Failed to extend owner lease: ",e),t.isPrimary;if(!t.allowTabSynchronization)throw e;return y("IndexedDbPersistence","Releasing owner lease after error during lease refresh",e),!1})).then((function(e){t.isPrimary!==e&&t.fn.Cs((function(){return t.Qa(e)})),t.isPrimary=e}))},t.prototype.ec=function(t){var e=this;return yo(t).get(Gi.key).next((function(t){return br.resolve(e.rc(t))}))},t.prototype.oc=function(t){return go(t).delete(this.clientId)},t.prototype.ac=function(){return o.__awaiter(this,void 0,void 0,(function(){var e,n,r,i,a=this;return o.__generator(this,(function(o){switch(o.label){case 0:return!this.isPrimary||this.cc(this.Ua,18e5)?[3,2]:(this.Ua=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",(function(e){var n=t.Qn(e,ro.store);return n.ts().next((function(t){var e=a.uc(t,18e5),r=t.filter((function(t){return-1===e.indexOf(t)}));return br.forEach(r,(function(t){return n.delete(t.clientId)})).next((function(){return r}))}))})).catch((function(){return[]}))]);case 1:if(e=o.sent(),this.Ga)for(n=0,r=e;nn&&(g("Detected an update time that is in the future: "+t+" > "+n),1))},t.prototype.Ha=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.Ba=function(){t.fn.ws((function(){return t.inForeground="visible"===t.document.visibilityState,t.za()}))},this.document.addEventListener("visibilitychange",this.Ba),this.inForeground="visible"===this.document.visibilityState)},t.prototype.fc=function(){this.Ba&&(this.document.removeEventListener("visibilitychange",this.Ba),this.Ba=null)},t.prototype.Ya=function(){var t,e=this;"function"==typeof(null===(t=this.window)||void 0===t?void 0:t.addEventListener)&&(this.La=function(){e._c(),e.fn.ws((function(){return e.Di()}))},this.window.addEventListener("unload",this.La))},t.prototype.dc=function(){this.La&&(this.window.removeEventListener("unload",this.La),this.La=null)},t.prototype.lc=function(t){var e;try{var n=null!==(null===(e=this.Ga)||void 0===e?void 0:e.getItem(this.hc(t)));return y("IndexedDbPersistence","Client '"+t+"' "+(n?"is":"is not")+" zombied in LocalStorage"),n}catch(t){return g("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},t.prototype._c=function(){if(this.Ga)try{this.Ga.setItem(this.hc(this.clientId),String(Date.now()))}catch(t){g("Failed to set zombie client id.",t)}},t.prototype.wc=function(){if(this.Ga)try{this.Ga.removeItem(this.hc(this.clientId))}catch(t){}},t.prototype.hc=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},t}();function yo(t){return vo.Qn(t,Gi.store)}function go(t){return vo.Qn(t,ro.store)}var mo=function(){function t(t,e){this.db=t,this.wo=new pi(this,e)}return t.prototype.Po=function(t){var e=this.Rc(t);return this.db.Tc().ba(t).next((function(t){return e.next((function(e){return t+e}))}))},t.prototype.Rc=function(t){var e=0;return this.Vo(t,(function(t){e++})).next((function(){return e}))},t.prototype.Ce=function(t,e){return this.db.Tc().Ce(t,e)},t.prototype.Vo=function(t,e){return this.gc(t,(function(t,n){return e(n)}))},t.prototype.Da=function(t,e,n){return _o(t,n)},t.prototype.Na=function(t,e,n){return _o(t,n)},t.prototype.po=function(t,e,n){return this.db.Tc().po(t,e,n)},t.prototype.Go=function(t,e){return _o(t,e)},t.prototype.Pc=function(t,e){return function(t,e){var n=!1;return Ri(t).os((function(r){return xi(t,r,e).next((function(t){return t&&(n=!0),br.resolve(!t)}))})).next((function(){return n}))}(t,e)},t.prototype.bo=function(t,e){var n=this,r=this.db.Ec().ra(),i=[],o=0;return this.gc(t,(function(a,s){if(s<=e){var u=n.Pc(t,a).next((function(e){if(!e)return o++,r.Rr(t,a).next((function(){return r.Ar(a),fo(t).delete([0,di(a.path)])}))}));i.push(u)}})).next((function(){return br.$n(i)})).next((function(){return r.apply(t)})).next((function(){return o}))},t.prototype.removeTarget=function(t,e){var n=e.st(t.xa);return this.db.Tc().ya(t,n)},t.prototype.yc=function(t,e){return _o(t,e)},t.prototype.gc=function(t,e){var n,r=fo(t),i=Gr.ai;return r.rs({index:Zi.documentTargetsIndex},(function(t,r){var o=t[0],a=(t[1],r.path),s=r.sequenceNumber;0===o?(i!==Gr.ai&&e(new P(gi(n)),i),i=s,n=a):i=Gr.ai})).next((function(){i!==Gr.ai&&e(new P(gi(n)),i)}))},t.prototype.So=function(t){return this.db.Ec().aa(t)},t}();function _o(t,e){return fo(t).put(function(t,e){return new Zi(0,di(t.path),e)}(e,t.xa))}function bo(t,e){var n=t.projectId;return t.j||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}var wo=function(){function t(t,e,n){this.persistence=t,this.Vc=e,this.bc=new It(J),this.vc=new ut((function(t){return yt(t)}),gt),this.Sc=lt.min(),this.Sr=t.mc(n),this.Dc=t.Ec(),this.Ka=t.Tc(),this.Cc=new ai(this.Dc,this.Sr,this.persistence.Ic()),this.Vc.Nc(this.Cc)}return t.prototype.Io=function(t){var e=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",(function(n){return t.vo(n,e.bc)}))},t}();function Eo(t,e){var n=E(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(function(t){var r=e.batch.keys(),i=n.Dc.ra({oa:!0});return function(t,e,n,r){var i=n.batch,o=i.keys(),a=br.resolve();return o.forEach((function(t){a=a.next((function(){return r.Rr(e,t)})).next((function(e){var o=e,a=n.dr.get(t);w(null!==a),(!o||o.version.L(a)<0)&&(o=i.cr(t,o,n))&&r.Er(o,n._r)}))})),a.next((function(){return t.Sr.Wo(e,i)}))}(n,t,e,i).next((function(){return i.apply(t)})).next((function(){return n.Sr.zo(t)})).next((function(){return n.Cc.kr(t,r)}))}))}function To(t){var e=E(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(function(t){return e.Ka.Ea(t)}))}function So(t,e){var n=E(t),r=e.nt,i=n.bc;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(function(t){var o=n.Dc.ra({oa:!0});i=n.bc;var a=[];e.zt.forEach((function(e,o){var s=i.get(o);if(s){a.push(n.Ka.Ca(t,e.se,o).next((function(){return n.Ka.Sa(t,e.ee,o)})));var u=e.resumeToken;if(u.O()>0){var c=s.it(u,r).st(t.xa);i=i.ot(o,c),function(t,e,n){return w(e.resumeToken.O()>0),0===t.resumeToken.O()||e.nt.X()-t.nt.X()>=3e8||n.ee.size+n.ne.size+n.se.size>0}(s,c,e)&&a.push(n.Ka.ya(t,c))}}}));var s=At(),u=jt();if(e.Yt.forEach((function(t,e){u=u.add(t)})),a.push(o.getEntries(t,u).next((function(i){e.Yt.forEach((function(u,c){var l=i.get(u);c instanceof Mn&&c.version.isEqual(lt.min())?(o.Ar(u,r),s=s.ot(u,c)):null==l||c.version.L(l.version)>0||0===c.version.L(l.version)&&l.hasPendingWrites?(o.Er(c,r),s=s.ot(u,c)):y("LocalStore","Ignoring outdated watch update for ",u,". Current version:",l.version," Watch version:",c.version),e.Jt.has(u)&&a.push(n.persistence.No.yc(t,u))}))}))),!r.isEqual(lt.min())){var c=n.Ka.Ea(t).next((function(e){return n.Ka.Aa(t,t.xa,r)}));a.push(c)}return br.$n(a).next((function(){return o.apply(t)})).next((function(){return n.Cc.Mr(t,s)}))})).then((function(t){return n.bc=i,t}))}function Io(t,e){var n=E(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(function(t){return void 0===e&&(e=-1),n.Sr.Bo(t,e)}))}function Co(t,e){var n=E(t);return n.persistence.runTransaction("Allocate target","readwrite",(function(t){var r;return n.Ka.va(t,e).next((function(i){return i?(r=i,br.resolve(r)):n.Ka.wa(t).next((function(i){return r=new wt(e,i,0,t.xa),n.Ka.Ra(t,r).next((function(){return r}))}))}))})).then((function(t){var r=n.bc.get(t.targetId);return(null===r||t.nt.L(r.nt)>0)&&(n.bc=n.bc.ot(t.targetId,t),n.vc.set(e,t.targetId)),t}))}function Oo(t,e,n){return o.__awaiter(this,void 0,void 0,(function(){var r,i,a,s;return o.__generator(this,(function(o){switch(o.label){case 0:r=E(t),i=r.bc.get(e),a=n?"readwrite":"readwrite-primary",o.label=1;case 1:return o.trys.push([1,4,,5]),n?[3,3]:[4,r.persistence.runTransaction("Release target",a,(function(t){return r.persistence.No.removeTarget(t,i)}))];case 2:o.sent(),o.label=3;case 3:return[3,5];case 4:if(!Sr(s=o.sent()))throw s;return y("LocalStore","Failed to update sequence numbers for target "+e+": "+s),[3,5];case 5:return r.bc=r.bc.remove(e),r.vc.delete(i.target),[2]}}))}))}function ko(t,e,n){var r=E(t),i=lt.min(),o=jt();return r.persistence.runTransaction("Execute query","readonly",(function(t){return function(t,e,n){var r=E(t),i=r.vc.get(n);return void 0!==i?br.resolve(r.bc.get(i)):r.Ka.va(e,n)}(r,t,Kn(e)).next((function(e){if(e)return i=e.lastLimboFreeSnapshotVersion,r.Ka.Fa(t,e.targetId).next((function(t){o=t}))})).next((function(){return r.Vc.Lr(t,e,n?i:lt.min(),n?o:jt())})).next((function(t){return{documents:t,Fc:o}}))}))}function xo(t,e){var n=E(t),r=E(n.Ka),i=n.bc.get(e);return i?Promise.resolve(i.target):n.persistence.runTransaction("Get target data","readonly",(function(t){return r.Ue(t,e).next((function(t){return t?t.target:null}))}))}function Po(t){var e=E(t);return e.persistence.runTransaction("Get new document changes","readonly",(function(t){return function(t,e,n){var r=E(t),i=At(),o=wi(n),a=ji(e),s=IDBKeyRange.lowerBound(o,!0);return a.rs({index:Yi.readTimeIndex,range:s},(function(t,e){var n=_i(r.serializer,e);i=i.ot(n.key,n),o=e.readTime})).next((function(){return{xc:i,readTime:Ei(o)}}))}(e.Dc,t,e.Sc)})).then((function(t){var n=t.xc,r=t.readTime;return e.Sc=r,n}))}function Ao(t){return o.__awaiter(this,void 0,void 0,(function(){var e;return o.__generator(this,(function(n){return[2,(e=E(t)).persistence.runTransaction("Synchronize last document change read time","readonly",(function(t){return function(t){var e=ji(t),n=lt.min();return e.rs({index:Yi.readTimeIndex,reverse:!0},(function(t,e,r){e.readTime&&(n=Ei(e.readTime)),r.done()})).next((function(){return n}))}(t)})).then((function(t){e.Sc=t}))]}))}))}function No(t){return o.__awaiter(this,void 0,void 0,(function(){return o.__generator(this,(function(e){if(t.code!==h.FAILED_PRECONDITION||t.message!==ii)throw t;return y("LocalStore","Unexpectedly lost primary lease"),[2]}))}))}var Ro=function(){function t(){this.$c=new kt(Do.kc),this.Mc=new kt(Do.Oc)}return t.prototype.m=function(){return this.$c.m()},t.prototype.Da=function(t,e){var n=new Do(t,e);this.$c=this.$c.add(n),this.Mc=this.Mc.add(n)},t.prototype.Lc=function(t,e){var n=this;t.forEach((function(t){return n.Da(t,e)}))},t.prototype.Na=function(t,e){this.Bc(new Do(t,e))},t.prototype.qc=function(t,e){var n=this;t.forEach((function(t){return n.Na(t,e)}))},t.prototype.Uc=function(t){var e=this,n=new P(new O([])),r=new Do(n,t),i=new Do(n,t+1),o=[];return this.Mc.Ft([r,i],(function(t){e.Bc(t),o.push(t.key)})),o},t.prototype.Qc=function(){var t=this;this.$c.forEach((function(e){return t.Bc(e)}))},t.prototype.Bc=function(t){this.$c=this.$c.delete(t),this.Mc=this.Mc.delete(t)},t.prototype.Wc=function(t){var e=new P(new O([])),n=new Do(e,t),r=new Do(e,t+1),i=jt();return this.Mc.Ft([n,r],(function(t){i=i.add(t.key)})),i},t.prototype.Ho=function(t){var e=new Do(t,0),n=this.$c.$t(e);return null!==n&&t.isEqual(n.key)},t}(),Do=function(){function t(t,e){this.key=t,this.jc=e}return t.kc=function(t,e){return P.i(t.key,e.key)||J(t.jc,e.jc)},t.Oc=function(t,e){return J(t.jc,e.jc)||P.i(t.key,e.key)},t}(),Lo=function(t,e){this.user=e,this.type="OAuth",this.Kc={},this.Kc.Authorization="Bearer "+t},Mo=function(){function t(){this.Gc=null}return t.prototype.getToken=function(){return Promise.resolve(null)},t.prototype.zc=function(){},t.prototype.Hc=function(t){this.Gc=t,t(Wr.UNAUTHENTICATED)},t.prototype.Yc=function(){this.Gc=null},t}(),jo=function(){function t(t){var e=this;this.Jc=null,this.currentUser=Wr.UNAUTHENTICATED,this.Xc=!1,this.Zc=0,this.Gc=null,this.forceRefresh=!1,this.Jc=function(){e.Zc++,e.currentUser=e.tu(),e.Xc=!0,e.Gc&&e.Gc(e.currentUser)},this.Zc=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.Jc):(this.Jc(null),t.get().then((function(t){e.auth=t,e.Jc&&e.auth.addAuthTokenListener(e.Jc)}),(function(){})))}return t.prototype.getToken=function(){var t=this,e=this.Zc,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then((function(n){return t.Zc!==e?(y("FirebaseCredentialsProvider","getToken aborted due to token change."),t.getToken()):n?(w("string"==typeof n.accessToken),new Lo(n.accessToken,t.currentUser)):null})):Promise.resolve(null)},t.prototype.zc=function(){this.forceRefresh=!0},t.prototype.Hc=function(t){this.Gc=t,this.Xc&&t(this.currentUser)},t.prototype.Yc=function(){this.auth&&this.auth.removeAuthTokenListener(this.Jc),this.Jc=null,this.Gc=null},t.prototype.tu=function(){var t=this.auth&&this.auth.getUid();return w(null===t||"string"==typeof t),new Wr(t)},t}(),Fo=function(){function t(t,e){this.eu=t,this.nu=e,this.type="FirstParty",this.user=Wr.ni}return Object.defineProperty(t.prototype,"Kc",{get:function(){var t={"X-Goog-AuthUser":this.nu},e=this.eu.auth.getAuthHeaderValueForFirstParty([]);return e&&(t.Authorization=e),t},enumerable:!1,configurable:!0}),t}(),Uo=function(){function t(t,e){this.eu=t,this.nu=e}return t.prototype.getToken=function(){return Promise.resolve(new Fo(this.eu,this.nu))},t.prototype.Hc=function(t){t(Wr.ni)},t.prototype.Yc=function(){},t.prototype.zc=function(){},t}(),Vo=function(){function t(t,e,n,r,i,o){this.fn=t,this.su=n,this.iu=r,this.ru=i,this.listener=o,this.state=0,this.ou=0,this.au=null,this.stream=null,this.ys=new _r(t,e)}return t.prototype.cu=function(){return 1===this.state||2===this.state||4===this.state},t.prototype.uu=function(){return 2===this.state},t.prototype.start=function(){3!==this.state?this.auth():this.hu()},t.prototype.stop=function(){return o.__awaiter(this,void 0,void 0,(function(){return o.__generator(this,(function(t){switch(t.label){case 0:return this.cu()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t.prototype.lu=function(){this.state=0,this.ys.reset()},t.prototype._u=function(){var t=this;this.uu()&&null===this.au&&(this.au=this.fn.yn(this.su,6e4,(function(){return t.fu()})))},t.prototype.du=function(t){this.wu(),this.stream.send(t)},t.prototype.fu=function(){return o.__awaiter(this,void 0,void 0,(function(){return o.__generator(this,(function(t){return this.uu()?[2,this.close(0)]:[2]}))}))},t.prototype.wu=function(){this.au&&(this.au.cancel(),this.au=null)},t.prototype.close=function(t,e){return o.__awaiter(this,void 0,void 0,(function(){return o.__generator(this,(function(n){switch(n.label){case 0:return this.wu(),this.ys.cancel(),this.ou++,3!==t?this.ys.reset():e&&e.code===h.RESOURCE_EXHAUSTED?(g(e.toString()),g("Using maximum backoff delay to prevent overloading the backend."),this.ys.Rn()):e&&e.code===h.UNAUTHENTICATED&&this.ru.zc(),null!==this.stream&&(this.mu(),this.stream.close(),this.stream=null),this.state=t,[4,this.listener.Tu(e)];case 1:return n.sent(),[2]}}))}))},t.prototype.mu=function(){},t.prototype.auth=function(){var t=this;this.state=1;var e=this.Eu(this.ou),n=this.ou;this.ru.getToken().then((function(e){t.ou===n&&t.Iu(e)}),(function(n){e((function(){var e=new p(h.UNKNOWN,"Fetching auth token failed: "+n.message);return t.Au(e)}))}))},t.prototype.Iu=function(t){var e=this,n=this.Eu(this.ou);this.stream=this.Ru(t),this.stream.gu((function(){n((function(){return e.state=2,e.listener.gu()}))})),this.stream.Tu((function(t){n((function(){return e.Au(t)}))})),this.stream.onMessage((function(t){n((function(){return e.onMessage(t)}))}))},t.prototype.hu=function(){var t=this;this.state=4,this.ys.gn((function(){return o.__awaiter(t,void 0,void 0,(function(){return o.__generator(this,(function(t){return this.state=0,this.start(),[2]}))}))}))},t.prototype.Au=function(t){return y("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},t.prototype.Eu=function(t){var e=this;return function(n){e.fn.ws((function(){return e.ou===t?n():(y("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())}))}},t}(),qo=function(t){function e(e,n,r,i,o){var a=this;return(a=t.call(this,e,"listen_stream_connection_backoff","listen_stream_idle",n,r,o)||this).serializer=i,a}return o.__extends(e,t),e.prototype.Ru=function(t){return this.iu.Pu("Listen",t)},e.prototype.onMessage=function(t){this.ys.reset();var e=function(t,e){var n;if("targetChange"in e){e.targetChange;var r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:b()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],o=function(t,e){return t.Qe?(w(void 0===e||"string"==typeof e),et.fromBase64String(e||"")):(w(void 0===e||e instanceof Uint8Array),et.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),a=e.targetChange.cause,s=a&&function(t){var e=void 0===t.code?h.UNKNOWN:St(t.code);return new p(e,t.message||"")}(a);n=new Kt(r,i,o,s||null)}else if("documentChange"in e){e.documentChange;var u=e.documentChange;u.document,u.document.name,u.document.updateTime;var c=Ae(t,u.document.name),l=Oe(u.document.updateTime),f=new An({mapValue:{fields:u.document.fields}}),d=new Ln(c,l,f,{}),v=u.targetIds||[],y=u.removedTargetIds||[];n=new zt(v,y,d.key,d)}else if("documentDelete"in e){e.documentDelete;var g=e.documentDelete;g.document;var m=Ae(t,g.document),_=g.readTime?Oe(g.readTime):lt.min(),E=new Mn(m,_),T=g.removedTargetIds||[];n=new zt([],T,E.key,E)}else if("documentRemove"in e){e.documentRemove;var S=e.documentRemove;S.document;var I=Ae(t,S.document),C=S.removedTargetIds||[];n=new zt([],C,I,null)}else{if(!("filter"in e))return b();e.filter;var O=e.filter;O.targetId;var k=O.count||0,x=new Et(k),P=O.targetId;n=new Ht(P,x)}return n}(this.serializer,t),n=function(t){if(!("targetChange"in t))return lt.min();var e=t.targetChange;return e.targetIds&&e.targetIds.length?lt.min():e.readTime?Oe(e.readTime):lt.min()}(t);return this.listener.yu(e,n)},e.prototype.Vu=function(t){var e={};e.database=De(this.serializer),e.addTarget=function(t,e){var n,r=e.target;return(n=mt(r)?{documents:Ue(t,r)}:{query:Ve(t,r)}).targetId=e.targetId,e.resumeToken.O()>0&&(n.resumeToken=Ie(t,e.resumeToken)),n}(this.serializer,t);var n=function(t,e){var n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return b()}}(0,e.et);return null==n?null:{"goog-listen-tags":n}}(this.serializer,t);n&&(e.labels=n),this.du(e)},e.prototype.pu=function(t){var e={};e.database=De(this.serializer),e.removeTarget=t,this.du(e)},e}(Vo),Bo=function(t){function e(e,n,r,i,o){var a=this;return(a=t.call(this,e,"write_stream_connection_backoff","write_stream_idle",n,r,o)||this).serializer=i,a.bu=!1,a}return o.__extends(e,t),Object.defineProperty(e.prototype,"vu",{get:function(){return this.bu},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.bu=!1,this.lastStreamToken=void 0,t.prototype.start.call(this)},e.prototype.mu=function(){this.bu&&this.Su([])},e.prototype.Ru=function(t){return this.iu.Pu("Write",t)},e.prototype.onMessage=function(t){if(w(!!t.streamToken),this.lastStreamToken=t.streamToken,this.bu){this.ys.reset();var e=function(t,e){return t&&t.length>0?(w(void 0!==e),t.map((function(t){return function(t,e){var n=t.updateTime?Oe(t.updateTime):Oe(e);n.isEqual(lt.min())&&(n=Oe(e));var r=null;return t.transformResults&&t.transformResults.length>0&&(r=t.transformResults),new dn(n,r)}(t,e)}))):[]}(t.writeResults,t.commitTime),n=Oe(t.commitTime);return this.listener.Du(n,e)}return w(!t.writeResults||0===t.writeResults.length),this.bu=!0,this.listener.Cu()},e.prototype.Nu=function(){var t={};t.database=De(this.serializer),this.du(t)},e.prototype.Su=function(t){var e=this,n={streamToken:this.lastStreamToken,writes:t.map((function(t){return je(e.serializer,t)}))};this.du(n)},e}(Vo),Wo=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).credentials=e,i.iu=n,i.serializer=r,i.Fu=!1,i}return o.__extends(e,t),e.prototype.xu=function(){if(this.Fu)throw new p(h.FAILED_PRECONDITION,"The client has already been terminated.")},e.prototype.$u=function(t,e,n){var r=this;return this.xu(),this.credentials.getToken().then((function(i){return r.iu.$u(t,e,n,i)})).catch((function(t){throw t.code===h.UNAUTHENTICATED&&r.credentials.zc(),t}))},e.prototype.ku=function(t,e,n){var r=this;return this.xu(),this.credentials.getToken().then((function(i){return r.iu.ku(t,e,n,i)})).catch((function(t){throw t.code===h.UNAUTHENTICATED&&r.credentials.zc(),t}))},e.prototype.terminate=function(){this.Fu=!1},e}((function(){})),Go=function(){function t(t,e){this.cs=t,this.di=e,this.state="Unknown",this.Mu=0,this.Ou=null,this.Lu=!0}return t.prototype.Bu=function(){var t=this;0===this.Mu&&(this.qu("Unknown"),this.Ou=this.cs.yn("online_state_timeout",1e4,(function(){return t.Ou=null,t.Uu("Backend didn't respond within 10 seconds."),t.qu("Offline"),Promise.resolve()})))},t.prototype.Qu=function(t){"Online"===this.state?this.qu("Unknown"):(this.Mu++,this.Mu>=1&&(this.Wu(),this.Uu("Connection failed 1 times. Most recent error: "+t.toString()),this.qu("Offline")))},t.prototype.set=function(t){this.Wu(),this.Mu=0,"Online"===t&&(this.Lu=!1),this.qu(t)},t.prototype.qu=function(t){t!==this.state&&(this.state=t,this.di(t))},t.prototype.Uu=function(t){var e="Could not reach Cloud Firestore backend. "+t+"\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.";this.Lu?(g(e),this.Lu=!1):y("OnlineStateTracker",e)},t.prototype.Wu=function(){null!==this.Ou&&(this.Ou.cancel(),this.Ou=null)},t}(),zo=function(t,e,n,r,i){var a=this;this.ju=t,this.Ku=e,this.cs=n,this.Gu={},this.zu=[],this.Hu=new Map,this.Yu=new Set,this.Ju=[],this.Xu=i,this.Xu.Zu((function(t){n.ws((function(){return o.__awaiter(a,void 0,void 0,(function(){return o.__generator(this,(function(t){switch(t.label){case 0:return ea(this)?(y("RemoteStore","Restarting streams for network reachability change."),[4,function(t){return o.__awaiter(this,void 0,void 0,(function(){var e;return o.__generator(this,(function(n){switch(n.label){case 0:return(e=E(t)).Yu.add(4),[4,Ko(e)];case 1:return n.sent(),e.th.set("Unknown"),e.Yu.delete(4),[4,Ho(e)];case 2:return n.sent(),[2]}}))}))}(this)]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))}))})),this.th=new Go(n,r)};function Ho(t){return o.__awaiter(this,void 0,void 0,(function(){var e,n;return o.__generator(this,(function(r){switch(r.label){case 0:if(!ea(t))return[3,4];e=0,n=t.Ju,r.label=1;case 1:return e0}function ea(t){return 0===E(t).Yu.size}function na(t){t.eh=void 0}function ra(t){return o.__awaiter(this,void 0,void 0,(function(){return o.__generator(this,(function(e){return t.Hu.forEach((function(e,n){Xo(t,e)})),[2]}))}))}function ia(t,e){return o.__awaiter(this,void 0,void 0,(function(){return o.__generator(this,(function(n){return na(t),ta(t)?(t.th.Qu(e),Zo(t)):t.th.set("Unknown"),[2]}))}))}function oa(t,e,n){return o.__awaiter(this,void 0,void 0,(function(){var r,i,a;return o.__generator(this,(function(s){switch(s.label){case 0:if(t.th.set("Online"),!(e instanceof Kt&&2===e.state&&e.cause))return[3,6];s.label=1;case 1:return s.trys.push([1,3,,5]),[4,function(t,e){return o.__awaiter(this,void 0,void 0,(function(){var n,r,i,a;return o.__generator(this,(function(o){switch(o.label){case 0:n=e.cause,r=0,i=e.targetIds,o.label=1;case 1:return r=0?[4,function(t,e){var n=t.eh.Oe(e);return n.zt.forEach((function(n,r){if(n.resumeToken.O()>0){var i=t.Hu.get(r);i&&t.Hu.set(r,i.it(n.resumeToken,e))}})),n.Ht.forEach((function(e){var n=t.Hu.get(e);if(n){t.Hu.set(e,n.it(et.B,n.nt)),Jo(t,e);var r=new wt(n.target,e,1,n.sequenceNumber);Xo(t,r)}})),t.Gu.sh(n)}(t,n)]:[3,10];case 9:s.sent(),s.label=10;case 10:return[3,13];case 11:return y("RemoteStore","Failed to raise snapshot:",a=s.sent()),[4,aa(t,a)];case 12:return s.sent(),[3,13];case 13:return[2]}}))}))}function aa(t,e,n){return o.__awaiter(this,void 0,void 0,(function(){var r=this;return o.__generator(this,(function(i){switch(i.label){case 0:if(!Sr(e))throw e;return t.Yu.add(1),[4,Ko(t)];case 1:return i.sent(),t.th.set("Offline"),n||(n=function(){return To(t.ju)}),t.cs.Cs((function(){return o.__awaiter(r,void 0,void 0,(function(){return o.__generator(this,(function(e){switch(e.label){case 0:return y("RemoteStore","Retrying IndexedDB access"),[4,n()];case 1:return e.sent(),t.Yu.delete(1),[4,Ho(t)];case 2:return e.sent(),[2]}}))}))})),[2]}}))}))}function sa(t,e){return e().catch((function(n){return aa(t,n,e)}))}function ua(t){return o.__awaiter(this,void 0,void 0,(function(){var e,n,r,i,a;return o.__generator(this,(function(o){switch(o.label){case 0:e=E(t),n=ga(e),r=e.zu.length>0?e.zu[e.zu.length-1].batchId:-1,o.label=1;case 1:if(!function(t){return ea(t)&&t.zu.length<10}(e))return[3,7];o.label=2;case 2:return o.trys.push([2,4,,6]),[4,Io(e.ju,r)];case 3:return null===(i=o.sent())?(0===e.zu.length&&n._u(),[3,7]):(r=i.batchId,function(t,e){t.zu.push(e);var n=ga(t);n.uu()&&n.vu&&n.Su(e.mutations)}(e,i),[3,6]);case 4:return a=o.sent(),[4,aa(e,a)];case 5:return o.sent(),[3,6];case 6:return[3,1];case 7:return ca(e)&&la(e),[2]}}))}))}function ca(t){return ea(t)&&!ga(t).cu()&&t.zu.length>0}function la(t){ga(t).start()}function fa(t){return o.__awaiter(this,void 0,void 0,(function(){return o.__generator(this,(function(e){return ga(t).Nu(),[2]}))}))}function ha(t){return o.__awaiter(this,void 0,void 0,(function(){var e,n,r,i;return o.__generator(this,(function(o){for(e=ga(t),n=0,r=t.zu;n0&&(y("RemoteStore","Stopping write stream with "+t.zu.length+" pending writes"),t.zu=[]),e.label=4;case 4:return[2]}}))}))}))),t.ah}var ma=function(t){this.key=t},_a=function(t){this.key=t},ba=function(){function t(t,e){this.query=t,this.uh=e,this.hh=null,this.te=!1,this.lh=jt(),this.Wt=jt(),this._h=er(t),this.fh=new Vt(this._h)}return Object.defineProperty(t.prototype,"dh",{get:function(){return this.uh},enumerable:!1,configurable:!0}),t.prototype.wh=function(t,e){var n=this,r=e?e.mh:new qt,i=e?e.fh:this.fh,o=e?e.Wt:this.Wt,a=i,s=!1,u=qn(this.query)&&i.size===this.query.limit?i.last():null,c=Bn(this.query)&&i.size===this.query.limit?i.first():null;if(t.ht((function(t,e){var l=i.get(t),f=e instanceof Ln?e:null;f&&(f=tr(n.query,f)?f:null);var h=!!l&&n.Wt.has(l.key),p=!!f&&(f.Je||n.Wt.has(f.key)&&f.hasCommittedMutations),d=!1;l&&f?l.data().isEqual(f.data())?h!==p&&(r.track({type:3,doc:f}),d=!0):n.Th(l,f)||(r.track({type:2,doc:f}),d=!0,(u&&n._h(f,u)>0||c&&n._h(f,c)<0)&&(s=!0)):!l&&f?(r.track({type:0,doc:f}),d=!0):l&&!f&&(r.track({type:1,doc:l}),d=!0,(u||c)&&(s=!0)),d&&(f?(a=a.add(f),o=p?o.add(t):o.delete(t)):(a=a.delete(t),o=o.delete(t)))})),qn(this.query)||Bn(this.query))for(;a.size>this.query.limit;){var l=qn(this.query)?a.last():a.first();a=a.delete(l.key),o=o.delete(l.key),r.track({type:1,doc:l})}return{fh:a,mh:r,Eh:s,Wt:o}},t.prototype.Th=function(t,e){return t.Je&&e.hasCommittedMutations&&!e.Je},t.prototype.yr=function(t,e,n){var r=this,i=this.fh;this.fh=t.fh,this.Wt=t.Wt;var o=t.mh.Ut();o.sort((function(t,e){return function(t,e){var n=function(t){switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return b()}};return n(t)-n(e)}(t.type,e.type)||r._h(t.doc,e.doc)})),this.Ih(n);var a=e?this.Ah():[],s=0===this.lh.size&&this.te?1:0,u=s!==this.hh;return this.hh=s,0!==o.length||u?{snapshot:new Bt(this.query,t.fh,i,o,t.Wt,0===s,u,!1),Rh:a}:{Rh:a}},t.prototype.Qs=function(t){return this.te&&"Offline"===t?(this.te=!1,this.yr({fh:this.fh,mh:new qt,Wt:this.Wt,Eh:!1},!1)):{Rh:[]}},t.prototype.gh=function(t){return!this.uh.has(t)&&!!this.fh.has(t)&&!this.fh.get(t).Je},t.prototype.Ih=function(t){var e=this;t&&(t.ee.forEach((function(t){return e.uh=e.uh.add(t)})),t.ne.forEach((function(t){})),t.se.forEach((function(t){return e.uh=e.uh.delete(t)})),this.te=t.te)},t.prototype.Ah=function(){var t=this;if(!this.te)return[];var e=this.lh;this.lh=jt(),this.fh.forEach((function(e){t.gh(e.key)&&(t.lh=t.lh.add(e.key))}));var n=[];return e.forEach((function(e){t.lh.has(e)||n.push(new _a(e))})),this.lh.forEach((function(t){e.has(t)||n.push(new ma(t))})),n},t.prototype.Ph=function(t){this.uh=t.Fc,this.lh=jt();var e=this.wh(t.documents);return this.yr(e,!0)},t.prototype.yh=function(){return Bt.Gt(this.query,this.fh,this.Wt,0===this.hh)},t}(),wa=function(t,e,n){this.query=t,this.targetId=e,this.view=n},Ea=function(t){this.key=t,this.Vh=!1},Ta=function(){function t(t,e,n,r,i,o){this.ju=t,this.ph=e,this.bh=n,this.Sh=r,this.currentUser=i,this.Dh=o,this.Ch={},this.Nh=new ut((function(t){return Jn(t)}),Xn),this.Fh=new Map,this.xh=[],this.$h=new It(P.i),this.kh=new Map,this.Mh=new Ro,this.Oh={},this.Lh=new Map,this.Bh=so.da(),this.onlineState="Unknown",this.qh=void 0}return Object.defineProperty(t.prototype,"Uh",{get:function(){return!0===this.qh},enumerable:!1,configurable:!0}),t}();function Sa(t,e){return o.__awaiter(this,void 0,void 0,(function(){var n,r,i,a,s,u;return o.__generator(this,(function(o){switch(o.label){case 0:return n=Ya(t),(a=n.Nh.get(e))?(r=a.targetId,n.Sh.Oi(r),i=a.view.yh(),[3,4]):[3,1];case 1:return[4,Co(n.ju,Kn(e))];case 2:return s=o.sent(),u=n.Sh.Oi(s.targetId),r=s.targetId,[4,Ia(n,e,r,"current"===u)];case 3:i=o.sent(),n.Uh&&Qo(n.ph,s),o.label=4;case 4:return[2,i]}}))}))}function Ia(t,e,n,r){return o.__awaiter(this,void 0,void 0,(function(){var i,a,s,u,c,l;return o.__generator(this,(function(f){switch(f.label){case 0:return t.Qh=function(e,n,r){return function(t,e,n,r){return o.__awaiter(this,void 0,void 0,(function(){var i,a,s;return o.__generator(this,(function(o){switch(o.label){case 0:return(i=e.view.wh(n)).Eh?[4,ko(t.ju,e.query,!1).then((function(t){var n=t.documents;return e.view.wh(n,i)}))]:[3,2];case 1:i=o.sent(),o.label=2;case 2:return a=r&&r.zt.get(e.targetId),s=e.view.yr(i,t.Uh,a),[2,(Ma(t,e.targetId,s.Rh),s.snapshot)]}}))}))}(t,e,n,r)},[4,ko(t.ju,e,!0)];case 1:return i=f.sent(),a=new ba(e,i.Fc),s=a.wh(i.documents),u=Gt.Zt(n,r&&"Offline"!==t.onlineState),c=a.yr(s,t.Uh,u),Ma(t,n,c.Rh),l=new wa(e,n,a),[2,(t.Nh.set(e,l),t.Fh.has(n)?t.Fh.get(n).push(e):t.Fh.set(n,[e]),c.snapshot)]}}))}))}function Ca(t,e){return o.__awaiter(this,void 0,void 0,(function(){var n,r,i;return o.__generator(this,(function(o){switch(o.label){case 0:return n=E(t),r=n.Nh.get(e),(i=n.Fh.get(r.targetId)).length>1?[2,(n.Fh.set(r.targetId,i.filter((function(t){return!Xn(t,e)}))),void n.Nh.delete(e))]:n.Uh?(n.Sh.Bi(r.targetId),n.Sh.Fi(r.targetId)?[3,2]:[4,Oo(n.ju,r.targetId,!1).then((function(){n.Sh.Ui(r.targetId),Yo(n.ph,r.targetId),Da(n,r.targetId)})).catch(No)]):[3,3];case 1:o.sent(),o.label=2;case 2:return[3,5];case 3:return Da(n,r.targetId),[4,Oo(n.ju,r.targetId,!0)];case 4:o.sent(),o.label=5;case 5:return[2]}}))}))}function Oa(t,e){return o.__awaiter(this,void 0,void 0,(function(){var n,r;return o.__generator(this,(function(i){switch(i.label){case 0:n=E(t),i.label=1;case 1:return i.trys.push([1,4,,6]),[4,So(n.ju,e)];case 2:return r=i.sent(),e.zt.forEach((function(t,e){var r=n.kh.get(e);r&&(w(t.ee.size+t.ne.size+t.se.size<=1),t.ee.size>0?r.Vh=!0:t.ne.size>0?w(r.Vh):t.se.size>0&&(w(r.Vh),r.Vh=!1))})),[4,Ua(n,r,e)];case 3:return i.sent(),[3,6];case 4:return[4,No(i.sent())];case 5:return i.sent(),[3,6];case 6:return[2]}}))}))}function ka(t,e,n){var r=E(t);if(r.Uh&&0===n||!r.Uh&&1===n){var i=[];r.Nh.forEach((function(t,n){var r=n.view.Qs(e);r.snapshot&&i.push(r.snapshot)})),function(t,e){var n=E(t);n.onlineState=e;var r=!1;n.Bs.forEach((function(t,n){for(var i=0,o=n.listeners;i0&&t.$h.size0)},t.prototype.Hh=function(t,e){return v()<=s.LogLevel.DEBUG&&y("IndexFreeQueryEngine","Using full collection scan to execute query:",Zn(e)),this.zh.Lr(t,e,lt.min())},t}(),Za=function(){function t(t,e){this.Dr=t,this.No=e,this.Sr=[],this.Jh=1,this.Xh=new kt(Do.kc)}return t.prototype.$o=function(t){return br.resolve(0===this.Sr.length)},t.prototype.ko=function(t,e,n,r){var i=this.Jh;this.Jh++,this.Sr.length>0&&this.Sr[this.Sr.length-1];var o=new ei(i,e,n,r);this.Sr.push(o);for(var a=0,s=r;ai?this.Sr[i]:null)},t.prototype.qo=function(){return br.resolve(0===this.Sr.length?-1:this.Jh-1)},t.prototype.Uo=function(t){return br.resolve(this.Sr.slice())},t.prototype.Nr=function(t,e){var n=this,r=new Do(e,0),i=new Do(e,Number.POSITIVE_INFINITY),o=[];return this.Xh.Ft([r,i],(function(t){var e=n.Zh(t.jc);o.push(e)})),br.resolve(o)},t.prototype.Or=function(t,e){var n=this,r=new kt(J);return e.forEach((function(t){var e=new Do(t,0),i=new Do(t,Number.POSITIVE_INFINITY);n.Xh.Ft([e,i],(function(t){r=r.add(t.jc)}))})),br.resolve(this.el(r))},t.prototype.Wr=function(t,e){var n=e.path,r=n.length+1,i=n;P.F(i)||(i=i.child(""));var o=new Do(new P(i),0),a=new kt(J);return this.Xh.xt((function(t){var e=t.key.path;return!!n.T(e)&&(e.length===r&&(a=a.add(t.jc)),!0)}),o),br.resolve(this.el(a))},t.prototype.el=function(t){var e=this,n=[];return t.forEach((function(t){var r=e.Zh(t);null!==r&&n.push(r)})),n},t.prototype.Wo=function(t,e){var n=this;w(0===this.nl(e.batchId,"removed")),this.Sr.shift();var r=this.Xh;return br.forEach(e.mutations,(function(i){var o=new Do(i.key,e.batchId);return r=r.delete(o),n.No.Go(t,i.key)})).next((function(){n.Xh=r}))},t.prototype.Ko=function(t){},t.prototype.Ho=function(t,e){var n=new Do(e,0),r=this.Xh.$t(n);return br.resolve(e.isEqual(r&&r.key))},t.prototype.zo=function(t){return this.Sr.length,br.resolve()},t.prototype.nl=function(t,e){return this.tl(t)},t.prototype.tl=function(t){return 0===this.Sr.length?0:t-this.Sr[0].batchId},t.prototype.Zh=function(t){var e=this.tl(t);return e<0||e>=this.Sr.length?null:this.Sr[e]},t}(),ts=function(){function t(t,e){this.Dr=t,this.sl=e,this.docs=new It(P.i),this.size=0}return t.prototype.Er=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,a=this.sl(e);return this.docs=this.docs.ot(r,{ta:e,size:a,readTime:n}),this.size+=a-o,this.Dr.Mo(t,r.path.h())},t.prototype.Ar=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},t.prototype.Rr=function(t,e){var n=this.docs.get(e);return br.resolve(n?n.ta:null)},t.prototype.getEntries=function(t,e){var n=this,r=Nt();return e.forEach((function(t){var e=n.docs.get(t);r=r.ot(t,e?e.ta:null)})),br.resolve(r)},t.prototype.Lr=function(t,e,n){for(var r=Dt(),i=new P(e.path.child("")),o=this.docs.ft(i);o.At();){var a=o.It(),s=a.key,u=a.value,c=u.ta,l=u.readTime;if(!e.path.T(s.path))break;l.L(n)<=0||c instanceof Ln&&tr(e,c)&&(r=r.ot(c.key,c))}return br.resolve(r)},t.prototype.il=function(t,e){return br.forEach(this.docs,(function(t){return e(t)}))},t.prototype.ra=function(t){return new es(this)},t.prototype.aa=function(t){return br.resolve(this.size)},t}(),es=function(t){function e(e){var n=this;return(n=t.call(this)||this).ca=e,n}return o.__extends(e,t),e.prototype.yr=function(t){var e=this,n=[];return this.wr.forEach((function(r,i){i?n.push(e.ca.Er(t,i,e.readTime)):e.ca.Ar(r)})),br.$n(n)},e.prototype.gr=function(t,e){return this.ca.Rr(t,e)},e.prototype.Pr=function(t,e){return this.ca.getEntries(t,e)},e}(ri),ns=function(){function t(t){this.persistence=t,this.rl=new ut((function(t){return yt(t)}),gt),this.lastRemoteSnapshotVersion=lt.min(),this.highestTargetId=0,this.ol=0,this.al=new Ro,this.targetCount=0,this.cl=so.fa()}return t.prototype.Ce=function(t,e){return this.rl.forEach((function(t,n){return e(n)})),br.resolve()},t.prototype.Ea=function(t){return br.resolve(this.lastRemoteSnapshotVersion)},t.prototype.Ia=function(t){return br.resolve(this.ol)},t.prototype.wa=function(t){return this.highestTargetId=this.cl.next(),br.resolve(this.highestTargetId)},t.prototype.Aa=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.ol&&(this.ol=e),br.resolve()},t.prototype.ga=function(t){this.rl.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.cl=new so(e),this.highestTargetId=e),t.sequenceNumber>this.ol&&(this.ol=t.sequenceNumber)},t.prototype.Ra=function(t,e){return this.ga(e),this.targetCount+=1,br.resolve()},t.prototype.ya=function(t,e){return this.ga(e),br.resolve()},t.prototype.Va=function(t,e){return this.rl.delete(e.target),this.al.Uc(e.targetId),this.targetCount-=1,br.resolve()},t.prototype.po=function(t,e,n){var r=this,i=0,o=[];return this.rl.forEach((function(a,s){s.sequenceNumber<=e&&null===n.get(s.targetId)&&(r.rl.delete(a),o.push(r.pa(t,s.targetId)),i++)})),br.$n(o).next((function(){return i}))},t.prototype.ba=function(t){return br.resolve(this.targetCount)},t.prototype.va=function(t,e){var n=this.rl.get(e)||null;return br.resolve(n)},t.prototype.Sa=function(t,e,n){return this.al.Lc(e,n),br.resolve()},t.prototype.Ca=function(t,e,n){this.al.qc(e,n);var r=this.persistence.No,i=[];return r&&e.forEach((function(e){i.push(r.Go(t,e))})),br.$n(i)},t.prototype.pa=function(t,e){return this.al.Uc(e),br.resolve()},t.prototype.Fa=function(t,e){var n=this.al.Wc(e);return br.resolve(n)},t.prototype.Ho=function(t,e){return br.resolve(this.al.Ho(e))},t}(),rs=function(){function t(t){var e=this;this.ul={},this.Ma=new Gr(0),this.Oa=!1,this.Oa=!0,this.No=t(this),this.Ka=new ns(this),this.Dr=new Vi,this.vr=function(t,n){return new ts(t,(function(t){return e.No.hl(t)}))}(this.Dr)}return t.prototype.start=function(){return Promise.resolve()},t.prototype.Di=function(){return this.Oa=!1,Promise.resolve()},Object.defineProperty(t.prototype,"Ei",{get:function(){return this.Oa},enumerable:!1,configurable:!0}),t.prototype.Za=function(){},t.prototype.tc=function(){},t.prototype.Ic=function(){return this.Dr},t.prototype.mc=function(t){var e=this.ul[t.ti()];return e||(e=new Za(this.Dr,this.No),this.ul[t.ti()]=e),e},t.prototype.Tc=function(){return this.Ka},t.prototype.Ec=function(){return this.vr},t.prototype.runTransaction=function(t,e,n){var r=this;y("MemoryPersistence","Starting transaction:",t);var i=new is(this.Ma.next());return this.No.ll(),n(i).next((function(t){return r.No._l(i).next((function(){return t}))})).Fn().then((function(t){return i.br(),t}))},t.prototype.fl=function(t,e){return br.kn(Object.values(this.ul).map((function(n){return function(){return n.Ho(t,e)}})))},t}(),is=function(t){function e(e){var n=this;return(n=t.call(this)||this).xa=e,n}return o.__extends(e,t),e}(oi),os=function(){function t(t){this.persistence=t,this.dl=new Ro,this.wl=null}return t.ml=function(e){return new t(e)},Object.defineProperty(t.prototype,"Tl",{get:function(){if(this.wl)return this.wl;throw b()},enumerable:!1,configurable:!0}),t.prototype.Da=function(t,e,n){return this.dl.Da(n,e),this.Tl.delete(n.toString()),br.resolve()},t.prototype.Na=function(t,e,n){return this.dl.Na(n,e),this.Tl.add(n.toString()),br.resolve()},t.prototype.Go=function(t,e){return this.Tl.add(e.toString()),br.resolve()},t.prototype.removeTarget=function(t,e){var n=this;this.dl.Uc(e.targetId).forEach((function(t){return n.Tl.add(t.toString())}));var r=this.persistence.Tc();return r.Fa(t,e.targetId).next((function(t){t.forEach((function(t){return n.Tl.add(t.toString())}))})).next((function(){return r.Va(t,e)}))},t.prototype.ll=function(){this.wl=new Set},t.prototype._l=function(t){var e=this,n=this.persistence.Ec().ra();return br.forEach(this.Tl,(function(r){var i=P.D(r);return e.El(t,i).next((function(t){t||n.Ar(i)}))})).next((function(){return e.wl=null,n.apply(t)}))},t.prototype.yc=function(t,e){var n=this;return this.El(t,e).next((function(t){t?n.Tl.delete(e.toString()):n.Tl.add(e.toString())}))},t.prototype.hl=function(t){return 0},t.prototype.El=function(t,e){var n=this;return br.kn([function(){return br.resolve(n.dl.Ho(e))},function(){return n.persistence.Tc().Ho(t,e)},function(){return n.persistence.fl(t,e)}])},t}(),as=function(){function t(t){this.Il=t.Il,this.Al=t.Al}return t.prototype.gu=function(t){this.Rl=t},t.prototype.Tu=function(t){this.gl=t},t.prototype.onMessage=function(t){this.Pl=t},t.prototype.close=function(){this.Al()},t.prototype.send=function(t){this.Il(t)},t.prototype.yl=function(){this.Rl()},t.prototype.Vl=function(t){this.gl(t)},t.prototype.pl=function(t){this.Pl(t)},t}(),ss={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery"},us=function(t){function e(e){var n=this;return(n=t.call(this,e)||this).forceLongPolling=e.forceLongPolling,n.W=e.W,n}return o.__extends(e,t),e.prototype.Nl=function(t,e,n,r){return new Promise((function(i,o){var a=new c.XhrIo;a.listenOnce(c.EventType.COMPLETE,(function(){try{switch(a.getLastErrorCode()){case c.ErrorCode.NO_ERROR:var e=a.getResponseJson();y("Connection","XHR received:",JSON.stringify(e)),i(e);break;case c.ErrorCode.TIMEOUT:y("Connection",'RPC "'+t+'" timed out'),o(new p(h.DEADLINE_EXCEEDED,"Request time out"));break;case c.ErrorCode.HTTP_ERROR:var n=a.getStatus();if(y("Connection",'RPC "'+t+'" failed with status:',n,"response text:",a.getResponseText()),n>0){var r=a.getResponseJson().error;if(r&&r.status&&r.message){var s=function(t){var e=t.toLowerCase().replace("_","-");return Object.values(h).indexOf(e)>=0?e:h.UNKNOWN}(r.status);o(new p(s,r.message))}else o(new p(h.UNKNOWN,"Server responded with status "+a.getStatus()))}else o(new p(h.UNAVAILABLE,"Connection failed."));break;default:b()}}finally{y("Connection",'RPC "'+t+'" completed.')}}));var s=JSON.stringify(r);a.send(e,"POST",s,n,15)}))},e.prototype.Pu=function(t,e){var n=[this.vl,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=c.createWebChannelTransport(),i={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.U.projectId+"/databases/"+this.U.database},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.W};this.Cl(i.initMessageHeaders,e),u.isMobileCordova()||u.isReactNative()||u.isElectron()||u.isIE()||u.isUWP()||u.isBrowserExtension()||(i.httpHeadersOverwriteParam="$httpHeaders");var o=n.join("");y("Connection","Creating WebChannel: "+o,i);var a=r.createWebChannel(o,i),s=!1,l=!1,f=new as({Il:function(t){l?y("Connection","Not sending because WebChannel is closed:",t):(s||(y("Connection","Opening WebChannel transport."),a.open(),s=!0),y("Connection","WebChannel sending:",t),a.send(t))},Al:function(){return a.close()}}),d=function(t,e){a.listen(t,(function(t){try{e(t)}catch(t){setTimeout((function(){throw t}),0)}}))};return d(c.WebChannel.EventType.OPEN,(function(){l||y("Connection","WebChannel transport opened.")})),d(c.WebChannel.EventType.CLOSE,(function(){l||(l=!0,y("Connection","WebChannel transport closed"),f.Vl())})),d(c.WebChannel.EventType.ERROR,(function(t){l||(l=!0,m("Connection","WebChannel transport errored:",t),f.Vl(new p(h.UNAVAILABLE,"The operation could not be completed")))})),d(c.WebChannel.EventType.MESSAGE,(function(t){var e;if(!l){var n=t.data[0];w(!!n);var r=n,i=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(i){y("Connection","WebChannel received error:",i);var o=i.status,s=function(t){var e=_t[t];if(void 0!==e)return St(e)}(o),u=i.message;void 0===s&&(s=h.INTERNAL,u="Unknown error status: "+o+" with message "+i.message),l=!0,f.Vl(new p(s,u)),a.close()}else y("Connection","WebChannel received:",n),f.pl(n)}})),setTimeout((function(){f.yl()}),0),f},e}(function(){function t(t){this.bl=t,this.U=t.U;var e=t.ssl?"https":"http";this.vl=e+"://"+t.host,this.Sl="projects/"+this.U.projectId+"/databases/"+this.U.database+"/documents"}return t.prototype.$u=function(t,e,n,r){var i=this.Dl(t,e);y("RestConnection","Sending: ",i,n);var o={};return this.Cl(o,r),this.Nl(t,i,o,n).then((function(t){return y("RestConnection","Received: ",t),t}),(function(e){throw m("RestConnection",t+" failed with error: ",e,"url: ",i,"request:",n),e}))},t.prototype.ku=function(t,e,n,r){return this.$u(t,e,n,r)},t.prototype.Cl=function(t,e){if(t["X-Goog-Api-Client"]="gl-js/ fire/7.24.0",t["Content-Type"]="text/plain",e)for(var n in e.Kc)e.Kc.hasOwnProperty(n)&&(t[n]=e.Kc[n])},t.prototype.Dl=function(t,e){var n=ss[t];return this.vl+"/v1/"+e+":"+n},t}()),cs=function(){function t(){var t=this;this.Fl=function(){return t.xl()},this.$l=function(){return t.kl()},this.Ml=[],this.Ol()}return t.prototype.Zu=function(t){this.Ml.push(t)},t.prototype.Di=function(){window.removeEventListener("online",this.Fl),window.removeEventListener("offline",this.$l)},t.prototype.Ol=function(){window.addEventListener("online",this.Fl),window.addEventListener("offline",this.$l)},t.prototype.xl=function(){y("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.Ml;t90)throw new p(h.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new p(h.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this.u_=t,this.h_=e}return Object.defineProperty(t.prototype,"latitude",{get:function(){return this.u_},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"longitude",{get:function(){return this.h_},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(t){return this.u_===t.u_&&this.h_===t.h_},t.prototype.toJSON=function(){return{latitude:this.u_,longitude:this.h_}},t.prototype.Y=function(t){return J(this.u_,t.u_)||J(this.h_,t.h_)},t}(),ks=function(t){this.l_=t},xs=/^__.*__$/,Ps=function(t,e,n){this.__=t,this.f_=e,this.d_=n},As=function(){function t(t,e,n){this.data=t,this.We=e,this.fieldTransforms=n}return t.prototype.w_=function(t,e){var n=[];return null!==this.We?n.push(new Sn(t,this.data,this.We,e)):n.push(new Tn(t,this.data,e)),this.fieldTransforms.length>0&&n.push(new Cn(t,this.fieldTransforms)),n},t}(),Ns=function(){function t(t,e,n){this.data=t,this.We=e,this.fieldTransforms=n}return t.prototype.w_=function(t,e){var n=[new Sn(t,this.data,this.We,e)];return this.fieldTransforms.length>0&&n.push(new Cn(t,this.fieldTransforms)),n},t}();function Rs(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw b()}}var Ds=function(){function t(t,e,n,r,i,o){this.settings=t,this.U=e,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===i&&this.m_(),this.fieldTransforms=i||[],this.We=o||[]}return Object.defineProperty(t.prototype,"path",{get:function(){return this.settings.path},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"s_",{get:function(){return this.settings.s_},enumerable:!1,configurable:!0}),t.prototype.T_=function(e){return new t(Object.assign(Object.assign({},this.settings),e),this.U,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.We)},t.prototype.E_=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.T_({path:n,o_:!1});return r.I_(t),r},t.prototype.A_=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.T_({path:n,o_:!1});return r.m_(),r},t.prototype.R_=function(t){return this.T_({path:void 0,o_:!0})},t.prototype.i_=function(t){return Hs(t,this.settings.methodName,this.settings.g_||!1,this.path,this.settings.r_)},t.prototype.contains=function(t){return void 0!==this.We.find((function(e){return t.T(e)}))||void 0!==this.fieldTransforms.find((function(e){return t.T(e.field)}))},t.prototype.m_=function(){if(this.path)for(var t=0;t=0;--d)if(!Ks(l,s[d])){var v=s[d],y=u[d],g=a.A_(v);if(y instanceof ws||y instanceof ks&&y.l_ instanceof ws)l.push(v);else{var m=Vs(y,g);null!=m&&(l.push(v),f.set(v,m))}}var _=new hn(l);return new Ns(f.Xe(),_,a.fieldTransforms)}function Us(t,e,n,r){return void 0===r&&(r=!1),Vs(n,t.P_(r?4:3,e))}function Vs(t,e){if(t instanceof ks&&(t=t.l_),Bs(t))return Ws("Unsupported field value:",e,t),qs(t,e);if(t instanceof bs)return function(t,e){if(!Rs(e.s_))throw e.i_(t.e_+"() can only be used with update() and set()");if(!e.path)throw e.i_(t.e_+"() is not currently supported inside arrays");var n=t.n_(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(e.path&&e.We.push(e.path),t instanceof Array){if(e.settings.o_&&4!==e.s_)throw e.i_("Nested arrays are not supported");return function(t,e){for(var n=[],r=0,i=0,o=t;i0&&e.We.push(e.path):S(t,(function(t,r){var i=Vs(r,e.E_(t));null!=i&&(n[t]=i)})),{mapValue:{fields:n}}}function Bs(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof ct||t instanceof Os||t instanceof nt||t instanceof Ps||t instanceof bs)}function Ws(t,e,n){if(!Bs(n)||!B(n)){var r=W(n);throw"an object"===r?e.i_(t+" a custom object"):e.i_(t+" "+r)}}function Gs(t,e,n){if(e instanceof gs)return e.t_;if("string"==typeof e)return zs(t,e);throw Hs("Field path arguments must be of type string or FieldPath.",t,!1,void 0,n)}function zs(t,e,n){try{return function(t){if(t.search(_s)>=0)throw new p(h.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not contain '~', '*', '/', '[', or ']'");try{return new(ms.bind.apply(ms,o.__spreadArrays([void 0],t.split("."))))}catch(e){throw new p(h.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'")}}(e).t_}catch(e){throw Hs((r=e)instanceof Error?r.message:r.toString(),t,!1,void 0,n)}var r}function Hs(t,e,n,r,i){var o=r&&!r.m(),a=void 0!==i,s="Function "+e+"() called with invalid data";n&&(s+=" (via `toFirestore()`)");var u="";return(o||a)&&(u+=" (found",o&&(u+=" in field "+r),a&&(u+=" in document "+i),u+=")"),new p(h.INVALID_ARGUMENT,(s+=". ")+t+u)}function Ks(t,e){return t.some((function(t){return t.isEqual(e)}))}var $s=function(){function t(t){this.Ku=t,this.y_=new Map,this.mutations=[],this.V_=!1,this.p_=null,this.b_=new Set}return t.prototype.v_=function(t){return o.__awaiter(this,void 0,void 0,(function(){var e,n=this;return o.__generator(this,(function(r){switch(r.label){case 0:if(this.S_(),this.mutations.length>0)throw new p(h.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(t,e){return o.__awaiter(this,void 0,void 0,(function(){var n,r,i,a,s,u;return o.__generator(this,(function(o){switch(o.label){case 0:return n=E(t),r=De(n.serializer)+"/documents",i={documents:e.map((function(t){return Pe(n.serializer,t)}))},[4,n.ku("BatchGetDocuments",r,i)];case 1:return a=o.sent(),s=new Map,a.forEach((function(t){var e=function(t,e){return"found"in e?function(t,e){w(!!e.found),e.found.name,e.found.updateTime;var n=Ae(t,e.found.name),r=Oe(e.found.updateTime),i=new An({mapValue:{fields:e.found.fields}});return new Ln(n,r,i,{})}(t,e):"missing"in e?function(t,e){w(!!e.missing),w(!!e.readTime);var n=Ae(t,e.missing),r=Oe(e.readTime);return new Mn(n,r)}(t,e):b()}(n.serializer,t);s.set(e.key.toString(),e)})),u=[],[2,(e.forEach((function(t){var e=s.get(t.toString());w(!!e),u.push(e)})),u)]}}))}))}(this.Ku,t)];case 1:return[2,((e=r.sent()).forEach((function(t){t instanceof Mn||t instanceof Ln?n.D_(t):b()})),e)]}}))}))},t.prototype.set=function(t,e){this.write(e.w_(t,this.Ge(t))),this.b_.add(t.toString())},t.prototype.update=function(t,e){try{this.write(e.w_(t,this.C_(t)))}catch(t){this.p_=t}this.b_.add(t.toString())},t.prototype.delete=function(t){this.write([new xn(t,this.Ge(t))]),this.b_.add(t.toString())},t.prototype.commit=function(){return o.__awaiter(this,void 0,void 0,(function(){var t,e=this;return o.__generator(this,(function(n){switch(n.label){case 0:if(this.S_(),this.p_)throw this.p_;return t=this.y_,this.mutations.forEach((function(e){t.delete(e.key.toString())})),t.forEach((function(t,n){var r=P.D(n);e.mutations.push(new Pn(r,e.Ge(r)))})),[4,function(t,e){return o.__awaiter(this,void 0,void 0,(function(){var n,r,i;return o.__generator(this,(function(o){switch(o.label){case 0:return n=E(t),r=De(n.serializer)+"/documents",i={writes:e.map((function(t){return je(n.serializer,t)}))},[4,n.$u("Commit",r,i)];case 1:return o.sent(),[2]}}))}))}(this.Ku,this.mutations)];case 1:return n.sent(),this.V_=!0,[2]}}))}))},t.prototype.D_=function(t){var e;if(t instanceof Ln)e=t.version;else{if(!(t instanceof Mn))throw b();e=lt.min()}var n=this.y_.get(t.key.toString());if(n){if(!e.isEqual(n))throw new p(h.ABORTED,"Document version changed between two reads.")}else this.y_.set(t.key.toString(),e)},t.prototype.Ge=function(t){var e=this.y_.get(t.toString());return!this.b_.has(t.toString())&&e?vn.updateTime(e):vn.ze()},t.prototype.C_=function(t){var e=this.y_.get(t.toString());if(!this.b_.has(t.toString())&&e){if(e.isEqual(lt.min()))throw new p(h.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return vn.updateTime(e)}return vn.exists(!0)},t.prototype.write=function(t){this.S_(),this.mutations=this.mutations.concat(t)},t.prototype.S_=function(){},t}(),Qs=function(){function t(t,e,n,r){this.cs=t,this.Ku=e,this.updateFunction=n,this.ls=r,this.N_=5,this.ys=new _r(this.cs,"transaction_retry")}return t.prototype.run=function(){this.F_()},t.prototype.F_=function(){var t=this;this.ys.gn((function(){return o.__awaiter(t,void 0,void 0,(function(){var t,e,n=this;return o.__generator(this,(function(r){return t=new $s(this.Ku),(e=this.x_(t))&&e.then((function(e){n.cs.ws((function(){return t.commit().then((function(){n.ls.resolve(e)})).catch((function(t){n.k_(t)}))}))})).catch((function(t){n.k_(t)})),[2]}))}))}))},t.prototype.x_=function(t){try{var e=this.updateFunction(t);return!ft(e)&&e.catch&&e.then?e:(this.ls.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.ls.reject(t),null}},t.prototype.k_=function(t){var e=this;this.N_>0&&this.M_(t)?(this.N_-=1,this.cs.ws((function(){return e.F_(),Promise.resolve()}))):this.ls.reject(t)},t.prototype.M_=function(t){if("FirebaseError"===t.name){var e=t.code;return"aborted"===e||"failed-precondition"===e||!Tt(e)}return!1},t}(),Ys=function(){function t(t,e){this.credentials=t,this.cs=e,this.clientId=X.k(),this.O_=new mr}return t.prototype.start=function(t,e,n,r){var i=this;this.L_(),this.bl=t;var a=new mr,s=!1;return this.credentials.Hc((function(t){if(!s)return s=!0,y("FirestoreClient","Initializing. user=",t.uid),i.B_(e,n,r,t,a).then(i.O_.resolve,i.O_.reject);i.cs.Cs((function(){return function(t,e){return o.__awaiter(this,void 0,void 0,(function(){var n,r;return o.__generator(this,(function(i){switch(i.label){case 0:return(n=E(t)).cs.xs(),y("RemoteStore","RemoteStore received new credentials"),r=ea(n),n.Yu.add(3),[4,Ko(n)];case 1:return i.sent(),r&&n.th.set("Unknown"),[4,n.Gu.Jl(e)];case 2:return i.sent(),n.Yu.delete(3),[4,Ho(n)];case 3:return i.sent(),[2]}}))}))}(i.ph,t)}))})),this.cs.ws((function(){return i.O_.promise})),a.promise},t.prototype.enableNetwork=function(){var t=this;return this.L_(),this.cs.enqueue((function(){return t.persistence.tc(!0),function(t){var e=E(t);return e.Yu.delete(0),Ho(e)}(t.ph)}))},t.prototype.B_=function(t,e,n,r,a){return o.__awaiter(this,void 0,void 0,(function(){var s,u,c=this;return o.__generator(this,(function(l){switch(l.label){case 0:return l.trys.push([0,3,,4]),s={cs:this.cs,bl:this.bl,clientId:this.clientId,credentials:this.credentials,Wl:r,Dh:100,persistenceSettings:n},[4,t.initialize(s)];case 1:return l.sent(),[4,e.initialize(t,s)];case 2:return l.sent(),this.persistence=t.persistence,this.Sh=t.Sh,this.ju=t.ju,this.ql=t.ql,this.Ku=e.Ku,this.ph=e.ph,this.fi=e.fi,this.q_=e.bh,this.q_.Us=Sa.bind(null,this.fi),this.q_.js=Ca.bind(null,this.fi),this.persistence.Za((function(){return o.__awaiter(c,void 0,void 0,(function(){return o.__generator(this,(function(t){switch(t.label){case 0:return[4,this.terminate()];case 1:return t.sent(),[2]}}))}))})),a.resolve(),[3,4];case 3:if(u=l.sent(),a.reject(u),!this.U_(u))throw u;return[2,(i.warn("Error enabling offline persistence. Falling back to persistence disabled: "+u),this.B_(new ps,new vs,{jl:!1},r,a))];case 4:return[2]}}))}))},t.prototype.U_=function(t){return"FirebaseError"===t.name?t.code===h.FAILED_PRECONDITION||t.code===h.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code},t.prototype.L_=function(){if(this.cs.ps)throw new p(h.FAILED_PRECONDITION,"The client has already been terminated.")},t.prototype.disableNetwork=function(){var t=this;return this.L_(),this.cs.enqueue((function(){return t.persistence.tc(!1),function(t){return o.__awaiter(this,void 0,void 0,(function(){var e;return o.__generator(this,(function(n){switch(n.label){case 0:return(e=E(t)).Yu.add(0),[4,Ko(e)];case 1:return n.sent(),e.th.set("Offline"),[2]}}))}))}(t.ph)}))},t.prototype.terminate=function(){var t=this;this.cs.Ds();var e=new mr;return this.cs.bs((function(){return o.__awaiter(t,void 0,void 0,(function(){var t,n;return o.__generator(this,(function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),this.ql&&this.ql.stop(),[4,$o(this.ph)];case 1:return r.sent(),[4,this.Sh.Di()];case 2:return r.sent(),[4,this.persistence.Di()];case 3:return r.sent(),this.credentials.Yc(),e.resolve(),[3,5];case 4:return t=r.sent(),n=Dr(t,"Failed to shutdown persistence"),e.reject(n),[3,5];case 5:return[2]}}))}))})),e.promise},t.prototype.waitForPendingWrites=function(){var t=this;this.L_();var e=new mr;return this.cs.ws((function(){return function(t,e){return o.__awaiter(this,void 0,void 0,(function(){var n,r,i,a,s;return o.__generator(this,(function(o){switch(o.label){case 0:ea((n=E(t)).ph)||y("SyncEngine","The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled."),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,function(t){var e=E(t);return e.persistence.runTransaction("Get highest unacknowledged batch id","readonly",(function(t){return e.Sr.qo(t)}))}(n.ju)];case 2:return-1===(r=o.sent())?[2,void e.resolve()]:((i=n.Lh.get(r)||[]).push(e),n.Lh.set(r,i),[3,4]);case 3:return a=o.sent(),s=Dr(a,"Initialization of waitForPendingWrites() operation failed"),e.reject(s),[3,4];case 4:return[2]}}))}))}(t.fi,e)})),e.promise},t.prototype.listen=function(t,e,n){var r=this;this.L_();var i=new ys(n),o=new Br(t,i,e);return this.cs.ws((function(){return jr(r.q_,o)})),function(){i.Zl(),r.cs.ws((function(){return Fr(r.q_,o)}))}},t.prototype.Q_=function(t){return o.__awaiter(this,void 0,void 0,(function(){var e,n=this;return o.__generator(this,(function(r){switch(r.label){case 0:return this.L_(),[4,this.O_.promise];case 1:return r.sent(),e=new mr,[2,(this.cs.ws((function(){return function(t,e,n){return o.__awaiter(this,void 0,void 0,(function(){var r,i,a;return o.__generator(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,function(t,e){var n=E(t);return n.persistence.runTransaction("read document","readonly",(function(t){return n.Cc.Cr(t,e)}))}(t,e)];case 1:return(r=o.sent())instanceof Ln?n.resolve(r):r instanceof Mn?n.resolve(null):n.reject(new p(h.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 i=o.sent(),a=Dr(i,"Failed to get document '"+e+" from cache"),n.reject(a),[3,3];case 3:return[2]}}))}))}(n.ju,t,e)})),e.promise)]}}))}))},t.prototype.W_=function(t,e){return void 0===e&&(e={}),o.__awaiter(this,void 0,void 0,(function(){var n,r=this;return o.__generator(this,(function(i){switch(i.label){case 0:return this.L_(),[4,this.O_.promise];case 1:return i.sent(),n=new mr,[2,(this.cs.ws((function(){return function(t,e,n,r,i){var o=new ys({next:function(o){e.ws((function(){return Fr(t,a)}));var s=o.docs.has(n);!s&&o.fromCache?i.reject(new p(h.UNAVAILABLE,"Failed to get document because the client is offline.")):s&&o.fromCache&&r&&"server"===r.source?i.reject(new p(h.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):i.resolve(o)},error:function(t){return i.reject(t)}}),a=new Br(Vn(n.path),o,{includeMetadataChanges:!0,Xs:!0});return jr(t,a)}(r.q_,r.cs,t,e,n)})),n.promise)]}}))}))},t.prototype.j_=function(t){return o.__awaiter(this,void 0,void 0,(function(){var e,n=this;return o.__generator(this,(function(r){switch(r.label){case 0:return this.L_(),[4,this.O_.promise];case 1:return r.sent(),e=new mr,[2,(this.cs.ws((function(){return function(t,e,n){return o.__awaiter(this,void 0,void 0,(function(){var r,i,a,s,u,c;return o.__generator(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,ko(t,e,!0)];case 1:return r=o.sent(),i=new ba(e,r.Fc),a=i.wh(r.documents),s=i.yr(a,!1),n.resolve(s.snapshot),[3,3];case 2:return u=o.sent(),c=Dr(u,"Failed to execute query '"+e+" against cache"),n.reject(c),[3,3];case 3:return[2]}}))}))}(n.ju,t,e)})),e.promise)]}}))}))},t.prototype.K_=function(t,e){return void 0===e&&(e={}),o.__awaiter(this,void 0,void 0,(function(){var n,r=this;return o.__generator(this,(function(i){switch(i.label){case 0:return this.L_(),[4,this.O_.promise];case 1:return i.sent(),n=new mr,[2,(this.cs.ws((function(){return function(t,e,n,r,i){var o=new ys({next:function(n){e.ws((function(){return Fr(t,a)})),n.fromCache&&"server"===r.source?i.reject(new p(h.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):i.resolve(n)},error:function(t){return i.reject(t)}}),a=new Br(n,o,{includeMetadataChanges:!0,Xs:!0});return jr(t,a)}(r.q_,r.cs,t,e,n)})),n.promise)]}}))}))},t.prototype.write=function(t){var e=this;this.L_();var n=new mr;return this.cs.ws((function(){return function(t,e,n){return o.__awaiter(this,void 0,void 0,(function(){var r,i,a,s;return o.__generator(this,(function(o){switch(o.label){case 0:r=Xa(t),o.label=1;case 1:return o.trys.push([1,5,,6]),[4,function(t,e){var n,r=E(t),i=ct.now(),o=e.reduce((function(t,e){return t.add(e.key)}),jt());return r.persistence.runTransaction("Locally write mutations","readwrite",(function(t){return r.Cc.kr(t,o).next((function(o){n=o;for(var a=[],s=0,u=e;s=0)throw new p(h.INVALID_ARGUMENT,"Invalid collection ID '"+t+"' passed to function Firestore.collectionGroup(). Collection IDs must not contain '/'.");return this.hf(),new du(function(t){return new Fn(O.P(),t)}(t),this,null)},t.prototype.runTransaction=function(t){var e=this;return N("Firestore.runTransaction",arguments,1),L("Firestore.runTransaction","function",1,t),this.hf().transaction((function(n){return t(new nu(e,n))}))},t.prototype.batch=function(){return this.hf(),new ru(this)},Object.defineProperty(t,"logLevel",{get:function(){switch(v()){case s.LogLevel.DEBUG:return"debug";case s.LogLevel.ERROR:return"error";case s.LogLevel.SILENT:return"silent";case s.LogLevel.WARN:return"warn";case s.LogLevel.INFO:return"info";case s.LogLevel.VERBOSE:return"verbose";default:return"error"}},enumerable:!1,configurable:!0}),t.setLogLevel=function(t){var e;N("Firestore.setLogLevel",arguments,1),V("setLogLevel",["debug","error","silent","warn","info","verbose"],1,t),e=t,d.setLogLevel(e)},t.prototype.gf=function(){return this.wf.timestampsInSnapshots},t.prototype.Pf=function(){return this.wf},t}(),nu=function(){function t(t,e){this.yf=t,this.Vf=e}return t.prototype.get=function(t){var e=this;N("Transaction.get",arguments,1);var n=bu("Transaction.get",t,this.yf);return this.Vf.v_([n.f_]).then((function(t){if(!t||1!==t.length)return b();var r=t[0];if(r instanceof Mn)return new au(e.yf,n.f_,null,!1,!1,n.d_);if(r instanceof Ln)return new au(e.yf,n.f_,r,!1,!1,n.d_);throw b()}))},t.prototype.set=function(t,e,n){D("Transaction.set",arguments,2,3);var r=bu("Transaction.set",t,this.yf);n=gu("Transaction.set",n);var i=Eu(r.d_,e,n),o=Ms(this.yf.mf,"Transaction.set",r.f_,i,null!==r.d_,n);return this.Vf.set(r.f_,o),this},t.prototype.update=function(t,e,n){for(var r,i,o=[],a=3;a0?this.yf.hf().write(this.pf):Promise.resolve()},t.prototype.vf=function(){if(this.bf)throw new p(h.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},t}(),iu=function(t){function e(e,n,r){var i=this;return(i=t.call(this,n.__,e,r)||this).f_=e,i.firestore=n,i.d_=r,i.lf=i.firestore.hf(),i}return o.__extends(e,t),e.Rf=function(t,n,r){if(t.length%2!=0)throw new p(h.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.R()+" has "+t.length);return new e(new P(t),n,r)},Object.defineProperty(e.prototype,"id",{get:function(){return this.f_.path._()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return new yu(this.f_.path.h(),this.firestore,this.d_)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this.f_.path.R()},enumerable:!1,configurable:!0}),e.prototype.collection=function(t){if(N("DocumentReference.collection",arguments,1),L("DocumentReference.collection","non-empty string",1,t),!t)throw new p(h.INVALID_ARGUMENT,"Must provide a non-empty collection name to collection()");var e=O.g(t);return new yu(this.f_.path.child(e),this.firestore,null)},e.prototype.isEqual=function(t){if(!(t instanceof e))throw H("isEqual","DocumentReference",1,t);return this.firestore===t.firestore&&this.f_.isEqual(t.f_)&&this.d_===t.d_},e.prototype.set=function(t,e){D("DocumentReference.set",arguments,1,2),e=gu("DocumentReference.set",e);var n=Eu(this.d_,t,e),r=Ms(this.firestore.mf,"DocumentReference.set",this.f_,n,null!==this.d_,e);return this.lf.write(r.w_(this.f_,vn.ze()))},e.prototype.update=function(t,e){for(var n,r=[],i=2;i, or >=) must be on the same field. But you have inequality filters on '"+n.toString()+"' and '"+e.field.toString()+"'");var r=Wn(t);null!==r&&hu(0,e.field,r)}var i=function(t,e){for(var n=0,r=t.filters;n=0)return i.op}return null}(t,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==i)throw i===e.op?new p(h.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+e.op.toString()+"' filter."):new p(h.INVALID_ARGUMENT,"Invalid query. You cannot use '"+e.op.toString()+"' filters with '"+i.toString()+"' filters.")}(t,d),d}function cu(t,e,n){if(null!==t.startAt)throw new p(h.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==t.endAt)throw new p(h.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");var r=new vr(e,n);return function(t,e){if(null===Wn(t)){var n=Gn(t);null!==n&&hu(0,n,e.field)}}(t,r),r}function lu(t,e,n){if("string"==typeof n){if(""===n)throw new p(h.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!zn(e)&&-1!==n.indexOf("/"))throw new p(h.INVALID_ARGUMENT,"Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '"+n+"' contains a '/' character.");var r=e.path.child(O.g(n));if(!P.F(r))throw new p(h.INVALID_ARGUMENT,"Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '"+r+"' is not because it has an odd number of segments ("+r.length+").");return he(t,new P(r))}if(n instanceof Ps)return he(t,n.f_);throw new p(h.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+W(n)+".")}function fu(t,e){if(!Array.isArray(t)||0===t.length)throw new p(h.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+e.toString()+"' filters.");if(t.length>10)throw new p(h.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters support a maximum of 10 elements in the value array.");if("in"===e||"array-contains-any"===e){if(t.indexOf(null)>=0)throw new p(h.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters cannot contain 'null' in the value array.");if(t.filter((function(t){return Number.isNaN(t)})).length>0)throw new p(h.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters cannot contain 'NaN' in the value array.")}}function hu(t,e,n){if(!n.isEqual(e))throw new p(h.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+e.toString()+"' and so you must also use '"+e.toString()+"' as your first orderBy(), but your first orderBy() is on field '"+n.toString()+"' instead.")}function pu(t){if(Bn(t)&&0===t.on.length)throw new p(h.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var du=function(){function t(t,e,n){this.Ff=t,this.firestore=e,this.d_=n}return t.prototype.where=function(e,n,r){N("Query.where",arguments,3),G("Query.where",3,r);var i=V("Query.where",["<","<=","==","!=",">=",">","array-contains","in","array-contains-any","not-in"],2,n),o=Gs("Query.where",e),a=uu(this.Ff,"Query.where",this.firestore.mf,this.firestore.__,o,i,r);return new t(function(t,e){var n=t.filters.concat([e]);return new Fn(t.path,t.collectionGroup,t.on.slice(),n,t.limit,t.an,t.startAt,t.endAt)}(this.Ff,a),this.firestore,this.d_)},t.prototype.orderBy=function(e,n){var r;if(D("Query.orderBy",arguments,1,2),M("Query.orderBy","non-empty string",2,n),void 0===n||"asc"===n)r="asc";else{if("desc"!==n)throw new p(h.INVALID_ARGUMENT,"Function Query.orderBy() has unknown direction '"+n+"', expected 'asc' or 'desc'.");r="desc"}var i=Gs("Query.orderBy",e),o=cu(this.Ff,i,r);return new t(function(t,e){var n=t.on.concat([e]);return new Fn(t.path,t.collectionGroup,n,t.filters.slice(),t.limit,t.an,t.startAt,t.endAt)}(this.Ff,o),this.firestore,this.d_)},t.prototype.limit=function(e){return N("Query.limit",arguments,1),L("Query.limit","number",1,e),K("Query.limit",1,e),new t($n(this.Ff,e,"F"),this.firestore,this.d_)},t.prototype.limitToLast=function(e){return N("Query.limitToLast",arguments,1),L("Query.limitToLast","number",1,e),K("Query.limitToLast",1,e),new t($n(this.Ff,e,"L"),this.firestore,this.d_)},t.prototype.startAt=function(e){for(var n=[],r=1;ra.length)throw new p(h.INVALID_ARGUMENT,"Too many arguments provided to "+r+"(). The number of arguments must be less than or equal to the number of orderBy() clauses");for(var s=[],u=0;u{"use strict";var r=n(5752),i=n(70655),o=n(79730);function a(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=a(r),u={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},c=function(t){function e(n,r,i){var o=t.call(this,r)||this;return Object.setPrototypeOf(o,e.prototype),o.code=n,o.details=i,o}return i.__extends(e,t),e}(Error),l=function(){function t(t,e){var n=this;this.auth=null,this.messaging=null,this.auth=t.getImmediate({optional:!0}),this.messaging=e.getImmediate({optional:!0}),this.auth||t.get().then((function(t){return n.auth=t}),(function(){})),this.messaging||e.get().then((function(t){return n.messaging=t}),(function(){}))}return t.prototype.getAuthToken=function(){return i.__awaiter(this,void 0,void 0,(function(){var t;return i.__generator(this,(function(e){switch(e.label){case 0:if(!this.auth)return[2,void 0];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.auth.getToken()];case 2:return(t=e.sent())?[2,t.accessToken]:[2,void 0];case 3:return e.sent(),[2,void 0];case 4:return[2]}}))}))},t.prototype.getInstanceIdToken=function(){return i.__awaiter(this,void 0,void 0,(function(){return i.__generator(this,(function(t){if(!this.messaging||!("Notification"in self)||"granted"!==Notification.permission)return[2,void 0];try{return[2,this.messaging.getToken()]}catch(t){return[2,void 0]}return[2]}))}))},t.prototype.getContext=function(){return i.__awaiter(this,void 0,void 0,(function(){var t,e;return i.__generator(this,(function(n){switch(n.label){case 0:return[4,this.getAuthToken()];case 1:return t=n.sent(),[4,this.getInstanceIdToken()];case 2:return e=n.sent(),[2,{authToken:t,instanceIdToken:e}]}}))}))},t}();function f(t,e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r]));return n}var h,p,d,v=function(){function t(){}return t.prototype.encode=function(t){var e=this;if(null==t)return null;if(t instanceof Number&&(t=t.valueOf()),"number"==typeof t&&isFinite(t))return t;if(!0===t||!1===t)return t;if("[object String]"===Object.prototype.toString.call(t))return t;if(Array.isArray(t))return t.map((function(t){return e.encode(t)}));if("function"==typeof t||"object"==typeof t)return f(t,(function(t){return e.encode(t)}));throw new Error("Data cannot be encoded in JSON: "+t)},t.prototype.decode=function(t){var e=this;if(null==t)return t;if(t["@type"])switch(t["@type"]){case"type.googleapis.com/google.protobuf.Int64Value":case"type.googleapis.com/google.protobuf.UInt64Value":var n=Number(t.value);if(isNaN(n))throw new Error("Data cannot be decoded from JSON: "+t);return n;default:throw new Error("Data cannot be decoded from JSON: "+t)}return Array.isArray(t)?t.map((function(t){return e.decode(t)})):"function"==typeof t||"object"==typeof t?f(t,(function(t){return e.decode(t)})):t},t}(),y=function(){function t(t,e,n,r,i){var o=this;void 0===r&&(r="us-central1"),this.app_=t,this.fetchImpl=i,this.serializer=new v,this.emulatorOrigin=null,this.INTERNAL={delete:function(){return Promise.resolve(o.deleteService())}},this.contextProvider=new l(e,n),this.cancelAllRequests=new Promise((function(t){o.deleteService=function(){return t()}}));try{var a=new URL(r);this.customDomain=a.origin,this.region="us-central1"}catch(t){this.customDomain=null,this.region=r}}return Object.defineProperty(t.prototype,"app",{get:function(){return this.app_},enumerable:!1,configurable:!0}),t.prototype._url=function(t){var e=this.app_.options.projectId;return null!==this.emulatorOrigin?this.emulatorOrigin+"/"+e+"/"+this.region+"/"+t:null!==this.customDomain?this.customDomain+"/"+t:"https://"+this.region+"-"+e+".cloudfunctions.net/"+t},t.prototype.useFunctionsEmulator=function(t){this.emulatorOrigin=t},t.prototype.httpsCallable=function(t,e){var n=this;return function(r){return n.call(t,r,e||{})}},t.prototype.postJSON=function(t,e,n){return i.__awaiter(this,void 0,void 0,(function(){var r,o;return i.__generator(this,(function(i){switch(i.label){case 0:n["Content-Type"]="application/json",i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.fetchImpl(t,{method:"POST",body:JSON.stringify(e),headers:n})];case 2:return r=i.sent(),[3,4];case 3:return i.sent(),[2,{status:0,json:null}];case 4:o=null,i.label=5;case 5:return i.trys.push([5,7,,8]),[4,r.json()];case 6:return o=i.sent(),[3,8];case 7:return i.sent(),[3,8];case 8:return[2,{status:r.status,json:o}]}}))}))},t.prototype.call=function(t,e,n){return i.__awaiter(this,void 0,void 0,(function(){var r,o,a,s,l,f,h,p,d,v,y;return i.__generator(this,(function(i){switch(i.label){case 0:return r=this._url(t),e=this.serializer.encode(e),o={data:e},a={},[4,this.contextProvider.getContext()];case 1:return(s=i.sent()).authToken&&(a.Authorization="Bearer "+s.authToken),s.instanceIdToken&&(a["Firebase-Instance-ID-Token"]=s.instanceIdToken),l=n.timeout||7e4,f=function(t){var e,n=new Promise((function(n,r){e=setTimeout((function(){r(new c("deadline-exceeded","deadline-exceeded"))}),t)}));return{timer:e,promise:n}}(l),h=f.timer,p=f.promise,[4,Promise.race([g(h,this.postJSON(r,o,a)),p,g(h,this.cancelAllRequests)])];case 2:if(!(d=i.sent()))throw new c("cancelled","Firebase Functions instance was deleted.");if(v=function(t,e,n){var r=function(t){if(t>=200&&t<300)return"ok";switch(t){case 0:case 500:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}(t),i=r,o=void 0;try{var a=e&&e.error;if(a){var s=a.status;if("string"==typeof s){if(!u[s])return new c("internal","internal");r=u[s],i=s}var l=a.message;"string"==typeof l&&(i=l),void 0!==(o=a.details)&&(o=n.decode(o))}}catch(t){}return"ok"===r?null:new c(r,i,o)}(d.status,d.json,this.serializer))throw v;if(!d.json)throw new c("internal","Response is not valid JSON object.");if(void 0===(y=d.json.data)&&(y=d.json.result),void 0===y)throw new c("internal","Response is missing data field.");return[2,{data:this.serializer.decode(y)}]}}))}))},t}();function g(t,e){return i.__awaiter(this,void 0,void 0,(function(){var n;return i.__generator(this,(function(r){switch(r.label){case 0:return[4,e];case 1:return n=r.sent(),clearTimeout(t),[2,n]}}))}))}h=s.default,p=fetch.bind(self),d={Functions:y},h.INTERNAL.registerComponent(new o.Component("functions",(function(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),i=t.getProvider("messaging");return new y(n,r,i,e,p)}),"PUBLIC").setServiceProps(d).setMultipleInstances(!0)),s.default.registerVersion("@firebase/functions","0.5.1")},90426:(t,e,n)=>{"use strict";n.r(e),n.d(e,{registerInstallations:()=>$});var r,i=n(5752),o=n(79730),a=n(70655),s=n(31313),u=n(98676),c=n(25108),l="w:0.4.17",f=((r={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',r["not-registered"]="Firebase Installation is not registered.",r["installation-not-found"]="Firebase Installation not found.",r["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',r["app-offline"]="Could not process request. Application offline.",r["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",r),h=new s.ErrorFactory("installations","Installations",f);function p(t){return t instanceof s.FirebaseError&&t.code.includes("request-failed")}function d(t){return"https://firebaseinstallations.googleapis.com/v1/projects/"+t.projectId+"/installations"}function v(t){return{token:t.token,requestStatus:2,expiresIn:(e=t.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()};var e}function y(t,e){return(0,a.__awaiter)(this,void 0,void 0,(function(){var n,r;return(0,a.__generator)(this,(function(i){switch(i.label){case 0:return[4,e.json()];case 1:return n=i.sent(),r=n.error,[2,h.create("request-failed",{requestName:t,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})]}}))}))}function g(t){var e=t.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function m(t,e){var n=e.refreshToken,r=g(t);return r.append("Authorization",function(t){return"FIS_v2 "+t}(n)),r}function _(t){return(0,a.__awaiter)(this,void 0,void 0,(function(){var e;return(0,a.__generator)(this,(function(n){switch(n.label){case 0:return[4,t()];case 1:return(e=n.sent()).status>=500&&e.status<600?[2,t()]:[2,e]}}))}))}function b(t,e){var n=e.fid;return(0,a.__awaiter)(this,void 0,void 0,(function(){var e,r,i,o,s,u;return(0,a.__generator)(this,(function(a){switch(a.label){case 0:return e=d(t),r=g(t),i={fid:n,authVersion:"FIS_v2",appId:t.appId,sdkVersion:l},o={method:"POST",headers:r,body:JSON.stringify(i)},[4,_((function(){return fetch(e,o)}))];case 1:return(s=a.sent()).ok?[4,s.json()]:[3,3];case 2:return[2,{fid:(u=a.sent()).fid||n,registrationStatus:2,refreshToken:u.refreshToken,authToken:v(u.authToken)}];case 3:return[4,y("Create Installation",s)];case 4:throw a.sent()}}))}))}function w(t){return new Promise((function(e){setTimeout(e,t)}))}var E=/^[cdef][\w-]{21}$/;function T(){try{var t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;var e=function(t){return(e=t,btoa(String.fromCharCode.apply(String,(0,a.__spread)(e))).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var e}(t);return E.test(e)?e:""}catch(t){return""}}function S(t){return t.appName+"!"+t.appId}var I=new Map;function C(t,e){var n=S(t);O(n,e),function(t,e){var n=x();n&&n.postMessage({key:t,fid:e}),P()}(n,e)}function O(t,e){var n,r,i=I.get(t);if(i)try{for(var o=(0,a.__values)(i),s=o.next();!s.done;s=o.next())(0,s.value)(e)}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}var k=null;function x(){return!k&&"BroadcastChannel"in self&&((k=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(t){O(t.data.key,t.data.fid)}),k}function P(){0===I.size&&k&&(k.close(),k=null)}var A="firebase-installations-store",N=null;function R(){return N||(N=(0,u.openDb)("firebase-installations-database",1,(function(t){0===t.oldVersion&&t.createObjectStore(A)}))),N}function D(t,e){return(0,a.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s;return(0,a.__generator)(this,(function(a){switch(a.label){case 0:return n=S(t),[4,R()];case 1:return r=a.sent(),i=r.transaction(A,"readwrite"),[4,(o=i.objectStore(A)).get(n)];case 2:return s=a.sent(),[4,o.put(e,n)];case 3:return a.sent(),[4,i.complete];case 4:return a.sent(),s&&s.fid===e.fid||C(t,e.fid),[2,e]}}))}))}function L(t){return(0,a.__awaiter)(this,void 0,void 0,(function(){var e,n,r;return(0,a.__generator)(this,(function(i){switch(i.label){case 0:return e=S(t),[4,R()];case 1:return n=i.sent(),[4,(r=n.transaction(A,"readwrite")).objectStore(A).delete(e)];case 2:return i.sent(),[4,r.complete];case 3:return i.sent(),[2]}}))}))}function M(t,e){return(0,a.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,u;return(0,a.__generator)(this,(function(a){switch(a.label){case 0:return n=S(t),[4,R()];case 1:return r=a.sent(),i=r.transaction(A,"readwrite"),[4,(o=i.objectStore(A)).get(n)];case 2:return s=a.sent(),void 0!==(u=e(s))?[3,4]:[4,o.delete(n)];case 3:return a.sent(),[3,6];case 4:return[4,o.put(u,n)];case 5:a.sent(),a.label=6;case 6:return[4,i.complete];case 7:return a.sent(),!u||s&&s.fid===u.fid||C(t,u.fid),[2,u]}}))}))}function j(t){return(0,a.__awaiter)(this,void 0,void 0,(function(){var e,n,r;return(0,a.__generator)(this,(function(i){switch(i.label){case 0:return[4,M(t,(function(n){var r=function(t){return V(t||{fid:T(),registrationStatus:0})}(n),i=function(t,e){if(0===e.registrationStatus){if(!navigator.onLine)return{installationEntry:e,registrationPromise:Promise.reject(h.create("app-offline"))};var n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},r=function(t,e){return(0,a.__awaiter)(this,void 0,void 0,(function(){var n,r;return(0,a.__generator)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,7]),[4,b(t,e)];case 1:return n=i.sent(),[2,D(t,n)];case 2:return p(r=i.sent())&&409===r.serverCode?[4,L(t)]:[3,4];case 3:return i.sent(),[3,6];case 4:return[4,D(t,{fid:e.fid,registrationStatus:0})];case 5:i.sent(),i.label=6;case 6:throw r;case 7:return[2]}}))}))}(t,n);return{installationEntry:n,registrationPromise:r}}return 1===e.registrationStatus?{installationEntry:e,registrationPromise:F(t)}:{installationEntry:e}}(t,r);return e=i.registrationPromise,i.installationEntry}))];case 1:return""!==(n=i.sent()).fid?[3,3]:(r={},[4,e]);case 2:return[2,(r.installationEntry=i.sent(),r)];case 3:return[2,{installationEntry:n,registrationPromise:e}]}}))}))}function F(t){return(0,a.__awaiter)(this,void 0,void 0,(function(){var e,n,r,i;return(0,a.__generator)(this,(function(o){switch(o.label){case 0:return[4,U(t)];case 1:e=o.sent(),o.label=2;case 2:return 1!==e.registrationStatus?[3,5]:[4,w(100)];case 3:return o.sent(),[4,U(t)];case 4:return e=o.sent(),[3,2];case 5:return 0!==e.registrationStatus?[3,7]:[4,j(t)];case 6:return n=o.sent(),r=n.installationEntry,(i=n.registrationPromise)?[2,i]:[2,r];case 7:return[2,e]}}))}))}function U(t){return M(t,(function(t){if(!t)throw h.create("installation-not-found");return V(t)}))}function V(t){return 1===(e=t).registrationStatus&&e.registrationTime+1e4{"use strict";n.r(e),n.d(e,{LogLevel:()=>a,Logger:()=>h,setLogLevel:()=>p,setUserLogHandler:()=>d});var r,i=n(25108);function o(){for(var t=0,e=0,n=arguments.length;e=(null!=r?r:e.logLevel)&&t({level:a[n].toLowerCase(),message:s,args:i,type:e.name})}},r=0,i=s;r{"use strict";n.r(e),n(90426);var r,i,o=n(79730),a=n(31313),s=n(70655),u=n(98676),c=n(5752),l=n(25108),f=((r={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',r["only-available-in-window"]="This method is available in a Window context.",r["only-available-in-sw"]="This method is available in a service worker context.",r["permission-default"]="The notification permission was not granted and dismissed instead.",r["permission-blocked"]="The notification permission was not granted and blocked instead.",r["unsupported-browser"]="This browser doesn't support the API's required to use the firebase SDK.",r["failed-service-worker-registration"]="We are unable to register the default service worker. {$browserErrorMessage}",r["token-subscribe-failed"]="A problem occurred while subscribing the user to FCM: {$errorInfo}",r["token-subscribe-no-token"]="FCM returned no token when subscribing the user to push.",r["token-unsubscribe-failed"]="A problem occurred while unsubscribing the user from FCM: {$errorInfo}",r["token-update-failed"]="A problem occurred while updating the user from FCM: {$errorInfo}",r["token-update-no-token"]="FCM returned no token when updating the user to push.",r["use-sw-after-get-token"]="The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.",r["invalid-sw-registration"]="The input to useServiceWorker() must be a ServiceWorkerRegistration.",r["invalid-bg-handler"]="The input to setBackgroundMessageHandler() must be a function.",r["invalid-vapid-key"]="The public VAPID key must be a string.",r["use-vapid-key-after-get-token"]="The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used.",r),h=new a.ErrorFactory("messaging","Messaging",f),p="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4";function d(t){var e=new Uint8Array(t);return btoa(String.fromCharCode.apply(String,(0,s.__spread)(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function v(t){for(var e=(t+"=".repeat((4-t.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(e),r=new Uint8Array(n.length),i=0;i0&&"string"==typeof t.token&&t.token.length>0&&"string"==typeof e.auth&&e.auth.length>0&&"string"==typeof e.p256dh&&e.p256dh.length>0&&"string"==typeof e.endpoint&&e.endpoint.length>0&&"string"==typeof e.swScope&&e.swScope.length>0&&"string"==typeof e.vapidKey&&e.vapidKey.length>0}var b="firebase-messaging-store",w=null;function E(){return w||(w=(0,u.openDb)("firebase-messaging-database",1,(function(t){0===t.oldVersion&&t.createObjectStore(b)}))),w}function T(t){return(0,s.__awaiter)(this,void 0,void 0,(function(){var e,n,r;return(0,s.__generator)(this,(function(i){switch(i.label){case 0:return e=C(t),[4,E()];case 1:return[4,i.sent().transaction(b).objectStore(b).get(e)];case 2:return(n=i.sent())?[2,n]:[3,3];case 3:return[4,m(t.appConfig.senderId)];case 4:return(r=i.sent())?[4,S(t,r)]:[3,6];case 5:return i.sent(),[2,r];case 6:return[2]}}))}))}function S(t,e){return(0,s.__awaiter)(this,void 0,void 0,(function(){var n,r,i;return(0,s.__generator)(this,(function(o){switch(o.label){case 0:return n=C(t),[4,E()];case 1:return r=o.sent(),[4,(i=r.transaction(b,"readwrite")).objectStore(b).put(e,n)];case 2:return o.sent(),[4,i.complete];case 3:return o.sent(),[2,e]}}))}))}function I(t){return(0,s.__awaiter)(this,void 0,void 0,(function(){var e,n,r;return(0,s.__generator)(this,(function(i){switch(i.label){case 0:return e=C(t),[4,E()];case 1:return n=i.sent(),[4,(r=n.transaction(b,"readwrite")).objectStore(b).delete(e)];case 2:return i.sent(),[4,r.complete];case 3:return i.sent(),[2]}}))}))}function C(t){return t.appConfig.appId}function O(t,e){return(0,s.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,a,u;return(0,s.__generator)(this,(function(s){switch(s.label){case 0:return[4,A(t)];case 1:n=s.sent(),r=N(e),i={method:"POST",headers:n,body:JSON.stringify(r)},s.label=2;case 2:return s.trys.push([2,5,,6]),[4,fetch(P(t.appConfig),i)];case 3:return[4,s.sent().json()];case 4:return o=s.sent(),[3,6];case 5:throw a=s.sent(),h.create("token-subscribe-failed",{errorInfo:a});case 6:if(o.error)throw u=o.error.message,h.create("token-subscribe-failed",{errorInfo:u});if(!o.token)throw h.create("token-subscribe-no-token");return[2,o.token]}}))}))}function k(t,e){return(0,s.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,a,u;return(0,s.__generator)(this,(function(s){switch(s.label){case 0:return[4,A(t)];case 1:n=s.sent(),r=N(e.subscriptionOptions),i={method:"PATCH",headers:n,body:JSON.stringify(r)},s.label=2;case 2:return s.trys.push([2,5,,6]),[4,fetch(P(t.appConfig)+"/"+e.token,i)];case 3:return[4,s.sent().json()];case 4:return o=s.sent(),[3,6];case 5:throw a=s.sent(),h.create("token-update-failed",{errorInfo:a});case 6:if(o.error)throw u=o.error.message,h.create("token-update-failed",{errorInfo:u});if(!o.token)throw h.create("token-update-no-token");return[2,o.token]}}))}))}function x(t,e){return(0,s.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,a;return(0,s.__generator)(this,(function(s){switch(s.label){case 0:return[4,A(t)];case 1:n=s.sent(),r={method:"DELETE",headers:n},s.label=2;case 2:return s.trys.push([2,5,,6]),[4,fetch(P(t.appConfig)+"/"+e,r)];case 3:return[4,s.sent().json()];case 4:if((i=s.sent()).error)throw o=i.error.message,h.create("token-unsubscribe-failed",{errorInfo:o});return[3,6];case 5:throw a=s.sent(),h.create("token-unsubscribe-failed",{errorInfo:a});case 6:return[2]}}))}))}function P(t){return"https://fcmregistrations.googleapis.com/v1/projects/"+t.projectId+"/registrations"}function A(t){var e=t.appConfig,n=t.installations;return(0,s.__awaiter)(this,void 0,void 0,(function(){var t;return(0,s.__generator)(this,(function(r){switch(r.label){case 0:return[4,n.getToken()];case 1:return t=r.sent(),[2,new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":"FIS "+t})]}}))}))}function N(t){var e=t.p256dh,n=t.auth,r=t.endpoint,i=t.vapidKey,o={web:{endpoint:r,auth:n,p256dh:e}};return i!==p&&(o.web.applicationPubKey=i),o}function R(t,e,n){return(0,s.__awaiter)(this,void 0,void 0,(function(){var r,i,o,a;return(0,s.__generator)(this,(function(s){switch(s.label){case 0:if("granted"!==Notification.permission)throw h.create("permission-blocked");return[4,j(e,n)];case 1:return r=s.sent(),[4,T(t)];case 2:return i=s.sent(),o={vapidKey:n,swScope:e.scope,endpoint:r.endpoint,auth:d(r.getKey("auth")),p256dh:d(r.getKey("p256dh"))},i?[3,3]:[2,M(t,o)];case 3:if(u=i.subscriptionOptions,f=(c=o).vapidKey===u.vapidKey,p=c.endpoint===u.endpoint,v=c.auth===u.auth,y=c.p256dh===u.p256dh,f&&p&&v&&y)return[3,8];s.label=4;case 4:return s.trys.push([4,6,,7]),[4,x(t,i.token)];case 5:return s.sent(),[3,7];case 6:return a=s.sent(),l.warn(a),[3,7];case 7:return[2,M(t,o)];case 8:return Date.now()>=i.createTime+6048e5?[2,L({token:i.token,createTime:Date.now(),subscriptionOptions:o},t,e)]:[2,i.token];case 9:return[2]}var u,c,f,p,v,y}))}))}function D(t,e){return(0,s.__awaiter)(this,void 0,void 0,(function(){var n,r;return(0,s.__generator)(this,(function(i){switch(i.label){case 0:return[4,T(t)];case 1:return(n=i.sent())?[4,x(t,n.token)]:[3,4];case 2:return i.sent(),[4,I(t)];case 3:i.sent(),i.label=4;case 4:return[4,e.pushManager.getSubscription()];case 5:return(r=i.sent())?[2,r.unsubscribe()]:[2,!0]}}))}))}function L(t,e,n){return(0,s.__awaiter)(this,void 0,void 0,(function(){var r,i,o;return(0,s.__generator)(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,5]),[4,k(e,t)];case 1:return r=a.sent(),i=(0,s.__assign)((0,s.__assign)({},t),{token:r,createTime:Date.now()}),[4,S(e,i)];case 2:return a.sent(),[2,r];case 3:return o=a.sent(),[4,D(e,n)];case 4:throw a.sent(),o;case 5:return[2]}}))}))}function M(t,e){return(0,s.__awaiter)(this,void 0,void 0,(function(){var n,r;return(0,s.__generator)(this,(function(i){switch(i.label){case 0:return[4,O(t,e)];case 1:return n=i.sent(),r={token:n,createTime:Date.now(),subscriptionOptions:e},[4,S(t,r)];case 2:return i.sent(),[2,r.token]}}))}))}function j(t,e){return(0,s.__awaiter)(this,void 0,void 0,(function(){var n;return(0,s.__generator)(this,(function(r){switch(r.label){case 0:return[4,t.pushManager.getSubscription()];case 1:return(n=r.sent())?[2,n]:[2,t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:v(e)})]}}))}))}function F(t){return"object"==typeof t&&!!t&&"google.c.a.c_id"in t}var U=function(){function t(t){var e=this;this.firebaseDependencies=t,this.isOnBackgroundMessageUsed=null,this.vapidKey=null,this.bgMessageHandler=null,self.addEventListener("push",(function(t){t.waitUntil(e.onPush(t))})),self.addEventListener("pushsubscriptionchange",(function(t){t.waitUntil(e.onSubChange(t))})),self.addEventListener("notificationclick",(function(t){t.waitUntil(e.onNotificationClick(t))}))}return Object.defineProperty(t.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),t.prototype.setBackgroundMessageHandler=function(t){if(this.isOnBackgroundMessageUsed=!1,!t||"function"!=typeof t)throw h.create("invalid-bg-handler");this.bgMessageHandler=t},t.prototype.onBackgroundMessage=function(t){var e=this;return this.isOnBackgroundMessageUsed=!0,this.bgMessageHandler=t,function(){e.bgMessageHandler=null}},t.prototype.getToken=function(){var t,e;return(0,s.__awaiter)(this,void 0,void 0,(function(){var n;return(0,s.__generator)(this,(function(r){switch(r.label){case 0:return this.vapidKey?[3,2]:[4,T(this.firebaseDependencies)];case 1:n=r.sent(),this.vapidKey=null!==(e=null===(t=null==n?void 0:n.subscriptionOptions)||void 0===t?void 0:t.vapidKey)&&void 0!==e?e:p,r.label=2;case 2:return[2,R(this.firebaseDependencies,self.registration,this.vapidKey)]}}))}))},t.prototype.deleteToken=function(){return D(this.firebaseDependencies,self.registration)},t.prototype.requestPermission=function(){throw h.create("only-available-in-window")},t.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw h.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw h.create("invalid-vapid-key");this.vapidKey=t},t.prototype.useServiceWorker=function(){throw h.create("only-available-in-window")},t.prototype.onMessage=function(){throw h.create("only-available-in-window")},t.prototype.onTokenRefresh=function(){throw h.create("only-available-in-window")},t.prototype.onPush=function(t){return(0,s.__awaiter)(this,void 0,void 0,(function(){var e,n,r,i;return(0,s.__generator)(this,(function(o){switch(o.label){case 0:return e=function(t){var e=t.data;if(!e)return null;try{return e.json()}catch(t){return null}}(t),e?[4,W()]:(l.debug("FirebaseMessaging: failed to get parsed MessagePayload from the PushEvent. Skip handling the push."),[2]);case 1:return function(t){return t.some((function(t){return"visible"===t.visibilityState&&!t.url.startsWith("chrome-extension://")}))}(n=o.sent())?[2,B(n,e)]:(r=!1,e.notification?[4,G(V(e))]:[3,3]);case 2:o.sent(),r=!0,o.label=3;case 3:return!0===r&&!1===this.isOnBackgroundMessageUsed||this.bgMessageHandler&&(i=function(t){var e={from:t.from,collapseKey:t.collapse_key};return function(t,e){if(e.notification){t.notification={};var n=e.notification.title;n&&(t.notification.title=n);var r=e.notification.body;r&&(t.notification.body=r);var i=e.notification.image;i&&(t.notification.image=i)}}(e,t),function(t,e){e.data&&(t.data=e.data)}(e,t),function(t,e){if(e.fcmOptions){t.fcmOptions={};var n=e.fcmOptions.link;n&&(t.fcmOptions.link=n);var r=e.fcmOptions.analytics_label;r&&(t.fcmOptions.analyticsLabel=r)}}(e,t),e}(e),"function"==typeof this.bgMessageHandler?this.bgMessageHandler(i):this.bgMessageHandler.next(i)),[2]}}))}))},t.prototype.onSubChange=function(t){var e,n;return(0,s.__awaiter)(this,void 0,void 0,(function(){var r;return(0,s.__generator)(this,(function(i){switch(i.label){case 0:return t.newSubscription?[3,2]:[4,D(this.firebaseDependencies,self.registration)];case 1:case 5:return i.sent(),[2];case 2:return[4,T(this.firebaseDependencies)];case 3:return r=i.sent(),[4,D(this.firebaseDependencies,self.registration)];case 4:return i.sent(),[4,R(this.firebaseDependencies,self.registration,null!==(n=null===(e=null==r?void 0:r.subscriptionOptions)||void 0===e?void 0:e.vapidKey)&&void 0!==n?n:p)]}}))}))},t.prototype.onNotificationClick=function(t){var e,n;return(0,s.__awaiter)(this,void 0,void 0,(function(){var r,o,a,u,c;return(0,s.__generator)(this,(function(s){switch(s.label){case 0:return(r=null===(n=null===(e=t.notification)||void 0===e?void 0:e.data)||void 0===n?void 0:n.FCM_MSG)?t.action?[2]:(t.stopImmediatePropagation(),t.notification.close(),o=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||(F(t.data)?self.location.origin:null)}(r),o?(a=new URL(o,self.location.href),u=new URL(self.location.origin),a.host!==u.host?[2]:[4,q(a)]):[2]):[2];case 1:return(c=s.sent())?[3,4]:[4,self.clients.openWindow(o)];case 2:return c=s.sent(),[4,(3e3,new Promise((function(t){setTimeout(t,3e3)})))];case 3:return s.sent(),[3,6];case 4:return[4,c.focus()];case 5:c=s.sent(),s.label=6;case 6:return c?(r.messageType=i.NOTIFICATION_CLICKED,r.isFirebaseMessaging=!0,[2,c.postMessage(r)]):[2]}}))}))},t}();function V(t){var e,n=(0,s.__assign)({},t.notification);return n.data=((e={}).FCM_MSG=t,e),n}function q(t){return(0,s.__awaiter)(this,void 0,void 0,(function(){var e,n,r,i,o,a,u;return(0,s.__generator)(this,(function(c){switch(c.label){case 0:return[4,W()];case 1:e=c.sent();try{for(n=(0,s.__values)(e),r=n.next();!r.done;r=n.next())if(i=r.value,o=new URL(i.url,self.location.href),t.host===o.host)return[2,i]}catch(t){a={error:t}}finally{try{r&&!r.done&&(u=n.return)&&u.call(n)}finally{if(a)throw a.error}}return[2,null]}}))}))}function B(t,e){var n,r;e.isFirebaseMessaging=!0,e.messageType=i.PUSH_RECEIVED;try{for(var o=(0,s.__values)(t),a=o.next();!a.done;a=o.next())a.value.postMessage(e)}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}function W(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function G(t){var e,n=t.actions,r=Notification.maxActions;return n&&r&&n.length>r&&l.warn("This browser only supports "+r+" actions. The remaining actions will not be displayed."),self.registration.showNotification(null!==(e=t.title)&&void 0!==e?e:"",t)}var z=function(){function t(t){var e=this;this.firebaseDependencies=t,this.vapidKey=null,this.onMessageCallback=null,navigator.serviceWorker.addEventListener("message",(function(t){return e.messageEventListener(t)}))}return Object.defineProperty(t.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),t.prototype.messageEventListener=function(t){return(0,s.__awaiter)(this,void 0,void 0,(function(){var e,n;return(0,s.__generator)(this,(function(r){switch(r.label){case 0:return(e=t.data).isFirebaseMessaging?(this.onMessageCallback&&e.messageType===i.PUSH_RECEIVED&&("function"==typeof this.onMessageCallback?this.onMessageCallback(function(t){return delete t.messageType,delete t.isFirebaseMessaging,t}(Object.assign({},e))):this.onMessageCallback.next(Object.assign({},e))),F(n=e.data)&&"1"===n["google.c.a.e"]?[4,this.logEvent(e.messageType,n)]:[3,2]):[2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.getVapidKey=function(){return this.vapidKey},t.prototype.getSwReg=function(){return this.swRegistration},t.prototype.getToken=function(t){return(0,s.__awaiter)(this,void 0,void 0,(function(){return(0,s.__generator)(this,(function(e){switch(e.label){case 0:return"default"!==Notification.permission?[3,2]:[4,Notification.requestPermission()];case 1:e.sent(),e.label=2;case 2:if("granted"!==Notification.permission)throw h.create("permission-blocked");return[4,this.updateVapidKey(null==t?void 0:t.vapidKey)];case 3:return e.sent(),[4,this.updateSwReg(null==t?void 0:t.serviceWorkerRegistration)];case 4:return e.sent(),[2,R(this.firebaseDependencies,this.swRegistration,this.vapidKey)]}}))}))},t.prototype.updateVapidKey=function(t){return(0,s.__awaiter)(this,void 0,void 0,(function(){return(0,s.__generator)(this,(function(e){return t?this.vapidKey=t:this.vapidKey||(this.vapidKey=p),[2]}))}))},t.prototype.updateSwReg=function(t){return(0,s.__awaiter)(this,void 0,void 0,(function(){return(0,s.__generator)(this,(function(e){switch(e.label){case 0:return t||this.swRegistration?[3,2]:[4,this.registerDefaultSw()];case 1:e.sent(),e.label=2;case 2:if(!t&&this.swRegistration)return[2];if(!(t instanceof ServiceWorkerRegistration))throw h.create("invalid-sw-registration");return this.swRegistration=t,[2]}}))}))},t.prototype.registerDefaultSw=function(){return(0,s.__awaiter)(this,void 0,void 0,(function(){var t,e;return(0,s.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),t=this,[4,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"})];case 1:return t.swRegistration=n.sent(),this.swRegistration.update().catch((function(){})),[3,3];case 2:throw e=n.sent(),h.create("failed-service-worker-registration",{browserErrorMessage:e.message});case 3:return[2]}}))}))},t.prototype.deleteToken=function(){return(0,s.__awaiter)(this,void 0,void 0,(function(){return(0,s.__generator)(this,(function(t){switch(t.label){case 0:return this.swRegistration?[3,2]:[4,this.registerDefaultSw()];case 1:t.sent(),t.label=2;case 2:return[2,D(this.firebaseDependencies,this.swRegistration)]}}))}))},t.prototype.requestPermission=function(){return(0,s.__awaiter)(this,void 0,void 0,(function(){var t;return(0,s.__generator)(this,(function(e){switch(e.label){case 0:return"granted"===Notification.permission?[2]:[4,Notification.requestPermission()];case 1:if("granted"===(t=e.sent()))return[2];throw"denied"===t?h.create("permission-blocked"):h.create("permission-default")}}))}))},t.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw h.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw h.create("invalid-vapid-key");this.vapidKey=t},t.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw h.create("invalid-sw-registration");if(this.swRegistration)throw h.create("use-sw-after-get-token");this.swRegistration=t},t.prototype.onMessage=function(t){var e=this;return this.onMessageCallback=t,function(){e.onMessageCallback=null}},t.prototype.setBackgroundMessageHandler=function(){throw h.create("only-available-in-sw")},t.prototype.onBackgroundMessage=function(){throw h.create("only-available-in-sw")},t.prototype.onTokenRefresh=function(){return function(){}},t.prototype.logEvent=function(t,e){return(0,s.__awaiter)(this,void 0,void 0,(function(){var n;return(0,s.__generator)(this,(function(r){switch(r.label){case 0:return n=function(t){switch(t){case i.NOTIFICATION_CLICKED:return"notification_open";case i.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(t),[4,this.firebaseDependencies.analyticsProvider.get()];case 1:return r.sent().logEvent(n,{message_id:e["google.c.a.c_id"],message_name:e["google.c.a.c_l"],message_time:e["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)}),[2]}}))}))},t}();function H(t){return h.create("missing-app-config-values",{valueName:t})}var K={isSupported:$};function $(){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")}c.default.INTERNAL.registerComponent(new o.Component("messaging",(function(t){var e=t.getProvider("app").getImmediate(),n=function(t){var e,n;if(!t||!t.options)throw H("App Configuration Object");if(!t.name)throw H("App Name");var r=t.options;try{for(var i=(0,s.__values)(["projectId","apiKey","appId","messagingSenderId"]),o=i.next();!o.done;o=i.next()){var a=o.value;if(!r[a])throw H(a)}}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),r={app:e,appConfig:n,installations:t.getProvider("installations").getImmediate(),analyticsProvider:t.getProvider("analytics-internal")};if(!$())throw h.create("unsupported-browser");return self&&"ServiceWorkerGlobalScope"in self?new U(r):new z(r)}),"PUBLIC").setServiceProps(K))},11136:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(5752);n(90426);var i=n(70655),o=n(31313),a=n(14594),s=n(79730);function u(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var c,l,f,h=u(r),p="0.4.2",d=p,v="FB-PERF-TRACE-MEASURE",y="_wt_",g="_fcp",m="_fid",_="@firebase/performance/config",b="@firebase/performance/configexpire",w="Performance",E=((c={})["trace started"]="Trace {$traceName} was started before.",c["trace stopped"]="Trace {$traceName} is not running.",c["nonpositive trace startTime"]="Trace {$traceName} startTime should be positive.",c["nonpositive trace duration"]="Trace {$traceName} duration should be positive.",c["no window"]="Window is not available.",c["no app id"]="App id is not available.",c["no project id"]="Project id is not available.",c["no api key"]="Api key is not available.",c["invalid cc log"]="Attempted to queue invalid cc event",c["FB not default"]="Performance can only start when Firebase app instance is the default one.",c["RC response not ok"]="RC response is not ok",c["invalid attribute name"]="Attribute name {$attributeName} is invalid.",c["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",c["invalid custom metric name"]="Custom metric name {$customMetricName} is invalid",c["invalid String merger input"]="Input for String merger is invalid, contact support team to resolve.",c),T=new o.ErrorFactory("performance",w,E),S=new a.Logger(w);S.logLevel=a.LogLevel.INFO;var I,C=function(){function t(t){if(this.window=t,!t)throw T.create("no window");this.performance=t.performance,this.PerformanceObserver=t.PerformanceObserver,this.windowLocation=t.location,this.navigator=t.navigator,this.document=t.document,this.navigator&&this.navigator.cookieEnabled&&(this.localStorage=t.localStorage),t.perfMetrics&&t.perfMetrics.onFirstInputDelay&&(this.onFirstInputDelay=t.perfMetrics.onFirstInputDelay)}return t.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},t.prototype.mark=function(t){this.performance&&this.performance.mark&&this.performance.mark(t)},t.prototype.measure=function(t,e,n){this.performance&&this.performance.measure&&this.performance.measure(t,e,n)},t.prototype.getEntriesByType=function(t){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(t):[]},t.prototype.getEntriesByName=function(t){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(t):[]},t.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},t.prototype.requiredApisAvailable=function(){return fetch&&Promise&&this.navigator&&this.navigator.cookieEnabled?!!o.isIndexedDBAvailable()||(S.info("IndexedDB is not supported by current browswer"),!1):(S.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled."),!1)},t.prototype.setupObserver=function(t,e){if(this.PerformanceObserver){var n=new this.PerformanceObserver((function(t){for(var n=0,r=t.getEntries();n1)throw T.create("invalid String merger input");for(var r=[],i=0;ii&&r.push(e.charAt(i));return r.join("")}var k,x,P=function(){function t(){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=O("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=O("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}return t.prototype.getAppId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!t)throw T.create("no app id");return t},t.prototype.getProjectId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!t)throw T.create("no project id");return t},t.prototype.getApiKey=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!t)throw T.create("no api key");return t},t.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},t.getInstance=function(){return void 0===I&&(I=new t),I},t}();function A(){return k}!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.VISIBLE=1]="VISIBLE",t[t.HIDDEN=2]="HIDDEN"}(x||(x={}));var N=["firebase_","google_","ga_"],R=new RegExp("^[a-zA-Z]\\w*$");function D(){var t=C.getInstance().navigator;return"serviceWorker"in t?t.serviceWorker.controller?2:3:1}function L(){switch(C.getInstance().document.visibilityState){case"visible":return x.VISIBLE;case"hidden":return x.HIDDEN;default:return x.UNKNOWN}}function M(){var t=C.getInstance().navigator.connection;switch(t&&t.effectiveType){case"slow-2g":return 1;case"2g":return 2;case"3g":return 3;case"4g":return 4;default:return 0}}var j="Could not fetch config, will use default configs";function F(t){if(!t)return t;var e=P.getInstance(),n=t.entries||{};return void 0!==n.fpr_enabled?e.loggingEnabled="true"===String(n.fpr_enabled):e.loggingEnabled=true,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=U(e.tracesSamplingRate),e.logNetworkAfterSampling=U(e.networkRequestsSamplingRate),t}function U(t){return Math.random()<=t}var V,q=1;function B(){return q=2,V=V||function(){var t=C.getInstance().document;return new Promise((function(e){if(t&&"complete"!==t.readyState){var n=function(){"complete"===t.readyState&&(t.removeEventListener("readystatechange",n),e())};t.addEventListener("readystatechange",n)}else e()}))}().then((function(){return(t=P.getInstance().installationsService.getId()).then((function(t){k=t})),t;var t})).then((function(t){return function(t){var e=function(){var t=C.getInstance().localStorage;if(t){var e=t.getItem(b);if(e&&Number(e)>Date.now()){var n=t.getItem(_);if(n)try{return JSON.parse(n)}catch(t){return}}}}();return e?(F(e),Promise.resolve()):function(t){return(e=P.getInstance().installationsService.getToken(),e.then((function(t){})),e).then((function(e){var n="https://firebaseremoteconfig.googleapis.com/v1/projects/"+P.getInstance().getProjectId()+"/namespaces/fireperf:fetch?key="+P.getInstance().getApiKey(),r=new Request(n,{method:"POST",headers:{Authorization:"FIREBASE_INSTALLATIONS_AUTH "+e},body:JSON.stringify({app_instance_id:t,app_instance_id_token:e,app_id:P.getInstance().getAppId(),app_version:d,sdk_version:"0.0.1"})});return fetch(r).then((function(t){if(t.ok)return t.json();throw T.create("RC response not ok")}))})).catch((function(){S.info(j)}));var e}(t).then(F).then((function(t){return function(t){var e=C.getInstance().localStorage;t&&e&&(e.setItem(_,JSON.stringify(t)),e.setItem(b,String(Date.now()+60*P.getInstance().configTimeToLive*60*1e3)))}(t)}),(function(){}))}(t)})).then((function(){return W()}),(function(){return W()}))}function W(){q=3}var G,z=1e4,H=3,K=[],$=!1;function Q(t){setTimeout((function(){if(0!==H)return K.length?void function(){var t=i.__spreadArrays(K);K=[];var e=t.map((function(t){return{source_extension_json_proto3:t.message,event_time_ms:String(t.eventTime)}}));(function(t,e){return function(t){var e=P.getInstance().getFlTransportFullUrl();return fetch(e,{method:"POST",body:JSON.stringify(t)})}(t).then((function(t){return t.ok||S.info("Call to Firebase backend failed."),t.json()})).then((function(t){var n=Number(t.nextRequestWaitMillis),r=z;isNaN(n)||(r=Math.max(n,r));var o=t.logResponseDetails;Array.isArray(o)&&o.length>0&&"RETRY_REQUEST_LATER"===o[0].responseAction&&(K=i.__spreadArrays(e,K),S.info("Retry transport request later.")),H=3,Q(r)}))})({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:P.getInstance().logSource,log_event:e},t).catch((function(){K=i.__spreadArrays(t,K),H--,S.info("Tries left: "+H+"."),Q(z)}))}():Q(z)}),t)}function Y(t){if(!t.eventTime||!t.message)throw T.create("invalid cc log");K=i.__spreadArrays(K,[t])}function X(t,e){G||(G=function(t){return function(){for(var e=[],n=0;n100)&&(e&&e.startsWith(y)&&nt.indexOf(t)>-1||!t.startsWith("_"))}(t,this.name))throw T.create("invalid custom metric name",{customMetricName:t});var n,r;this.counters[t]=(n=e,(r=Math.floor(n))40||N.some((function(e){return t.startsWith(e)}))||!t.match(R))}(t),r=function(t){return 0!==t.length&&t.length<=100}(e);if(n&&r)this.customAttributes[t]=e;else{if(!n)throw T.create("invalid attribute name",{attributeName:t});if(!r)throw T.create("invalid attribute value",{attributeValue:e})}},t.prototype.getAttribute=function(t){return this.customAttributes[t]},t.prototype.removeAttribute=function(t){void 0!==this.customAttributes[t]&&delete this.customAttributes[t]},t.prototype.getAttributes=function(){return i.__assign({},this.customAttributes)},t.prototype.setStartTime=function(t){this.startTimeUs=t},t.prototype.setDuration=function(t){this.durationUs=t},t.prototype.calculateTraceMetrics=function(){var t=this.api.getEntriesByName(this.traceMeasure),e=t&&t[0];e&&(this.durationUs=Math.floor(1e3*e.duration),this.startTimeUs=Math.floor(1e3*(e.startTime+this.api.getTimeOrigin())))},t.createOobTrace=function(e,n,r){var i=C.getInstance().getUrl();if(i){var o=new t(y+i,!0),a=Math.floor(1e3*C.getInstance().getTimeOrigin());if(o.setStartTime(a),e&&e[0]&&(o.setDuration(Math.floor(1e3*e[0].duration)),o.putMetric("domInteractive",Math.floor(1e3*e[0].domInteractive)),o.putMetric("domContentLoadedEventEnd",Math.floor(1e3*e[0].domContentLoadedEventEnd)),o.putMetric("loadEventEnd",Math.floor(1e3*e[0].loadEventEnd))),n){var s=n.find((function(t){return"first-paint"===t.name}));s&&s.startTime&&o.putMetric("_fp",Math.floor(1e3*s.startTime));var u=n.find((function(t){return"first-contentful-paint"===t.name}));u&&u.startTime&&o.putMetric(g,Math.floor(1e3*u.startTime)),r&&o.putMetric(m,Math.floor(1e3*r))}J(o)}},t.createUserTimingTrace=function(e){J(new t(e,!1,e))},t}();function it(t){var e=t;if(e&&void 0!==e.responseStart){var n=C.getInstance().getTimeOrigin(),r=Math.floor(1e3*(e.startTime+n)),i=e.responseStart?Math.floor(1e3*(e.responseStart-e.startTime)):void 0,o=Math.floor(1e3*(e.responseEnd-e.startTime));!function(t){var e=P.getInstance();if(e.instrumentationEnabled){var n=t.url,r=e.logEndPointUrl.split("?")[0],i=e.flTransportEndpointUrl.split("?")[0];n!==r&&n!==i&&e.loggingEnabled&&e.logNetworkAfterSampling&&setTimeout((function(){return X(t,0)}),0)}}({url:e.name&&e.name.split("?")[0],responsePayloadBytes:e.transferSize,startTimeUs:r,timeToResponseInitiatedUs:i,timeToResponseCompletedUs:o})}}function ot(){A()&&(setTimeout((function(){return function(){var t=C.getInstance(),e=t.getEntriesByType("navigation"),n=t.getEntriesByType("paint");if(t.onFirstInputDelay){var r=setTimeout((function(){rt.createOobTrace(e,n),r=void 0}),5e3);t.onFirstInputDelay((function(t){r&&(clearTimeout(r),rt.createOobTrace(e,n,t))}))}else rt.createOobTrace(e,n)}()}),0),setTimeout((function(){return function(){for(var t=C.getInstance(),e=0,n=t.getEntriesByType("resource");e{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(5752);n(90426);var i=n(70655),o=n(31313),a=n(14594),s=n(79730);function u(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var c,l=u(r),f=function(){function t(t,e,n,r){this.client=t,this.storage=e,this.storageCache=n,this.logger=r}return t.prototype.isCachedDataFresh=function(t,e){if(!e)return this.logger.debug("Config fetch cache check. Cache unpopulated."),!1;var n=Date.now()-e,r=n<=t;return this.logger.debug("Config fetch cache check. Cache age millis: "+n+". Cache max age millis (minimumFetchIntervalMillis setting): "+t+". Is cache hit: "+r+"."),r},t.prototype.fetch=function(t){return i.__awaiter(this,void 0,void 0,(function(){var e,n,r,o,a;return i.__generator(this,(function(i){switch(i.label){case 0:return[4,Promise.all([this.storage.getLastSuccessfulFetchTimestampMillis(),this.storage.getLastSuccessfulFetchResponse()])];case 1:return e=i.sent(),n=e[0],(r=e[1])&&this.isCachedDataFresh(t.cacheMaxAgeMillis,n)?[2,r]:(t.eTag=r&&r.eTag,[4,this.client.fetch(t)]);case 2:return o=i.sent(),a=[this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())],200===o.status&&a.push(this.storage.setLastSuccessfulFetchResponse(o)),[4,Promise.all(a)];case 3:return i.sent(),[2,o]}}))}))},t}(),h=((c={})["registration-window"]="Undefined window object. This SDK only supports usage in a browser environment.",c["registration-project-id"]="Undefined project identifier. Check Firebase app initialization.",c["registration-api-key"]="Undefined API key. Check Firebase app initialization.",c["registration-app-id"]="Undefined app identifier. Check Firebase app initialization.",c["storage-open"]="Error thrown when opening storage. Original error: {$originalErrorMessage}.",c["storage-get"]="Error thrown when reading from storage. Original error: {$originalErrorMessage}.",c["storage-set"]="Error thrown when writing to storage. Original error: {$originalErrorMessage}.",c["storage-delete"]="Error thrown when deleting from storage. Original error: {$originalErrorMessage}.",c["fetch-client-network"]="Fetch client failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.",c["fetch-timeout"]='The config fetch request timed out. Configure timeout using "fetchTimeoutMillis" SDK setting.',c["fetch-throttle"]='The config fetch request timed out while in an exponential backoff state. Configure timeout using "fetchTimeoutMillis" SDK setting. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.',c["fetch-client-parse"]="Fetch client could not parse response. Original error: {$originalErrorMessage}.",c["fetch-status"]="Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.",c),p=new o.ErrorFactory("remoteconfig","Remote Config",h),d=function(){function t(t,e,n,r,i,o){this.firebaseInstallations=t,this.sdkVersion=e,this.namespace=n,this.projectId=r,this.apiKey=i,this.appId=o}return t.prototype.fetch=function(t){return i.__awaiter(this,void 0,void 0,(function(){var e,n,r,o,a,s,u,c,l,f,h,d,v,y,g,m,_,b,w;return i.__generator(this,(function(i){switch(i.label){case 0:return[4,Promise.all([this.firebaseInstallations.getId(),this.firebaseInstallations.getToken()])];case 1:e=i.sent(),n=e[0],r=e[1],o=window.FIREBASE_REMOTE_CONFIG_URL_BASE||"https://firebaseremoteconfig.googleapis.com",a=o+"/v1/projects/"+this.projectId+"/namespaces/"+this.namespace+":fetch?key="+this.apiKey,s={"Content-Type":"application/json","Content-Encoding":"gzip","If-None-Match":t.eTag||"*"},u={sdk_version:this.sdkVersion,app_instance_id:n,app_instance_id_token:r,app_id:this.appId,language_code:(void 0===E&&(E=navigator),E.languages&&E.languages[0]||E.language)},c={method:"POST",headers:s,body:JSON.stringify(u)},l=fetch(a,c),f=new Promise((function(e,n){t.signal.addEventListener((function(){var t=new Error("The operation was aborted.");t.name="AbortError",n(t)}))})),i.label=2;case 2:return i.trys.push([2,5,,6]),[4,Promise.race([l,f])];case 3:return i.sent(),[4,l];case 4:return h=i.sent(),[3,6];case 5:throw d=i.sent(),v="fetch-client-network","AbortError"===d.name&&(v="fetch-timeout"),p.create(v,{originalErrorMessage:d.message});case 6:if(y=h.status,g=h.headers.get("ETag")||void 0,200!==h.status)return[3,11];b=void 0,i.label=7;case 7:return i.trys.push([7,9,,10]),[4,h.json()];case 8:return b=i.sent(),[3,10];case 9:throw w=i.sent(),p.create("fetch-client-parse",{originalErrorMessage:w.message});case 10:m=b.entries,_=b.state,i.label=11;case 11:if("INSTANCE_STATE_UNSPECIFIED"===_?y=500:"NO_CHANGE"===_?y=304:"NO_TEMPLATE"!==_&&"EMPTY_CONFIG"!==_||(m={}),304!==y&&200!==y)throw p.create("fetch-status",{httpStatus:y});return[2,{status:y,eTag:g,config:m}]}var E}))}))},t}(),v=function(){function t(){this.listeners=[]}return t.prototype.addEventListener=function(t){this.listeners.push(t)},t.prototype.abort=function(){this.listeners.forEach((function(t){return t()}))},t}(),y=["1","true","t","yes","y","on"],g=function(){function t(t,e){void 0===e&&(e=""),this._source=t,this._value=e}return t.prototype.asString=function(){return this._value},t.prototype.asBoolean=function(){return"static"!==this._source&&y.indexOf(this._value.toLowerCase())>=0},t.prototype.asNumber=function(){if("static"===this._source)return 0;var t=Number(this._value);return isNaN(t)&&(t=0),t},t.prototype.getSource=function(){return this._source},t}(),m=function(){function t(t,e,n,r,i){this.app=t,this._client=e,this._storageCache=n,this._storage=r,this._logger=i,this._isInitializationComplete=!1,this.settings={fetchTimeoutMillis:6e4,minimumFetchIntervalMillis:432e5},this.defaultConfig={}}return t.prototype.setLogLevel=function(t){switch(t){case"debug":this._logger.logLevel=a.LogLevel.DEBUG;break;case"silent":this._logger.logLevel=a.LogLevel.SILENT;break;default:this._logger.logLevel=a.LogLevel.ERROR}},Object.defineProperty(t.prototype,"fetchTimeMillis",{get:function(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastFetchStatus",{get:function(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"},enumerable:!1,configurable:!0}),t.prototype.activate=function(){return i.__awaiter(this,void 0,void 0,(function(){var t,e,n;return i.__generator(this,(function(r){switch(r.label){case 0:return[4,Promise.all([this._storage.getLastSuccessfulFetchResponse(),this._storage.getActiveConfigEtag()])];case 1:return t=r.sent(),e=t[0],n=t[1],e&&e.config&&e.eTag&&e.eTag!==n?[4,Promise.all([this._storageCache.setActiveConfig(e.config),this._storage.setActiveConfigEtag(e.eTag)])]:[2,!1];case 2:return r.sent(),[2,!0]}}))}))},t.prototype.ensureInitialized=function(){var t=this;return this._initializePromise||(this._initializePromise=this._storageCache.loadFromStorage().then((function(){t._isInitializationComplete=!0}))),this._initializePromise},t.prototype.fetch=function(){return i.__awaiter(this,void 0,void 0,(function(){var t,e,n,r=this;return i.__generator(this,(function(a){switch(a.label){case 0:t=new v,setTimeout((function(){return i.__awaiter(r,void 0,void 0,(function(){return i.__generator(this,(function(e){return t.abort(),[2]}))}))}),this.settings.fetchTimeoutMillis),a.label=1;case 1:return a.trys.push([1,4,,6]),[4,this._client.fetch({cacheMaxAgeMillis:this.settings.minimumFetchIntervalMillis,signal:t})];case 2:return a.sent(),[4,this._storageCache.setLastFetchStatus("success")];case 3:return a.sent(),[3,6];case 4:return e=a.sent(),"fetch-throttle",n=(s=e)instanceof o.FirebaseError&&-1!==s.code.indexOf("fetch-throttle")?"throttle":"failure",[4,this._storageCache.setLastFetchStatus(n)];case 5:throw a.sent(),e;case 6:return[2]}var s}))}))},t.prototype.fetchAndActivate=function(){return i.__awaiter(this,void 0,void 0,(function(){return i.__generator(this,(function(t){switch(t.label){case 0:return[4,this.fetch()];case 1:return t.sent(),[2,this.activate()]}}))}))},t.prototype.getAll=function(){var t,e,n=this;return(t=this._storageCache.getActiveConfig(),e=this.defaultConfig,void 0===t&&(t={}),void 0===e&&(e={}),Object.keys(i.__assign(i.__assign({},t),e))).reduce((function(t,e){return t[e]=n.getValue(e),t}),{})},t.prototype.getBoolean=function(t){return this.getValue(t).asBoolean()},t.prototype.getNumber=function(t){return this.getValue(t).asNumber()},t.prototype.getString=function(t){return this.getValue(t).asString()},t.prototype.getValue=function(t){this._isInitializationComplete||this._logger.debug('A value was requested for key "'+t+'" before SDK initialization completed. Await on ensureInitialized if the intent was to get a previously activated value.');var e=this._storageCache.getActiveConfig();return e&&void 0!==e[t]?new g("remote",e[t]):this.defaultConfig&&void 0!==this.defaultConfig[t]?new g("default",String(this.defaultConfig[t])):(this._logger.debug('Returning static value for key "'+t+'". Define a default or remote value if this is unintentional.'),new g("static"))},t}();function _(t,e){var n=t.target.error||void 0;return p.create(e,{originalErrorMessage:n&&n.message})}var b="app_namespace_store",w=function(){function t(t,e,n,r){void 0===r&&(r=new Promise((function(t,e){var n=indexedDB.open("firebase_remote_config",1);n.onerror=function(t){e(_(t,"storage-open"))},n.onsuccess=function(e){t(e.target.result)},n.onupgradeneeded=function(t){var e=t.target.result;0===t.oldVersion&&e.createObjectStore(b,{keyPath:"compositeKey"})}}))),this.appId=t,this.appName=e,this.namespace=n,this.openDbPromise=r}return t.prototype.getLastFetchStatus=function(){return this.get("last_fetch_status")},t.prototype.setLastFetchStatus=function(t){return this.set("last_fetch_status",t)},t.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.get("last_successful_fetch_timestamp_millis")},t.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.set("last_successful_fetch_timestamp_millis",t)},t.prototype.getLastSuccessfulFetchResponse=function(){return this.get("last_successful_fetch_response")},t.prototype.setLastSuccessfulFetchResponse=function(t){return this.set("last_successful_fetch_response",t)},t.prototype.getActiveConfig=function(){return this.get("active_config")},t.prototype.setActiveConfig=function(t){return this.set("active_config",t)},t.prototype.getActiveConfigEtag=function(){return this.get("active_config_etag")},t.prototype.setActiveConfigEtag=function(t){return this.set("active_config_etag",t)},t.prototype.getThrottleMetadata=function(){return this.get("throttle_metadata")},t.prototype.setThrottleMetadata=function(t){return this.set("throttle_metadata",t)},t.prototype.deleteThrottleMetadata=function(){return this.delete("throttle_metadata")},t.prototype.get=function(t){return i.__awaiter(this,void 0,void 0,(function(){var e,n=this;return i.__generator(this,(function(r){switch(r.label){case 0:return[4,this.openDbPromise];case 1:return e=r.sent(),[2,new Promise((function(r,i){var o=e.transaction([b],"readonly").objectStore(b),a=n.createCompositeKey(t);try{var s=o.get(a);s.onerror=function(t){i(_(t,"storage-get"))},s.onsuccess=function(t){var e=t.target.result;r(e?e.value:void 0)}}catch(t){i(p.create("storage-get",{originalErrorMessage:t&&t.message}))}}))]}}))}))},t.prototype.set=function(t,e){return i.__awaiter(this,void 0,void 0,(function(){var n,r=this;return i.__generator(this,(function(i){switch(i.label){case 0:return[4,this.openDbPromise];case 1:return n=i.sent(),[2,new Promise((function(i,o){var a=n.transaction([b],"readwrite").objectStore(b),s=r.createCompositeKey(t);try{var u=a.put({compositeKey:s,value:e});u.onerror=function(t){o(_(t,"storage-set"))},u.onsuccess=function(){i()}}catch(t){o(p.create("storage-set",{originalErrorMessage:t&&t.message}))}}))]}}))}))},t.prototype.delete=function(t){return i.__awaiter(this,void 0,void 0,(function(){var e,n=this;return i.__generator(this,(function(r){switch(r.label){case 0:return[4,this.openDbPromise];case 1:return e=r.sent(),[2,new Promise((function(r,i){var o=e.transaction([b],"readwrite").objectStore(b),a=n.createCompositeKey(t);try{var s=o.delete(a);s.onerror=function(t){i(_(t,"storage-delete"))},s.onsuccess=function(){r()}}catch(t){i(p.create("storage-delete",{originalErrorMessage:t&&t.message}))}}))]}}))}))},t.prototype.createCompositeKey=function(t){return[this.appId,this.appName,this.namespace,t].join()},t}(),E=function(){function t(t){this.storage=t}return t.prototype.getLastFetchStatus=function(){return this.lastFetchStatus},t.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.lastSuccessfulFetchTimestampMillis},t.prototype.getActiveConfig=function(){return this.activeConfig},t.prototype.loadFromStorage=function(){return i.__awaiter(this,void 0,void 0,(function(){var t,e,n,r,o,a;return i.__generator(this,(function(i){switch(i.label){case 0:return t=this.storage.getLastFetchStatus(),e=this.storage.getLastSuccessfulFetchTimestampMillis(),n=this.storage.getActiveConfig(),[4,t];case 1:return(r=i.sent())&&(this.lastFetchStatus=r),[4,e];case 2:return(o=i.sent())&&(this.lastSuccessfulFetchTimestampMillis=o),[4,n];case 3:return(a=i.sent())&&(this.activeConfig=a),[2]}}))}))},t.prototype.setLastFetchStatus=function(t){return this.lastFetchStatus=t,this.storage.setLastFetchStatus(t)},t.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.lastSuccessfulFetchTimestampMillis=t,this.storage.setLastSuccessfulFetchTimestampMillis(t)},t.prototype.setActiveConfig=function(t){return this.activeConfig=t,this.storage.setActiveConfig(t)},t}();function T(t,e){return new Promise((function(n,r){var i=Math.max(e-Date.now(),0),o=setTimeout(n,i);t.addEventListener((function(){clearTimeout(o),r(p.create("fetch-throttle",{throttleEndTimeMillis:e}))}))}))}var S=function(){function t(t,e){this.client=t,this.storage=e}return t.prototype.fetch=function(t){return i.__awaiter(this,void 0,void 0,(function(){var e;return i.__generator(this,(function(n){switch(n.label){case 0:return[4,this.storage.getThrottleMetadata()];case 1:return e=n.sent()||{backoffCount:0,throttleEndTimeMillis:Date.now()},[2,this.attemptFetch(t,e)]}}))}))},t.prototype.attemptFetch=function(t,e){var n=e.throttleEndTimeMillis,r=e.backoffCount;return i.__awaiter(this,void 0,void 0,(function(){var e,a,s;return i.__generator(this,(function(i){switch(i.label){case 0:return[4,T(t.signal,n)];case 1:i.sent(),i.label=2;case 2:return i.trys.push([2,5,,7]),[4,this.client.fetch(t)];case 3:return e=i.sent(),[4,this.storage.deleteThrottleMetadata()];case 4:return i.sent(),[2,e];case 5:if(!function(t){if(!(t instanceof o.FirebaseError))return!1;var e=Number(t.httpStatus);return 429===e||500===e||503===e||504===e}(a=i.sent()))throw a;return s={throttleEndTimeMillis:Date.now()+o.calculateBackoffMillis(r),backoffCount:r+1},[4,this.storage.setThrottleMetadata(s)];case 6:return i.sent(),[2,this.attemptFetch(t,s)];case 7:return[2]}}))}))},t}(),I="@firebase/remote-config";function C(t){t.INTERNAL.registerComponent(new s.Component("remoteConfig",(function(e,n){var r=e.getProvider("app").getImmediate(),i=e.getProvider("installations").getImmediate();if("undefined"==typeof window)throw p.create("registration-window");var o=r.options,s=o.projectId,u=o.apiKey,c=o.appId;if(!s)throw p.create("registration-project-id");if(!u)throw p.create("registration-api-key");if(!c)throw p.create("registration-app-id");n=n||"firebase";var l=new w(c,r.name,n),h=new E(l),v=new a.Logger(I);v.logLevel=a.LogLevel.ERROR;var y=new d(i,t.SDK_VERSION,n,s,u,c),g=new S(y,l),_=new f(g,l,h,v),b=new m(r,_,h,l,v);return b.ensureInitialized(),b}),"PUBLIC").setMultipleInstances(!0)),t.registerVersion(I,"0.1.28")}C(l.default),e.registerRemoteConfig=C},78847:(t,e,n)=>{"use strict";n.r(e),n.d(e,{registerStorage:()=>Gt});var r=n(5752),i=n(70655),o=n(79730),a="firebasestorage.googleapis.com",s=function(){function t(t,e){this.code_=c(t),this.message_="Firebase Storage: "+e,this.serverResponse_=null,this.name_="FirebaseError"}return t.prototype.codeProp=function(){return this.code},t.prototype.codeEquals=function(t){return c(t)===this.codeProp()},t.prototype.serverResponseProp=function(){return this.serverResponse_},t.prototype.setServerResponseProp=function(t){this.serverResponse_=t},Object.defineProperty(t.prototype,"name",{get:function(){return this.name_},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"code",{get:function(){return this.code_},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"message",{get:function(){return this.serverResponse_?this.message_+"\n"+this.serverResponse_:this.message_},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"serverResponse",{get:function(){return this.serverResponse_},enumerable:!1,configurable:!0}),t}(),u="canceled";function c(t){return"storage/"+t}function l(){return new s("unknown","An unknown error occurred, please check the error payload for server response.")}function f(){return new s(u,"User canceled the upload/download.")}function h(){return new s("cannot-slice-blob","Cannot slice blob for upload. Please retry the upload.")}function p(){return new s("no-download-url","The given file does not have any download URLs.")}function d(t,e,n){return new s("invalid-argument","Invalid argument in `"+e+"` at index "+t+": "+n)}function v(){return new s("app-deleted","The Firebase app was deleted.")}function y(t,e){return new s("invalid-format","String does not match format '"+t+"': "+e)}function g(t){throw new s("internal-error","Internal error: "+t)}var m={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};function _(t){switch(t){case m.RAW:case m.BASE64:case m.BASE64URL:case m.DATA_URL:return;default:throw"Expected one of the event types: ["+m.RAW+", "+m.BASE64+", "+m.BASE64URL+", "+m.DATA_URL+"]."}}var b=function(t,e){this.data=t,this.contentType=e||null};function w(t,e){switch(t){case m.RAW:return new b(E(e));case m.BASE64:case m.BASE64URL:return new b(T(t,e));case m.DATA_URL:return new b((n=new I(e)).base64?T(m.BASE64,n.rest):function(t){var e;try{e=decodeURIComponent(t)}catch(t){throw y(m.DATA_URL,"Malformed data URL.")}return E(e)}(n.rest),new I(e).contentType)}var n;throw l()}function E(t){for(var e=[],n=0;n>6,128|63&r):55296==(64512&r)?n>18,128|r>>12&63,128|r>>6&63,128|63&r)):e.push(239,191,189):56320==(64512&r)?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|63&r)}return new Uint8Array(e)}function T(t,e){switch(t){case m.BASE64:var n=-1!==e.indexOf("-"),r=-1!==e.indexOf("_");if(n||r)throw y(t,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break;case m.BASE64URL:var i=-1!==e.indexOf("+"),o=-1!==e.indexOf("/");if(i||o)throw y(t,"Invalid character '"+(i?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/")}var a;try{a=atob(e)}catch(e){throw y(t,"Invalid character found")}for(var s=new Uint8Array(a.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)},C={STATE_CHANGED:"state_changed"},O="running",k="pausing",x="paused",P="success",A="canceling",N="canceled",R="error",D={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function L(t){switch(t){case O:case k:case A:return D.RUNNING;case x:return D.PAUSED;case P:return D.SUCCESS;case N:return D.CANCELED;default:return D.ERROR}}function M(t){return null!=t}function j(t){return void 0!==t}function F(t){return"function"==typeof t}function U(t){return"object"==typeof t}function V(t){return U(t)&&null!==t}function q(t){return"string"==typeof t||t instanceof String}function B(t){return W(t)&&Number.isInteger(t)}function W(t){return"number"==typeof t||t instanceof Number}function G(t){return z()&&t instanceof Blob}function z(){return"undefined"!=typeof Blob}!function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"}(S||(S={}));var H=function(){function t(){var t=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=S.NO_ERROR,this.sendPromise_=new Promise((function(e){t.xhr_.addEventListener("abort",(function(){t.errorCode_=S.ABORT,e(t)})),t.xhr_.addEventListener("error",(function(){t.errorCode_=S.NETWORK_ERROR,e(t)})),t.xhr_.addEventListener("load",(function(){e(t)}))}))}return t.prototype.send=function(t,e,n,r){if(this.sent_)throw g("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(e,t,!0),M(r))for(var i in r)r.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,r[i].toString());return M(n)?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_},t.prototype.getErrorCode=function(){if(!this.sent_)throw g("cannot .getErrorCode() before sending");return this.errorCode_},t.prototype.getStatus=function(){if(!this.sent_)throw g("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}},t.prototype.getResponseText=function(){if(!this.sent_)throw g("cannot .getResponseText() before sending");return this.xhr_.responseText},t.prototype.abort=function(){this.xhr_.abort()},t.prototype.getResponseHeader=function(t){return this.xhr_.getResponseHeader(t)},t.prototype.addUploadProgressListener=function(t){M(this.xhr_.upload)&&this.xhr_.upload.addEventListener("progress",t)},t.prototype.removeUploadProgressListener=function(t){M(this.xhr_.upload)&&this.xhr_.upload.removeEventListener("progress",t)},t}(),K=function(){function t(){}return t.prototype.createXhrIo=function(){return new H},t}();function $(){return"undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function Q(){for(var t=[],e=0;e0})).join("/");return 0===t.length?n:t+"/"+n}function tt(t){var e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function et(t){return"https://"+a+"/v0"+t}function nt(t){var e=encodeURIComponent,n="?";for(var r in t)t.hasOwnProperty(r)&&(n=n+(e(r)+"=")+e(t[r])+"&");return n.slice(0,-1)}function rt(t,e){return e}var it=function(t,e,n,r){this.server=t,this.local=e||t,this.writable=!!n,this.xform=r||rt},ot=null;function at(t,e,n){var r=J(e);return null===r?null:function(t,e,n){for(var r={type:"file"},i=n.length,o=0;o1e3)throw"Expected maxResults to be less than or equal to 1000."}else{if("pageToken"!==e)throw"Unknown option: "+e;if(t.pageToken&&!q(t.pageToken))throw"Expected pageToken to be string."}}var lt=function(t,e,n,r){this.url=t,this.method=e,this.handler=n,this.timeout=r,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]};function ft(t){if(!t)throw l()}function ht(t,e){return function(n,r){var i=at(t,r,e);return ft(null!==i),i}}function pt(t){return function(e,n){var r,i,o;return 401===e.getStatus()?r=new s("unauthenticated","User is not authenticated, please authenticate using Firebase Authentication and try again."):402===e.getStatus()?(o=t.bucket,r=new s("quota-exceeded","Quota for bucket '"+o+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===e.getStatus()?(i=t.path,r=new s("unauthorized","User does not have permission to access '"+i+"'.")):r=n,r.setServerResponseProp(n.serverResponseProp()),r}}function dt(t){var e=pt(t);return function(n,r){var i,o=e(n,r);return 404===n.getStatus()&&(i=t.path,o=new s("object-not-found","Object '"+i+"' does not exist.")),o.setServerResponseProp(r.serverResponseProp()),o}}function vt(t,e,n){var r=et(e.fullServerUrl()),i=t.maxOperationRetryTime,o=new lt(r,"GET",ht(t,n),i);return o.errorHandler=dt(e),o}function yt(t,e,n,r,i){var o={};e.isRoot?o.prefix="":o.prefix=e.path+"/",n&&n.length>0&&(o.delimiter=n),r&&(o.pageToken=r),i&&(o.maxResults=i);var a=et(e.bucketOnlyServerUrl()),s=t.maxOperationRetryTime,u=new lt(a,"GET",function(t,e){return function(n,r){var i=function(t,e,n){var r=J(n);return null===r?null:function(t,e,n){var r={prefixes:[],items:[],nextPageToken:n.nextPageToken};if(n.prefixes)for(var i=0,o=n.prefixes;i=0))throw"Expected a number 0 or greater."}))}function Rt(t,e){return new Ot((function(e){if(!(null===e||M(e)&&e instanceof Object))throw"Expected an Object.";null!=t&&t(e)}),e)}function Dt(t){return new Ot((function(t){if(null!==t&&!F(t))throw"Expected a Function."}),t)}function Lt(t){return function(){for(var e=[],n=0;n262144},t.prototype.start_=function(){this.state_===O&&null===this.request_&&(this.resumable_?null===this.uploadUrl_?this.createResumable_():this.needToFetchStatus_?this.fetchStatus_():this.needToFetchMetadata_?this.fetchMetadata_():this.continueUpload_():this.oneShotUpload_())},t.prototype.resolveToken_=function(t){var e=this;this.service_.getAuthToken().then((function(n){switch(e.state_){case O:t(n);break;case A:e.transition_(N);break;case k:e.transition_(x)}}))},t.prototype.createResumable_=function(){var t=this;this.resolveToken_((function(e){var n=function(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),a=bt(e,r,i),s={name:a.fullPath},u=et(o),c={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":r.size(),"X-Goog-Upload-Header-Content-Type":a.contentType,"Content-Type":"application/json; charset=utf-8"},l=st(a,n),f=t.maxUploadRetryTime,h=new lt(u,"POST",(function(t){var e;Et(t);try{e=t.getResponseHeader("X-Goog-Upload-URL")}catch(t){ft(!1)}return ft(q(e)),e}),f);return h.urlParams=s,h.headers=c,h.body=l,h.errorHandler=pt(e),h}(t.service_,t.location_,t.mappings_,t.blob_,t.metadata_),r=t.service_.makeRequest(n,e);t.request_=r,r.getPromise().then((function(e){t.request_=null,t.uploadUrl_=e,t.needToFetchStatus_=!1,t.completeTransitions_()}),t.errorHandler_)}))},t.prototype.fetchStatus_=function(){var t=this,e=this.uploadUrl_;this.resolveToken_((function(n){var r=function(t,e,n,r){var i=t.maxUploadRetryTime,o=new lt(n,"POST",(function(t){var e=Et(t,["active","final"]),n=null;try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(t){ft(!1)}n||ft(!1);var i=Number(n);return ft(!isNaN(i)),new wt(i,r.size(),"final"===e)}),i);return o.headers={"X-Goog-Upload-Command":"query"},o.errorHandler=pt(e),o}(t.service_,t.location_,e,t.blob_),i=t.service_.makeRequest(r,n);t.request_=i,i.getPromise().then((function(e){t.request_=null,t.updateProgress_(e.current),t.needToFetchStatus_=!1,e.finalized&&(t.needToFetchMetadata_=!0),t.completeTransitions_()}),t.errorHandler_)}))},t.prototype.continueUpload_=function(){var t=this,e=Tt*this.chunkMultiplier_,n=new wt(this.transferred_,this.blob_.size()),r=this.uploadUrl_;this.resolveToken_((function(i){var o;try{o=function(t,e,n,r,i,o,a,u){var c=new wt(0,0);if(a?(c.current=a.current,c.total=a.total):(c.current=0,c.total=r.size()),r.size()!==c.total)throw new s("server-file-wrong-size","Server recorded incorrect upload file size, please retry the upload.");var l=c.total-c.current,f=l;i>0&&(f=Math.min(f,i));var p=c.current,d=p+f,v={"X-Goog-Upload-Command":f===l?"upload, finalize":"upload","X-Goog-Upload-Offset":c.current},y=r.slice(p,d);if(null===y)throw h();var g=e.maxUploadRetryTime,m=new lt(n,"POST",(function(t,n){var i,a=Et(t,["active","final"]),s=c.current+f,u=r.size();return i="final"===a?ht(e,o)(t,n):null,new wt(s,u,"final"===a,i)}),g);return m.headers=v,m.body=y.uploadData(),m.progressCallback=u||null,m.errorHandler=pt(t),m}(t.location_,t.service_,r,t.blob_,e,t.mappings_,n,t.makeProgressCallback_())}catch(e){return t.error_=e,void t.transition_(R)}var a=t.service_.makeRequest(o,i);t.request_=a,a.getPromise().then((function(e){t.increaseMultiplier_(),t.request_=null,t.updateProgress_(e.current),e.finalized?(t.metadata_=e.metadata,t.transition_(P)):t.completeTransitions_()}),t.errorHandler_)}))},t.prototype.increaseMultiplier_=function(){Tt*this.chunkMultiplier_<33554432&&(this.chunkMultiplier_*=2)},t.prototype.fetchMetadata_=function(){var t=this;this.resolveToken_((function(e){var n=vt(t.service_,t.location_,t.mappings_),r=t.service_.makeRequest(n,e);t.request_=r,r.getPromise().then((function(e){t.request_=null,t.metadata_=e,t.transition_(P)}),t.metadataErrorHandler_)}))},t.prototype.oneShotUpload_=function(){var t=this;this.resolveToken_((function(e){var n=function(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"},s=function(){for(var t="",e=0;e<2;e++)t+=Math.random().toString().slice(2);return t}();a["Content-Type"]="multipart/related; boundary="+s;var u=bt(e,r,i),c="--"+s+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+st(u,n)+"\r\n--"+s+"\r\nContent-Type: "+u.contentType+"\r\n\r\n",l="\r\n--"+s+"--",f=Y.getBlob(c,r,l);if(null===f)throw h();var p={name:u.fullPath},d=et(o),v=t.maxUploadRetryTime,y=new lt(d,"POST",ht(t,n),v);return y.urlParams=p,y.headers=a,y.body=f.uploadData(),y.errorHandler=pt(e),y}(t.service_,t.location_,t.mappings_,t.blob_,t.metadata_),r=t.service_.makeRequest(n,e);t.request_=r,r.getPromise().then((function(e){t.request_=null,t.metadata_=e,t.updateProgress_(t.blob_.size()),t.transition_(P)}),t.errorHandler_)}))},t.prototype.updateProgress_=function(t){var e=this.transferred_;this.transferred_=t,this.transferred_!==e&&this.notifyObservers_()},t.prototype.transition_=function(t){if(this.state_!==t)switch(t){case A:case k:this.state_=t,null!==this.request_&&this.request_.cancel();break;case O:var e=this.state_===x;this.state_=t,e&&(this.notifyObservers_(),this.start_());break;case x:this.state_=t,this.notifyObservers_();break;case N:this.error_=f(),this.state_=t,this.notifyObservers_();break;case R:case P:this.state_=t,this.notifyObservers_()}},t.prototype.completeTransitions_=function(){switch(this.state_){case k:this.transition_(x);break;case A:this.transition_(N);break;case O:this.start_()}},Object.defineProperty(t.prototype,"snapshot",{get:function(){var t=L(this.state_);return new It(this.transferred_,this.blob_.size(),t,this.metadata_,this,this.ref_)},enumerable:!1,configurable:!0}),t.prototype.on=function(t,e,n,r){function i(){if(t!==C.STATE_CHANGED)throw"Expected one of the event types: ["+C.STATE_CHANGED+"]."}var o="Expected a function or an Object with one of `next`, `error`, `complete` properties.",a=Dt(!0).validator,s=Rt(null,!0).validator;function u(t){try{return void a(t)}catch(t){}try{if(s(t),!(j(t.next)||j(t.error)||j(t.complete)))throw"";return}catch(t){throw o}}var c=[kt(i),Rt(u,!0),Dt(!0),Dt(!0)];Ct("on",c,arguments);var l=this;function f(t){return function(e,n,i){null!==t&&Ct("on",t,arguments);var o=new St(e,n,r);return l.addObserver_(o),function(){l.removeObserver_(o)}}}function h(t){if(null===t)throw o;u(t)}var p=[Rt(h),Dt(!0),Dt(!0)],d=!(j(e)||j(n)||j(r));return d?f(p):f(null)(e,n,r)},t.prototype.then=function(t,e){return this.promise_.then(t,e)},t.prototype.catch=function(t){return this.then(null,t)},t.prototype.addObserver_=function(t){this.observers_.push(t),this.notifyObserver_(t)},t.prototype.removeObserver_=function(t){var e=this.observers_.indexOf(t);-1!==e&&this.observers_.splice(e,1)},t.prototype.notifyObservers_=function(){var t=this;this.finishPromise_(),this.observers_.slice().forEach((function(e){t.notifyObserver_(e)}))},t.prototype.finishPromise_=function(){if(null!==this.resolve_){var t=!0;switch(L(this.state_)){case D.SUCCESS:Lt(this.resolve_.bind(null,this.snapshot))();break;case D.CANCELED:case D.ERROR:Lt(this.reject_.bind(null,this.error_))();break;default:t=!1}t&&(this.resolve_=null,this.reject_=null)}},t.prototype.notifyObserver_=function(t){switch(L(this.state_)){case D.RUNNING:case D.PAUSED:t.next&&Lt(t.next.bind(t,this.snapshot))();break;case D.SUCCESS:t.complete&&Lt(t.complete.bind(t))();break;default:t.error&&Lt(t.error.bind(t,this.error_))()}},t.prototype.resume=function(){Ct("resume",[],arguments);var t=this.state_===x||this.state_===k;return t&&this.transition_(O),t},t.prototype.pause=function(){Ct("pause",[],arguments);var t=this.state_===O;return t&&this.transition_(k),t},t.prototype.cancel=function(){Ct("cancel",[],arguments);var t=this.state_===O||this.state_===k;return t&&this.transition_(A),t},t}(),jt=function(){function t(t,e){this.service=t,this.location=e instanceof X?e:X.makeFromUrl(e)}return t.prototype.toString=function(){return Ct("toString",[],arguments),"gs://"+this.location.bucket+"/"+this.location.path},t.prototype.newRef=function(e,n){return new t(e,n)},t.prototype.mappings=function(){return function(){if(ot)return ot;var t=[];t.push(new it("bucket")),t.push(new it("generation")),t.push(new it("metageneration")),t.push(new it("name","fullPath",!0));var e=new it("name");e.xform=function(t,e){return function(t){return!q(t)||t.length<2?t:tt(t)}(e)},t.push(e);var n=new it("size");return n.xform=function(t,e){return M(e)?Number(e):e},t.push(n),t.push(new it("timeCreated")),t.push(new it("updated")),t.push(new it("md5Hash",null,!0)),t.push(new it("cacheControl",null,!0)),t.push(new it("contentDisposition",null,!0)),t.push(new it("contentEncoding",null,!0)),t.push(new it("contentLanguage",null,!0)),t.push(new it("contentType",null,!0)),t.push(new it("metadata","customMetadata",!0)),ot=t}()},t.prototype.child=function(t){Ct("child",[kt()],arguments);var e=Z(this.location.path,t),n=new X(this.location.bucket,e);return this.newRef(this.service,n)},Object.defineProperty(t.prototype,"parent",{get:function(){var t=function(t){if(0===t.length)return null;var e=t.lastIndexOf("/");return-1===e?"":t.slice(0,e)}(this.location.path);if(null===t)return null;var e=new X(this.location.bucket,t);return this.newRef(this.service,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){var t=new X(this.location.bucket,"");return this.newRef(this.service,t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bucket",{get:function(){return this.location.bucket},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fullPath",{get:function(){return this.location.path},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return tt(this.location.path)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"storage",{get:function(){return this.service},enumerable:!1,configurable:!0}),t.prototype.put=function(t,e){return void 0===e&&(e=null),Ct("put",[xt(),Pt(!0)],arguments),this.throwIfRoot_("put"),new Mt(this,this.service,this.location,this.mappings(),new Y(t),e)},t.prototype.putString=function(t,e,n){void 0===e&&(e=m.RAW),Ct("putString",[kt(),kt(_,!0),Pt(!0)],arguments),this.throwIfRoot_("putString");var r=w(e,t),i=Object.assign({},n);return!M(i.contentType)&&M(r.contentType)&&(i.contentType=r.contentType),new Mt(this,this.service,this.location,this.mappings(),new Y(r.data,!0),i)},t.prototype.delete=function(){var t=this;return Ct("delete",[],arguments),this.throwIfRoot_("delete"),this.service.getAuthToken().then((function(e){var n=_t(t.service,t.location);return t.service.makeRequest(n,e).getPromise()}))},t.prototype.listAll=function(){Ct("listAll",[],arguments);var t={prefixes:[],items:[]};return this.listAllHelper(t).then((function(){return t}))},t.prototype.listAllHelper=function(t,e){return(0,i.__awaiter)(this,void 0,void 0,(function(){var n,r,o,a;return(0,i.__generator)(this,(function(i){switch(i.label){case 0:return n={pageToken:e},[4,this.list(n)];case 1:return r=i.sent(),(o=t.prefixes).push.apply(o,r.prefixes),(a=t.items).push.apply(a,r.items),null==r.nextPageToken?[3,3]:[4,this.listAllHelper(t,r.nextPageToken)];case 2:i.sent(),i.label=3;case 3:return[2]}}))}))},t.prototype.list=function(t){Ct("list",[At(!0)],arguments);var e=this;return this.service.getAuthToken().then((function(n){var r=t||{},i=yt(e.service,e.location,"/",r.pageToken,r.maxResults);return e.service.makeRequest(i,n).getPromise()}))},t.prototype.getMetadata=function(){var t=this;return Ct("getMetadata",[],arguments),this.throwIfRoot_("getMetadata"),this.service.getAuthToken().then((function(e){var n=vt(t.service,t.location,t.mappings());return t.service.makeRequest(n,e).getPromise()}))},t.prototype.updateMetadata=function(t){var e=this;return Ct("updateMetadata",[Pt()],arguments),this.throwIfRoot_("updateMetadata"),this.service.getAuthToken().then((function(n){var r=mt(e.service,e.location,t,e.mappings());return e.service.makeRequest(r,n).getPromise()}))},t.prototype.getDownloadURL=function(){var t=this;return Ct("getDownloadURL",[],arguments),this.throwIfRoot_("getDownloadURL"),this.service.getAuthToken().then((function(e){var n=gt(t.service,t.location,t.mappings());return t.service.makeRequest(n,e).getPromise().then((function(t){if(null===t)throw p();return t}))}))},t.prototype.throwIfRoot_=function(t){if(""===this.location.path)throw function(t){return new s("invalid-root-operation","The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}(t)},t}(),Ft=function(){function t(t){this.promise_=Promise.reject(t)}return t.prototype.getPromise=function(){return this.promise_},t.prototype.cancel=function(t){},t}(),Ut=function(){function t(t,e,n,r,i,o,a,s,u,c,l){var f=this;this.pendingXhr_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.url_=t,this.method_=e,this.headers_=n,this.body_=r,this.successCodes_=i.slice(),this.additionalRetryCodes_=o.slice(),this.callback_=a,this.errorCallback_=s,this.progressCallback_=c,this.timeout_=u,this.pool_=l,this.promise_=new Promise((function(t,e){f.resolve_=t,f.reject_=e,f.start_()}))}return t.prototype.start_=function(){var t=this;function e(e,n){var r,i=t.resolve_,o=t.reject_,a=n.xhr;if(n.wasSuccessCode)try{var u=t.callback_(a,a.getResponseText());j(u)?i(u):i()}catch(t){o(t)}else null!==a?((r=l()).setServerResponseProp(a.getResponseText()),t.errorCallback_?o(t.errorCallback_(a,r)):o(r)):n.canceled?o(r=t.appDelete_?v():f()):o(r=new s("retry-limit-exceeded","Max retry time for operation exceeded, please try again."))}this.canceled_?e(0,new Vt(!1,null,!0)):this.backoffId_=function(e,n,r){var o=1,a=null,s=!1,u=0;function c(){return 2===u}var l=!1;function f(){for(var t=[],e=0;e=500&&t<600,n=-1!==[408,429].indexOf(t),r=-1!==this.additionalRetryCodes_.indexOf(t);return e||n||r},t}(),Vt=function(t,e,n){this.wasSuccessCode=t,this.xhr=e,this.canceled=!!n};var qt=function(){function t(e,n,r,i){var o;this.bucket_=null,this.appId_=null,this.deleted_=!1,this.app_=e,this.authProvider_=n,this.maxOperationRetryTime_=12e4,this.maxUploadRetryTime_=6e5,this.requests_=new Set,this.pool_=r,this.bucket_=null!=i?X.makeFromBucketSpec(i):t.extractBucket_(null===(o=this.app_)||void 0===o?void 0:o.options),this.internals_=new Bt(this)}return t.extractBucket_=function(t){var e=null==t?void 0:t.storageBucket;return null==e?null:X.makeFromBucketSpec(e)},t.prototype.getAuthToken=function(){return(0,i.__awaiter)(this,void 0,void 0,(function(){var t,e;return(0,i.__generator)(this,(function(n){switch(n.label){case 0:return(t=this.authProvider_.getImmediate({optional:!0}))?[4,t.getToken()]:[3,2];case 1:if(null!==(e=n.sent()))return[2,e.accessToken];n.label=2;case 2:return[2,null]}}))}))},t.prototype.deleteApp=function(){this.deleted_=!0,this.app_=null,this.requests_.forEach((function(t){return t.cancel()})),this.requests_.clear()},t.prototype.makeStorageReference=function(t){return new jt(this,t)},t.prototype.makeRequest=function(t,e){var n=this;if(this.deleted_)return new Ft(v());var i=function(t,e,n,i){var o=nt(t.urlParams),a=t.url+o,s=Object.assign({},t.headers);return function(t,e){e&&(t["X-Firebase-GMPID"]=e)}(s,e),function(t,e){null!==e&&e.length>0&&(t.Authorization="Firebase "+e)}(s,n),function(t){var e=void 0!==r.default?r.default.SDK_VERSION:"AppManager";t["X-Firebase-Storage-Version"]="webjs/"+e}(s),new Ut(a,t.method,s,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,i)}(t,this.appId_,e,this.pool_);return this.requests_.add(i),i.getPromise().then((function(){return n.requests_.delete(i)}),(function(){return n.requests_.delete(i)})),i},t.prototype.ref=function(t){function e(t){if("string"!=typeof t)throw"Path is not a string.";if(/^[A-Za-z]+:\/\//.test(t))throw"Expected child path but got a URL, use refFromURL instead."}if(Ct("ref",[kt(e,!0)],arguments),null==this.bucket_)throw new Error("No Storage Bucket defined in Firebase Options.");var n=new jt(this,this.bucket_);return null!=t?n.child(t):n},t.prototype.refFromURL=function(t){function e(t){if("string"!=typeof t)throw"Path is not a string.";if(!/^[A-Za-z]+:\/\//.test(t))throw"Expected full URL but got a child path, use ref instead.";try{X.makeFromUrl(t)}catch(t){throw"Expected valid full URL but got an invalid one."}}return Ct("refFromURL",[kt(e,!1)],arguments),new jt(this,t)},Object.defineProperty(t.prototype,"maxUploadRetryTime",{get:function(){return this.maxUploadRetryTime_},enumerable:!1,configurable:!0}),t.prototype.setMaxUploadRetryTime=function(t){Ct("setMaxUploadRetryTime",[Nt()],arguments),this.maxUploadRetryTime_=t},Object.defineProperty(t.prototype,"maxOperationRetryTime",{get:function(){return this.maxOperationRetryTime_},enumerable:!1,configurable:!0}),t.prototype.setMaxOperationRetryTime=function(t){Ct("setMaxOperationRetryTime",[Nt()],arguments),this.maxOperationRetryTime_=t},Object.defineProperty(t.prototype,"app",{get:function(){return this.app_},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"INTERNAL",{get:function(){return this.internals_},enumerable:!1,configurable:!0}),t}(),Bt=function(){function t(t){this.service_=t}return t.prototype.delete=function(){return this.service_.deleteApp(),Promise.resolve()},t}();function Wt(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal");return new qt(n,r,new K,e)}function Gt(t){var e={TaskState:D,TaskEvent:C,StringFormat:m,Storage:qt,Reference:jt};t.INTERNAL.registerComponent(new o.Component("storage",Wt,"PUBLIC").setServiceProps(e).setMultipleInstances(!0)),t.registerVersion("@firebase/storage","0.3.43")}Gt(r.default)},31313:(t,e,n)=>{"use strict";var r=n(25108);Object.defineProperty(e,"__esModule",{value:!0});var i=n(70655),o={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},a=function(t,e){if(!t)throw s(e)},s=function(t){return new Error("Firebase Database ("+o.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)},u=function(t){for(var e=[],n=0,r=0;r>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},c={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,f=(3&o)<<4|s>>4,h=(15&s)<<2|c>>6,p=63&c;u||(p=64,a||(h=64)),r.push(n[l],n[f],n[h],n[p])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(u(t),e)},decodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){for(var e=[],n=0,r=0;n191&&i<224){var o=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&o)}else if(i>239&&i<365){var a=((7&i)<<18|(63&(o=t[n++]))<<12|(63&(s=t[n++]))<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(a>>10)),e[r++]=String.fromCharCode(56320+(1023&a))}else{o=t[n++];var s=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&s)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray:function(t,e){this.init_();for(var n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i>4;if(r.push(c),64!==s){var l=a<<4&240|s>>2;if(r.push(l),64!==u){var f=s<<6&192|u;r.push(f)}}}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)}}},l=function(t){try{return c.decodeString(t,!0)}catch(t){r.error("base64Decode failed: ",t)}return null};function f(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]=f(t[n],e[n]));return t}var h=function(){function t(){var t=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))}return t.prototype.wrapCallback=function(t){var e=this;return function(n,r){n?e.reject(n):e.resolve(r),"function"==typeof t&&(e.promise.catch((function(){})),1===t.length?t(n):t(n,r))}},t}();function p(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function d(){try{return"[object process]"===Object.prototype.toString.call(n.g.process)}catch(t){return!1}}var v=function(t){function e(n,r){var i=t.call(this,r)||this;return i.code=n,i.name="FirebaseError",Object.setPrototypeOf(i,e.prototype),Error.captureStackTrace&&Error.captureStackTrace(i,y.prototype.create),i}return i.__extends(e,t),e}(Error),y=function(){function t(t,e,n){this.service=t,this.serviceName=e,this.errors=n}return t.prototype.create=function(t){for(var e=[],n=1;n"}))}var m=/\{\$([^}]+)}/g;function _(t){return JSON.parse(t)}var b=function(t){var e={},n={},r={},i="";try{var o=t.split(".");e=_(l(o[0])||""),n=_(l(o[1])||""),i=o[2],r=n.d||{},delete n.d}catch(t){}return{header:e,claims:n,data:r,signature:i}},w=function(){function t(){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>>31)}var o,a,s=this.chain_[0],u=this.chain_[1],c=this.chain_[2],l=this.chain_[3],f=this.chain_[4];for(r=0;r<80;r++)r<40?r<20?(o=l^u&(c^l),a=1518500249):(o=u^c^l,a=1859775393):r<60?(o=u&c|l&(u|c),a=2400959708):(o=u^c^l,a=3395469782),i=(s<<5|s>>>27)+o+f+a+n[r]&4294967295,f=l,l=c,c=4294967295&(u<<30|u>>>2),u=s,s=i;this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+u&4294967295,this.chain_[2]=this.chain_[2]+c&4294967295,this.chain_[3]=this.chain_[3]+l&4294967295,this.chain_[4]=this.chain_[4]+f&4294967295},t.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=56;n--)this.buf_[n]=255&e,e/=256;this.compress_(this.buf_);var r=0;for(n=0;n<5;n++)for(var i=24;i>=0;i-=8)t[r]=this.chain_[n]>>i&255,++r;return t},t}(),E=function(){function t(t,e){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((function(){t(n)})).catch((function(t){n.error(t)}))}return t.prototype.next=function(t){this.forEachObserver((function(e){e.next(t)}))},t.prototype.error=function(t){this.forEachObserver((function(e){e.error(t)})),this.close(t)},t.prototype.complete=function(){this.forEachObserver((function(t){t.complete()})),this.close()},t.prototype.subscribe=function(t,e,n){var r,i=this;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(t,e){if("object"!=typeof t||null===t)return!1;for(var n=0,r=["next","error","complete"];n 4. Need to update it?")}return t+" failed: "+(r+" argument ")}var I=144e5;e.CONSTANTS=o,e.Deferred=h,e.ErrorFactory=y,e.FirebaseError=v,e.MAX_VALUE_MILLIS=I,e.RANDOM_FACTOR=.5,e.Sha1=w,e.areCookiesEnabled=function(){return!(!navigator||!navigator.cookieEnabled)},e.assert=a,e.assertionError=s,e.async=function(t,e){return function(){for(var n=[],r=0;r=0},e.isEmpty=function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0},e.isIE=function(){var t=p();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0},e.isIndexedDBAvailable=function(){return"indexedDB"in self&&null!=indexedDB},e.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(p())},e.isNode=d,e.isNodeSdk=function(){return!0===o.NODE_CLIENT||!0===o.NODE_ADMIN},e.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},e.isSafari=function(){return!d()&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")},e.isUWP=function(){return p().indexOf("MSAppHost/")>=0},e.isValidFormat=function(t){var e=b(t).claims;return!!e&&"object"==typeof e&&e.hasOwnProperty("iat")},e.isValidTimestamp=function(t){var e=b(t).claims,n=Math.floor((new Date).getTime()/1e3),r=0,i=0;return"object"==typeof e&&(e.hasOwnProperty("nbf")?r=e.nbf:e.hasOwnProperty("iat")&&(r=e.iat),i=e.hasOwnProperty("exp")?e.exp:r+86400),!!n&&!!r&&!!i&&n>=r&&n<=i},e.issuedAtTime=function(t){var e=b(t).claims;return"object"==typeof e&&e.hasOwnProperty("iat")?e.iat:null},e.jsonEval=_,e.map=function(t,e,n){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=e.call(n,t[i],i,t));return r},e.querystring=function(t){for(var e=[],n=function(t,n){Array.isArray(n)?n.forEach((function(n){e.push(encodeURIComponent(t)+"="+encodeURIComponent(n))})):e.push(encodeURIComponent(t)+"="+encodeURIComponent(n))},r=0,i=Object.entries(t);r=55296&&r<=56319?(e+=4,n++):e+=3}return e},e.stringToByteArray=function(t){for(var e=[],n=0,r=0;r=55296&&i<=56319){var o=i-55296;r++,a(r>6|192,e[n++]=63&i|128):i<65536?(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},e.stringify=function(t){return JSON.stringify(t)},e.validateArgCount=function(t,e,n,r){var i;if(rn&&(i=0===n?"none":"no more than "+n),i)throw new Error(t+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+i+".")},e.validateCallback=function(t,e,n,r){if((!r||n)&&"function"!=typeof n)throw new Error(S(t,e,r)+"must be a valid function.")},e.validateContextObject=function(t,e,n,r){if((!r||n)&&("object"!=typeof n||null===n))throw new Error(S(t,e,r)+"must be a valid context object.")},e.validateIndexedDBOpenable=function(){return new Promise((function(t,e){try{var n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=window.indexedDB.open(r);i.onsuccess=function(){i.result.close(),n||window.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=function(){n=!1},i.onerror=function(){var t;e((null===(t=i.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}}))},e.validateNamespace=function(t,e,n,r){if((!r||n)&&"string"!=typeof n)throw new Error(S(t,e,r)+"must be a valid firebase namespace.")}},73705:(t,e,n)=>{"use strict";n.r(e),n.d(e,{ErrorCode:()=>nr,EventType:()=>rr,WebChannel:()=>ir,XhrIo:()=>or,createWebChannelTransport:()=>er,default:()=>ar});var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)};function i(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var o,a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},s=s||{},u=a||self;function c(){}function l(t){var e=typeof t;return"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}function f(t){var e=l(t);return"array"==e||"object"==e&&"number"==typeof t.length}function h(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var p="closure_uid_"+(1e9*Math.random()>>>0),d=0;function v(t,e,n){return t.call.apply(t.bind,arguments)}function y(t,e,n){if(!t)throw Error();if(2e?1:0}t:{var A=u.navigator;if(A){var N=A.userAgent;if(N){O=N;break t}}O=""}function R(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function D(t){var e={};for(var n in t)e[n]=t[n];return e}var L="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function M(t,e){for(var n,r,i=1;iparseFloat(K)){F=String(Q);break t}}F=K}var Y,X={};function J(t){return function(t,e){var n=X;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e()}(t,(function(){for(var e=0,n=k(String(F)).split("."),r=k(String(t)).split("."),i=Math.max(n.length,r.length),o=0;0==e&&o=t.keyCode)&&(t.keyCode=-1)}catch(t){}};var at="closure_listenable_"+(1e6*Math.random()|0),st=0;function ut(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ca=i,this.key=++st,this.Y=this.Z=!1}function ct(t){t.Y=!0,t.listener=null,t.proxy=null,t.src=null,t.ca=null}function lt(t){this.src=t,this.a={},this.b=0}function ft(t,e){var n=e.type;if(n in t.a){var r,i=t.a[n],o=E(i,e);(r=0<=o)&&Array.prototype.splice.call(i,o,1),r&&(ct(e),0==t.a[n].length&&(delete t.a[n],t.b--))}}function ht(t,e,n,r){for(var i=0;i>>0);function It(t){return"function"==l(t)?t:(t[St]||(t[St]=function(e){return t.handleEvent(e)}),t[St])}function Ct(){w.call(this),this.c=new lt(this),this.J=this,this.C=null}function Ot(t,e,n,r){if(!(e=t.c.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;or.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var o=i[0];if("noop"!=o&&"stop"!=o&&"close"!=o)for(var a=1;ae.length?ge:(e=e.substr(r,n),t.D=r+n,e))}function Ee(t){t.U=_()+t.P,Te(t,t.P)}function Te(t,e){if(null!=t.o)throw Error("WatchDog timer not null");t.o=re(g(t.Ua,t),e)}function Se(t){t.o&&(u.clearTimeout(t.o),t.o=null)}function Ie(t){0==t.g.v||t.A||Wn(t.g,t)}function Ce(t){Se(t);var e=t.F;e&&"function"==typeof e.ja&&e.ja(),t.F=null,Vt(t.R),Kt(t.J),t.a&&(e=t.a,t.a=null,e.abort(),e.ja())}function Oe(t,e){try{var n=t.g;if(0!=n.v&&(n.a==t||sn(n.b,t)))if(n.I=t.N,!t.C&&sn(n.b,t)&&3==n.v){try{var r=n.ka.a.parse(e)}catch(t){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.j){if(n.a){if(!(n.a.u+3e3i[2]&&n.H&&0==n.o&&!n.m&&(n.m=re(g(n.Ra,n),6e3));if(1>=an(n.b)&&n.ea){try{n.ea()}catch(t){}n.ea=void 0}}else zn(n,11)}else if((t.C||n.a==t)&&Bn(n),!C(e))for(e=r=n.ka.a.parse(e),r=0;re||3==e&&!W&&!this.a.$())){this.A||4!=e||7==n||Zt(8==n||0>=r?3:2),Se(this);var i=this.a.X();this.N=i;var o=this.a.$();if(this.b=200==i,function(t,e,n,r,i,o,a){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+"\n"+n+"\n"+o+" "+a}))}(this.c,this.m,this.l,this.f,this.T,e,i),this.b){if(this.V&&!this.C){e:{if(this.a){var a,s=this.a;if((a=s.a?s.a.getResponseHeader("X-HTTP-Initial-Response"):null)&&!C(a)){var u=a;break e}}u=null}if(!u){this.b=!1,this.h=3,ee(12),Ce(this),Ie(this);break t}Qt(this.c,this.f,u,"Initial handshake response via X-HTTP-Initial-Response"),this.C=!0,Oe(this,u)}this.I?(be(this,e,o),W&&this.b&&3==e&&(Ht(this.J,this.R,"tick",this.Va),this.R.start())):(Qt(this.c,this.f,o,null),Oe(this,o)),4==e&&Ce(this),this.b&&!this.A&&(4==e?Wn(this.g,this):(this.b=!1,Ee(this)))}else 400==i&&0e)throw Error("Bad port number "+e);t.h=e}else t.h=null}function Fe(t,e,n){e instanceof Qe?(t.b=e,function(t,e){e&&!t.f&&(Ye(t),t.c=null,t.a.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(Xe(this,e),Ze(this,n,t))}),t)),t.f=e}(t.b,t.a)):(n||(e=Be(e,Ke)),t.b=new Qe(e,t.a))}function Ue(t,e,n){t.b.set(e,n)}function Ve(t){return Ue(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^_()).toString(36)),t}function qe(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Be(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,We),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function We(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Re.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Be(e,Ge,!0),":");var n=this.c;return(n||"file"==e)&&(t.push("//"),(e=this.j)&&t.push(Be(e,Ge,!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(Be(n,"/"==n.charAt(0)?He:ze,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",Be(n,$e)),t.join("")};var Ge=/[#\/\?@]/g,ze=/[#\?:]/g,He=/[#\?]/g,Ke=/[#\?@]/g,$e=/#/g;function Qe(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function Ye(t){t.a||(t.a=new xe,t.b=0,t.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n2*t.c&&Pe(t)))}function Je(t,e){return Ye(t),e=tn(t,e),Ae(t.a.b,e)}function Ze(t,e,n){Xe(t,e),0=t.f}function an(t){return t.b?1:t.a?t.a.size:0}function sn(t,e){return t.b?t.b==e:!!t.a&&t.a.has(e)}function un(t,e){t.a?t.a.add(e):t.b=e}function cn(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function ln(t){var e,n;if(null!=t.b)return t.c.concat(t.b.s);if(null!=t.a&&0!==t.a.size){var r=t.c;try{for(var o=i(t.a.values()),a=o.next();!a.done;a=o.next()){var s=a.value;r=r.concat(s.s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return r}return I(t.c)}function fn(){}function hn(){this.a=new fn}function pn(t,e,n){var r=n||"";try{ke(t,(function(t,n){var i=t;h(t)&&(i=kt(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function dn(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}nn.prototype.cancel=function(){var t,e;if(this.c=ln(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=i(this.a.values()),r=n.next();!r.done;r=n.next())r.value.cancel()}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.a.clear()}},fn.prototype.stringify=function(t){return u.JSON.stringify(t,void 0)},fn.prototype.parse=function(t){return u.JSON.parse(t,void 0)};var vn=u.JSON.parse;function yn(t){Ct.call(this),this.headers=new xe,this.H=t||null,this.b=!1,this.s=this.a=null,this.B="",this.h=0,this.f="",this.g=this.A=this.l=this.u=!1,this.o=0,this.m=null,this.I=gn,this.D=this.F=!1}b(yn,Ct);var gn="",mn=/^https?$/i,_n=["POST","PUT"];function bn(t){return"content-type"==t.toLowerCase()}function wn(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,En(t),Sn(t)}function En(t){t.u||(t.u=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function Tn(t){if(t.b&&void 0!==s&&(!t.s[1]||4!=Cn(t)||2!=t.X()))if(t.l&&4==Cn(t))qt(t.za,0,t);else if(t.dispatchEvent("readystatechange"),4==Cn(t)){t.b=!1;try{var e,n=t.X();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.B).match(Ne)[1]||null;if(!o&&u.self&&u.self.location){var a=u.self.location.protocol;o=a.substr(0,a.length-1)}i=!mn.test(o?o.toLowerCase():"")}e=i}if(e)t.dispatchEvent("complete"),t.dispatchEvent("success");else{t.h=6;try{var c=2(c-=o))o=Math.max(0,i[u].b-100),s=!1;else try{pn(l,a,"req"+c+"_")}catch(t){r&&r(l)}}if(s){r=a.join("&");break t}}return t=t.g.splice(0,n),e.s=t,r}function Fn(t){t.a||t.j||(t.U=1,Lt(t.Aa,t),t.o=0)}function Un(t){return!(t.a||t.j||3<=t.o||(t.U++,t.j=re(g(t.Aa,t),Gn(t,t.o)),t.o++,0))}function Vn(t){null!=t.s&&(u.clearTimeout(t.s),t.s=null)}function qn(t){t.a=new de(t,t.c,"rpc",t.U),null===t.i&&(t.a.B=t.l),t.a.O=0;var e=De(t.la);Ue(e,"RID","rpc"),Ue(e,"SID",t.J),Ue(e,"CI",t.H?"0":"1"),Ue(e,"AID",t.P),Mn(t,e),Ue(e,"TYPE","xmlhttp"),t.i&&t.l&&On(e,t.i,t.l),t.D&&t.a.setTimeout(t.D);var n=t.a;t=t.ga,n.H=1,n.i=Ve(De(e)),n.j=null,n.I=!0,_e(n,t)}function Bn(t){null!=t.m&&(u.clearTimeout(t.m),t.m=null)}function Wn(t,e){var n=null;if(t.a==e){Bn(t),Vn(t),t.a=null;var r=2}else{if(!sn(t.b,e))return;n=e.s,cn(t.b,e),r=1}if(t.I=e.N,0!=t.v)if(e.b)if(1==r){n=e.j?e.j.length:0,e=_()-e.u;var i=t.u;(r=Xt()).dispatchEvent(new ne(r,n,e,i)),Dn(t)}else Fn(t);else if(3==(i=e.h)||0==i&&0=t.b.f-(t.h?1:0)||(t.h?(t.g=e.s.concat(t.g),0):1==t.v||2==t.v||t.u>=(t.Ia?0:t.Ja)||(t.h=re(g(t.Ba,t,e),Gn(t,t.u)),t.u++,0)))}(t,e)||2==r&&Un(t)))switch(n&&0e?null:"string"==typeof t?t.charAt(e):t[e]}(i.L()),n=u.FormData&&t instanceof u.FormData,!(0<=E(_n,e))||r||n||i.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),i.forEach((function(t,e){this.a.setRequestHeader(e,t)}),this),this.I&&(this.a.responseType=this.I),"withCredentials"in this.a&&this.a.withCredentials!==this.F&&(this.a.withCredentials=this.F);try{In(this),0=this.N)){var t=2*this.N;this.c.info("BP detection timer enabled: "+t),this.s=re(g(this.Sa,this),t)}},o.Sa=function(){this.s&&(this.s=null,this.c.info("BP detection timeout reached."),this.c.info("Buffering proxy detected and switch to long-polling!"),this.H=!1,this.F=!0,An(this),qn(this))},o.Ra=function(){null!=this.m&&(this.m=null,An(this),Un(this),ee(19))},o.Xa=function(t){t?(this.c.info("Successfully pinged google.com"),ee(2)):(this.c.info("Failed to ping google.com"),ee(1))},(o=Qn.prototype).ta=function(){},o.sa=function(){},o.ra=function(){},o.qa=function(){},o.Ha=function(){},Yn.prototype.a=function(t,e){return new Xn(t,e)},b(Xn,Ct),(o=Xn.prototype).addEventListener=function(t,e,n,r){Xn.S.addEventListener.call(this,t,e,n,r)},o.removeEventListener=function(t,e,n,r){Xn.S.removeEventListener.call(this,t,e,n,r)},o.Oa=function(){this.a.f=this.f,this.h&&(this.a.C=!0);var t=this.a,e=this.l,n=this.b||void 0;ee(0),t.fa=e,t.W=n||{},t.H=t.T,t.B=Kn(t,null,t.fa),Dn(t)},o.close=function(){Pn(this.a)},o.Pa=function(t){if("string"==typeof t){var e={};e.__data__=t,Rn(this.a,e)}else this.g?((e={}).__data__=kt(t),Rn(this.a,e)):Rn(this.a,t)},o.G=function(){this.a.f=null,delete this.f,Pn(this.a),delete this.a,Xn.S.G.call(this)},b(Jn,fe),b(Zn,he),b(tr,Qn),tr.prototype.ta=function(){this.a.dispatchEvent("a")},tr.prototype.sa=function(t){this.a.dispatchEvent(new Jn(t))},tr.prototype.ra=function(t){this.a.dispatchEvent(new Zn(t))},tr.prototype.qa=function(){this.a.dispatchEvent("b")},Yn.prototype.createWebChannel=Yn.prototype.a,Xn.prototype.send=Xn.prototype.Pa,Xn.prototype.open=Xn.prototype.Oa,Xn.prototype.close=Xn.prototype.close,ie.NO_ERROR=0,ie.TIMEOUT=8,ie.HTTP_ERROR=6,oe.COMPLETE="complete",ue.EventType=le,le.OPEN="a",le.CLOSE="b",le.ERROR="c",le.MESSAGE="d",Ct.prototype.listen=Ct.prototype.va,yn.prototype.listenOnce=yn.prototype.wa,yn.prototype.getLastError=yn.prototype.Qa,yn.prototype.getLastErrorCode=yn.prototype.ua,yn.prototype.getStatus=yn.prototype.X,yn.prototype.getResponseJson=yn.prototype.Na,yn.prototype.getResponseText=yn.prototype.$,yn.prototype.send=yn.prototype.ba;var er=function(){return new Yn},nr=ie,rr=oe,ir=ue,or=yn;const ar={createWebChannelTransport:er,ErrorCode:ie,EventType:oe,WebChannel:ue,XhrIo:yn}},48583:(t,e,n)=>{"use strict";var r=n(27418);function i(t,e){if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i=0;c--)if(l[c]!==f[c])return!1;for(c=l.length-1;c>=0;c--)if(!_(t[s=l[c]],e[s],n,r))return!1;return!0}(t,e,n,r))}return n?t===e:t==e}function b(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function w(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function E(t,e,n,r){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&g(i,n,"Missing expected exception"+r);var o="string"==typeof r,s=!t&&i&&!n;if((!t&&a.isError(i)&&o&&w(i,n)||s)&&g(i,n,"Got unwanted exception"+r),t&&i&&n&&!w(i,n)||!t&&i)throw i}h.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return v(y(t.actual),128)+" "+t.operator+" "+v(y(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var n=new Error;if(n.stack){var r=n.stack,i=d(e),o=r.indexOf("\n"+i);if(o>=0){var a=r.indexOf("\n",o+1);r=r.substring(a+1)}this.stack=r}}},a.inherits(h.AssertionError,Error),h.fail=g,h.ok=m,h.equal=function(t,e,n){t!=e&&g(t,e,n,"==",h.equal)},h.notEqual=function(t,e,n){t==e&&g(t,e,n,"!=",h.notEqual)},h.deepEqual=function(t,e,n){_(t,e,!1)||g(t,e,n,"deepEqual",h.deepEqual)},h.deepStrictEqual=function(t,e,n){_(t,e,!0)||g(t,e,n,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function(t,e,n){_(t,e,!1)&&g(t,e,n,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=function t(e,n,r){_(e,n,!0)&&g(e,n,r,"notDeepStrictEqual",t)},h.strictEqual=function(t,e,n){t!==e&&g(t,e,n,"===",h.strictEqual)},h.notStrictEqual=function(t,e,n){t===e&&g(t,e,n,"!==",h.notStrictEqual)},h.throws=function(t,e,n){E(!0,t,e,n)},h.doesNotThrow=function(t,e,n){E(!1,t,e,n)},h.ifError=function(t){if(t)throw t},h.strict=r((function t(e,n){e||g(e,!0,n,"==",t)}),h,{equal:h.strictEqual,deepEqual:h.deepStrictEqual,notEqual:h.notStrictEqual,notDeepEqual:h.notDeepStrictEqual}),h.strict.strict=h.strict;var T=Object.keys||function(t){var e=[];for(var n in t)s.call(t,n)&&e.push(n);return e}},16076:t=>{"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},52014:t=>{t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},30069:(t,e,n)=>{var r=n(34155),i=n(25108),o=/%[sdj%]/g;e.format=function(t){if(!m(t)){for(var e=[],n=0;n=i)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}})),s=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),v(n)?r.showHidden=n:n&&e._extend(r,n),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=c),f(r,t,r.depth)}function c(t,e){var n=u.styles[e];return n?"["+u.colors[n][0]+"m"+t+"["+u.colors[n][1]+"m":t}function l(t,e){return t}function f(t,n,r){if(t.customInspect&&n&&S(n.inspect)&&n.inspect!==e.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,t);return m(i)||(i=f(t,i,r)),i}var o=function(t,e){if(_(e))return t.stylize("undefined","undefined");if(m(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return g(e)?t.stylize(""+e,"number"):v(e)?t.stylize(""+e,"boolean"):y(e)?t.stylize("null","null"):void 0}(t,n);if(o)return o;var a=Object.keys(n),s=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(n)),T(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return h(n);if(0===a.length){if(S(n)){var u=n.name?": "+n.name:"";return t.stylize("[Function"+u+"]","special")}if(b(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(E(n))return t.stylize(Date.prototype.toString.call(n),"date");if(T(n))return h(n)}var c,l="",w=!1,I=["{","}"];return d(n)&&(w=!0,I=["[","]"]),S(n)&&(l=" [Function"+(n.name?": "+n.name:"")+"]"),b(n)&&(l=" "+RegExp.prototype.toString.call(n)),E(n)&&(l=" "+Date.prototype.toUTCString.call(n)),T(n)&&(l=" "+h(n)),0!==a.length||w&&0!=n.length?r<0?b(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special"):(t.seen.push(n),c=w?function(t,e,n,r,i){for(var o=[],a=0,s=e.length;a60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}(c,l,I)):I[0]+l+I[1]}function h(t){return"["+Error.prototype.toString.call(t)+"]"}function p(t,e,n,r,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),x(r,i)||(a="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=y(n)?f(t,u.value,null):f(t,u.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),_(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function d(t){return Array.isArray(t)}function v(t){return"boolean"==typeof t}function y(t){return null===t}function g(t){return"number"==typeof t}function m(t){return"string"==typeof t}function _(t){return void 0===t}function b(t){return w(t)&&"[object RegExp]"===I(t)}function w(t){return"object"==typeof t&&null!==t}function E(t){return w(t)&&"[object Date]"===I(t)}function T(t){return w(t)&&("[object Error]"===I(t)||t instanceof Error)}function S(t){return"function"==typeof t}function I(t){return Object.prototype.toString.call(t)}function C(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(t){if(_(a)&&(a=r.env.NODE_DEBUG||""),t=t.toUpperCase(),!s[t])if(new RegExp("\\b"+t+"\\b","i").test(a)){var n=r.pid;s[t]=function(){var r=e.format.apply(e,arguments);i.error("%s %d: %s",t,n,r)}}else s[t]=function(){};return s[t]},e.inspect=u,u.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},u.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=d,e.isBoolean=v,e.isNull=y,e.isNullOrUndefined=function(t){return null==t},e.isNumber=g,e.isString=m,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=_,e.isRegExp=b,e.isObject=w,e.isDate=E,e.isError=T,e.isFunction=S,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=n(52014);var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k(){var t=new Date,e=[C(t.getHours()),C(t.getMinutes()),C(t.getSeconds())].join(":");return[t.getDate(),O[t.getMonth()],e].join(" ")}function x(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){i.log("%s - %s",k(),e.format.apply(e,arguments))},e.inherits=n(16076),e._extend=function(t,e){if(!e||!w(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}},42966:(t,e,n)=>{"use strict";var r=n(67294),i=n(73935),o=n(96128),a=n(68356),s=n.n(a),u=n(14010),c=n(6641),l=n(92342);function f(t){return function(e){var n=e.dispatch,r=e.getState;return function(e){return function(i){return"function"==typeof i?i(n,r,t):e(i)}}}}var h=f();h.withExtraArgument=f;const p=h;var d=n(34988),v=n(32181),y=n(92972),g=n(42058),m=n(94305),_=n(92077),b=n(9453),w=n(61811),E=n(79844);const T=(0,l.UY)({room:v.ZP,user:y.ZP,game:g.ZP,cards:m.ZP,round:_.ZP,hands:b.ZP,socket:E.ZP,chat:w.ZP});var S=!("undefined"!=typeof window&&window.document&&window.document.createElement),I=n(12855),C=n(9263),O=n.n(C);const k=n(41445).Z,x=n(79927).Z;var P=s()({loader:function(){return Promise.all([n.e(845),n.e(805),n.e(151)]).then(n.bind(n,35151))},loading:function(){return null},modules:["./Welcome"]}),A=s()({loader:function(){return Promise.all([n.e(359),n.e(805),n.e(647)]).then(n.bind(n,79647))},loading:function(){return null},modules:["./Setup_v2"]}),N=s()({loader:function(){return Promise.all([n.e(845),n.e(359),n.e(805),n.e(491),n.e(958)]).then(n.bind(n,84958))},loading:function(){return null},modules:["./Waiting"]}),R=s()({loader:function(){return Promise.all([n.e(845),n.e(359),n.e(805),n.e(491),n.e(551)]).then(n.bind(n,29551))},loading:function(){return null},modules:["./Board"]}),D=s()({loader:function(){return Promise.all([n.e(845),n.e(552)]).then(n.bind(n,55552))},loading:function(){return null},modules:["./Counter"]});const L=function(){return r.createElement(k,null,r.createElement(x,{exact:!0,path:"/",component:P}),r.createElement(x,{exact:!0,path:"/setup/:code",component:A}),r.createElement(x,{exact:!0,path:"/waiting/:code",component:N}),r.createElement(x,{exact:!0,path:"/game/:code",component:R}),r.createElement(x,{exact:!0,path:"/counter",component:D}))};var M,j=n(36808),F=n.n(j),U=new Uint8Array(16);function V(){if(!M&&!(M="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return M(U)}const q=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,B=function(t){return"string"==typeof t&&q.test(t)};for(var W=[],G=0;G<256;++G)W.push((G+256).toString(16).substr(1));const z=function(t,e,n){var r=(t=t||{}).random||(t.rng||V)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(W[t[e+0]]+W[t[e+1]]+W[t[e+2]]+W[t[e+3]]+"-"+W[t[e+4]]+W[t[e+5]]+"-"+W[t[e+6]]+W[t[e+7]]+"-"+W[t[e+8]]+W[t[e+9]]+"-"+W[t[e+10]]+W[t[e+11]]+W[t[e+12]]+W[t[e+13]]+W[t[e+14]]+W[t[e+15]]).toLowerCase();if(!B(n))throw TypeError("Stringified UUID is invalid");return n}(r)};function H(t){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(t)}function K(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function $(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Q(t,e){return Q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Q(t,e)}function Y(t,e){if(e&&("object"===H(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return X(t)}function X(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function J(t){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},J(t)}function Z(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var tt={apiKey:"AIzaSyCm3Mc9Dh0zEeUkSZ-qXrOCaPmfszSDqm0",authDomain:"sitaratas-47089.firebaseapp.com",databaseURL:"https://sitaratas-47089.firebaseio.com",projectId:"sitaratas-47089",storageBucket:"sitaratas-47089.appspot.com",messagingSenderId:"123382092310",appId:"1:123382092310:web:97a7b71d7f1f4f16075b37",measurementId:"G-DVD436K83Z"},et=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Q(t,e)}(a,t);var e,n,i,o=(n=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=J(n);if(i){var r=J(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return Y(this,t)});function a(){var t;$(this,a);for(var e=arguments.length,n=new Array(e),i=0;i0&&void 0!==arguments[0]?arguments[0]:"/",e=S?(0,d.PP)({initialEntries:[t]}):(0,d.lX)(),n=[],r=[p,(0,c.zk)(e)],i=l.qC.apply(void 0,[l.md.apply(void 0,r)].concat(n)),o=S?{}:window.__PRELOADED_STATE__;S||delete window.__PRELOADED_STATE__;var a=(0,l.MT)((0,c.iz)(e)(T),o,i);return{store:a,history:e}}(),it=rt.store,ot=rt.history,at=r.createElement(o.Provider,{store:it},r.createElement(c.xI,{history:ot},r.createElement(u.Ay,{noServerRender:!0},r.createElement(nt,null)))),st=document.querySelector("#root");s().preloadReady().then((function(){(0,i.hydrate)(at,st)}))},94305:(t,e,n)=>{"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;ev,ZP:()=>f,eJ:()=>h,jn:()=>p,yJ:()=>d});var a="SET_CARDS",s="SET_JOKERS",u="REMOVE_CARD",c="RESET_CARDS",l={data:[],jokers:{}};const f=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case a:return i(i({},t),{},{data:e.cards});case s:return i(i({},t),{},{jokers:e.data});case u:return i(i({},t),{},{data:t.data.filter((function(t,n){return n!==e.index}))});case c:return{data:[]};default:return t}};var h=function(t){return function(e){return new Promise((function(n){return n(e({type:a,cards:t}))}))}},p=function(t){return function(e){return new Promise((function(n){return n(e({type:s,data:t}))}))}},d=function(t){return function(e){return new Promise((function(n){return n(e({type:u,index:t}))}))}},v=function(){return function(t){return new Promise((function(e){return e(t({type:c}))}))}}},61811:(t,e,n)=>{"use strict";function r(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nv,J0:()=>g,Z:()=>d,ZP:()=>p,yO:()=>y});var u="SET_MESSAGES",c="ADD_MESSAGE",l="TOGGLE_MOBILE",f="NEW_MESSAGE_ALERT",h={data:[],fetching:!0,showMobile:!1,alert:!1};const p=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case u:return a(a({},t),{},{data:e.data,fetching:!1});case c:return a(a({},t),{},{data:[].concat(r(t.data),[e.data]),alert:!0});case l:return a(a({},t),{},{showMobile:!t.showMobile});case f:return a(a({},t),{},{alert:e.data});default:return t}};var d=function(t){return function(e){return new Promise((function(n){return n(e({type:u,data:t}))}))}},v=function(t){return function(e){return new Promise((function(n){return n(e({type:c,data:t}))}))}},y=function(){return function(t){return new Promise((function(e){return e(t({type:l}))}))}},g=function(t){return function(e){return new Promise((function(n){return n(e({type:f,data:t}))}))}}},42058:(t,e,n)=>{"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;el,_X:()=>p,x2:()=>h,y6:()=>f});var a="SET_GAME",s="UPDATE_GAME_HAND",u="RESET_GAME",c={data:null};const l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case a:return i(i({},t),{},{data:e.game});case s:return i(i({},t),{},{data:i(i({},t.data),{},{hand:e.hand})});case u:return{data:null};default:return t}};var f=function(t){return function(e){return new Promise((function(n){return n(e({type:a,game:t}))}))}},h=function(t){return function(e){return new Promise((function(n){return n(e({type:s,hand:t}))}))}},p=function(){return function(t){return new Promise((function(e){return e(t({type:u}))}))}}},9453:(t,e,n)=>{"use strict";function r(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nv,Z0:()=>g,ZP:()=>d,f$:()=>_,jy:()=>y,rE:()=>m});var u="SET_HAND",c="SET_PREVIOUS_HAND",l="ADD_CARD",f="ADD_HAND_WINNER",h="RESET_HANDS",p={data:null,prev:null};const d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case u:return a(a({},t),{},{data:e.hand});case c:return a(a({},t),{},{prev:e.data});case l:return a(a({},t),{},{data:a(a({},t.data),{},{cards:[e.card].concat(r(t.data.cards)),base:t.data.base?t.data.base:15!==e.card.value?e.card:null})});case f:return a(a({},t),{},{data:a(a({},t.data),{},{winner:e.card})});case h:return{data:null};default:return t}};var v=function(t){return function(e){return new Promise((function(n){return n(e({type:u,hand:t}))}))}},y=function(t){return function(e){return new Promise((function(n){return n(e({type:c,data:t}))}))}},g=function(t){return function(e){return new Promise((function(n){return n(e({type:l,card:t}))}))}},m=function(t){return function(e){return new Promise((function(n){return n(e({type:f,card:t}))}))}},_=function(){return function(t){return new Promise((function(e){return e(t({type:h}))}))}}},32181:(t,e,n)=>{"use strict";function r(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nS,MJ:()=>I,UR:()=>k,ZP:()=>_,bZ:()=>w,jn:()=>O,jy:()=>x,tu:()=>b,u3:()=>C,vP:()=>T,zw:()=>E});var u="SET_ROOM",c="SET_ROOM_WITH_PLAYERS",l="RESET_ROOM",f="SET_PLAYERS",h="ADD_PLAYER",p="REMOVE_PLAYER",d="SET_PRIVACY",v="SET_JOKERS",y="SET_MAX_PLAYERS",g="SET_SPORT",m={code:null,host_browser_id:null,players:[],privacy:"private",jokers:!1,maxPlayers:4,sport:"basketball"};const _=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case u:return a(a({},t),{},{code:e.code,host_browser_id:e.id,privacy:e.privacy,jokers:e.jokers,maxPlayers:e.maxPlayers,sport:e.sport});case c:return a(a({},t),{},{code:e.room.code,host_browser_id:e.room.host_browser_id,privacy:e.room.privacy,jokers:e.room.jokers,maxPlayers:e.room.maxPlayers,players:e.players,sport:e.room.sport});case f:return a(a({},t),{},{players:e.data});case d:return a(a({},t),{},{privacy:e.privacy});case v:return a(a({},t),{},{jokers:e.jokers});case y:return a(a({},t),{},{maxPlayers:e.amount});case g:return a(a({},t),{},{sport:e.data});case h:return a(a({},t),{},{players:[].concat(r(t.players),[e.player])});case p:return a(a({},t),{},{players:t.players.filter((function(t){return t.browser_id?t.browser_id!==e.id:t.uid!==e.id}))});case l:return{code:null,host_browser_id:null,players:[]};default:return t}};var b=function(t,e){return function(n){return new Promise((function(r){return r(n({type:u,code:t,id:e}))}))}},w=function(t,e){return function(n){return new Promise((function(r){return r(n({type:c,room:t,players:e}))}))}},E=function(){return function(t){return new Promise((function(e){return e(t({type:l}))}))}},T=function(t){return function(e){return new Promise((function(n){return n(e({type:f,data:t}))}))}},S=function(t){return function(e){return new Promise((function(n){return n(e({type:h,player:t}))}))}},I=function(t){return function(e){return new Promise((function(n){return n(e({type:p,id:t}))}))}},C=function(t){return function(e){return new Promise((function(n){return n(e({type:d,privacy:t}))}))}},O=function(t){return function(e){return new Promise((function(n){return n(e({type:v,jokers:t}))}))}},k=function(t){return function(e){return new Promise((function(n){return n(e({type:y,amount:t}))}))}},x=function(t){return function(e){return new Promise((function(n){return n(e({type:g,data:t}))}))}}},92077:(t,e,n)=>{"use strict";function r(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nw,OM:()=>E,Ol:()=>b,Ou:()=>T,PJ:()=>_,ZP:()=>y,c3:()=>m,vg:()=>g});var u="SET_ROUND",c="SET_PREVIOUS_ROUND",l="ADD_MY_BET",f="UPDATE_RESULTS",h="SET_NEXT_TURN",p="ADD_WON",d="RESET_ROUND",v={data:null,prev:null};const y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case u:return a(a({},t),{},{data:e.round});case c:return a(a({},t),{},{prev:e.data});case l:return a(a({},t),{},{data:a(a({},t.data),{},{results:[e.data].concat(r(t.data.results))})});case p:return a(a({},t),{},{data:a(a({},t.data),{},{results:t.data.results.map((function(t){return t.uid===e.uid?a(a({},t),{},{won:t.won+1}):t}))})});case h:return a(a({},t),{},{data:a(a({},t.data),{},{turn:e.uid,action:e.step})});case f:return a(a({},t),{},{data:a(a({},t.data),{},{results:e.results})});case d:return{data:null};default:return t}};var g=function(t){return function(e){return new Promise((function(n){return n(e({type:u,round:t}))}))}},m=function(t){return function(e){return new Promise((function(n){return n(e({type:c,data:t}))}))}},_=function(t){return function(e){return new Promise((function(n){return n(e({type:l,data:t}))}))}},b=function(t){return function(e){return new Promise((function(n){return n(e({type:f,results:t}))}))}},w=function(t){return function(e){return new Promise((function(n){return n(e({type:p,uid:t}))}))}},E=function(){return function(t){return new Promise((function(e){return e(t({type:d}))}))}},T=function(t,e){return function(n){return new Promise((function(r){return r(n({type:h,uid:t,step:e}))}))}}},79844:(t,e,n)=>{"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;ef,ZP:()=>c,uU:()=>l});var a="SET_SOCKET",s="SET_CONNECTIONS",u={channel:null,connections:[]};const c=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case a:return i(i({},t),{},{channel:e.data});case s:return i(i({},t),{},{connections:e.data});default:return t}};var l=function(t){return function(e){return new Promise((function(n){return n(e({type:a,data:t}))}))}},f=function(t){return function(e){return new Promise((function(n){return n(e({type:s,data:t}))}))}}},92972:(t,e,n)=>{"use strict";n.d(e,{ZP:()=>d,av:()=>g,ij:()=>m,m0:()=>v,zO:()=>y,zb:()=>_});var r=n(36808),i=n.n(r);function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function a(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:p,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case u:return i().set("language",e.data,{expires:365}),a(a({},t),{},{language:e.data});case c:return a(a({},t),{},{browser_id:e.id});case l:return a(a({},t),{},{browser_id:e.data.browser_id,room_code:e.data.room_code,name:e.data.name,isReady:e.data.isReady});case h:return a(a({},t),{},{isReady:e.status});case f:return a(a({},t),{},{room_code:null,name:"",isReady:!1});default:return t}};var v=function(t){return function(e){return new Promise((function(n){return n(e({type:u,data:t}))}))}},y=function(t){return function(e){return new Promise((function(n){return n(e({type:c,id:t}))}))}},g=function(t){return function(e){return new Promise((function(n){return n(e({type:l,data:t}))}))}},m=function(t){return function(e){return new Promise((function(n){return n(e({type:h,status:t}))}))}},_=function(){return function(t){return new Promise((function(e){return e(t({type:f}))}))}}},76124:(t,e,n)=>{"use strict";if(n(87931),n(95654),n(67182),n.g._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");function r(t,e,n){t[e]||Object.defineProperty(t,e,{writable:!0,configurable:!0,value:n})}n.g._babelPolyfill=!0,r(String.prototype,"padLeft","".padStart),r(String.prototype,"padRight","".padEnd),"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach((function(t){[][t]&&r(Array,t,Function.call.bind([][t]))}))},67182:(t,e,n)=>{n(54530),t.exports=n(48080).RegExp.escape},50666:t=>{t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},98479:(t,e,n)=>{var r=n(42380);t.exports=function(t,e){if("number"!=typeof t&&"Number"!=r(t))throw TypeError(e);return+t}},17296:(t,e,n)=>{var r=n(64410)("unscopables"),i=Array.prototype;null==i[r]&&n(74461)(i,r,{}),t.exports=function(t){i[r][t]=!0}},10990:(t,e,n)=>{"use strict";var r=n(25454)(!0);t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},30269:t=>{t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},85075:(t,e,n)=>{var r=n(49708);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},43697:(t,e,n)=>{"use strict";var r=n(16040),i=n(39519),o=n(15263);t.exports=[].copyWithin||function(t,e){var n=r(this),a=o(n.length),s=i(t,a),u=i(e,a),c=arguments.length>2?arguments[2]:void 0,l=Math.min((void 0===c?a:i(c,a))-u,a-s),f=1;for(u0;)u in n?n[s]=n[u]:delete n[s],s+=f,u+=f;return n}},35572:(t,e,n)=>{"use strict";var r=n(16040),i=n(39519),o=n(15263);t.exports=function(t){for(var e=r(this),n=o(e.length),a=arguments.length,s=i(a>1?arguments[1]:void 0,n),u=a>2?arguments[2]:void 0,c=void 0===u?n:i(u,n);c>s;)e[s++]=t;return e}},59315:(t,e,n)=>{var r=n(74036);t.exports=function(t,e){var n=[];return r(t,!1,n.push,n,e),n}},64513:(t,e,n)=>{var r=n(76282),i=n(15263),o=n(39519);t.exports=function(t){return function(e,n,a){var s,u=r(e),c=i(u.length),l=o(a,c);if(t&&n!=n){for(;c>l;)if((s=u[l++])!=s)return!0}else for(;c>l;l++)if((t||l in u)&&u[l]===n)return t||l||0;return!t&&-1}}},13635:(t,e,n)=>{var r=n(21550),i=n(75945),o=n(16040),a=n(15263),s=n(42143);t.exports=function(t,e){var n=1==t,u=2==t,c=3==t,l=4==t,f=6==t,h=5==t||f,p=e||s;return function(e,s,d){for(var v,y,g=o(e),m=i(g),_=r(s,d,3),b=a(m.length),w=0,E=n?p(e,b):u?p(e,0):void 0;b>w;w++)if((h||w in m)&&(y=_(v=m[w],w,g),t))if(n)E[w]=y;else if(y)switch(t){case 3:return!0;case 5:return v;case 6:return w;case 2:E.push(v)}else if(l)return!1;return f?-1:c||l?l:E}}},56574:(t,e,n)=>{var r=n(50666),i=n(16040),o=n(75945),a=n(15263);t.exports=function(t,e,n,s,u){r(e);var c=i(t),l=o(c),f=a(c.length),h=u?f-1:0,p=u?-1:1;if(n<2)for(;;){if(h in l){s=l[h],h+=p;break}if(h+=p,u?h<0:f<=h)throw TypeError("Reduce of empty array with no initial value")}for(;u?h>=0:f>h;h+=p)h in l&&(s=e(s,l[h],h,c));return s}},80920:(t,e,n)=>{var r=n(49708),i=n(63623),o=n(64410)("species");t.exports=function(t){var e;return i(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!i(e.prototype)||(e=void 0),r(e)&&null===(e=e[o])&&(e=void 0)),void 0===e?Array:e}},42143:(t,e,n)=>{var r=n(80920);t.exports=function(t,e){return new(r(t))(e)}},47240:(t,e,n)=>{"use strict";var r=n(50666),i=n(49708),o=n(31671),a=[].slice,s={},u=function(t,e,n){if(!(e in s)){for(var r=[],i=0;i{var r=n(42380),i=n(64410)("toStringTag"),o="Arguments"==r(function(){return arguments}());t.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),i))?n:o?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},42380:t=>{var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},37647:(t,e,n)=>{"use strict";var r=n(24213).f,i=n(6088),o=n(33227),a=n(21550),s=n(30269),u=n(74036),c=n(15706),l=n(34257),f=n(72373),h=n(83144),p=n(18648).fastKey,d=n(51554),v=h?"_s":"size",y=function(t,e){var n,r=p(e);if("F"!==r)return t._i[r];for(n=t._f;n;n=n.n)if(n.k==e)return n};t.exports={getConstructor:function(t,e,n,c){var l=t((function(t,r){s(t,l,e,"_i"),t._t=e,t._i=i(null),t._f=void 0,t._l=void 0,t[v]=0,null!=r&&u(r,n,t[c],t)}));return o(l.prototype,{clear:function(){for(var t=d(this,e),n=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete n[r.i];t._f=t._l=void 0,t[v]=0},delete:function(t){var n=d(this,e),r=y(n,t);if(r){var i=r.n,o=r.p;delete n._i[r.i],r.r=!0,o&&(o.n=i),i&&(i.p=o),n._f==r&&(n._f=i),n._l==r&&(n._l=o),n[v]--}return!!r},forEach:function(t){d(this,e);for(var n,r=a(t,arguments.length>1?arguments[1]:void 0,3);n=n?n.n:this._f;)for(r(n.v,n.k,this);n&&n.r;)n=n.p},has:function(t){return!!y(d(this,e),t)}}),h&&r(l.prototype,"size",{get:function(){return d(this,e)[v]}}),l},def:function(t,e,n){var r,i,o=y(t,e);return o?o.v=n:(t._l=o={i:i=p(e,!0),k:e,v:n,p:r=t._l,n:void 0,r:!1},t._f||(t._f=o),r&&(r.n=o),t[v]++,"F"!==i&&(t._i[i]=o)),t},getEntry:y,setStrong:function(t,e,n){c(t,e,(function(t,n){this._t=d(t,e),this._k=n,this._l=void 0}),(function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?l(0,"keys"==e?n.k:"values"==e?n.v:[n.k,n.v]):(t._t=void 0,l(1))}),n?"entries":"values",!n,!0),f(e)}}},72935:(t,e,n)=>{var r=n(96347),i=n(59315);t.exports=function(t){return function(){if(r(this)!=t)throw TypeError(t+"#toJSON isn't generic");return i(this)}}},78348:(t,e,n)=>{"use strict";var r=n(33227),i=n(18648).getWeak,o=n(85075),a=n(49708),s=n(30269),u=n(74036),c=n(13635),l=n(83050),f=n(51554),h=c(5),p=c(6),d=0,v=function(t){return t._l||(t._l=new y)},y=function(){this.a=[]},g=function(t,e){return h(t.a,(function(t){return t[0]===e}))};y.prototype={get:function(t){var e=g(this,t);if(e)return e[1]},has:function(t){return!!g(this,t)},set:function(t,e){var n=g(this,t);n?n[1]=e:this.a.push([t,e])},delete:function(t){var e=p(this.a,(function(e){return e[0]===t}));return~e&&this.a.splice(e,1),!!~e}},t.exports={getConstructor:function(t,e,n,o){var c=t((function(t,r){s(t,c,e,"_i"),t._t=e,t._i=d++,t._l=void 0,null!=r&&u(r,n,t[o],t)}));return r(c.prototype,{delete:function(t){if(!a(t))return!1;var n=i(t);return!0===n?v(f(this,e)).delete(t):n&&l(n,this._i)&&delete n[this._i]},has:function(t){if(!a(t))return!1;var n=i(t);return!0===n?v(f(this,e)).has(t):n&&l(n,this._i)}}),c},def:function(t,e,n){var r=i(o(e),!0);return!0===r?v(t).set(e,n):r[t._i]=n,t},ufstore:v}},8107:(t,e,n)=>{"use strict";var r=n(24405),i=n(61693),o=n(69593),a=n(33227),s=n(18648),u=n(74036),c=n(30269),l=n(49708),f=n(10496),h=n(3229),p=n(25572),d=n(77856);t.exports=function(t,e,n,v,y,g){var m=r[t],_=m,b=y?"set":"add",w=_&&_.prototype,E={},T=function(t){var e=w[t];o(w,t,"delete"==t||"has"==t?function(t){return!(g&&!l(t))&&e.call(this,0===t?0:t)}:"get"==t?function(t){return g&&!l(t)?void 0:e.call(this,0===t?0:t)}:"add"==t?function(t){return e.call(this,0===t?0:t),this}:function(t,n){return e.call(this,0===t?0:t,n),this})};if("function"==typeof _&&(g||w.forEach&&!f((function(){(new _).entries().next()})))){var S=new _,I=S[b](g?{}:-0,1)!=S,C=f((function(){S.has(1)})),O=h((function(t){new _(t)})),k=!g&&f((function(){for(var t=new _,e=5;e--;)t[b](e,e);return!t.has(-0)}));O||((_=e((function(e,n){c(e,_,t);var r=d(new m,e,_);return null!=n&&u(n,y,r[b],r),r}))).prototype=w,w.constructor=_),(C||k)&&(T("delete"),T("has"),y&&T("get")),(k||I)&&T(b),g&&w.clear&&delete w.clear}else _=v.getConstructor(e,t,y,b),a(_.prototype,n),s.NEED=!0;return p(_,t),E[t]=_,i(i.G+i.W+i.F*(_!=m),E),g||v.setStrong(_,t,y),_}},48080:t=>{var e=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=e)},72559:(t,e,n)=>{"use strict";var r=n(24213),i=n(33388);t.exports=function(t,e,n){e in t?r.f(t,e,i(0,n)):t[e]=n}},21550:(t,e,n)=>{var r=n(50666);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},59496:(t,e,n)=>{"use strict";var r=n(10496),i=Date.prototype.getTime,o=Date.prototype.toISOString,a=function(t){return t>9?t:"0"+t};t.exports=r((function(){return"0385-07-25T07:06:39.999Z"!=o.call(new Date(-50000000000001))}))||!r((function(){o.call(new Date(NaN))}))?function(){if(!isFinite(i.call(this)))throw RangeError("Invalid time value");var t=this,e=t.getUTCFullYear(),n=t.getUTCMilliseconds(),r=e<0?"-":e>9999?"+":"";return r+("00000"+Math.abs(e)).slice(r?-6:-4)+"-"+a(t.getUTCMonth()+1)+"-"+a(t.getUTCDate())+"T"+a(t.getUTCHours())+":"+a(t.getUTCMinutes())+":"+a(t.getUTCSeconds())+"."+(n>99?n:"0"+a(n))+"Z"}:o},72967:(t,e,n)=>{"use strict";var r=n(85075),i=n(23825),o="number";t.exports=function(t){if("string"!==t&&t!==o&&"default"!==t)throw TypeError("Incorrect hint");return i(r(this),t!=o)}},91083:t=>{t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},83144:(t,e,n)=>{t.exports=!n(10496)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},47339:(t,e,n)=>{var r=n(49708),i=n(24405).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},95985:t=>{t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},86522:(t,e,n)=>{var r=n(31126),i=n(68910),o=n(2806);t.exports=function(t){var e=r(t),n=i.f;if(n)for(var a,s=n(t),u=o.f,c=0;s.length>c;)u.call(t,a=s[c++])&&e.push(a);return e}},61693:(t,e,n)=>{var r=n(24405),i=n(48080),o=n(74461),a=n(69593),s=n(21550),u=function(t,e,n){var c,l,f,h,p=t&u.F,d=t&u.G,v=t&u.S,y=t&u.P,g=t&u.B,m=d?r:v?r[e]||(r[e]={}):(r[e]||{}).prototype,_=d?i:i[e]||(i[e]={}),b=_.prototype||(_.prototype={});for(c in d&&(n=e),n)f=((l=!p&&m&&void 0!==m[c])?m:n)[c],h=g&&l?s(f,r):y&&"function"==typeof f?s(Function.call,f):f,m&&a(m,c,f,t&u.U),_[c]!=f&&o(_,c,h),y&&b[c]!=f&&(b[c]=f)};r.core=i,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},90528:(t,e,n)=>{var r=n(64410)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[r]=!1,!"/./"[t](e)}catch(t){}}return!0}},10496:t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},87925:(t,e,n)=>{"use strict";n(47515);var r=n(69593),i=n(74461),o=n(10496),a=n(91083),s=n(64410),u=n(72562),c=s("species"),l=!o((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")})),f=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2===n.length&&"a"===n[0]&&"b"===n[1]}();t.exports=function(t,e,n){var h=s(t),p=!o((function(){var e={};return e[h]=function(){return 7},7!=""[t](e)})),d=p?!o((function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[c]=function(){return n}),n[h](""),!e})):void 0;if(!p||!d||"replace"===t&&!l||"split"===t&&!f){var v=/./[h],y=n(a,h,""[t],(function(t,e,n,r,i){return e.exec===u?p&&!i?{done:!0,value:v.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}})),g=y[0],m=y[1];r(String.prototype,t,g),i(RegExp.prototype,h,2==e?function(t,e){return m.call(t,this,e)}:function(t){return m.call(t,this)})}}},95660:(t,e,n)=>{"use strict";var r=n(85075);t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},84225:(t,e,n)=>{"use strict";var r=n(63623),i=n(49708),o=n(15263),a=n(21550),s=n(64410)("isConcatSpreadable");t.exports=function t(e,n,u,c,l,f,h,p){for(var d,v,y=l,g=0,m=!!h&&a(h,p,3);g0)y=t(e,n,d,o(d.length),y,f-1)-1;else{if(y>=9007199254740991)throw TypeError();e[y]=d}y++}g++}return y}},74036:(t,e,n)=>{var r=n(21550),i=n(98226),o=n(92193),a=n(85075),s=n(15263),u=n(77521),c={},l={},f=t.exports=function(t,e,n,f,h){var p,d,v,y,g=h?function(){return t}:u(t),m=r(n,f,e?2:1),_=0;if("function"!=typeof g)throw TypeError(t+" is not iterable!");if(o(g)){for(p=s(t.length);p>_;_++)if((y=e?m(a(d=t[_])[0],d[1]):m(t[_]))===c||y===l)return y}else for(v=g.call(t);!(d=v.next()).done;)if((y=i(v,m,d.value,e))===c||y===l)return y};f.BREAK=c,f.RETURN=l},19769:(t,e,n)=>{t.exports=n(47104)("native-function-to-string",Function.toString)},24405:t=>{var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},83050:t=>{var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},74461:(t,e,n)=>{var r=n(24213),i=n(33388);t.exports=n(83144)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},17727:(t,e,n)=>{var r=n(24405).document;t.exports=r&&r.documentElement},80748:(t,e,n)=>{t.exports=!n(83144)&&!n(10496)((function(){return 7!=Object.defineProperty(n(47339)("div"),"a",{get:function(){return 7}}).a}))},77856:(t,e,n)=>{var r=n(49708),i=n(41794).set;t.exports=function(t,e,n){var o,a=e.constructor;return a!==n&&"function"==typeof a&&(o=a.prototype)!==n.prototype&&r(o)&&i&&i(t,o),t}},31671:t=>{t.exports=function(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},75945:(t,e,n)=>{var r=n(42380);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},92193:(t,e,n)=>{var r=n(47985),i=n(64410)("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||o[i]===t)}},63623:(t,e,n)=>{var r=n(42380);t.exports=Array.isArray||function(t){return"Array"==r(t)}},48645:(t,e,n)=>{var r=n(49708),i=Math.floor;t.exports=function(t){return!r(t)&&isFinite(t)&&i(t)===t}},49708:t=>{t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},70939:(t,e,n)=>{var r=n(49708),i=n(42380),o=n(64410)("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[o])?!!e:"RegExp"==i(t))}},98226:(t,e,n)=>{var r=n(85075);t.exports=function(t,e,n,i){try{return i?e(r(n)[0],n[1]):e(n)}catch(e){var o=t.return;throw void 0!==o&&r(o.call(t)),e}}},39614:(t,e,n)=>{"use strict";var r=n(6088),i=n(33388),o=n(25572),a={};n(74461)(a,n(64410)("iterator"),(function(){return this})),t.exports=function(t,e,n){t.prototype=r(a,{next:i(1,n)}),o(t,e+" Iterator")}},15706:(t,e,n)=>{"use strict";var r=n(14925),i=n(61693),o=n(69593),a=n(74461),s=n(47985),u=n(39614),c=n(25572),l=n(88539),f=n(64410)("iterator"),h=!([].keys&&"next"in[].keys()),p="keys",d="values",v=function(){return this};t.exports=function(t,e,n,y,g,m,_){u(n,e,y);var b,w,E,T=function(t){if(!h&&t in O)return O[t];switch(t){case p:case d:return function(){return new n(this,t)}}return function(){return new n(this,t)}},S=e+" Iterator",I=g==d,C=!1,O=t.prototype,k=O[f]||O["@@iterator"]||g&&O[g],x=k||T(g),P=g?I?T("entries"):x:void 0,A="Array"==e&&O.entries||k;if(A&&(E=l(A.call(new t)))!==Object.prototype&&E.next&&(c(E,S,!0),r||"function"==typeof E[f]||a(E,f,v)),I&&k&&k.name!==d&&(C=!0,x=function(){return k.call(this)}),r&&!_||!h&&!C&&O[f]||a(O,f,x),s[e]=x,s[S]=v,g)if(b={values:I?x:T(d),keys:m?x:T(p),entries:P},_)for(w in b)w in O||o(O,w,b[w]);else i(i.P+i.F*(h||C),e,b);return b}},3229:(t,e,n)=>{var r=n(64410)("iterator"),i=!1;try{var o=[7][r]();o.return=function(){i=!0},Array.from(o,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!i)return!1;var n=!1;try{var o=[7],a=o[r]();a.next=function(){return{done:n=!0}},o[r]=function(){return a},t(o)}catch(t){}return n}},34257:t=>{t.exports=function(t,e){return{value:e,done:!!t}}},47985:t=>{t.exports={}},14925:t=>{t.exports=!1},98651:t=>{var e=Math.expm1;t.exports=!e||e(10)>22025.465794806718||e(10)<22025.465794806718||-2e-17!=e(-2e-17)?function(t){return 0==(t=+t)?t:t>-1e-6&&t<1e-6?t+t*t/2:Math.exp(t)-1}:e},88961:(t,e,n)=>{var r=n(19439),i=Math.pow,o=i(2,-52),a=i(2,-23),s=i(2,127)*(2-a),u=i(2,-126);t.exports=Math.fround||function(t){var e,n,i=Math.abs(t),c=r(t);return is||n!=n?c*(1/0):c*n}},18738:t=>{t.exports=Math.log1p||function(t){return(t=+t)>-1e-8&&t<1e-8?t-t*t/2:Math.log(1+t)}},64917:t=>{t.exports=Math.scale||function(t,e,n,r,i){return 0===arguments.length||t!=t||e!=e||n!=n||r!=r||i!=i?NaN:t===1/0||t===-1/0?t:(t-e)*(i-r)/(n-e)+r}},19439:t=>{t.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},18648:(t,e,n)=>{var r=n(7767)("meta"),i=n(49708),o=n(83050),a=n(24213).f,s=0,u=Object.isExtensible||function(){return!0},c=!n(10496)((function(){return u(Object.preventExtensions({}))})),l=function(t){a(t,r,{value:{i:"O"+ ++s,w:{}}})},f=t.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,r)){if(!u(t))return"F";if(!e)return"E";l(t)}return t[r].i},getWeak:function(t,e){if(!o(t,r)){if(!u(t))return!0;if(!e)return!1;l(t)}return t[r].w},onFreeze:function(t){return c&&f.NEED&&u(t)&&!o(t,r)&&l(t),t}}},70380:(t,e,n)=>{var r=n(29164),i=n(61693),o=n(47104)("metadata"),a=o.store||(o.store=new(n(86189))),s=function(t,e,n){var i=a.get(t);if(!i){if(!n)return;a.set(t,i=new r)}var o=i.get(e);if(!o){if(!n)return;i.set(e,o=new r)}return o};t.exports={store:a,map:s,has:function(t,e,n){var r=s(e,n,!1);return void 0!==r&&r.has(t)},get:function(t,e,n){var r=s(e,n,!1);return void 0===r?void 0:r.get(t)},set:function(t,e,n,r){s(n,r,!0).set(t,e)},keys:function(t,e){var n=s(t,e,!1),r=[];return n&&n.forEach((function(t,e){r.push(e)})),r},key:function(t){return void 0===t||"symbol"==typeof t?t:String(t)},exp:function(t){i(i.S,"Reflect",t)}}},32583:(t,e,n)=>{var r=n(24405),i=n(21597).set,o=r.MutationObserver||r.WebKitMutationObserver,a=r.process,s=r.Promise,u="process"==n(42380)(a);t.exports=function(){var t,e,n,c=function(){var r,i;for(u&&(r=a.domain)&&r.exit();t;){i=t.fn,t=t.next;try{i()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(u)n=function(){a.nextTick(c)};else if(!o||r.navigator&&r.navigator.standalone)if(s&&s.resolve){var l=s.resolve(void 0);n=function(){l.then(c)}}else n=function(){i.call(r,c)};else{var f=!0,h=document.createTextNode("");new o(c).observe(h,{characterData:!0}),n=function(){h.data=f=!f}}return function(r){var i={fn:r,next:void 0};e&&(e.next=i),t||(t=i,n()),e=i}}},12219:(t,e,n)=>{"use strict";var r=n(50666);function i(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r})),this.resolve=r(e),this.reject=r(n)}t.exports.f=function(t){return new i(t)}},92075:(t,e,n)=>{"use strict";var r=n(83144),i=n(31126),o=n(68910),a=n(2806),s=n(16040),u=n(75945),c=Object.assign;t.exports=!c||n(10496)((function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!=c({},t)[n]||Object.keys(c({},e)).join("")!=r}))?function(t,e){for(var n=s(t),c=arguments.length,l=1,f=o.f,h=a.f;c>l;)for(var p,d=u(arguments[l++]),v=f?i(d).concat(f(d)):i(d),y=v.length,g=0;y>g;)p=v[g++],r&&!h.call(d,p)||(n[p]=d[p]);return n}:c},6088:(t,e,n)=>{var r=n(85075),i=n(62390),o=n(95985),a=n(81145)("IE_PROTO"),s=function(){},u=function(){var t,e=n(47339)("iframe"),r=o.length;for(e.style.display="none",n(17727).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("