PageSourceSearch

https://unigow-development.web.app/_next/static/chunks/1a193b7d.f2b9976832b6c84ae3cc.js

js unigow-development.web.app collected 2026-10-03 12:39:04 UTC 267,634 bytes, 1 lines download raw bytes

1(window.webpackJsonp_N_E=window.webpackJsonp_N_E||[]).push([[9],{LNIX:function(t,e,n){"use strict";(function(t){n.d(e,"a",(function(){return lc})),n.d(e,"b",(function(){return cc})),n.d(e,"c",(function(){return A})),n.d(e,"d",(function(){return sc})),n.d(e,"e",(function(){return fc})),n.d(e,"f",(function(){return mc})),n.d(e,"g",(function(){return yc})),n.d(e,"h",(function(){return _a})),n.d(e,"i",(function(){return gc})),n.d(e,"j",(function(){return Ic})),n.d(e,"k",(function(){return Ia})),n.d(e,"l",(function(){return Nc})),n.d(e,"m",(function(){return wc})),n.d(e,"n",(function(){return jc})),n.d(e,"o",(function(){return Ec})),n.d(e,"p",(function(){return hc})),n.d(e,"q",(function(){return Ps})),n.d(e,"r",(function(){return J})),n.d(e,"s",(function(){return uc})),n.d(e,"t",(function(){return Oc}));var r=n("q/0M"),i=n("qOnz"),o=n("x7I3"),u=n("mrSG"),s=new r.b("@firebase/firestore");function a(){return s.logLevel}function c(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(s.logLevel<=r.a.DEBUG){var i=e.map(l);s.debug.apply(s,Object(u.g)(["Firestore (8.2.0): "+t],i))}}function f(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(s.logLevel<=r.a.ERROR){var i=e.map(l);s.error.apply(s,Object(u.g)(["Firestore (8.2.0): "+t],i))}}function h(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(s.logLevel<=r.a.WARN){var i=e.map(l);s.warn.apply(s,Object(u.g)(["Firestore (8.2.0): "+t],i))}}function l(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}var e}function p(t){void 0===t&&(t="Unexpected state");var e="FIRESTORE (8.2.0) INTERNAL ASSERTION FAILED: "+t;throw f(e),new Error(e)}function d(t,e){t||p()}function v(t,e){return t}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;r<t;r++)n[r]=Math.floor(256*Math.random());return n}var m=function(){function t(){}return t.t=function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length,n="";n.length<20;)for(var r=y(40),i=0;i<r.length;++i)n.length<20&&r[i]<e&&(n+=t.charAt(r[i]%t.length));return n},t}();function g(t,e){return t<e?-1:t>e?1:0}function b(t,e,n){return t.length===e.length&&t.every((function(t,r){return n(t,e[r])}))}function w(t){return t+"\0"}var I=function(){function t(t){this.i=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<t.length;++n)e+=String.fromCharCode(t[n]);return e}(e))},t.prototype.toBase64=function(){return t=this.i,btoa(t);var t},t.prototype.toUint8Array=function(){return function(t){for(var e=new Uint8Array(t.length),n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}(this.i)},t.prototype.o=function(){return 2*this.i.length},t.prototype.u=function(t){return g(this.i,t.i)},t.prototype.isEqual=function(t){return this.i===t.i},t}();I.h=new I("");var _={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"},E=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 Object(u.c)(e,t),e}(Error),O=function(){function t(t){this.l=t}return t.fromBase64String=function(e){try{return new t(I.fromBase64String(e))}catch(e){throw new E(_.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}},t.fromUint8Array=function(e){return new t(I.fromUint8Array(e))},t.prototype.toBase64=function(){return this.l.toBase64()},t.prototype.toUint8Array=function(){return this.l.toUint8Array()},t.prototype.toString=function(){return"Bytes(base64: "+this.toBase64()+")"},t.prototype.isEqual=function(t){return this.l.isEqual(t.l)},t}(),T=function(t){this._=t};function N(){if("undefined"==typeof Uint8Array)throw new E(_.UNIMPLEMENT
1ED,"Uint8Arrays are not available in this environment.")}function j(){if("undefined"==typeof atob)throw new E(_.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var A=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(u.c)(e,t),e.fromBase64String=function(t){return j(),new e(O.fromBase64String(t))},e.fromUint8Array=function(t){return N(),new e(O.fromUint8Array(t))},e.prototype.toBase64=function(){return j(),this._.toBase64()},e.prototype.toUint8Array=function(){return N(),this._.toUint8Array()},e.prototype.isEqual=function(t){return this._.isEqual(t._)},e.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},e}(T),D=function(){function t(t){this.uid=t}return t.prototype.T=function(){return null!=this.uid},t.prototype.I=function(){return this.T()?"uid:"+this.uid:"anonymous-user"},t.prototype.isEqual=function(t){return t.uid===this.uid},t}();D.UNAUTHENTICATED=new D(null),D.m=new D("google-credentials-uid"),D.A=new D("first-party-uid");var k=function(t,e){this.user=e,this.type="OAuth",this.R={},this.R.Authorization="Bearer "+t},S=function(){function t(){this.P=null}return t.prototype.getToken=function(){return Promise.resolve(null)},t.prototype.g=function(){},t.prototype.V=function(t){this.P=t,t(D.UNAUTHENTICATED)},t.prototype.p=function(){this.P=null},t}(),x=function(){function t(t){var e=this;this.v=null,this.currentUser=D.UNAUTHENTICATED,this.S=!1,this.D=0,this.P=null,this.forceRefresh=!1,this.v=function(){e.D++,e.currentUser=e.C(),e.S=!0,e.P&&e.P(e.currentUser)},this.D=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.v):(this.v(null),t.get().then((function(t){e.auth=t,e.v&&e.auth.addAuthTokenListener(e.v)}),(function(){})))}return t.prototype.getToken=function(){var t=this,e=this.D,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then((function(n){return t.D!==e?(c("FirebaseCredentialsProvider","getToken aborted due to token change."),t.getToken()):n?(d("string"==typeof n.accessToken),new k(n.accessToken,t.currentUser)):null})):Promise.resolve(null)},t.prototype.g=function(){this.forceRefresh=!0},t.prototype.V=function(t){this.P=t,this.S&&t(this.currentUser)},t.prototype.p=function(){this.auth&&this.auth.removeAuthTokenListener(this.v),this.v=null,this.P=null},t.prototype.C=function(){var t=this.auth&&this.auth.getUid();return d(null===t||"string"==typeof t),new D(t)},t}(),P=function(){function t(t,e){this.N=t,this.F=e,this.type="FirstParty",this.user=D.A}return Object.defineProperty(t.prototype,"R",{get:function(){var t={"X-Goog-AuthUser":this.F},e=this.N.auth.getAuthHeaderValueForFirstParty([]);return e&&(t.Authorization=e),t},enumerable:!1,configurable:!0}),t}(),R=function(){function t(t,e){this.N=t,this.F=e}return t.prototype.getToken=function(){return Promise.resolve(new P(this.N,this.F))},t.prototype.V=function(t){t(D.A)},t.prototype.p=function(){},t.prototype.g=function(){},t}(),L=function(t,e,n,r,i,o){this.O=t,this.persistenceKey=e,this.host=n,this.ssl=r,this.forceLongPolling=i,this.k=o},U=function(){function t(t,e){this.projectId=t,this.database=e||"(default)"}return Object.defineProperty(t.prototype,"M",{get:function(){return"(default)"===this.database},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(e){return e instanceof t&&e.projectId===this.projectId&&e.database===this.database},t}(),C=function(){function t(){}return t.prototype.L=function(t){},t.prototype.$=function(){},t}(),V=function(){function t(){var t=this;this.B=function(){return t.q()},this.U=function(){return t.K()},this.W=[],this.j()}return t.prototype.L=function(t){this.W.push(t)},t.prototype.$=function(){window.removeEventListener("online",this.B),window.removeEventListener("offline",this.U)},t.prototype.j=function(){window.addEventListener("online",this.B),window.addEventListener("offline",this.U)},t.prototype.q=function(){c("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.W;t<e.length;t++)(0,e[t])(0)},t.prototype.K=function(){c("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(var t=0,e=this.W;t<e.length;t++)(0,e[t])(1)},t.G=function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener},t}();function M(t){return null==t}function q(t){return 0===t&&1/t==-1/0}function F(t){return"number"==typeof t&&Number.isInteger(t)&&!q(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}var B,G,z={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery"};function K(t){switch(t){case _.OK:return p();case _.CANCELLED:case _.UNKNOWN:case _.DEADLINE_EXCEEDED:case _.RESOURCE_EXHAUSTED:case _.INTERNAL:case _.UNAVAILABLE:case _.UNAUTHENTICATED:return!1;case _.INVALID_ARGUMENT:case _.NOT_FOUND:case _.ALREADY_EXISTS:case _.PERMISSION_DENIED:case _.FAILED_PRECONDITION:case _.ABORTED:case _.OUT_OF_RANGE:case _.UNIMPLEMENT
1ED:case _.DATA_LOSS:return!0;default:return p()}}function Q(t){if(void 0===t)return f("GRPC error has no .code"),_.UNKNOWN;switch(t){case B.OK:return _.OK;case B.CANCELLED:return _.CANCELLED;case B.UNKNOWN:return _.UNKNOWN;case B.DEADLINE_EXCEEDED:return _.DEADLINE_EXCEEDED;case B.RESOURCE_EXHAUSTED:return _.RESOURCE_EXHAUSTED;case B.INTERNAL:return _.INTERNAL;case B.UNAVAILABLE:return _.UNAVAILABLE;case B.UNAUTHENTICATED:return _.UNAUTHENTICATED;case B.INVALID_ARGUMENT:return _.INVALID_ARGUMENT;case B.NOT_FOUND:return _.NOT_FOUND;case B.ALREADY_EXISTS:return _.ALREADY_EXISTS;case B.PERMISSION_DENIED:return _.PERMISSION_DENIED;case B.FAILED_PRECONDITION:return _.FAILED_PRECONDITION;case B.ABORTED:return _.ABORTED;case B.OUT_OF_RANGE:return _.OUT_OF_RANGE;case B.UNIMPLEMENTED:return _.UNIMPLEMENTED;case B.DATA_LOSS:return _.DATA_LOSS;default:return p()}}(G=B||(B={}))[G.OK=0]="OK",G[G.CANCELLED=1]="CANCELLED",G[G.UNKNOWN=2]="UNKNOWN",G[G.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",G[G.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",G[G.NOT_FOUND=5]="NOT_FOUND",G[G.ALREADY_EXISTS=6]="ALREADY_EXISTS",G[G.PERMISSION_DENIED=7]="PERMISSION_DENIED",G[G.UNAUTHENTICATED=16]="UNAUTHENTICATED",G[G.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",G[G.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",G[G.ABORTED=10]="ABORTED",G[G.OUT_OF_RANGE=11]="OUT_OF_RANGE",G[G.UNIMPLEMENTED=12]="UNIMPLEMENTED",G[G.INTERNAL=13]="INTERNAL",G[G.UNAVAILABLE=14]="UNAVAILABLE",G[G.DATA_LOSS=15]="DATA_LOSS";var W=function(){function t(t){this.H=t.H,this.J=t.J}return t.prototype.Y=function(t){this.X=t},t.prototype.Z=function(t){this.tt=t},t.prototype.onMessage=function(t){this.et=t},t.prototype.close=function(){this.J()},t.prototype.send=function(t){this.H(t)},t.prototype.nt=function(){this.X()},t.prototype.st=function(t){this.tt(t)},t.prototype.it=function(t){this.et(t)},t}(),H=function(){var t=this;this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))},Y=function(t){function e(e){var n=this;return(n=t.call(this,e)||this).forceLongPolling=e.forceLongPolling,n.k=e.k,n}return Object(u.c)(e,t),e.prototype.lt=function(t,e,n,r){return new Promise((function(i,u){var s=new o.f;s.listenOnce(o.c.COMPLETE,(function(){try{switch(s.getLastErrorCode()){case o.a.NO_ERROR:var e=s.getResponseJson();c("Connection","XHR received:",JSON.stringify(e)),i(e);break;case o.a.TIMEOUT:c("Connection",'RPC "'+t+'" timed out'),u(new E(_.DEADLINE_EXCEEDED,"Request time out"));break;case o.a.HTTP_ERROR:var n=s.getStatus();if(c("Connection",'RPC "'+t+'" failed with status:',n,"response text:",s.getResponseText()),n>0){var r=s.getResponseJson().error;if(r&&r.status&&r.message){var a=function(t){var e=t.toLowerCase().replace(/_/g,"-");return Object.values(_).indexOf(e)>=0?e:_.UNKNOWN}(r.status);u(new E(a,r.message))}else u(new E(_.UNKNOWN,"Server responded with status "+s.getStatus()))}else u(new E(_.UNAVAILABLE,"Connection failed."));break;default:p()}}finally{c("Connection",'RPC "'+t+'" completed.')}}));var a=JSON.stringify(r);s.send(e,"POST",a,n,15)}))},e.prototype.ft=function(t,e){var n=[this.ot,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=Object(o.g)(),u=Object(o.h)(),s={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.O.projectId+"/databases/"+this.O.database},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.k};this.ht(s.initMessageHeaders,e),Object(i.x)()||Object(i.A)()||Object(i.t)()||Object(i.v)()||Object(i.B)()||Object(i.s)()||(s.httpHeadersOverwriteParam="$httpHeaders");var a=n.join("");c("Connection","Creating WebChannel: "+a,s);var f=r.createWebChannel(a,s),l=!1,p=!1,v=new W({H:function(t){p?c("Connection","Not sending because WebChannel is closed:",t):(l||(c("Connection","Opening WebChannel transport."),f.open(),l=!0),c("Connection","WebChannel sending:",t),f.send(t))},J:function(){return f.close()}}),y=function(t,e,n){t.listen(e,(function(t){try{n(t)}catch(t){setTimeout((function(){throw t}),0)}}))};return y(f,o.e.EventType.OPEN,(function(){p||c("Connection","WebChannel transport opened.")})),y(f,o.e.EventType.CLOSE,(function(){p||(p=!0,c("Connection","WebChannel transport closed"),v.st())}
1)),y(f,o.e.EventType.ERROR,(function(t){p||(p=!0,h("Connection","WebChannel transport errored:",t),v.st(new E(_.UNAVAILABLE,"The operation could not be completed")))})),y(f,o.e.EventType.MESSAGE,(function(t){var e;if(!p){var n=t.data[0];d(!!n);var r=n,i=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(i){c("Connection","WebChannel received error:",i);var o=i.status,u=function(t){var e=B[t];if(void 0!==e)return Q(e)}(o),s=i.message;void 0===u&&(u=_.INTERNAL,s="Unknown error status: "+o+" with message "+i.message),p=!0,v.st(new E(u,s)),f.close()}else c("Connection","WebChannel received:",n),v.it(n)}})),y(u,o.b.STAT_EVENT,(function(t){t.stat===o.d.PROXY?c("Connection","Detected buffering proxy"):t.stat===o.d.NOPROXY&&c("Connection","Detected no buffering proxy")})),setTimeout((function(){v.nt()}),0),v},e}(function(){function t(t){this.rt=t,this.O=t.O;var e=t.ssl?"https":"http";this.ot=e+"://"+t.host,this.ct="projects/"+this.O.projectId+"/databases/"+this.O.database+"/documents"}return t.prototype.at=function(t,e,n,r){var i=this.ut(t,e);c("RestConnection","Sending: ",i,n);var o={};return this.ht(o,r),this.lt(t,i,o,n).then((function(t){return c("RestConnection","Received: ",t),t}),(function(e){throw h("RestConnection",t+" failed with error: ",e,"url: ",i,"request:",n),e}))},t.prototype._t=function(t,e,n,r){return this.at(t,e,n,r)},t.prototype.ht=function(t,e){if(t["X-Goog-Api-Client"]="gl-js/ fire/8.2.0",t["Content-Type"]="text/plain",e)for(var n in e.R)e.R.hasOwnProperty(n)&&(t[n]=e.R[n])},t.prototype.ut=function(t,e){var n=z[t];return this.ot+"/v1/"+e+":"+n},t}()),J=function(){function t(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new E(_.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new E(_.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new E(_.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new E(_.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.dt=function(t){return this.seconds===t.seconds?g(this.nanoseconds,t.nanoseconds):g(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}(),$=function(){function t(t){this.timestamp=t}return t.wt=function(e){return new t(e)},t.min=function(){return new t(new J(0,0))},t.prototype.u=function(t){return this.timestamp.dt(t.timestamp)},t.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},t.prototype.Et=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},t.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},t.prototype.Tt=function(){return this.timestamp},t}(),X=function(){function t(t,e,n){void 0===e?e=0:e>t.length&&p(),void 0===n?n=t.length-e:n>t.length-e&&p(),this.segments=t,this.offset=e,this.It=n}return Object.defineProperty(t.prototype,"length",{get:function(){return this.It},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(e){return 0===t.At(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.Rt(n)},t.prototype.limit=function(){return this.offset+this.length},t.prototype.Pt=function(t){return t=void 0===t?1:t,this.Rt(this.segments,this.offset+t,this.length-t)},t.prototype.yt=function(){return this.Rt(this.segments,this.offset,this.length-1)},t.prototype.gt=function(){return this.segments[this.offset]},t.prototype.Vt=function(){return this.get(this.length-1)},t.prototype.get=function(t){return this.segments[this.offset+t]},t.prototype.bt=function(){return 0===this.length},t.prototype.vt=function(t){if(t.length<this.length)return!1;for(var e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0},t.prototype.St=function(t){if(this.length+1!==t.length)return!1;for(var e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0},t.prototype.forEach=function(t){for(var e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])},t.prototype.Dt=function(){return this.segments.slice(this.offset,this.limit())},t.At=function(t,e){for(var n=Math.min(t.length,e.length),r=0;r<n;r++){var i=t.get(r),o=e.get(r);if(i<o)return-1;if(i>o)return 1}return t.length<e.length?-1:t.length>e.length?1:0},t}(),Z=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(u.c)(e,t),e.prototype.Rt=function(t,n,r){return new e(t,n,r)},e.prototype.Ct=function(){return this.Dt().join("/")},e.prototype.toString=function(){return this.Ct()},e.xt=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=[],i=0,o=t;i<o.length;i++){var u=o[i];if(u.indexOf("//")>
1=0)throw new E(_.INVALID_ARGUMENT,"Invalid segment ("+u+"). Paths must not contain // in them.");r.push.apply(r,u.split("/").filter((function(t){return t.length>0})))}return new e(r)},e.Nt=function(){return new e([])},e}(X),tt=/^[_a-zA-Z][_a-zA-Z0-9]*$/,et=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(u.c)(e,t),e.prototype.Rt=function(t,n,r){return new e(t,n,r)},e.Ft=function(t){return tt.test(t)},e.prototype.Ct=function(){return this.Dt().map((function(t){return t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),e.Ft(t)||(t="`"+t+"`"),t})).join(".")},e.prototype.toString=function(){return this.Ct()},e.prototype.Ot=function(){return 1===this.length&&"__name__"===this.get(0)},e.kt=function(){return new e(["__name__"])},e.Mt=function(t){for(var n=[],r="",i=0,o=function(){if(0===r.length)throw new E(_.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");n.push(r),r=""},u=!1;i<t.length;){var s=t[i];if("\\"===s){if(i+1===t.length)throw new E(_.INVALID_ARGUMENT,"Path has trailing escape character: "+t);var a=t[i+1];if("\\"!==a&&"."!==a&&"`"!==a)throw new E(_.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);r+=a,i+=2}else"`"===s?(u=!u,i++):"."!==s||u?(r+=s,i++):(o(),i++)}if(o(),u)throw new E(_.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new e(n)},e.Nt=function(){return new e([])},e}(X),nt=function(){function t(t){this.path=t}return t.Lt=function(e){return new t(Z.xt(e))},t.$t=function(e){return new t(Z.xt(e).Pt(5))},t.prototype.Bt=function(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t},t.prototype.isEqual=function(t){return null!==t&&0===Z.At(this.path,t.path)},t.prototype.toString=function(){return this.path.toString()},t.At=function(t,e){return Z.At(t.path,e.path)},t.qt=function(t){return t.length%2==0},t.Ut=function(e){return new t(new Z(e.slice()))},t}();function rt(t){var e=0;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function it(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function ot(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}var ut=function(){function t(t){this.fields=t,t.sort(et.At)}return t.prototype.Qt=function(t){for(var e=0,n=this.fields;e<n.length;e++)if(n[e].vt(t))return!0;return!1},t.prototype.isEqual=function(t){return b(this.fields,t.fields,(function(t,e){return t.isEqual(e)}))},t}(),st=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function at(t){if(d(!!t),"string"==typeof t){var e=0,n=st.exec(t);if(d(!!n),n[1]){var r=n[1];r=(r+"000000000").substr(0,9),e=Number(r)}var i=new Date(t);return{seconds:Math.floor(i.getTime()/1e3),nanos:e}}return{seconds:ct(t.seconds),nanos:ct(t.nanos)}}function ct(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function ft(t){return"string"==typeof t?I.fromBase64String(t):I.fromUint8Array(t)}function ht(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 lt(t){var e=at(t.mapValue.fields.__local_write_time__.timestampValue);return new J(e.seconds,e.nanos)}function pt(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?ht(t)?4:10:p()}function dt(t,e){var n=pt(t);if(n!==pt(e))return!1;switch(n){case 0:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return lt(t).isEqual(lt(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=at(t.timestampValue),r=at(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 ft(t.bytesValue).isEqual(ft(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return ct(t.geoPointValue.latitude)===ct(e.geoPointValue.latitude)&&ct(t.geoPointValue.longitude)===ct(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return ct(t.integerValue)===ct(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){var n=ct(t.doubleValue),r=ct(e.doubleValue);return n===r?q(n)===q(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return b(t.arrayValue.values||[],e.arrayValue.values||[],dt);case 10:return function(t,e){var n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(rt(n)!==rt(r))return!1;for(var i in n)if(n.hasOwnProperty(i)&&(void 0===r[i]||!dt(n[i],r[i])))return!1;return!0}(t,e);default:return p()}}function vt(t,e){return void 0!==(t.values||[]).find((function(t){return dt(t,e)}))}function yt(t,e){var n=pt(t),r=pt(e);
1if(n!==r)return g(n,r);switch(n){case 0:return 0;case 1:return g(t.booleanValue,e.booleanValue);case 2:return function(t,e){var n=ct(t.integerValue||t.doubleValue),r=ct(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return mt(t.timestampValue,e.timestampValue);case 4:return mt(lt(t),lt(e));case 5:return g(t.stringValue,e.stringValue);case 6:return function(t,e){var n=ft(t),r=ft(e);return n.u(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){for(var n=t.split("/"),r=e.split("/"),i=0;i<n.length&&i<r.length;i++){var o=g(n[i],r[i]);if(0!==o)return o}return g(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){var n=g(ct(t.latitude),ct(e.latitude));return 0!==n?n:g(ct(t.longitude),ct(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){for(var n=t.values||[],r=e.values||[],i=0;i<n.length&&i<r.length;++i){var o=yt(n[i],r[i]);if(o)return o}return g(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){var n=t.fields||{},r=Object.keys(n),i=e.fields||{},o=Object.keys(i);r.sort(),o.sort();for(var u=0;u<r.length&&u<o.length;++u){var s=g(r[u],o[u]);if(0!==s)return s;var a=yt(n[r[u]],i[o[u]]);if(0!==a)return a}return g(r.length,o.length)}(t.mapValue,e.mapValue);default:throw p()}}function mt(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return g(t,e);var n=at(t),r=at(e),i=g(n.seconds,r.seconds);return 0!==i?i:g(n.nanos,r.nanos)}function gt(t){return function t(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(t){var e=at(t);return"time("+e.seconds+","+e.nanos+")"}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?ft(e.bytesValue).toBase64():"referenceValue"in e?(r=e.referenceValue,nt.$t(r).toString()):"geoPointValue"in e?"geo("+(n=e.geoPointValue).latitude+","+n.longitude+")":"arrayValue"in e?function(e){for(var n="[",r=!0,i=0,o=e.values||[];i<o.length;i++)r?r=!1:n+=",",n+=t(o[i]);return n+"]"}(e.arrayValue):"mapValue"in e?function(e){for(var n="{",r=!0,i=0,o=Object.keys(e.fields||{}).sort();i<o.length;i++){var u=o[i];r?r=!1:n+=",",n+=u+":"+t(e.fields[u])}return n+"}"}(e.mapValue):p();var n,r}(t)}function bt(t,e){return{referenceValue:"projects/"+t.projectId+"/databases/"+t.database+"/documents/"+e.path.Ct()}}function wt(t){return!!t&&"integerValue"in t}function It(t){return!!t&&"arrayValue"in t}function _t(t){return!!t&&"nullValue"in t}function Et(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Ot(t){return!!t&&"mapValue"in t}var Tt=function(){function t(t){this.proto=t}return t.empty=function(){return new t({mapValue:{}})},t.prototype.field=function(t){if(t.bt())return this.proto;for(var e=this.proto,n=0;n<t.length-1;++n){if(!e.mapValue.fields)return null;if(!Ot(e=e.mapValue.fields[t.get(n)]))return null}return(e=(e.mapValue.fields||{})[t.Vt()])||null},t.prototype.isEqual=function(t){return dt(this.proto,t.proto)},t}(),Nt=function(){function t(t){void 0===t&&(t=Tt.empty()),this.Kt=t,this.Wt=new Map}return t.prototype.set=function(t,e){return this.jt(t,e),this},t.prototype.delete=function(t){return this.jt(t,null),this},t.prototype.jt=function(t,e){for(var n=this.Wt,r=0;r<t.length-1;++r){var i=t.get(r),o=n.get(i);o instanceof Map?n=o:o&&10===pt(o)?(o=new Map(Object.entries(o.mapValue.fields||{})),n.set(i,o),n=o):(o=new Map,n.set(i,o),n=o)}n.set(t.Vt(),e)},t.prototype.Gt=function(){var t=this.zt(et.Nt(),this.Wt);return null!=t?new Tt(t):this.Kt},t.prototype.zt=function(t,e){var n=this,r=!1,i=this.Kt.field(t),o=Ot(i)?Object.assign({},i.mapValue.fields):{};return e.forEach((function(e,i){if(e instanceof Map){var u=n.zt(t.child(i),e);null!=u&&(o[i]=u,r=!0)}else null!==e?(o[i]=e,r=!0):o.hasOwnProperty(i)&&(delete o[i],r=!0)})),r?{mapValue:{fields:o}}:null},t}();function jt(t){var e=[];return it(t.fields||{},(function(t,n){var r=new et([t]);if(Ot(n)){var i=jt(n.mapValue).fields;if(0===i.length)e.push(r);else for(var o=0,u=i;o<u.length;o++){var s=u[o];e.push(r.child(s))}}else e.push(r)})),new ut(e)}var At=function(t,e){this.key=t,this.version=e},Dt=function(t){function e(e,n,r,i){var o=this;return(o=t.call(this,e,n)||this).Ht=r,o.Jt=!!i.Jt,o.hasCommittedMutations=!!i.hasCommittedMutations,o}return Object(u.c)(e,t),e.prototype.field=function(t){return this.Ht.field(t)},e.prototype.data=function(){return this.Ht},e.prototype.Yt=function(){return this.Ht.proto},e.prototype.isEqual=function(t){return t instanceof e&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.Jt===t.Jt&&this.hasCommittedMutations===t.hasCommittedMutations&&this.Ht.isEqual(t.Ht)},e.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+this.Ht.toString()+", {hasLocalMutations: "+this.Jt+"}), {hasCommittedMutations: "+this.hasCommittedMutations+"})"},Object.defineProperty(e.prototype,"hasPendingWrites",{get:function(){return this.Jt||this.hasCommittedMutations}
1,enumerable:!1,configurable:!0}),e}(At),kt=function(t){function e(e,n,r){var i=this;return(i=t.call(this,e,n)||this).hasCommittedMutations=!(!r||!r.hasCommittedMutations),i}return Object(u.c)(e,t),e.prototype.toString=function(){return"NoDocument("+this.key+", "+this.version+")"},Object.defineProperty(e.prototype,"hasPendingWrites",{get:function(){return this.hasCommittedMutations},enumerable:!1,configurable:!0}),e.prototype.isEqual=function(t){return t instanceof e&&t.hasCommittedMutations===this.hasCommittedMutations&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},e}(At),St=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(u.c)(e,t),e.prototype.toString=function(){return"UnknownDocument("+this.key+", "+this.version+")"},Object.defineProperty(e.prototype,"hasPendingWrites",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.isEqual=function(t){return t instanceof e&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},e}(At),xt=function(t,e,n,r,i,o,u){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===u&&(u=null),this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=o,this.endAt=u,this.Xt=null};function Pt(t,e,n,r,i,o,u){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===u&&(u=null),new xt(t,e,n,r,i,o,u)}function Rt(t){var e=v(t);if(null===e.Xt){var n=e.path.Ct();null!==e.collectionGroup&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map((function(t){return function(t){return t.field.Ct()+t.op.toString()+gt(t.value)}(t)})).join(","),n+="|ob:",n+=e.orderBy.map((function(t){return function(t){return t.field.Ct()+t.dir}(t)})).join(","),M(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=Wt(e.startAt)),e.endAt&&(n+="|ub:",n+=Wt(e.endAt)),e.Xt=n}return e.Xt}function Lt(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(var n=0;n<t.orderBy.length;n++)if(!Yt(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(var r=0;r<t.filters.length;r++)if(i=t.filters[r],o=e.filters[r],i.op!==o.op||!i.field.isEqual(o.field)||!dt(i.value,o.value))return!1;var i,o;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!$t(t.startAt,e.startAt)&&$t(t.endAt,e.endAt)}function Ut(t){return nt.qt(t.path)&&null===t.collectionGroup&&0===t.filters.length}var Ct=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).field=e,i.op=n,i.value=r,i}return Object(u.c)(e,t),e.create=function(t,n,r){return t.Ot()?"in"===n||"not-in"===n?this.Zt(t,n,r):new Vt(t,n,r):"array-contains"===n?new Bt(t,r):"in"===n?new Gt(t,r):"not-in"===n?new zt(t,r):"array-contains-any"===n?new Kt(t,r):new e(t,n,r)},e.Zt=function(t,e,n){return"in"===e?new Mt(t,n):new qt(t,n)},e.prototype.matches=function(t){var e=t.field(this.field);return"!="===this.op?null!==e&&this.te(yt(e,this.value)):null!==e&&pt(this.value)===pt(e)&&this.te(yt(e,this.value))},e.prototype.te=function(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return p()}},e.prototype.ee=function(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0},e}((function(){})),Vt=function(t){function e(e,n,r){var i=this;return(i=t.call(this,e,n,r)||this).key=nt.$t(r.referenceValue),i}return Object(u.c)(e,t),e.prototype.matches=function(t){var e=nt.At(t.key,this.key);return this.te(e)},e}(Ct),Mt=function(t){function e(e,n){var r=this;return(r=t.call(this,e,"in",n)||this).keys=Ft("in",n),r}return Object(u.c)(e,t),e.prototype.matches=function(t){return this.keys.some((function(e){return e.isEqual(t.key)}))},e}(Ct),qt=function(t){function e(e,n){var r=this;return(r=t.call(this,e,"not-in",n)||this).keys=Ft("not-in",n),r}return Object(u.c)(e,t),e.prototype.matches=function(t){return!this.keys.some((function(e){return e.isEqual(t.key)}))},e}(Ct);function Ft(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((function(t){return nt.$t(t.referenceValue)}))}var Bt=function(t){function e(e,n){return t.call(this,e,"array-contains",n)||this}return Object(u.c)(e,t),e.prototype.matches=function(t){var e=t.field(this.field);return It(e)&&vt(e.arrayValue,this.value)},e}(Ct),Gt=function(t){function e(e,n){return t.call(this,e,"in",n)||this}return Object(u.c)(e,t),e.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&vt(this.value.arrayValue,e)},e}(Ct),zt=function(t){function e(e,n){return t.call(this,e,"not-in",n)||this}return Object(u.c)(e,t),e.prototype.matches=function(t){if(vt(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;var e=t.field(this.field);return null!==e&&!vt(this.value.arrayValue,e)},e}(Ct),Kt=function(t){function e(e,n){return t.call(this,e,"array-contains-any",n)||this}return Object(u.c)(e,t),e.prototype.matches=function(t){var e=this,n=t.field(this.field);return!(!It(n)||!n.arrayValue.values)&&n.arrayValue.values.some((function(t){return vt(e.value.arrayValue,t)}))},e}(Ct),Qt=function(t,e){this.position=t,this.before=e};function Wt(t){return(t.before?"b":"a")+":"+t.position.map((function(t){return gt(t)})).join(",")}var Ht=function(t,e){void 0===e&&(e="asc"),this.field=t,this.dir=e};function Yt(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}function Jt(t,e,n){for(var r=0,i=0;i<t.position.length;i++){var o=e[i],u=t.position[i];if(r=o.field.Ot()?nt.At(nt.$t(u.referenceValue),n.key):yt(u,n.field(o.field)),"desc"===o.dir&&(r*=-1),0!==r)break}return t.before?r<=0:r<0}function $t(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.before!==e.before||t.position.length!==e.position.length)return!1;for(var n=0;n<t.position.length;n++)if(!dt(t.position[n],e.position[n]))return!1;return!0}var Xt=function(t,e,n,r,i,o,u,s){void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o="F"),void 0===u&&(u=null),void 0===s&&(s=null),this.path=t,this.collectionGroup=e,this.ne=n,this.filters=r,this.limit=i,this.limitType=o,this.startAt=u,this.endAt=s,this.se=null,this.ie=null,this.startAt,this.endAt};function Zt(t,e,n,r,i,o,u,s){return new Xt(t,e,n,r,i,o,u,s)}function te(t){return new Xt(t)}function ee(t){return!M(t.limit)&&"F"===t.limitType}function ne(t){return!M(t.limit)&&"L"===t.limitType}function re(t){return t.ne.length>0?t.ne[0].field:null}function ie(t){for(var e=0,n=t.filters;e<n.length;e++){var r=n[e];if(r.ee())return r.field}return null}function oe(t){return null!==t.collectionGroup}function ue(t){var e=v(t);if(null===e.se){e.se=[];var n=ie(e),r=re(e);if(null!==n&&null===r)n.Ot()||e.se.push(new Ht(n)),e.se.push(new Ht(et.kt(),"asc"));else{for(var i=!1,o=0,u=e.ne;o<u.length;o++){var s=u[o];e.se.push(s),s.field.Ot()&&(i=!0)}if(!i){var a=e.ne.length>0?e.ne[e.ne.length-1].dir:"asc";e.se.push(new Ht(et.kt(),a))}}}return e.se}function se(t){var e=v(t);if(!e.ie)if("F"===e.limitType)e.ie=Pt(e.path,e.collectionGroup,ue(e),e.filters,e.limit,e.startAt,e.endAt);else{for(var n=[],r=0,i=ue(e);r<i.length;r++){var o=i[r],u="desc"===o.dir?"asc":"desc";n.push(new Ht(o.field,u))}var s=e.endAt?new Qt(e.endAt.position,!e.endAt.before):null,a=e.startAt?new Qt(e.startAt.position,!e.startAt.before):null;e.ie=Pt(e.path,e.collectionGroup,n,e.filters,e.limit,s,a)}return e.ie}function ae(t,e,n){return new Xt(t.path,t.collectionGroup,t.ne.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function ce(t,e){return Lt(se(t),se(e))&&t.limitType===e.limitType}function fe(t){return Rt(se(t))+"|lt:"+t.limitType}function he(t){return"Query(target="+function(t){var e=t.path.Ct();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=", filters: ["+t.filters.map((function(t){return(e=t).field.Ct()+" "+e.op+" "+gt(e.value);var e})).join(", ")+"]"),M(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=", orderBy: ["+t.orderBy.map((function(t){return function(t){return t.field.Ct()+" ("+t.dir+")"}(t)})).join(", ")+"]"),t.startAt&&(e+=", startAt: "+Wt(t.startAt)),t.endAt&&(e+=", endAt: "+Wt(t.endAt)),"Target("+e+")"}(se(t))+"; limitType="+t.limitType+")"}function le(t,e){return function(t,e){var n=e.key.path;return null!==t.collectionGroup?e.key.Bt(t.collectionGroup)&&t.path.vt(n):nt.qt(t.path)?t.path.isEqual(n):t.path.St(n)}(t,e)&&function(t,e){for(var n=0,r=t.ne;n<r.length;n++){var i=r[n];if(!i.field.Ot()&&null===e.field(i.field))return!1}return!0}(t,e)&&function(t,e){for(var n=0,r=t.filters;n<r.length;n++)if(!r[n].matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!Jt(t.startAt,ue(t),e))&&(!t.endAt||!Jt(t.endAt,ue(t),e))}(t,e)}function pe(t){return function(e,n){for(var r=!1,i=0,o=ue(t);i<o.length;i++){var u=o[i],s=de(u,e,n);if(0!==s)return s;r=r||u.field.Ot()}return 0}}function de(t,e,n){var r=t.field.Ot()?nt.At(e.key,n.key):function(t,e,n){var r=e.field(t),i=n.field(t);return null!==r&&null!==i?yt(r,i):p()}
1(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return p()}}var ve=function(){function t(t,e,n,r,i,o,u){void 0===i&&(i=$.min()),void 0===o&&(o=$.min()),void 0===u&&(u=I.h),this.target=t,this.targetId=e,this.re=n,this.sequenceNumber=r,this.oe=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=u}return t.prototype.ce=function(e){return new t(this.target,this.targetId,this.re,e,this.oe,this.lastLimboFreeSnapshotVersion,this.resumeToken)},t.prototype.ae=function(e,n){return new t(this.target,this.targetId,this.re,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e)},t.prototype.ue=function(e){return new t(this.target,this.targetId,this.re,this.sequenceNumber,this.oe,e,this.resumeToken)},t}();function ye(t,e){if(t.he){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:q(e)?"-0":e}}function me(t){return{integerValue:""+t}}function ge(t,e){return F(e)?me(e):ye(t,e)}var be=function(){this.le=void 0};function we(t,e,n){return t instanceof Ee?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 Oe?Te(t,e):t instanceof Ne?je(t,e):function(t,e){var n=_e(t,e),r=De(n)+De(t._e);return wt(n)&&wt(t._e)?me(r):ye(t.fe,r)}(t,e)}function Ie(t,e,n){return t instanceof Oe?Te(t,e):t instanceof Ne?je(t,e):n}function _e(t,e){return t instanceof Ae?wt(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}var Ee=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(u.c)(e,t),e}(be),Oe=function(t){function e(e){var n=this;return(n=t.call(this)||this).elements=e,n}return Object(u.c)(e,t),e}(be);function Te(t,e){for(var n=ke(e),r=function(t){n.some((function(e){return dt(e,t)}))||n.push(t)},i=0,o=t.elements;i<o.length;i++)r(o[i]);return{arrayValue:{values:n}}}var Ne=function(t){function e(e){var n=this;return(n=t.call(this)||this).elements=e,n}return Object(u.c)(e,t),e}(be);function je(t,e){for(var n=ke(e),r=function(t){n=n.filter((function(e){return!dt(e,t)}))},i=0,o=t.elements;i<o.length;i++)r(o[i]);return{arrayValue:{values:n}}}var Ae=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).fe=e,r._e=n,r}return Object(u.c)(e,t),e}(be);function De(t){return ct(t.integerValue||t.doubleValue)}function ke(t){return It(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}var Se=function(t,e){this.field=t,this.transform=e},xe=function(t,e){this.version=t,this.transformResults=e},Pe=function(){function t(t,e){this.updateTime=t,this.exists=e}return t.de=function(){return new t},t.exists=function(e){return new t(void 0,e)},t.updateTime=function(e){return new t(e)},Object.defineProperty(t.prototype,"we",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)},t}();function Re(t,e){return void 0!==t.updateTime?e instanceof Dt&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e instanceof Dt}var Le=function(){};function Ue(t,e,n){return t instanceof Fe?function(t,e,n){var r=t.value;if(n.transformResults){var i=ze(t.fieldTransforms,e,n.transformResults);r=Qe(t.fieldTransforms,r,i)}return new Dt(t.key,n.version,r,{hasCommittedMutations:!0})}(t,e,n):t instanceof Be?function(t,e,n){if(!Re(t.Ee,e))return new St(t.key,n.version);var r=Ge(t,e,n.transformResults?ze(t.fieldTransforms,e,n.transformResults):[]);return new Dt(t.key,n.version,r,{hasCommittedMutations:!0})}(t,e,n):function(t,e,n){return new kt(t.key,n.version,{hasCommittedMutations:!0})}(t,0,n)}function Ce(t,e,n,r){return t instanceof Fe?function(t,e,n,r){if(!Re(t.Ee,e))return e;var i=t.value;if(t.fieldTransforms){var o=Ke(t.fieldTransforms,n,e,r);i=Qe(t.fieldTransforms,i,o)}var u=qe(e);return new Dt(t.key,u,i,{Jt:!0})}(t,e,r,n):t instanceof Be?function(t,e,n,r){if(!Re(t.Ee,e))return e;var i=qe(e),o=Ge(t,e,Ke(t.fieldTransforms,n,e,r));return new Dt(t.key,i,o,{Jt:!0})}(t,e,r,n):function(t,e){return Re(t.Ee,e)?new kt(t.key,$.min()):e}(t,e)}function Ve(t,e){return void 0!==t.fieldTransforms?function(t,e){for(var n=null,r=0,i=t;r<i.length;r++){var o=i[r],u=e instanceof Dt?e.field(o.field):void 0,s=_e(o.transform,u||null);null!=s&&(n=null==n?(new Nt).set(o.field,s):n.set(o.field,s))}return n?n.Gt():null}(t.fieldTransforms,e):null}function Me(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.Ee.isEqual(e.Ee)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&b(t,e,(function(t,e){return function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Oe&&e instanceof Oe||t instanceof Ne&&e instanceof Ne?b(t.elements,e.elements,dt):t instanceof Ae&&e instanceof Ae?dt(t._e,e._e):t instanceof Ee&&e instanceof Ee}(t.transform,e.transform)}(t,e)}))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.Te.isEqual(e.Te))}function qe(t){return t instanceof Dt?t.version:$.min()}var Fe=function(t){function e(e,n,r,i){void 0===i&&(i=[]);var o=this;return(o=t.call(this)||this).key=e,o.value=n,o.Ee=r,o.fieldTransforms=i,o.type=0,o}return Object(u.c)(e,t),e}(Le),Be=function(t){function e(e,n,r,i,o){void 0===o&&(o=[]);var u=this;return(u=t.call(this)||this).key=e,u.data=n,u.Te=r,u.Ee=i,u.fieldTransforms=o,u.type=1,u}return Object(u.c)(e,t),e}(Le);function Ge(t,e,n){var r;return r=function(t,e){var n=new Nt(e);return t.Te.fields.forEach((function(e){if(!e.bt()){var r=t.data.field(e);null!==r?n.set(e,r):n.delete(e)}})),n.Gt()}(t,r=e instanceof Dt?e.data():Tt.empty()),Qe(t.fieldTransforms,r,n)}function ze(t,e,n){var r=[];d(t.length===n.length);for(var i=0;i<n.length;i++){var o=t[i],u=o.transform,s=null;e instanceof Dt&&(s=e.field(o.field)),r.push(Ie(u,s,n[i]))}return r}function Ke(t,e,n,r){for(var i=[],o=0,u=t;o<u.length;o++){var s=u[o],a=s.transform,c=null;n instanceof Dt&&(c=n.field(s.field)),null===c&&r instanceof Dt&&(c=r.field(s.field)),i.push(we(a,c,e))}return i}function Qe(t,e,n){for(var r=new Nt(e),i=0;i<t.length;i++){var o=t[i];r.set(o.field,n[i])}return r.Gt()}var We=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).key=e,r.Ee=n,r.type=2,r.fieldTransforms=[],r}return Object(u.c)(e,t),e}(Le),He=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).key=e,r.Ee=n,r.type=3,r.fieldTransforms=[],r}return Object(u.c)(e,t),e}(Le),Ye=function(t){this.count=t},Je=function(){function t(t,e){this.At=t,this.root=e||Xe.EMPTY}return t.prototype.Ie=function(e,n){return new t(this.At,this.root.Ie(e,n,this.At).copy(null,null,Xe.me,null,null))},t.prototype.remove=function(e){return new t(this.At,this.root.remove(e,this.At).copy(null,null,Xe.me,null,null))},t.prototype.get=function(t){for(var e=this.root;!e.bt();){var n=this.At(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null},t.prototype.indexOf=function(t){for(var e=0,n=this.root;!n.bt();){var r=this.At(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.bt=function(){return this.root.bt()},Object.defineProperty(t.prototype,"size",{get:function(){return this.root.size}
1,enumerable:!1,configurable:!0}),t.prototype.Ae=function(){return this.root.Ae()},t.prototype.Re=function(){return this.root.Re()},t.prototype.Pe=function(t){return this.root.Pe(t)},t.prototype.forEach=function(t){this.Pe((function(e,n){return t(e,n),!1}))},t.prototype.toString=function(){var t=[];return this.Pe((function(e,n){return t.push(e+":"+n),!1})),"{"+t.join(", ")+"}"},t.prototype.ye=function(t){return this.root.ye(t)},t.prototype.ge=function(){return new $e(this.root,null,this.At,!1)},t.prototype.Ve=function(t){return new $e(this.root,t,this.At,!1)},t.prototype.pe=function(){return new $e(this.root,null,this.At,!0)},t.prototype.be=function(t){return new $e(this.root,t,this.At,!0)},t}(),$e=function(){function t(t,e,n,r){this.ve=r,this.Se=[];for(var i=1;!t.bt();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.ve?t.left:t.right;else{if(0===i){this.Se.push(t);break}this.Se.push(t),t=this.ve?t.right:t.left}}return t.prototype.De=function(){var t=this.Se.pop(),e={key:t.key,value:t.value};if(this.ve)for(t=t.left;!t.bt();)this.Se.push(t),t=t.right;else for(t=t.right;!t.bt();)this.Se.push(t),t=t.left;return e},t.prototype.Ce=function(){return this.Se.length>0},t.prototype.xe=function(){if(0===this.Se.length)return null;var t=this.Se[this.Se.length-1];return{key:t.key,value:t.value}},t}(),Xe=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.bt=function(){return!1},t.prototype.Pe=function(t){return this.left.Pe(t)||t(this.key,this.value)||this.right.Pe(t)},t.prototype.ye=function(t){return this.right.ye(t)||t(this.key,this.value)||this.left.ye(t)},t.prototype.min=function(){return this.left.bt()?this:this.left.min()},t.prototype.Ae=function(){return this.min().key},t.prototype.Re=function(){return this.right.bt()?this.key:this.right.Re()},t.prototype.Ie=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.copy(null,null,null,r.left.Ie(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.Ie(t,e,n))).Ne()},t.prototype.Fe=function(){if(this.left.bt())return t.EMPTY;var e=this;return e.left.Oe()||e.left.left.Oe()||(e=e.ke()),(e=e.copy(null,null,null,e.left.Fe(),null)).Ne()},t.prototype.remove=function(e,n){var r,i=this;if(n(e,i.key)<0)i.left.bt()||i.left.Oe()||i.left.left.Oe()||(i=i.ke()),i=i.copy(null,null,null,i.left.remove(e,n),null);else{if(i.left.Oe()&&(i=i.Me()),i.right.bt()||i.right.Oe()||i.right.left.Oe()||(i=i.Le()),0===n(e,i.key)){if(i.right.bt())return t.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.Fe())}i=i.copy(null,null,null,null,i.right.remove(e,n))}return i.Ne()},t.prototype.Oe=function(){return this.color},t.prototype.Ne=function(){var t=this;return t.right.Oe()&&!t.left.Oe()&&(t=t.$e()),t.left.Oe()&&t.left.left.Oe()&&(t=t.Me()),t.left.Oe()&&t.right.Oe()&&(t=t.Be()),t},t.prototype.ke=function(){var t=this.Be();return t.right.left.Oe()&&(t=(t=(t=t.copy(null,null,null,null,t.right.Me())).$e()).Be()),t},t.prototype.Le=function(){var t=this.Be();return t.left.left.Oe()&&(t=(t=t.Me()).Be()),t},t.prototype.$e=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.Me=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.Be=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.qe=function(){var t=this.Ue();return Math.pow(2,t)<=this.size+1},t.prototype.Ue=function(){if(this.Oe()&&this.left.Oe())throw p();if(this.right.Oe())throw p();var t=this.left.Ue();if(t!==this.right.Ue())throw p();return t+(this.Oe()?0:1)},t}();Xe.EMPTY=null,Xe.RED=!0,Xe.me=!1,Xe.EMPTY=new(function(){function t(){this.size=0}return Object.defineProperty(t.prototype,"key",{get:function(){throw p()}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){throw p()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){throw p()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){throw p()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){throw p()},enumerable:!1,configurable:!0}),t.prototype.copy=function(t,e,n,r,i){return this},t.prototype.Ie=function(t,e,n){return new Xe(t,e)},t.prototype.remove=function(t,e){return this},t.prototype.bt=function(){return!0},t.prototype.Pe=function(t){return!1},t.prototype.ye=function(t){return!1},t.prototype.Ae=function(){return null},t.prototype.Re=function(){return null},t.prototype.Oe=function(){return!1},t.prototype.qe=function(){return!0},t.prototype.Ue=function(){return 0},t}());var Ze=function(){function t(t){this.At=t,this.data=new Je(this.At)}return t.prototype.has=function(t){return null!==this.data.get(t)},t.prototype.first=function(){return this.data.Ae()},t.prototype.last=function(){return this.data.Re()},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.Pe((function(e,n){return t(e),!1}))},t.prototype.Qe=function(t,e){for(var n=this.data.Ve(t[0]);n.Ce();){var r=n.De();if(this.At(r.key,t[1])>=0)return;e(r.key)}},t.prototype.Ke=function(t,e){var n;for(n=void 0!==e?this.data.Ve(e):this.data.ge();n.Ce();)if(!t(n.De().key))return},t.prototype.We=function(t){var e=this.data.Ve(t);return e.Ce()?e.De().key:null},t.prototype.ge=function(){return new tn(this.data.ge())},t.prototype.Ve=function(t){return new tn(this.data.Ve(t))},t.prototype.add=function(t){return this.copy(this.data.remove(t).Ie(t,!0))},t.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},t.prototype.bt=function(){return this.data.bt()},t.prototype.je=function(t){var e=this;return e.size<t.size&&(e=t,t=this),t.forEach((function(t){e=e.add(t)})),e},t.prototype.isEqual=function(e){if(!(e instanceof t))return!1;if(this.size!==e.size)return!1;for(var n=this.data.ge(),r=e.data.ge();n.Ce();){var i=n.De().key,o=r.De().key;if(0!==this.At(i,o))return!1}return!0},t.prototype.Dt=function(){var t=[];return this.forEach((function(e){t.push(e)})),t},t.prototype.toString=function(){var t=[];return this.forEach((function(e){return t.push(e)})),"SortedSet("+t.toString()+")"},t.prototype.copy=function(e){var n=new t(this.At);return n.data=e,n},t}(),tn=function(){function t(t){this.Ge=t}return t.prototype.De=function(){return this.Ge.De().key},t.prototype.Ce=function(){return this.Ge.Ce()},t}(),en=new Je(nt.At);function nn(){return en}function rn(){return nn()}var on=new Je(nt.At);function un(){return on}var sn=new Je(nt.At);function an(){return sn}var cn=new Ze(nt.At);function fn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=cn,r=0,i=t;r<i.length;r++){var o=i[r];n=n.add(o)}return n}var hn=new Ze(g);function ln(){return hn}var pn=function(){function t(t){this.At=t?function(e,n){return t(e,n)||nt.At(e.key,n.key)}:function(t,e){return nt.At(t.key,e.key)},this.ze=un(),this.He=new Je(this.At)}return t.Je=function(e){return new t(e.At)},t.prototype.has=function(t){return null!=this.ze.get(t)},t.prototype.get=function(t){return this.ze.get(t)},t.prototype.first=function(){return this.He.Ae()},t.prototype.last=function(){return this.He.Re()},t.prototype.bt=function(){return this.He.bt()},t.prototype.indexOf=function(t){var e=this.ze.get(t);return e?this.He.indexOf(e):-1},Object.defineProperty(t.prototype,"size",{get:function(){return this.He.size},enumerable:!1,configurable:!0}),t.prototype.forEach=function(t){this.He.Pe((function(e,n){return t(e),!1}))},t.prototype.add=function(t){var e=this.delete(t.key);return e.copy(e.ze.Ie(t.key,t),e.He.Ie(t,null))},t.prototype.delete=function(t){var e=this.get(t);return e?this.copy(this.ze.remove(t),this.He.remove(e)):this},t.prototype.isEqual=function(e){if(!(e instanceof t))return!1;if(this.size!==e.size)return!1;for(var n=this.He.ge(),r=e.He.ge();n.Ce();){var i=n.De().key,o=r.De().key;if(!i.isEqual(o))return!1}return!0},t.prototype.toString=function(){var t=[];return this.forEach((function(e){t.push(e.toString())})),0===t.length?"DocumentSet ()":"DocumentSet (\n  "+t.join("  \n")+"\n)"},t.prototype.copy=function(e,n){var r=new t;return r.At=this.At,r.ze=e,r.He=n,r},t}(),dn=function(){function t(){this.Ye=new Je(nt.At)}return t.prototype.track=function(t){var e=t.doc.key,n=this.Ye.get(e);n?0!==t.type&&3===n.type?this.Ye=this.Ye.Ie(e,t):3===t.type&&1!==n.type?this.Ye=this.Ye.Ie(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.Ye=this.Ye.Ie(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.Ye=this.Ye.Ie(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.Ye=this.Ye.remove(e):1===t.type&&2===n.type?this.Ye=this.Ye.Ie(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.Ye=this.Ye.Ie(e,{type:2,doc:t.doc}):p():this.Ye=this.Ye.Ie(e,t)},t.prototype.Xe=function(){var t=[];return this.Ye.Pe((function(e,n){t.push(n)})),t},t}(),vn=function(){function t(t,e,n,r,i,o,u,s){this.query=t,this.docs=e,this.Ze=n,this.docChanges=r,this.tn=i,this.fromCache=o,this.en=u,this.nn=s}return t.sn=function(e,n,r,i){var o=[];
1return n.forEach((function(t){o.push({type:0,doc:t})})),new t(e,n,pn.Je(n),o,r,i,!0,!1)},Object.defineProperty(t.prototype,"hasPendingWrites",{get:function(){return!this.tn.bt()},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(t){if(!(this.fromCache===t.fromCache&&this.en===t.en&&this.tn.isEqual(t.tn)&&ce(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.Ze.isEqual(t.Ze)))return!1;var e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(var r=0;r<e.length;r++)if(e[r].type!==n[r].type||!e[r].doc.isEqual(n[r].doc))return!1;return!0},t}(),yn=function(){function t(t,e,n,r,i){this.oe=t,this.rn=e,this.on=n,this.cn=r,this.an=i}return t.un=function(e,n){var r=new Map;return r.set(e,mn.hn(e,n)),new t($.min(),r,ln(),nn(),fn())},t}(),mn=function(){function t(t,e,n,r,i){this.resumeToken=t,this.ln=e,this._n=n,this.fn=r,this.dn=i}return t.hn=function(e,n){return new t(I.h,n,fn(),fn(),fn())},t}(),gn=function(t,e,n,r){this.wn=t,this.removedTargetIds=e,this.key=n,this.En=r},bn=function(t,e){this.targetId=t,this.Tn=e},wn=function(t,e,n,r){void 0===n&&(n=I.h),void 0===r&&(r=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r},In=function(){function t(){this.In=0,this.mn=On(),this.An=I.h,this.Rn=!1,this.Pn=!0}return Object.defineProperty(t.prototype,"ln",{get:function(){return this.Rn},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resumeToken",{get:function(){return this.An},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"yn",{get:function(){return 0!==this.In},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gn",{get:function(){return this.Pn},enumerable:!1,configurable:!0}),t.prototype.Vn=function(t){t.o()>0&&(this.Pn=!0,this.An=t)},t.prototype.pn=function(){var t=fn(),e=fn(),n=fn();
1return this.mn.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:p()}})),new mn(this.An,this.Rn,t,e,n)},t.prototype.bn=function(){this.Pn=!1,this.mn=On()},t.prototype.vn=function(t,e){this.Pn=!0,this.mn=this.mn.Ie(t,e)},t.prototype.Sn=function(t){this.Pn=!0,this.mn=this.mn.remove(t)},t.prototype.Dn=function(){this.In+=1},t.prototype.Cn=function(){this.In-=1},t.prototype.xn=function(){this.Pn=!0,this.Rn=!0},t}(),_n=function(){function t(t){this.Nn=t,this.Fn=new Map,this.On=nn(),this.kn=En(),this.Mn=new Ze(g)}return t.prototype.Ln=function(t){for(var e=0,n=t.wn;e<n.length;e++){var r=n[e];t.En instanceof Dt?this.$n(r,t.En):t.En instanceof kt&&this.Bn(r,t.key,t.En)}for(var i=0,o=t.removedTargetIds;i<o.length;i++)r=o[i],this.Bn(r,t.key,t.En)},t.prototype.qn=function(t){var e=this;this.Un(t,(function(n){var r=e.Qn(n);switch(t.state){case 0:e.Kn(n)&&r.Vn(t.resumeToken);break;case 1:r.Cn(),r.yn||r.bn(),r.Vn(t.resumeToken);break;case 2:r.Cn(),r.yn||e.removeTarget(n);break;case 3:e.Kn(n)&&(r.xn(),r.Vn(t.resumeToken));break;case 4:e.Kn(n)&&(e.Wn(n),r.Vn(t.resumeToken));break;default:p()}}))},t.prototype.Un=function(t,e){var n=this;t.targetIds.length>0?t.targetIds.forEach(e):this.Fn.forEach((function(t,r){n.Kn(r)&&e(r)}))},t.prototype.jn=function(t){var e=t.targetId,n=t.Tn.count,r=this.Gn(e);if(r){var i=r.target;if(Ut(i))if(0===n){var o=new nt(i.path);this.Bn(e,o,new kt(o,$.min()))}else d(1===n);else this.zn(e)!==n&&(this.Wn(e),this.Mn=this.Mn.add(e))}},t.prototype.Hn=function(t){var e=this,n=new Map;this.Fn.forEach((function(r,i){var o=e.Gn(i);if(o){if(r.ln&&Ut(o.target)){var u=new nt(o.target.path);null!==e.On.get(u)||e.Jn(i,u)||e.Bn(i,u,new kt(u,t))}r.gn&&(n.set(i,r.pn()),r.bn())}}));var r=fn();this.kn.forEach((function(t,n){var i=!0;n.Ke((function(t){var n=e.Gn(t);return!n||2===n.re||(i=!1,!1)})),i&&(r=r.add(t))}));var i=new yn(t,n,this.Mn,this.On,r);return this.On=nn(),this.kn=En(),this.Mn=new Ze(g),i},t.prototype.$n=function(t,e){if(this.Kn(t)){var n=this.Jn(t,e.key)?2:0;this.Qn(t).vn(e.key,n),this.On=this.On.Ie(e.key,e),this.kn=this.kn.Ie(e.key,this.Yn(e.key).add(t))}},t.prototype.Bn=function(t,e,n){if(this.Kn(t)){var r=this.Qn(t);this.Jn(t,e)?r.vn(e,1):r.Sn(e),this.kn=this.kn.Ie(e,this.Yn(e).delete(t)),n&&(this.On=this.On.Ie(e,n))}},t.prototype.removeTarget=function(t){this.Fn.delete(t)},t.prototype.zn=function(t){var e=this.Qn(t).pn();return this.Nn.Xn(t).size+e._n.size-e.dn.size},t.prototype.Dn=function(t){this.Qn(t).Dn()},t.prototype.Qn=function(t){var e=this.Fn.get(t);return e||(e=new In,this.Fn.set(t,e)),e},t.prototype.Yn=function(t){var e=this.kn.get(t);return e||(e=new Ze(g),this.kn=this.kn.Ie(t,e)),e},t.prototype.Kn=function(t){var e=null!==this.Gn(t);return e||c("WatchChangeAggregator","Detected inactive target",t),e},t.prototype.Gn=function(t){var e=this.Fn.get(t);return e&&e.yn?null:this.Nn.Zn(t)},t.prototype.Wn=function(t){var e=this;this.Fn.set(t,new In),this.Nn.Xn(t).forEach((function(n){e.Bn(t,n,null)}))},t.prototype.Jn=function(t,e){return this.Nn.Xn(t).has(e)},t}();function En(){return new Je(nt.At)}function On(){return new Je(nt.At)}var Tn={asc:"ASCENDING",desc:"DESCENDING"},Nn={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"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"},jn=function(t,e){this.O=t,this.he=e};function An(t,e){return t.he?new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+e.nanoseconds).slice(-9)+"Z":{seconds:""+e.seconds,nanos:e.nanoseconds}}function Dn(t,e){return t.he?e.toBase64():e.toUint8Array()}function kn(t,e){return An(t,e.Tt())}function Sn(t){return d(!!t),$.wt(function(t){var e=at(t);return new J(e.seconds,e.nanos)}(t))}function xn(t,e){return function(t){return new Z(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).Ct()}function Pn(t){var e=Z.xt(t);return d(nr(e)),e}function Rn(t,e){return xn(t.O,e.path)}function Ln(t,e){var n=Pn(e);
1if(n.get(1)!==t.O.projectId)throw new E(_.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.O.projectId);if(n.get(3)!==t.O.database)throw new E(_.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.O.database);return new nt(Mn(n))}function Un(t,e){return xn(t.O,e)}function Cn(t){var e=Pn(t);return 4===e.length?Z.Nt():Mn(e)}function Vn(t){return new Z(["projects",t.O.projectId,"databases",t.O.database]).Ct()}function Mn(t){return d(t.length>4&&"documents"===t.get(4)),t.Pt(5)}function qn(t,e,n){return{name:Rn(t,e),fields:n.proto.mapValue.fields}}function Fn(t,e,n){var r=Ln(t,e.name),i=Sn(e.updateTime),o=new Tt({mapValue:{fields:e.fields}});return new Dt(r,i,o,{hasCommittedMutations:!!n})}function Bn(t,e){var n;if(e instanceof Fe)n={update:qn(t,e.key,e.value)};else if(e instanceof We)n={delete:Rn(t,e.key)};else if(e instanceof Be)n={update:qn(t,e.key,e.data),updateMask:er(e.Te)};else{if(!(e instanceof He))return p();n={verify:Rn(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((function(t){return function(t,e){var n=e.transform;if(n instanceof Ee)return{fieldPath:e.field.Ct(),setToServerValue:"REQUEST_TIME"};if(n instanceof Oe)return{fieldPath:e.field.Ct(),appendMissingElements:{values:n.elements}};if(n instanceof Ne)return{fieldPath:e.field.Ct(),removeAllFromArray:{values:n.elements}};if(n instanceof Ae)return{fieldPath:e.field.Ct(),increment:n._e};throw p()}(0,t)}))),e.Ee.we||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:kn(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:p()}(t,e.Ee)),n}function Gn(t,e){var n=e.currentDocument?function(t){return void 0!==t.updateTime?Pe.updateTime(Sn(t.updateTime)):void 0!==t.exists?Pe.exists(t.exists):Pe.de()}(e.currentDocument):Pe.de(),r=e.updateTransforms?e.updateTransforms.map((function(e){return function(t,e){var n=null;if("setToServerValue"in e)d("REQUEST_TIME"===e.setToServerValue),n=new Ee;else if("appendMissingElements"in e){var r=e.appendMissingElements.values||[];n=new Oe(r)}else if("removeAllFromArray"in e){var i=e.removeAllFromArray.values||[];n=new Ne(i)}else"increment"in e?n=new Ae(t,e.increment):p();var o=et.Mt(e.fieldPath);return new Se(o,n)}(t,e)})):[];if(e.update){e.update.name;var i=Ln(t,e.update.name),o=new Tt({mapValue:{fields:e.update.fields}});if(e.updateMask){var u=function(t){var e=t.fieldPaths||[];return new ut(e.map((function(t){return et.Mt(t)})))}(e.updateMask);return new Be(i,o,u,n,r)}return new Fe(i,o,n,r)}if(e.delete){var s=Ln(t,e.delete);return new We(s,n)}if(e.verify){var a=Ln(t,e.verify);return new He(a,n)}return p()}function zn(t,e){return{documents:[Un(t,e.path)]}}function Kn(t,e){var n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Un(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Un(t,r.yt()),n.structuredQuery.from=[{collectionId:r.Vt()}]);var i=function(t){if(0!==t.length){var e=t.map((function(t){return function(t){if("=="===t.op){if(Et(t.value))return{unaryFilter:{field:$n(t.field),op:"IS_NAN"}};if(_t(t.value))return{unaryFilter:{field:$n(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(Et(t.value))return{unaryFilter:{field:$n(t.field),op:"IS_NOT_NAN"}};if(_t(t.value))return{unaryFilter:{field:$n(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:$n(t.field),op:Jn(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:$n(t.field),direction:Yn(t.dir)}}(t)}))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);var u=function(t,e){return t.he||M(e)?e:{value:e}}(t,e.limit);return null!==u&&(n.structuredQuery.limit=u),e.startAt&&(n.structuredQuery.startAt=Wn(e.startAt)),e.endAt&&(n.structuredQuery.endAt=Wn(e.endAt)),n}function Qn(t){var e=Cn(t.parent),n=t.structuredQuery,r=n.from?n.from.length:0,i=null;if(r>0){d(1===r);var o=n.from[0];o.allDescendants?i=o.collectionId:e=e.child(o.collectionId)}var u=[];n.where&&(u=function t(e){return e?void 0!==e.unaryFilter?[tr(e)]:void 0!==e.fieldFilter?[Zn(e)]:void 0!==e.compositeFilter?e.compositeFilter.filters.map((function(e){return t(e)})).reduce((function(t,e){return t.concat(e)})):p():[]}(n.where));var s=[];n.orderBy&&(s=n.orderBy.map((function(t){return function(t){return new Ht(Xn(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t)})));var a=null;n.limit&&(a=function(t){var e;return M(e="object"==typeof t?t.value:t)?null:e}(n.limit));var c=null;n.startAt&&(c=Hn(n.startAt));var f=null;return n.endAt&&(f=Hn(n.endAt)),Zt(e,i,s,u,a,"F",c,f)}function Wn(t){return{before:t.before,values:t.position}}function Hn(t){var e=!!t.before,n=t.values||[];return new Qt(n,e)}function Yn(t){return Tn[t]}function Jn(t){return Nn[t]}function $n(t){return{fieldPath:t.Ct()}}function Xn(t){return et.Mt(t.fieldPath)}function Zn(t){return Ct.create(Xn(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";case"OPERATOR_UNSPECIFIED":default:return p()}}(t.fieldFilter.op),t.fieldFilter.value)}function tr(t){switch(t.unaryFilter.op){case"IS_NAN":var e=Xn(t.unaryFilter.field);return Ct.create(e,"==",{doubleValue:NaN});case"IS_NULL":var n=Xn(t.unaryFilter.field);return Ct.create(n,"==",{nullValue:"NULL_VALUE"});
1case"IS_NOT_NAN":var r=Xn(t.unaryFilter.field);return Ct.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":var i=Xn(t.unaryFilter.field);return Ct.create(i,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return p()}}function er(t){var e=[];return t.fields.forEach((function(t){return e.push(t.Ct())})),{fieldPaths:e}}function nr(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}function rr(t){return new jn(t,!0)}var ir=function(){function t(t){var e=this;this.ts=null,this.es=null,this.result=void 0,this.error=void 0,this.ns=!1,this.ss=!1,t((function(t){e.ns=!0,e.result=t,e.ts&&e.ts(t)}),(function(t){e.ns=!0,e.error=t,e.es&&e.es(t)}))}return t.prototype.catch=function(t){return this.next(void 0,t)},t.prototype.next=function(e,n){var r=this;return this.ss&&p(),this.ss=!0,this.ns?this.error?this.rs(n,this.error):this.os(e,this.result):new t((function(t,i){r.ts=function(n){r.os(e,n).next(t,i)},r.es=function(e){r.rs(n,e).next(t,i)}}))},t.prototype.cs=function(){var t=this;return new Promise((function(e,n){t.next(e,n)}))},t.prototype.us=function(e){try{var n=e();return n instanceof t?n:t.resolve(n)}catch(e){return t.reject(e)}},t.prototype.os=function(e,n){return e?this.us((function(){return e(n)})):t.resolve(n)},t.prototype.rs=function(e,n){return e?this.us((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.hs=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.ls=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;i<o.length;i++)r(o[i]);return n},t.forEach=function(t,e){var n=this,r=[];return t.forEach((function(t,i){r.push(e.call(n,t,i))})),this.hs(r)},t}(),or=function(){function t(t,e){var n=this;this.action=t,this.transaction=e,this.aborted=!1,this._s=new H,this.transaction.oncomplete=function(){n._s.resolve()},this.transaction.onabort=function(){e.error?n._s.reject(new ar(t,e.error)):n._s.resolve()},this.transaction.onerror=function(e){var r=pr(e.target.error);n._s.reject(new ar(t,r))}}return t.open=function(e,n,r,i){try{return new t(n,e.transaction(i,r))}catch(e){throw new ar(n,e)}},Object.defineProperty(t.prototype,"fs",{get:function(){return this._s.promise},enumerable:!1,configurable:!0}),t.prototype.abort=function(t){t&&this._s.reject(t),this.aborted||(c("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 fr(e)},t}(),ur=function(){function e(t,n,r){this.name=t,this.version=n,this.ds=r,12.2===e.ws(Object(i.p)())&&f("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}return e.delete=function(t){return c("SimpleDb","Removing database:",t),hr(window.indexedDB.deleteDatabase(t)).cs()},e.G=function(){if("undefined"==typeof indexedDB)return!1;if(e.Es())return!0;var t=Object(i.p)(),n=e.ws(t),r=0<n&&n<10,o=e.Ts(t),u=0<o&&o<4.5;return!(t.indexOf("MSIE ")>0||t.indexOf("Trident/")>0||t.indexOf("Edge/")>0||r||u)},e.Es=function(){var e;return"undefined"!=typeof t&&"YES"===(null===(e=t.env)||void 0===e?void 0:e.Is)},e.As=function(t,e){return t.store(e)},e.ws=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)},e.Ts=function(t){var e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)},e.prototype.Rs=function(t){return Object(u.b)(this,void 0,void 0,(function(){var e,n=this;return Object(u.d)(this,(function(r){switch(r.label){case 0:return this.db?[3,2]:(c("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 ar(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 E(_.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 ar(t,n))},i.onupgradeneeded=function(t){c("SimpleDb",'Database "'+n.name+'" requires upgrade from version:',t.oldVersion);var e=t.target.result;n.ds.Ps(e,i.transaction,t.oldVersion,n.version).next((function(){c("SimpleDb","Database upgrade to version "+n.version+" complete")}
1))}}))]);case 1:e.db=r.sent(),r.label=2;case 2:return[2,(this.ys&&(this.db.onversionchange=function(t){return n.ys(t)}),this.db)]}}))}))},e.prototype.gs=function(t){this.ys=t,this.db&&(this.db.onversionchange=function(e){return t(e)})},e.prototype.runTransaction=function(t,e,n,r){return Object(u.b)(this,void 0,void 0,(function(){var i,o,s,a,f;return Object(u.d)(this,(function(h){switch(h.label){case 0:i="readonly"===e,o=0,s=function(){var e,s,f,h,l;return Object(u.d)(this,(function(u){switch(u.label){case 0:++o,u.label=1;case 1:return u.trys.push([1,4,,5]),[4,a.Rs(t)];case 2:return a.db=u.sent(),e=or.open(a.db,t,i?"readonly":"readwrite",n),s=r(e).catch((function(t){return e.abort(t),ir.reject(t)})).cs(),f={},s.catch((function(){})),[4,e.fs];case 3:return[2,(f.value=(u.sent(),s),f)];case 4:return h=u.sent(),l="FirebaseError"!==h.name&&o<3,c("SimpleDb","Transaction failed with error:",h.message,"Retrying:",l),a.close(),l?[3,5]:[2,{value:Promise.reject(h)}];case 5:return[2]}}))},a=this,h.label=1;case 1:return[5,s()];case 2:if("object"==typeof(f=h.sent()))return[2,f.value];h.label=3;case 3:return[3,1];case 4:return[2]}}
1))}))},e.prototype.close=function(){this.db&&this.db.close(),this.db=void 0},e}(),sr=function(){function t(t){this.Vs=t,this.ps=!1,this.bs=null}return Object.defineProperty(t.prototype,"ns",{get:function(){return this.ps},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vs",{get:function(){return this.bs},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cursor",{set:function(t){this.Vs=t},enumerable:!1,configurable:!0}),t.prototype.done=function(){this.ps=!0},t.prototype.Ss=function(t){this.bs=t},t.prototype.delete=function(){return hr(this.Vs.delete())},t}(),ar=function(t){function e(e,n){var r=this;return(r=t.call(this,_.UNAVAILABLE,"IndexedDB transaction '"+e+"' failed: "+n)||this).name="IndexedDbTransactionError",r}return Object(u.c)(e,t),e}(E);function cr(t){return"IndexedDbTransactionError"===t.name}var fr=function(){function t(t){this.store=t}return t.prototype.put=function(t,e){var n;return void 0!==e?(c("SimpleDb","PUT",this.store.name,t,e),n=this.store.put(e,t)):(c("SimpleDb","PUT",this.store.name,"<auto-key>",t),n=this.store.put(t)),hr(n)},t.prototype.add=function(t){return c("SimpleDb","ADD",this.store.name,t,t),hr(this.store.add(t))},t.prototype.get=function(t){var e=this;return hr(this.store.get(t)).next((function(n){return void 0===n&&(n=null),c("SimpleDb","GET",e.store.name,t,n),n}))},t.prototype.delete=function(t){return c("SimpleDb","DELETE",this.store.name,t),hr(this.store.delete(t))},t.prototype.count=function(){return c("SimpleDb","COUNT",this.store.name),hr(this.store.count())},t.prototype.Ds=function(t,e){var n=this.cursor(this.options(t,e)),r=[];return this.Cs(n,(function(t,e){r.push(e)})).next((function(){return r}))},t.prototype.xs=function(t,e){c("SimpleDb","DELETE ALL",this.store.name);var n=this.options(t,e);n.Ns=!1;var r=this.cursor(n);return this.Cs(r,(function(t,e,n){return n.delete()}))},t.prototype.Fs=function(t,e){var n;e?n=t:(n={},e=t);var r=this.cursor(n);return this.Cs(r,e)},t.prototype.Os=function(t){var e=this.cursor({});return new ir((function(n,r){e.onerror=function(t){var e=pr(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.Cs=function(t,e){var n=[];return new ir((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 sr(i),u=e(i.primaryKey,i.value,o);if(u instanceof ir){var s=u.catch((function(t){return o.done(),ir.reject(t)}));n.push(s)}o.ns?r():null===o.vs?i.continue():i.continue(o.vs)}else r()}})).next((function(){return ir.hs(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.Ns?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},t}();function hr(t){return new ir((function(e,n){t.onsuccess=function(t){var n=t.target.result;e(n)},t.onerror=function(t){var e=pr(t.target.error);n(e)}}))}var lr=!1;function pr(t){var e=ur.ws(Object(i.p)());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 E("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 lr||(lr=!0,setTimeout((function(){throw r}),0)),r}}return t}var dr=function(){function t(t,e,n,r,i){this.ks=t,this.Ms=e,this.Ls=n,this.op=r,this.$s=i,this.Bs=new H,this.then=this.Bs.promise.then.bind(this.Bs.promise),this.Bs.promise.catch((function(t){}))}return t.qs=function(e,n,r,i,o){var u=new t(e,n,Date.now()+r,i,o);return u.start(r),u},t.prototype.start=function(t){var e=this;this.Us=setTimeout((function(){return e.Qs()}),t)},t.prototype.Ks=function(){return this.Qs()},t.prototype.cancel=function(t){null!==this.Us&&(this.clearTimeout(),this.Bs.reject(new E(_.CANCELLED,"Operation cancelled"+(t?": "+t:"")))
1)},t.prototype.Qs=function(){var t=this;this.ks.Ws((function(){return null!==t.Us?(t.clearTimeout(),t.op().then((function(e){return t.Bs.resolve(e)}))):Promise.resolve()}))},t.prototype.clearTimeout=function(){null!==this.Us&&(this.$s(this),clearTimeout(this.Us),this.Us=null)},t}();function vr(t,e){if(f("AsyncQueue",e+": "+t),cr(t))return new E(_.UNAVAILABLE,e+": "+t);throw t}var yr=function(){function t(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this.js=t,this.Ms=e,this.Gs=n,this.zs=r,this.Hs=i,this.Js=0,this.Ys=null,this.Xs=Date.now(),this.reset()}return t.prototype.reset=function(){this.Js=0},t.prototype.Zs=function(){this.Js=this.Hs},t.prototype.ti=function(t){var e=this;this.cancel();var n=Math.floor(this.Js+this.ei()),r=Math.max(0,Date.now()-this.Xs),i=Math.max(0,n-r);i>0&&c("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.Js+" ms, delay with jitter: "+n+" ms, last attempt: "+r+" ms ago)"),this.Ys=this.js.ni(this.Ms,i,(function(){return e.Xs=Date.now(),t()})),this.Js*=this.zs,this.Js<this.Gs&&(this.Js=this.Gs),this.Js>this.Hs&&(this.Js=this.Hs)},t.prototype.si=function(){null!==this.Ys&&(this.Ys.Ks(),this.Ys=null)},t.prototype.cancel=function(){null!==this.Ys&&(this.Ys.cancel(),this.Ys=null)},t.prototype.ei=function(){return(Math.random()-.5)*this.Js},t}(),mr=function(){function t(t,e,n,r,i,o){this.js=t,this.ii=n,this.ri=r,this.oi=i,this.listener=o,this.state=0,this.ci=0,this.ai=null,this.stream=null,this.ui=new yr(t,e)}return t.prototype.hi=function(){return 1===this.state||2===this.state||4===this.state},t.prototype.li=function(){return 2===this.state},t.prototype.start=function(){3!==this.state?this.auth():this._i()},t.prototype.stop=function(){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(t){switch(t.label){case 0:return this.hi()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}
1))}))},t.prototype.fi=function(){this.state=0,this.ui.reset()},t.prototype.di=function(){var t=this;this.li()&&null===this.ai&&(this.ai=this.js.ni(this.ii,6e4,(function(){return t.wi()})))},t.prototype.Ei=function(t){this.Ti(),this.stream.send(t)},t.prototype.wi=function(){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(t){return this.li()?[2,this.close(0)]:[2]}))}))},t.prototype.Ti=function(){this.ai&&(this.ai.cancel(),this.ai=null)},t.prototype.close=function(t,e){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(n){switch(n.label){case 0:return this.Ti(),this.ui.cancel(),this.ci++,3!==t?this.ui.reset():e&&e.code===_.RESOURCE_EXHAUSTED?(f(e.toString()),f("Using maximum backoff delay to prevent overloading the backend."),this.ui.Zs()):e&&e.code===_.UNAUTHENTICATED&&this.oi.g(),null!==this.stream&&(this.Ii(),this.stream.close(),this.stream=null),this.state=t,[4,this.listener.Z(e)];case 1:return n.sent(),[2]}}))}))},t.prototype.Ii=function(){},t.prototype.auth=function(){var t=this;this.state=1;var e=this.mi(this.ci),n=this.ci;this.oi.getToken().then((function(e){t.ci===n&&t.Ai(e)}),(function(n){e((function(){var e=new E(_.UNKNOWN,"Fetching auth token failed: "+n.message);return t.Ri(e)}))}))},t.prototype.Ai=function(t){var e=this,n=this.mi(this.ci);this.stream=this.Pi(t),this.stream.Y((function(){n((function(){return e.state=2,e.listener.Y()}))})),this.stream.Z((function(t){n((function(){return e.Ri(t)}))})),this.stream.onMessage((function(t){n((function(){return e.onMessage(t)}))}))},t.prototype._i=function(){var t=this;this.state=4,this.ui.ti((function(){return Object(u.b)(t,void 0,void 0,(function(){return Object(u.d)(this,(function(t){return this.state=0,this.start(),[2]}))}))}))},t.prototype.Ri=function(t){return c("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},t.prototype.mi=function(t){var e=this;return function(n){e.js.Ws((function(){return e.ci===t?n():(c("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())}))}},t}(),gr=function(t){function e(e,n,r,i,o){var u=this;return(u=t.call(this,e,"listen_stream_connection_backoff","listen_stream_idle",n,r,o)||this).fe=i,u}return Object(u.c)(e,t),e.prototype.Pi=function(t){return this.ri.ft("Listen",t)},e.prototype.onMessage=function(t){this.ui.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:p()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],o=function(t,e){return t.he?(d(void 0===e||"string"==typeof e),I.fromBase64String(e||"")):(d(void 0===e||e instanceof Uint8Array),I.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),u=(s=e.targetChange.cause)&&function(t){var e=void 0===t.code?_.UNKNOWN:Q(t.code);return new E(e,t.message||"")}(s);n=new wn(r,i,o,u||null)}else if("documentChange"in e){e.documentChange,(r=e.documentChange).document,r.document.name,r.document.updateTime,i=Ln(t,r.document.name),o=Sn(r.document.updateTime);var s=new Tt({mapValue:{fields:r.document.fields}}),a=(u=new Dt(i,o,s,{}),r.targetIds||[]),c=r.removedTargetIds||[];n=new gn(a,c,u.key,u)}else if("documentDelete"in e)e.documentDelete,(r=e.documentDelete).document,i=Ln(t,r.document),o=r.readTime?Sn(r.readTime):$.min(),s=new kt(i,o),u=r.removedTargetIds||[],n=new gn([],u,s.key,s);else if("documentRemove"in e)e.documentRemove,(r=e.documentRemove).document,i=Ln(t,r.document),o=r.removedTargetIds||[],n=new gn([],o,i,null);else{if(!("filter"in e))return p();e.filter;var f=e.filter;f.targetId,r=f.count||0,i=new Ye(r),o=f.targetId,n=new bn(o,i)}return n}(this.fe,t),n=function(t){if(!("targetChange"in t))return $.min();var e=t.targetChange;return e.targetIds&&e.targetIds.length?$.min():e.readTime?Sn(e.readTime):$.min()}(t);return this.listener.yi(e,n)},e.prototype.gi=function(t){var e={};e.database=Vn(this.fe),e.addTarget=function(t,e){var n,r=e.target;return(n=Ut(r)?{documents:zn(t,r)}:{query:Kn(t,r)}).targetId=e.targetId,e.resumeToken.o()>0?n.resumeToken=Dn(t,e.resumeToken):e.oe.u($.min())>0&&(n.readTime=An(t,e.oe.Tt())),n}(this.fe,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 p()}}(0,e.re);return null==n?null:{"goog-listen-tags":n}}(this.fe,t);
1n&&(e.labels=n),this.Ei(e)},e.prototype.Vi=function(t){var e={};e.database=Vn(this.fe),e.removeTarget=t,this.Ei(e)},e}(mr),br=function(t){function e(e,n,r,i,o){var u=this;return(u=t.call(this,e,"write_stream_connection_backoff","write_stream_idle",n,r,o)||this).fe=i,u.pi=!1,u}return Object(u.c)(e,t),Object.defineProperty(e.prototype,"bi",{get:function(){return this.pi},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.pi=!1,this.lastStreamToken=void 0,t.prototype.start.call(this)},e.prototype.Ii=function(){this.pi&&this.vi([])},e.prototype.Pi=function(t){return this.ri.ft("Write",t)},e.prototype.onMessage=function(t){if(d(!!t.streamToken),this.lastStreamToken=t.streamToken,this.pi){this.ui.reset();var e=function(t,e){return t&&t.length>0?(d(void 0!==e),t.map((function(t){return function(t,e){var n=t.updateTime?Sn(t.updateTime):Sn(e);n.isEqual($.min())&&(n=Sn(e));var r=null;return t.transformResults&&t.transformResults.length>0&&(r=t.transformResults),new xe(n,r)}(t,e)}))):[]}(t.writeResults,t.commitTime),n=Sn(t.commitTime);return this.listener.Si(n,e)}return d(!t.writeResults||0===t.writeResults.length),this.pi=!0,this.listener.Di()},e.prototype.Ci=function(){var t={};t.database=Vn(this.fe),this.Ei(t)},e.prototype.vi=function(t){var e=this,n={streamToken:this.lastStreamToken,writes:t.map((function(t){return Bn(e.fe,t)}))};this.Ei(n)},e}(mr),wr=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).credentials=e,i.ri=n,i.fe=r,i.xi=!1,i}return Object(u.c)(e,t),e.prototype.Ni=function(){if(this.xi)throw new E(_.FAILED_PRECONDITION,"The client has already been terminated.")},e.prototype.at=function(t,e,n){var r=this;return this.Ni(),this.credentials.getToken().then((function(i){return r.ri.at(t,e,n,i)})).catch((function(t){throw t.code===_.UNAUTHENTICATED&&r.credentials.g(),t}))},e.prototype._t=function(t,e,n){var r=this;return this.Ni(),this.credentials.getToken().then((function(i){return r.ri._t(t,e,n,i)})).catch((function(t){throw t.code===_.UNAUTHENTICATED&&r.credentials.g(),t}))},e.prototype.terminate=function(){this.xi=!1},e}((function(){})),Ir="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",_r=function(){function t(){this.Fi=[]}return t.prototype.Oi=function(t){this.Fi.push(t)},t.prototype.ki=function(){this.Fi.forEach((function(t){return t()}))},t}(),Er={Mi:!1,Li:0,$i:0,Bi:0},Or=function(){function t(t,e,n){this.qi=t,this.Ui=e,this.Qi=n}return t.Ki=function(e){return new t(e,t.Wi,t.ji)},t}();Or.Wi=10,Or.ji=1e3,Or.Gi=new Or(41943040,Or.Wi,Or.ji),Or.zi=new Or(-1,0,0);var Tr=function(){function t(t,e){var n=this;this.previousValue=t,e&&(e.Hi=function(t){return n.Ji(t)},this.Yi=function(t){return e.Xi(t)})}return t.prototype.Ji=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},t.prototype.next=function(){var t=++this.previousValue;return this.Yi&&this.Yi(t),t},t}();function Nr(t){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(e){if(t.code!==_.FAILED_PRECONDITION||t.message!==Ir)throw t;return c("LocalStore","Unexpectedly lost primary lease"),[2]}))}))}Tr.Zi=-1;var jr=function(t,e){this.progress=t,this.tr=e},Ar=function(){function t(t,e,n,r){this.batchId=t,this.er=e,this.baseMutations=n,this.mutations=r}return t.prototype.nr=function(t,e,n){for(var r=n.sr,i=0;i<this.mutations.length;i++){var o=this.mutations[i];o.key.isEqual(t)&&(e=Ue(o,e,r[i]))}return e},t.prototype.ir=function(t,e){for(var n=0,r=this.baseMutations;n<r.length;n++){var i=r[n];i.key.isEqual(t)&&(e=Ce(i,e,e,this.er))}for(var o=e,u=0,s=this.mutations;u<s.length;u++){var a=s[u];a.key.isEqual(t)&&(e=Ce(a,e,o,this.er))}return e},t.prototype.rr=function(t){var e=this,n=t;return this.mutations.forEach((function(r){var i=e.ir(r.key,t.get(r.key));i&&(n=n.Ie(r.key,i))})),n},t.prototype.keys=function(){return this.mutations.reduce((function(t,e){return t.add(e.key)}),fn())},t.prototype.isEqual=function(t){return this.batchId===t.batchId&&b(this.mutations,t.mutations,(function(t,e){return Me(t,e)}))&&b(this.baseMutations,t.baseMutations,(function(t,e){return Me(t,e)}))},t}(),Dr=function(){function t(t,e,n,r){this.batch=t,this.cr=e,this.sr=n,this.ar=r}return t.from=function(e,n,r){d(e.mutations.length===r.length);for(var i=an(),o=e.mutations,u=0;u<o.length;u++)i=i.Ie(o[u].key,r[u].version);return new t(e,n,r,i)},t}(),kr=function(){function t(t,e){this.ur=t,this.hr=e,this.lr={}}return t.prototype.get=function(t){var e=this.ur(t),n=this.lr[e];
1if(void 0!==n)for(var r=0,i=n;r<i.length;r++){var o=i[r],u=o[0],s=o[1];if(this.hr(u,t))return s}},t.prototype.has=function(t){return void 0!==this.get(t)},t.prototype.set=function(t,e){var n=this.ur(t),r=this.lr[n];if(void 0!==r){for(var i=0;i<r.length;i++)if(this.hr(r[i][0],t))return void(r[i]=[t,e]);r.push([t,e])}else this.lr[n]=[[t,e]]},t.prototype.delete=function(t){var e=this.ur(t),n=this.lr[e];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(this.hr(n[r][0],t))return 1===n.length?delete this.lr[e]:n.splice(r,1),!0;return!1},t.prototype.forEach=function(t){it(this.lr,(function(e,n){for(var r=0,i=n;r<i.length;r++){var o=i[r],u=o[0],s=o[1];t(u,s)}}))},t.prototype.bt=function(){return ot(this.lr)},t}(),Sr=function(){function t(){this._r=new kr((function(t){return t.toString()}),(function(t,e){return t.isEqual(e)})),this.dr=!1}return t.prototype.wr=function(t){var e=this._r.get(t);return e?e.readTime:$.min()},t.prototype.Er=function(t,e){this.Tr(),this._r.set(t.key,{Ir:t,readTime:e})},t.prototype.mr=function(t,e){void 0===e&&(e=null),this.Tr(),this._r.set(t,{Ir:null,readTime:e})},t.prototype.Ar=function(t,e){this.Tr();var n=this._r.get(e);return void 0!==n?ir.resolve(n.Ir):this.Rr(t,e)},t.prototype.getEntries=function(t,e){return this.Pr(t,e)},t.prototype.apply=function(t){return this.Tr(),this.dr=!0,this.yr(t)},t.prototype.Tr=function(){},t}();function xr(t,e){var n=t[0],r=t[1],i=e[0],o=e[1],u=g(n,i);return 0===u?g(r,o):u}var Pr=function(){function t(t){this.gr=t,this.buffer=new Ze(xr),this.Vr=0}return t.prototype.pr=function(){return++this.Vr},t.prototype.br=function(t){var e=[t,this.pr()];if(this.buffer.size<this.gr)this.buffer=this.buffer.add(e);else{var n=this.buffer.last();xr(e,n)<0&&(this.buffer=this.buffer.delete(n).add(e))}},Object.defineProperty(t.prototype,"maxValue",{get:function(){return this.buffer.last()[0]},enumerable:!1,configurable:!0}),t}(),Rr=function(){function t(t,e){this.vr=t,this.ks=e,this.Sr=!1,this.Dr=null}return t.prototype.start=function(t){-1!==this.vr.params.qi&&this.Cr(t)},t.prototype.stop=function(){this.Dr&&(this.Dr.cancel(),this.Dr=null)},Object.defineProperty(t.prototype,"Nr",{get:function(){return null!==this.Dr},enumerable:!1,configurable:!0}),t.prototype.Cr=function(t){var e=this,n=this.Sr?3e5:6e4;c("LruGarbageCollector","Garbage collection scheduled in "+n+"ms"),this.Dr=this.ks.ni("lru_garbage_collection",n,(function(){return Object(u.b)(e,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(n){switch(n.label){case 0:this.Dr=null,this.Sr=!0,n.label=1;case 1:return n.trys.push([1,3,,7]),[4,t.Fr(this.vr)];case 2:return n.sent(),[3,7];case 3:return cr(e=n.sent())?(c("LruGarbageCollector","Ignoring IndexedDB error during garbage collection: ",e),[3,6]):[3,4];case 4:return[4,Nr(e)];case 5:n.sent(),n.label=6;case 6:return[3,7];case 7:return[4,this.Cr(t)];case 8:return n.sent(),[2]}}))}))}))},t}(),Lr=function(){function t(t,e){this.Or=t,this.params=e}return t.prototype.kr=function(t,e){return this.Or.Mr(t).next((function(t){return Math.floor(e/100*t)}))},t.prototype.Lr=function(t,e){var n=this;if(0===e)return ir.resolve(Tr.Zi);var r=new Pr(e);return this.Or.Un(t,(function(t){return r.br(t.sequenceNumber)})).next((function(){return n.Or.$r(t,(function(t){return r.br(t)}))})).next((function(){return r.maxValue}))},t.prototype.Br=function(t,e,n){return this.Or.Br(t,e,n)},t.prototype.qr=function(t,e){return this.Or.qr(t,e)},t.prototype.Ur=function(t,e){var n=this;return-1===this.params.qi?(c("LruGarbageCollector","Garbage collection skipped; disabled"),ir.resolve(Er)):this.Qr(t).next((function(r){return r<n.params.qi?(c("LruGarbageCollector","Garbage collection skipped; Cache size "+r+" is lower than threshold "+n.params.qi),Er):n.Kr(t,e)}))},t.prototype.Qr=function(t){return this.Or.Qr(t)},t.prototype.Kr=function(t,e){var n,i,o,u,s,f,h,l=this,p=Date.now();return this.kr(t,this.params.Ui).next((function(e){return e>l.params.Qi?(c("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+l.params.Qi+" from "+e),i=l.params.Qi):i=e,u=Date.now(),l.Lr(t,i)})).next((function(r){return n=r,s=Date.now(),l.Br(t,n,e)})).next((function(e){return o=e,f=Date.now(),l.qr(t,n)}
1)).next((function(t){return h=Date.now(),a()<=r.a.DEBUG&&c("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(u-p)+"ms\n\tDetermined least recently used "+i+" in "+(s-u)+"ms\n\tRemoved "+o+" targets in "+(f-s)+"ms\n\tRemoved "+t+" documents in "+(h-f)+"ms\nTotal Duration: "+(h-p)+"ms"),ir.resolve({Mi:!0,Li:i,$i:o,Bi:t})}))},t}();function Ur(t,e,n){if(!n)throw new E(_.INVALID_ARGUMENT,"Function "+t+"() cannot be called with an empty "+e+".")}function Cr(t,e){if(void 0===e)return{merge:!1};if(void 0!==e.mergeFields&&void 0!==e.merge)throw new E(_.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');return e}function Vr(t,e,n,r){if(!0===e&&!0===r)throw new E(_.INVALID_ARGUMENT,t+" and "+n+" cannot be used together.")}function Mr(t){if(!nt.qt(t))throw new E(_.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t+" has "+t.length+".")}function qr(t){if(nt.qt(t))throw new E(_.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t+" has "+t.length+".")}function Fr(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(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":p()}function Br(t,e){if("_delegate"in t&&(t=t._),!(t instanceof e)){if(e.name===t.constructor.name)throw new E(_.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");var n=Fr(t);throw new E(_.INVALID_ARGUMENT,"Expected type '"+e.name+"', but it was: "+n)}return t}function Gr(t,e){if(e<=0)throw new E(_.INVALID_ARGUMENT,"Function "+t+"() requires a positive number, but it was: "+e+".")}var zr=function(){function t(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new E(_.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new E(_.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,Vr("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}return t.prototype.isEqual=function(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties},t}(),Kr=new Map,Qr=function(){function t(t,e){this.Wr="(lite)",this.jr=new zr({}),this.Gr=!1,t instanceof U?(this.zr=t,this.Hr=new S):(this.Jr=t,this.zr=function(t){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new E(_.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new U(t.options.projectId)}(t),this.Hr=new x(e))}return Object.defineProperty(t.prototype,"app",{get:function(){if(!this.Jr)throw new E(_.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.Jr},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Yr",{get:function(){return this.Gr},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Xr",{get:function(){return void 0!==this.Zr}
1,enumerable:!1,configurable:!0}),t.prototype.eo=function(t){if(this.Gr)throw new E(_.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this.jr=new zr(t),void 0!==t.credentials&&(this.Hr=function(t){if(!t)return new S;switch(t.type){case"gapi":var e=t.client;return d(!("object"!=typeof e||null===e||!e.auth||!e.auth.getAuthHeaderValueForFirstParty)),new R(e,t.sessionIndex||"0");case"provider":return t.client;default:throw new E(_.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(t.credentials))},t.prototype.no=function(){return this.jr},t.prototype.so=function(){return this.Gr=!0,this.jr},t.prototype._delete=function(){return this.Zr||(this.Zr=this.io()),this.Zr},t.prototype.io=function(){return this,(t=Kr.get(this))&&(c("ComponentProvider","Removing Datastore"),Kr.delete(this),t.terminate()),Promise.resolve();var t},t}();function Wr(t){for(var e="",n=0;n<t.length;n++)e.length>0&&(e=Yr(e)),e=Hr(t.get(n),e);return Yr(e)}function Hr(t,e){for(var n=e,r=t.length,i=0;i<r;i++){var o=t.charAt(i);switch(o){case"\0":n+="\x01\x10";break;case"\x01":n+="\x01\x11";break;default:n+=o}}return n}function Yr(t){return t+"\x01\x01"}function Jr(t){var e=t.length;if(d(e>=2),2===e)return d("\x01"===t.charAt(0)&&"\x01"===t.charAt(1)),Z.Nt();for(var n=e-2,r=[],i="",o=0;o<e;){var u=t.indexOf("\x01",o);switch((u<0||u>n)&&p(),t.charAt(u+1)){case"\x01":var s=t.substring(o,u),a=void 0;0===i.length?a=s:(a=i+=s,i=""),r.push(a);break;case"\x10":i+=t.substring(o,u),i+="\0";break;case"\x11":i+=t.substring(o,u+1);break;default:p()}o=u+2}return new Z(r)}var $r=function(t,e){this.seconds=t,this.nanoseconds=e},Xr=function(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n};Xr.store="owner",Xr.key="owner";var Zr=function(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n};Zr.store="mutationQueues",Zr.keyPath="userId";var ti=function(t,e,n,r,i){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i};ti.store="mutations",ti.keyPath="batchId",ti.userMutationsIndex="userMutationsIndex",ti.userMutationsKeyPath=["userId","batchId"];var ei=function(){function t(){}return t.prefixForUser=function(t){return[t]},t.prefixForPath=function(t,e){return[t,Wr(e)]},t.key=function(t,e,n){return[t,Wr(e),n]},t}();ei.store="documentMutations",ei.PLACEHOLDER=new ei;var ni=function(t,e){this.path=t,this.readTime=e},ri=function(t,e){this.path=t,this.version=e},ii=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};ii.store="remoteDocuments",ii.readTimeIndex="readTimeIndex",ii.readTimeIndexPath="readTime",ii.collectionReadTimeIndex="collectionReadTimeIndex",ii.collectionReadTimeIndexPath=["parentPath","readTime"];var oi=function(t){this.byteSize=t};oi.store="remoteDocumentGlobal",oi.key="remoteDocumentGlobalKey";var ui=function(t,e,n,r,i,o,u){this.targetId=t,this.canonicalId=e,this.readTime=n,this.resumeToken=r,this.lastListenSequenceNumber=i,this.lastLimboFreeSnapshotVersion=o,this.query=u};ui.store="targets",ui.keyPath="targetId",ui.queryTargetsIndexName="queryTargetsIndex",ui.queryTargetsKeyPath=["canonicalId","targetId"];var si=function(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n};si.store="targetDocuments",si.keyPath=["targetId","path"],si.documentTargetsIndex="documentTargetsIndex",si.documentTargetsKeyPath=["path","targetId"];var ai=function(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r};ai.key="targetGlobalKey",ai.store="targetGlobal";var ci=function(t,e){this.collectionId=t,this.parent=e};ci.store="collectionParents",ci.keyPath=["collectionId","parent"];var fi=function(t,e,n,r){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=r};fi.store="clientMetadata",fi.keyPath="clientId";var hi=function(t,e,n){this.bundleId=t,this.createTime=e,this.version=n};hi.store="bundles",hi.keyPath="bundleId";var li=function(t,e,n){this.name=t,this.readTime=e,this.bundledQuery=n};li.store="namedQueries",li.keyPath="name";var pi=Object(u.g)(Object(u.g)(Object(u.g)(Object(u.g)([Zr.store,ti.store,ei.store,ii.store,ui.store,Xr.store,ai.store,si.store],[fi.store]),[oi.store]),[ci.store]),[hi.store,li.store]),di=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).ro=e,r.oo=n,r}return Object(u.c)(e,t),e}(_r);function vi(t,e){var n=v(t);return ur.As(n.ro,e)}var yi=function(t){this.co=t};function mi(t,e){if(e.document)return Fn(t.co,e.document,!!e.hasCommittedMutations);if(e.noDocument){var n=nt.Ut(e.noDocument.path),r=_i(e.noDocument.readTime);return new kt(n,r,{hasCommittedMutations:!!e.hasCommittedMutations})}if(e.unknownDocument){var i=nt.Ut(e.unknownDocument.path);return r=_i(e.unknownDocument.version),new St(i,r)}return p()}function gi(t,e,n){var r=bi(n),i=e.key.path.yt().Dt();if(e instanceof Dt){var o=function(t,e){return{name:Rn(t,e.key),fields:e.Yt().mapValue.fields,updateTime:An(t,e.version.Tt())}}(t.co,e),u=e.hasCommittedMutations;return new ii(null,null,o,u,r,i)}if(e instanceof kt){var s=e.key.path.Dt(),a=Ii(e.version);return u=e.hasCommittedMutations,new ii(null,new ni(s,a),null,u,r,i)}if(e instanceof St){var c=e.key.path.Dt(),f=Ii(e.version);return new ii(new ri(c,f),null,null,!0,r,i)}return p()}function bi(t){var e=t.Tt();return[e.seconds,e.nanoseconds]}function wi(t){var e=new J(t[0],t[1]);return $.wt(e)}function Ii(t){var e=t.Tt();return new $r(e.seconds,e.nanoseconds)}function _i(t){var e=new J(t.seconds,t.nanoseconds);return $.wt(e)}function Ei(t,e){for(var n=(e.baseMutations||[]).map((function(e){return Gn(t.co,e)})),r=e.mutations.length-1;r>=0;--r){var i=e.mutations[r];void 0!==(null==i?void 0:i.transform)&&(e.mutations[r-1].updateTransforms=i.transform.fieldTransforms,e.mutations.splice(r,1),--r)}var o=e.mutations.map((function(e){return Gn(t.co,e)})),u=J.fromMillis(e.localWriteTimeMs);return new Ar(e.batchId,u,n,o)}function Oi(t){var e,n,r=_i(t.readTime),i=void 0!==t.lastLimboFreeSnapshotVersion?_i(t.lastLimboFreeSnapshotVersion):$.min();return void 0!==t.query.documents?(d(1===(n=t.query).documents.length),e=se(te(Cn(n.documents[0])))):e=function(t){return se(Qn(t))}(t.query),new ve(e,t.targetId,0,t.lastListenSequenceNumber,r,i,I.fromBase64String(t.resumeToken))}function Ti(t,e){var n,r=Ii(e.oe),i=Ii(e.lastLimboFreeSnapshotVersion);n=Ut(e.target)?zn(t.co,e.target):Kn(t.co,e.target);var o=e.resumeToken.toBase64();return new ui(e.targetId,Rt(e.target),r,o,e.sequenceNumber,i,n)}function Ni(t){var e=Qn({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?ae(e,e.limit,"L"):e}var ji=function(){function t(){}return t.prototype.ao=function(t,e){return Ai(t).get(e).next((function(t){if(t)return{id:(e=t).bundleId,createTime:_i(e.createTime),version:e.version};var e}))},t.prototype.uo=function(t,e){return Ai(t).put({bundleId:(n=e).id,createTime:Ii(Sn(n.createTime)),version:n.version});var n},t.prototype.ho=function(t,e){return Di(t).get(e).next((function(t){if(t)return{name:(e=t).name,query:Ni(e.bundledQuery),readTime:_i(e.readTime)};var e}))},t.prototype.lo=function(t,e){return Di(t).put(function(t){return{name:t.name,readTime:Ii(Sn(t.readTime)),bundledQuery:t.bundledQuery}}(e))},t}();function Ai(t){return vi(t,hi.store)}function Di(t){return vi(t,li.store)}var ki=function(){function t(){this._o=new Si}return t.prototype.fo=function(t,e){return this._o.add(e),ir.resolve()},t.prototype.wo=function(t,e){return ir.resolve(this._o.getEntries(e))},t}(),Si=function(){function t(){this.index={}}return t.prototype.add=function(t){var e=t.Vt(),n=t.yt(),r=this.index[e]||new Ze(Z.At),i=!r.has(n);return this.index[e]=r.add(n),i},t.prototype.has=function(t){var e=t.Vt(),n=t.yt(),r=this.index[e];return r&&r.has(n)},t.prototype.getEntries=function(t){return(this.index[t]||new Ze(Z.At)).Dt()},t}(),xi=function(){function t(){this.Eo=new Si}return t.prototype.fo=function(t,e){var n=this;if(!this.Eo.has(e)){var r=e.Vt(),i=e.yt();t.Oi((function(){n.Eo.add(e)}));var o={collectionId:r,parent:Wr(i)};return Pi(t).put(o)}return ir.resolve()},t.prototype.wo=function(t,e){var n=[],r=IDBKeyRange.bound([e,""],[w(e),""],!1,!0);return Pi(t).Ds(r).next((function(t){for(var r=0,i=t;r<i.length;r++){var o=i[r];if(o.collectionId!==e)break;n.push(Jr(o.parent))}return n}))},t}();function Pi(t){return vi(t,ci.store)}function Ri(t,e,n){var r=t.store(ti.store),i=t.store(ei.store),o=[],u=IDBKeyRange.only(n.batchId),s=0,a=r.Fs({range:u},(function(t,e,n){return s++,n.delete()}));o.push(a.next((function(){d(1===s)})));for(var c=[],f=0,h=n.mutations;f<h.length;f++){var l=h[f],p=ei.key(e,l.key.path,n.batchId);o.push(i.delete(p)),c.push(l.key)}return ir.hs(o).next((function(){return c}))}function Li(t){var e;if(t.document)e=t.document;else if(t.unknownDocument)e=t.unknownDocument;else{if(!t.noDocument)throw p();e=t.noDocument}return JSON.stringify(e).length}var Ui=function(){function t(t,e,n,r){this.userId=t,this.fe=e,this.To=n,this.Io=r,this.mo={}}return t.Ao=function(e,n,r,i){return d(""!==e.uid),new t(e.T()?e.uid:"",n,r,i)},t.prototype.Ro=function(t){var e=!0,n=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return Vi(t).Fs({index:ti.userMutationsIndex,range:n},(function(t,n,r){e=!1,r.done()})).next((function(){return e}))},t.prototype.Po=function(t,e,n,r){var i=this,o=Mi(t),u=Vi(t);return u.add({}).next((function(s){d("number"==typeof s);for(var a=new Ar(s,e,n,r),c=function(t,e,n){var r=n.baseMutations.map((function(e){return Bn(t.co,e)})),i=n.mutations.map((function(e){return Bn(t.co,e)}));return new ti(e,n.batchId,n.er.toMillis(),r,i)}(i.fe,i.userId,a),f=[],h=new Ze((function(t,e){return g(t.Ct(),e.Ct())}
1)),l=0,p=r;l<p.length;l++){var v=p[l],y=ei.key(i.userId,v.key.path,s);h=h.add(v.key.path.yt()),f.push(u.put(c)),f.push(o.put(y,ei.PLACEHOLDER))}return h.forEach((function(e){f.push(i.To.fo(t,e))})),t.Oi((function(){i.mo[s]=a.keys()})),ir.hs(f).next((function(){return a}))}))},t.prototype.yo=function(t,e){var n=this;return Vi(t).get(e).next((function(t){return t?(d(t.userId===n.userId),Ei(n.fe,t)):null}))},t.prototype.Vo=function(t,e){var n=this;return this.mo[e]?ir.resolve(this.mo[e]):this.yo(t,e).next((function(t){if(t){var r=t.keys();return n.mo[e]=r,r}return null}))},t.prototype.po=function(t,e){var n=this,r=e+1,i=IDBKeyRange.lowerBound([this.userId,r]),o=null;return Vi(t).Fs({index:ti.userMutationsIndex,range:i},(function(t,e,i){e.userId===n.userId&&(d(e.batchId>=r),o=Ei(n.fe,e)),i.done()})).next((function(){return o}))},t.prototype.bo=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),n=-1;return Vi(t).Fs({index:ti.userMutationsIndex,range:e,reverse:!0},(function(t,e,r){n=e.batchId,r.done()})).next((function(){return n}))},t.prototype.vo=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return Vi(t).Ds(ti.userMutationsIndex,n).next((function(t){return t.map((function(t){return Ei(e.fe,t)}))}))},t.prototype.So=function(t,e){var n=this,r=ei.prefixForPath(this.userId,e.path),i=IDBKeyRange.lowerBound(r),o=[];return Mi(t).Fs({range:i},(function(r,i,u){var s=r[0],a=r[1],c=r[2],f=Jr(a);if(s===n.userId&&e.path.isEqual(f))return Vi(t).get(c).next((function(t){if(!t)throw p();d(t.userId===n.userId),o.push(Ei(n.fe,t))}));u.done()})).next((function(){return o}))},t.prototype.Do=function(t,e){var n=this,r=new Ze(g),i=[];return e.forEach((function(e){var o=ei.prefixForPath(n.userId,e.path),u=IDBKeyRange.lowerBound(o),s=Mi(t).Fs({range:u},(function(t,i,o){var u=t[0],s=t[1],a=t[2],c=Jr(s);u===n.userId&&e.path.isEqual(c)?r=r.add(a):o.done()}));i.push(s)})),ir.hs(i).next((function(){return n.Co(t,r)}))},t.prototype.xo=function(t,e){var n=this,r=e.path,i=r.length+1,o=ei.prefixForPath(this.userId,r),u=IDBKeyRange.lowerBound(o),s=new Ze(g);return Mi(t).Fs({range:u},(function(t,e,o){var u=t[0],a=t[1],c=t[2],f=Jr(a);u===n.userId&&r.vt(f)?f.length===i&&(s=s.add(c)):o.done()})).next((function(){return n.Co(t,s)}))},t.prototype.Co=function(t,e){var n=this,r=[],i=[];return e.forEach((function(e){i.push(Vi(t).get(e).next((function(t){if(null===t)throw p();d(t.userId===n.userId),r.push(Ei(n.fe,t))})))})),ir.hs(i).next((function(){return r}))},t.prototype.No=function(t,e){var n=this;return Ri(t.ro,this.userId,e).next((function(r){return t.Oi((function(){n.Fo(e.batchId)})),ir.forEach(r,(function(e){return n.Io.Oo(t,e)}))}))},t.prototype.Fo=function(t){delete this.mo[t]},t.prototype.ko=function(t){var e=this;return this.Ro(t).next((function(n){if(!n)return ir.resolve();var r=IDBKeyRange.lowerBound(ei.prefixForUser(e.userId)),i=[];return Mi(t).Fs({range:r},(function(t,n,r){if(t[0]===e.userId){var o=Jr(t[1]);i.push(o)}else r.done()})).next((function(){d(0===i.length)}))}))},t.prototype.Mo=function(t,e){return Ci(t,this.userId,e)},t.prototype.Lo=function(t){var e=this;return qi(t).get(this.userId).next((function(t){return t||new Zr(e.userId,-1,"")}))},t}();function Ci(t,e,n){var r=ei.prefixForPath(e,n.path),i=r[1],o=IDBKeyRange.lowerBound(r),u=!1;return Mi(t).Fs({range:o,Ns:!0},(function(t,n,r){var o=t[0],s=t[1];t[2],o===e&&s===i&&(u=!0),r.done()})).next((function(){return u}))}function Vi(t){return vi(t,ti.store)}function Mi(t){return vi(t,ei.store)}function qi(t){return vi(t,Zr.store)}var Fi=function(){function t(t){this.$o=t}return t.prototype.next=function(){return this.$o+=2,this.$o},t.Bo=function(){return new t(0)},t.qo=function(){return new t(-1)},t}(),Bi=function(){function t(t,e){this.Io=t,this.fe=e}return t.prototype.Uo=function(t){var e=this;return this.Qo(t).next((function(n){var r=new Fi(n.highestTargetId);return n.highestTargetId=r.next(),e.Ko(t,n).next((function(){return n.highestTargetId}))}))},t.prototype.Wo=function(t){return this.Qo(t).next((function(t){return $.wt(new J(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))}))},t.prototype.jo=function(t){return this.Qo(t).next((function(t){return t.highestListenSequenceNumber}))},t.prototype.Go=function(t,e,n){var r=this;
1return this.Qo(t).next((function(i){return i.highestListenSequenceNumber=e,n&&(i.lastRemoteSnapshotVersion=n.Tt()),e>i.highestListenSequenceNumber&&(i.highestListenSequenceNumber=e),r.Ko(t,i)}))},t.prototype.zo=function(t,e){var n=this;return this.Ho(t,e).next((function(){return n.Qo(t).next((function(r){return r.targetCount+=1,n.Jo(e,r),n.Ko(t,r)}))}))},t.prototype.Yo=function(t,e){return this.Ho(t,e)},t.prototype.Xo=function(t,e){var n=this;return this.Zo(t,e.targetId).next((function(){return Gi(t).delete(e.targetId)})).next((function(){return n.Qo(t)})).next((function(e){return d(e.targetCount>0),e.targetCount-=1,n.Ko(t,e)}))},t.prototype.Br=function(t,e,n){var r=this,i=0,o=[];return Gi(t).Fs((function(u,s){var a=Oi(s);a.sequenceNumber<=e&&null===n.get(a.targetId)&&(i++,o.push(r.Xo(t,a)))})).next((function(){return ir.hs(o)})).next((function(){return i}))},t.prototype.Un=function(t,e){return Gi(t).Fs((function(t,n){var r=Oi(n);e(r)}))},t.prototype.Qo=function(t){return zi(t).get(ai.key).next((function(t){return d(null!==t),t}))},t.prototype.Ko=function(t,e){return zi(t).put(ai.key,e)},t.prototype.Ho=function(t,e){return Gi(t).put(Ti(this.fe,e))},t.prototype.Jo=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.tc=function(t){return this.Qo(t).next((function(t){return t.targetCount}))},t.prototype.ec=function(t,e){var n=Rt(e),r=IDBKeyRange.bound([n,Number.NEGATIVE_INFINITY],[n,Number.POSITIVE_INFINITY]),i=null;return Gi(t).Fs({range:r,index:ui.queryTargetsIndexName},(function(t,n,r){var o=Oi(n);Lt(e,o.target)&&(i=o,r.done())})).next((function(){return i}))},t.prototype.nc=function(t,e,n){var r=this,i=[],o=Ki(t);return e.forEach((function(e){var u=Wr(e.path);i.push(o.put(new si(n,u))),i.push(r.Io.sc(t,n,e))})),ir.hs(i)},t.prototype.ic=function(t,e,n){var r=this,i=Ki(t);return ir.forEach(e,(function(e){var o=Wr(e.path);return ir.hs([i.delete([n,o]),r.Io.rc(t,n,e)])}))},t.prototype.Zo=function(t,e){var n=Ki(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return n.delete(r)},t.prototype.oc=function(t,e){var n=IDBKeyRange.bound([e],[e+1],!1,!0),r=Ki(t),i=fn();return r.Fs({range:n,Ns:!0},(function(t,e,n){var r=Jr(t[1]),o=new nt(r);i=i.add(o)})).next((function(){return i}))},t.prototype.Mo=function(t,e){var n=Wr(e.path),r=IDBKeyRange.bound([n],[w(n)],!1,!0),i=0;return Ki(t).Fs({index:si.documentTargetsIndex,Ns:!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.Zn=function(t,e){return Gi(t).get(e).next((function(t){return t?Oi(t):null}))},t}();function Gi(t){return vi(t,ui.store)}function zi(t){return vi(t,ai.store)}function Ki(t){return vi(t,si.store)}var Qi=function(){function t(t,e){this.db=t,this.vr=function(t,e){return new Lr(t,e)}(this,e)}return t.prototype.Mr=function(t){var e=this.cc(t);return this.db.ac().tc(t).next((function(t){return e.next((function(e){return t+e}))}))},t.prototype.cc=function(t){var e=0;return this.$r(t,(function(t){e++})).next((function(){return e}))},t.prototype.Un=function(t,e){return this.db.ac().Un(t,e)},t.prototype.$r=function(t,e){return this.uc(t,(function(t,n){return e(n)}))},t.prototype.sc=function(t,e,n){return Wi(t,n)},t.prototype.rc=function(t,e,n){return Wi(t,n)},t.prototype.Br=function(t,e,n){return this.db.ac().Br(t,e,n)},t.prototype.Oo=function(t,e){return Wi(t,e)},t.prototype.hc=function(t,e){return function(t,e){var n=!1;return qi(t).Os((function(r){return Ci(t,r,e).next((function(t){return t&&(n=!0),ir.resolve(!t)}))})).next((function(){return n}))}(t,e)},t.prototype.qr=function(t,e){var n=this,r=this.db._c().lc(),i=[],o=0;return this.uc(t,(function(u,s){if(s<=e){var a=n.hc(t,u).next((function(e){if(!e)return o++,r.Ar(t,u).next((function(){return r.mr(u),Ki(t).delete([0,Wr(u.path)])}))}));i.push(a)}})).next((function(){return ir.hs(i)})).next((function(){return r.apply(t)})).next((function(){return o}))},t.prototype.removeTarget=function(t,e){var n=e.ce(t.oo);return this.db.ac().Yo(t,n)},t.prototype.fc=function(t,e){return Wi(t,e)},t.prototype.uc=function(t,e){var n,r=Ki(t),i=Tr.Zi;return r.Fs({index:si.documentTargetsIndex},(function(t,r){var o=t[0],u=(t[1],r.path),s=r.sequenceNumber;0===o?(i!==Tr.Zi&&e(new nt(Jr(n)),i),i=s,n=u):i=Tr.Zi})).next((function(){i!==Tr.Zi&&e(new nt(Jr(n)),i)}))},t.prototype.Qr=function(t){return this.db._c().dc(t)},t}();function Wi(t,e){return Ki(t).put(function(t,e){return new si(0,Wr(t.path),e)}(e,t.oo))}var Hi=function(){function t(t,e){this.fe=t,this.To=e}return t.prototype.Er=function(t,e,n){return $i(t).put(Xi(e),n)},t.prototype.mr=function(t,e){var n=$i(t),r=Xi(e);return n.delete(r)},t.prototype.updateMetadata=function(t,e){var n=this;return this.getMetadata(t).next((function(r){return r.byteSize+=e,n.wc(t,r)}))},t.prototype.Ar=function(t,e){var n=this;return $i(t).get(Xi(e)).next((function(t){return n.Ec(t)}))},t.prototype.Tc=function(t,e){var n=this;return $i(t).get(Xi(e)).next((function(t){var e=n.Ec(t);return e?{Ir:e,size:Li(t)}:null}))},t.prototype.getEntries=function(t,e){var n=this,r=rn();return this.Ic(t,e,(function(t,e){var i=n.Ec(e);r=r.Ie(t,i)})).next((function(){return r}))},t.prototype.mc=function(t,e){var n=this,r=rn(),i=new Je(nt.At);return this.Ic(t,e,(function(t,e){var o=n.Ec(e);o?(r=r.Ie(t,o),i=i.Ie(t,Li(e))):(r=r.Ie(t,null),i=i.Ie(t,0))})).next((function(){return{Ac:r,Rc:i}}))},t.prototype.Ic=function(t,e,n){if(e.bt())return ir.resolve();var r=IDBKeyRange.bound(e.first().path.Dt(),e.last().path.Dt()),i=e.ge(),o=i.De();return $i(t).Fs({range:r},(function(t,e,r){for(var u=nt.Ut(t);o&&nt.At(o,u)<0;)n(o,null),o=i.De();o&&o.isEqual(u)&&(n(o,e),o=i.Ce()?i.De():null),o?r.Ss(o.path.Dt()):r.done()})).next((function(){for(;o;)n(o,null),o=i.Ce()?i.De():null}))},t.prototype.Pc=function(t,e,n){var r=this,i=un(),o=e.path.length+1,u={};if(n.isEqual($.min())){var s=e.path.Dt();u.range=IDBKeyRange.lowerBound(s)}else{var a=e.path.Dt(),c=bi(n);
1u.range=IDBKeyRange.lowerBound([a,c],!0),u.index=ii.collectionReadTimeIndex}return $i(t).Fs(u,(function(t,n,u){if(t.length===o){var s=mi(r.fe,n);e.path.vt(s.key.path)?s instanceof Dt&&le(e,s)&&(i=i.Ie(s.key,s)):u.done()}})).next((function(){return i}))},t.prototype.lc=function(t){return new Yi(this,!!t&&t.yc)},t.prototype.dc=function(t){return this.getMetadata(t).next((function(t){return t.byteSize}))},t.prototype.getMetadata=function(t){return Ji(t).get(oi.key).next((function(t){return d(!!t),t}))},t.prototype.wc=function(t,e){return Ji(t).put(oi.key,e)},t.prototype.Ec=function(t){if(t){var e=mi(this.fe,t);return e instanceof kt&&e.version.isEqual($.min())?null:e}return null},t}(),Yi=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).gc=e,r.yc=n,r.Vc=new kr((function(t){return t.toString()}),(function(t,e){return t.isEqual(e)})),r}return Object(u.c)(e,t),e.prototype.yr=function(t){var e=this,n=[],r=0,i=new Ze((function(t,e){return g(t.Ct(),e.Ct())}));return this._r.forEach((function(o,u){var s=e.Vc.get(o);if(u.Ir){var a=gi(e.gc.fe,u.Ir,e.wr(o));i=i.add(o.path.yt());var c=Li(a);r+=c-s,n.push(e.gc.Er(t,o,a))}else if(r-=s,e.yc){var f=gi(e.gc.fe,new kt(o,$.min()),e.wr(o));n.push(e.gc.Er(t,o,f))}else n.push(e.gc.mr(t,o))})),i.forEach((function(r){n.push(e.gc.To.fo(t,r))})),n.push(this.gc.updateMetadata(t,r)),ir.hs(n)},e.prototype.Rr=function(t,e){var n=this;return this.gc.Tc(t,e).next((function(t){return null===t?(n.Vc.set(e,0),null):(n.Vc.set(e,t.size),t.Ir)}))},e.prototype.Pr=function(t,e){var n=this;return this.gc.mc(t,e).next((function(t){var e=t.Ac;return t.Rc.forEach((function(t,e){n.Vc.set(t,e)})),e}))},e}(Sr);function Ji(t){return vi(t,oi.store)}function $i(t){return vi(t,ii.store)}function Xi(t){return t.path.Dt()}var Zi=function(){function t(t){this.fe=t}return t.prototype.Ps=function(t,e,n,r){var i=this;d(n<r&&n>=0&&r<=11);var o=new or("createOrUpgrade",e);n<1&&r>=1&&(function(t){t.createObjectStore(Xr.store)}(t),function(t){t.createObjectStore(Zr.store,{keyPath:Zr.keyPath}),t.createObjectStore(ti.store,{keyPath:ti.keyPath,autoIncrement:!0}).createIndex(ti.userMutationsIndex,ti.userMutationsKeyPath,{unique:!0}),t.createObjectStore(ei.store)}(t),to(t),function(t){t.createObjectStore(ii.store)}(t));var u=ir.resolve();return n<3&&r>=3&&(0!==n&&(function(t){t.deleteObjectStore(si.store),t.deleteObjectStore(ui.store),t.deleteObjectStore(ai.store)}(t),to(t)),u=u.next((function(){return function(t){var e=t.store(ai.store),n=new ai(0,0,$.min().Tt(),0);return e.put(ai.key,n)}(o)}))),n<4&&r>=4&&(0!==n&&(u=u.next((function(){return function(t,e){return e.store(ti.store).Ds().next((function(n){t.deleteObjectStore(ti.store),t.createObjectStore(ti.store,{keyPath:ti.keyPath,autoIncrement:!0}).createIndex(ti.userMutationsIndex,ti.userMutationsKeyPath,{unique:!0});var r=e.store(ti.store),i=n.map((function(t){return r.put(t)}));return ir.hs(i)}))}(t,o)}))),u=u.next((function(){!function(t){t.createObjectStore(fi.store,{keyPath:fi.keyPath})}(t)}))),n<5&&r>=5&&(u=u.next((function(){return i.bc(o)}))),n<6&&r>=6&&(u=u.next((function(){return function(t){t.createObjectStore(oi.store)}(t),i.vc(o)}))),n<7&&r>=7&&(u=u.next((function(){return i.Sc(o)}))),n<8&&r>=8&&(u=u.next((function(){return i.Dc(t,o)}))),n<9&&r>=9&&(u=u.next((function(){!function(t){t.objectStoreNames.contains("remoteDocumentChanges")&&t.deleteObjectStore("remoteDocumentChanges")}(t),function(t){var e=t.objectStore(ii.store);e.createIndex(ii.readTimeIndex,ii.readTimeIndexPath,{unique:!1}),e.createIndex(ii.collectionReadTimeIndex,ii.collectionReadTimeIndexPath,{unique:!1})}(e)}))),n<10&&r>=10&&(u=u.next((function(){return i.Cc(o)}))),n<11&&r>=11&&(u=u.next((function(){!function(t){t.createObjectStore(hi.store,{keyPath:hi.keyPath})}(t),function(t){t.createObjectStore(li.store,{keyPath:li.keyPath})}(t)}))),u},t.prototype.vc=function(t){var e=0;return t.store(ii.store).Fs((function(t,n){e+=Li(n)})).next((function(){var n=new oi(e);return t.store(oi.store).put(oi.key,n)}))},t.prototype.bc=function(t){var e=this,n=t.store(Zr.store),r=t.store(ti.store);return n.Ds().next((function(n){return ir.forEach(n,(function(n){var i=IDBKeyRange.bound([n.userId,-1],[n.userId,n.lastAcknowledgedBatchId]);return r.Ds(ti.userMutationsIndex,i).next((function(r){return ir.forEach(r,(function(r){d(r.userId===n.userId);var i=Ei(e.fe,r);return Ri(t,n.userId,i).next((function(){}))}))}))}))}))},t.prototype.Sc=function(t){var e=t.store(si.store),n=t.store(ii.store);return t.store(ai.store).get(ai.key).next((function(t){var r=[];return n.Fs((function(n,i){var o=new Z(n),u=function(t){return[0,Wr(t)]}(o);r.push(e.get(u).next((function(n){return n?ir.resolve():function(n){return e.put(new si(0,Wr(n),t.highestListenSequenceNumber))}(o)})))})).next((function(){return ir.hs(r)}))}
1))},t.prototype.Dc=function(t,e){t.createObjectStore(ci.store,{keyPath:ci.keyPath});var n=e.store(ci.store),r=new Si,i=function(t){if(r.add(t)){var e=t.Vt(),i=t.yt();return n.put({collectionId:e,parent:Wr(i)})}};return e.store(ii.store).Fs({Ns:!0},(function(t,e){var n=new Z(t);return i(n.yt())})).next((function(){return e.store(ei.store).Fs({Ns:!0},(function(t,e){t[0];var n=t[1],r=(t[2],Jr(n));return i(r.yt())}))}))},t.prototype.Cc=function(t){var e=this,n=t.store(ui.store);return n.Fs((function(t,r){var i=Oi(r),o=Ti(e.fe,i);return n.put(o)}))},t}();function to(t){t.createObjectStore(si.store,{keyPath:si.keyPath}).createIndex(si.documentTargetsIndex,si.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(ui.store,{keyPath:ui.keyPath}).createIndex(ui.queryTargetsIndexName,ui.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(ai.store)}var eo="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",no=function(){function t(e,n,r,i,o,u,s,a,c,h){if(this.allowTabSynchronization=e,this.persistenceKey=n,this.clientId=r,this.js=o,this.window=u,this.document=s,this.xc=c,this.Nc=h,this.Fc=null,this.Oc=!1,this.isPrimary=!1,this.networkEnabled=!0,this.kc=null,this.inForeground=!1,this.Mc=null,this.Lc=null,this.$c=Number.NEGATIVE_INFINITY,this.Bc=function(t){return Promise.resolve()},!t.G())throw new E(_.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.Io=new Qi(this,i),this.qc=n+"main",this.fe=new yi(a),this.Uc=new ur(this.qc,11,new Zi(this.fe)),this.Qc=new Bi(this.Io,this.fe),this.To=new xi,this.Kc=function(t,e){return new Hi(t,e)}(this.fe,this.To),this.Wc=new ji,this.window&&this.window.localStorage?this.jc=this.window.localStorage:(this.jc=null,!1===h&&f("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}return t.prototype.start=function(){var t=this;return this.Gc().then((function(){if(!t.isPrimary&&!t.allowTabSynchronization)throw new E(_.FAILED_PRECONDITION,eo);return t.zc(),t.Hc(),t.Jc(),t.runTransaction("getHighestListenSequenceNumber","readonly",(function(e){return t.Qc.jo(e)}))})).then((function(e){t.Fc=new Tr(e,t.xc)})).then((function(){t.Oc=!0})).catch((function(e){return t.Uc&&t.Uc.close(),Promise.reject(e)}))},t.prototype.Yc=function(t){var e=this;return this.Bc=function(n){return Object(u.b)(e,void 0,void 0,(function(){return Object(u.d)(this,(function(e){return this.Nr?[2,t(n)]:[2]}))}))},t(this.isPrimary)},t.prototype.Xc=function(t){var e=this;this.Uc.gs((function(n){return Object(u.b)(e,void 0,void 0,(function(){return Object(u.d)(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]}}
1))}))}))},t.prototype.Zc=function(t){var e=this;this.networkEnabled!==t&&(this.networkEnabled=t,this.js.Ws((function(){return Object(u.b)(e,void 0,void 0,(function(){return Object(u.d)(this,(function(t){switch(t.label){case 0:return this.Nr?[4,this.Gc()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))})))},t.prototype.Gc=function(){var t=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",(function(e){return io(e).put(new fi(t.clientId,Date.now(),t.networkEnabled,t.inForeground)).next((function(){if(t.isPrimary)return t.ta(e).next((function(e){e||(t.isPrimary=!1,t.js.ea((function(){return t.Bc(!1)})))}))})).next((function(){return t.na(e)})).next((function(n){return t.isPrimary&&!n?t.sa(e).next((function(){return!1})):!!n&&t.ia(e).next((function(){return!0}))}))})).catch((function(e){if(cr(e))return c("IndexedDbPersistence","Failed to extend owner lease: ",e),t.isPrimary;if(!t.allowTabSynchronization)throw e;return c("IndexedDbPersistence","Releasing owner lease after error during lease refresh",e),!1})).then((function(e){t.isPrimary!==e&&t.js.ea((function(){return t.Bc(e)})),t.isPrimary=e}))},t.prototype.ta=function(t){var e=this;return ro(t).get(Xr.key).next((function(t){return ir.resolve(e.ra(t))}))},t.prototype.oa=function(t){return io(t).delete(this.clientId)},t.prototype.ca=function(){return Object(u.b)(this,void 0,void 0,(function(){var t,e,n,r,i=this;return Object(u.d)(this,(function(o){switch(o.label){case 0:return!this.isPrimary||this.aa(this.$c,18e5)?[3,2]:(this.$c=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",(function(t){var e=vi(t,fi.store);return e.Ds().next((function(t){var n=i.ua(t,18e5),r=t.filter((function(t){return-1===n.indexOf(t)}));return ir.forEach(r,(function(t){return e.delete(t.clientId)})).next((function(){return r}))}))})).catch((function(){return[]}))]);case 1:if(t=o.sent(),this.jc)for(e=0,n=t;e<n.length;e++)r=n[e],this.jc.removeItem(this.ha(r.clientId));o.label=2;case 2:return[2]}}
1))}))},t.prototype.Jc=function(){var t=this;this.Lc=this.js.ni("client_metadata_refresh",4e3,(function(){return t.Gc().then((function(){return t.ca()})).then((function(){return t.Jc()}))}))},t.prototype.ra=function(t){return!!t&&t.ownerId===this.clientId},t.prototype.na=function(t){var e=this;return this.Nc?ir.resolve(!0):ro(t).get(Xr.key).next((function(n){if(null!==n&&e.aa(n.leaseTimestampMs,5e3)&&!e.la(n.ownerId)){if(e.ra(n)&&e.networkEnabled)return!0;if(!e.ra(n)){if(!n.allowTabSynchronization)throw new E(_.FAILED_PRECONDITION,eo);return!1}}return!(!e.networkEnabled||!e.inForeground)||io(t).Ds().next((function(t){return void 0===e.ua(t,5e3).find((function(t){if(e.clientId!==t.clientId){var n=!e.networkEnabled&&t.networkEnabled,r=!e.inForeground&&t.inForeground,i=e.networkEnabled===t.networkEnabled;if(n||r&&i)return!0}return!1}))}))})).next((function(t){return e.isPrimary!==t&&c("IndexedDbPersistence","Client "+(t?"is":"is not")+" eligible for a primary lease."),t}))},t.prototype.$=function(){return Object(u.b)(this,void 0,void 0,(function(){var t=this;return Object(u.d)(this,(function(e){switch(e.label){case 0:return this.Oc=!1,this._a(),this.Lc&&(this.Lc.cancel(),this.Lc=null),this.fa(),this.da(),[4,this.Uc.runTransaction("shutdown","readwrite",[Xr.store,fi.store],(function(e){var n=new di(e,Tr.Zi);return t.sa(n).next((function(){return t.oa(n)}))}))];case 1:return e.sent(),this.Uc.close(),this.wa(),[2]}}))}))},t.prototype.ua=function(t,e){var n=this;return t.filter((function(t){return n.aa(t.updateTimeMs,e)&&!n.la(t.clientId)}))},t.prototype.Ea=function(){var t=this;return this.runTransaction("getActiveClients","readonly",(function(e){return io(e).Ds().next((function(e){return t.ua(e,18e5).map((function(t){return t.clientId}))}))}))},Object.defineProperty(t.prototype,"Nr",{get:function(){return this.Oc},enumerable:!1,configurable:!0}),t.prototype.Ta=function(t){return Ui.Ao(t,this.fe,this.To,this.Io)},t.prototype.ac=function(){return this.Qc},t.prototype._c=function(){return this.Kc},t.prototype.Ia=function(){return this.To},t.prototype.ma=function(){return this.Wc},t.prototype.runTransaction=function(t,e,n){var r=this;c("IndexedDbPersistence","Starting transaction:",t);var i,o="readonly"===e?"readonly":"readwrite";return this.Uc.runTransaction(t,o,pi,(function(o){return i=new di(o,r.Fc?r.Fc.next():Tr.Zi),"readwrite-primary"===e?r.ta(i).next((function(t){return!!t||r.na(i)})).next((function(e){if(!e)throw f("Failed to obtain primary lease for action '"+t+"'."),r.isPrimary=!1,r.js.ea((function(){return r.Bc(!1)})),new E(_.FAILED_PRECONDITION,Ir);return n(i)})).next((function(t){return r.ia(i).next((function(){return t}))})):r.Aa(i).next((function(){return n(i)}))})).then((function(t){return i.ki(),t}))},t.prototype.Aa=function(t){var e=this;return ro(t).get(Xr.key).next((function(t){if(null!==t&&e.aa(t.leaseTimestampMs,5e3)&&!e.la(t.ownerId)&&!e.ra(t)&&!(e.Nc||e.allowTabSynchronization&&t.allowTabSynchronization))throw new E(_.FAILED_PRECONDITION,eo)}))},t.prototype.ia=function(t){var e=new Xr(this.clientId,this.allowTabSynchronization,Date.now());return ro(t).put(Xr.key,e)},t.G=function(){return ur.G()},t.prototype.sa=function(t){var e=this,n=ro(t);return n.get(Xr.key).next((function(t){return e.ra(t)?(c("IndexedDbPersistence","Releasing primary lease."),n.delete(Xr.key)):ir.resolve()}))},t.prototype.aa=function(t,e){var n=Date.now();return!(t<n-e||t>n&&(f("Detected an update time that is in the future: "+t+" > "+n),1))},t.prototype.zc=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.Mc=function(){t.js.Ws((function(){return t.inForeground="visible"===t.document.visibilityState,t.Gc()}))},this.document.addEventListener("visibilitychange",this.Mc),this.inForeground="visible"===this.document.visibilityState)},t.prototype.fa=function(){this.Mc&&(this.document.removeEventListener("visibilitychange",this.Mc),this.Mc=null)},t.prototype.Hc=function(){var t,e=this;"function"==typeof(null===(t=this.window)||void 0===t?void 0:t.addEventListener)&&(this.kc=function(){e._a(),e.js.Ws((function(){return e.$()}))},this.window.addEventListener("unload",this.kc))},t.prototype.da=function(){this.kc&&(this.window.removeEventListener("unload",this.kc),this.kc=null)},t.prototype.la=function(t){var e;try{var n=null!==(null===(e=this.jc)||void 0===e?void 0:e.getItem(this.ha(t)));return c("IndexedDbPersistence","Client '"+t+"' "+(n?"is":"is not")+" zombied in LocalStorage"),n}catch(t){return f("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},t.prototype._a=function(){if(this.jc)try{this.jc.setItem(this.ha(this.clientId),String(Date.now()))}catch(t){f("Failed to set zombie client id.",t)}},t.prototype.wa=function(){if(this.jc)try{this.jc.removeItem(this.ha(this.clientId))}catch(t){}},t.prototype.ha=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},t}();function ro(t){return vi(t,Xr.store)}function io(t){return vi(t,fi.store)}function oo(t,e){var n=t.projectId;return t.M||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}var uo=function(){function t(t,e,n){this.Kc=t,this.Ra=e,this.To=n}return t.prototype.Pa=function(t,e){var n=this;return this.Ra.So(t,e).next((function(r){return n.ya(t,e,r)}))},t.prototype.ya=function(t,e,n){return this.Kc.Ar(t,e).next((function(t){for(var r=0,i=n;r<i.length;r++)t=i[r].ir(e,t);return t}))},t.prototype.ga=function(t,e,n){var r=rn();return e.forEach((function(t,e){for(var i=0,o=n;i<o.length;i++)e=o[i].ir(t,e);r=r.Ie(t,e)})),r},t.prototype.Va=function(t,e){var n=this;return this.Kc.getEntries(t,e).next((function(e){return n.pa(t,e)}))},t.prototype.pa=function(t,e){var n=this;return this.Ra.Do(t,e).next((function(r){var i=n.ga(t,e,r),o=nn();
1return i.forEach((function(t,e){e||(e=new kt(t,$.min())),o=o.Ie(t,e)})),o}))},t.prototype.Pc=function(t,e,n){return function(t){return nt.qt(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.ba(t,e.path):oe(e)?this.va(t,e,n):this.Sa(t,e,n)},t.prototype.ba=function(t,e){return this.Pa(t,new nt(e)).next((function(t){var e=un();return t instanceof Dt&&(e=e.Ie(t.key,t)),e}))},t.prototype.va=function(t,e,n){var r=this,i=e.collectionGroup,o=un();return this.To.wo(t,i).next((function(u){return ir.forEach(u,(function(u){var s=function(t,e){return new Xt(e,null,t.ne.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,u.child(i));return r.Sa(t,s,n).next((function(t){t.forEach((function(t,e){o=o.Ie(t,e)}))}))})).next((function(){return o}))}))},t.prototype.Sa=function(t,e,n){var r,i,o=this;return this.Kc.Pc(t,e,n).next((function(n){return r=n,o.Ra.xo(t,e)})).next((function(e){return i=e,o.Da(t,i,r).next((function(t){r=t;for(var e=0,n=i;e<n.length;e++)for(var o=n[e],u=0,s=o.mutations;u<s.length;u++){var a=s[u],c=a.key,f=r.get(c),h=Ce(a,f,f,o.er);r=h instanceof Dt?r.Ie(c,h):r.remove(c)}}))})).next((function(){return r.forEach((function(t,n){le(e,n)||(r=r.remove(t))})),r}))},t.prototype.Da=function(t,e,n){for(var r=fn(),i=0,o=e;i<o.length;i++)for(var u=0,s=o[i].mutations;u<s.length;u++){var a=s[u];a instanceof Be&&null===n.get(a.key)&&(r=r.add(a.key))}var c=n;return this.Kc.getEntries(t,r).next((function(t){return t.forEach((function(t,e){null!==e&&e instanceof Dt&&(c=c.Ie(t,e))})),c}))},t}(),so=function(){function t(t,e,n,r){this.targetId=t,this.fromCache=e,this.Ca=n,this.xa=r}return t.Na=function(e,n){for(var r=fn(),i=fn(),o=0,u=n.docChanges;o<u.length;o++){var s=u[o];switch(s.type){case 0:r=r.add(s.doc.key);break;case 1:i=i.add(s.doc.key)}}return new t(e,n.fromCache,r,i)},t}(),ao=function(){function t(){}return t.prototype.Fa=function(t){this.Oa=t},t.prototype.Pc=function(t,e,n,i){var o=this;return function(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.ne.length||1===t.ne.length&&t.ne[0].field.Ot())}(e)||n.isEqual($.min())?this.ka(t,e):this.Oa.Va(t,i).next((function(u){var s=o.Ma(e,u);return(ee(e)||ne(e))&&o.La(e.limitType,s,i,n)?o.ka(t,e):(a()<=r.a.DEBUG&&c("QueryEngine","Re-using previous result from %s to execute query: %s",n.toString(),he(e)),o.Oa.Pc(t,e,n).next((function(t){return s.forEach((function(e){t=t.Ie(e.key,e)})),t})))}))},t.prototype.Ma=function(t,e){var n=new Ze(pe(t));return e.forEach((function(e,r){r instanceof Dt&&le(t,r)&&(n=n.add(r))})),n},t.prototype.La=function(t,e,n,r){if(n.size!==e.size)return!0;var i="F"===t?e.last():e.first();return!!i&&(i.hasPendingWrites||i.version.u(r)>0)},t.prototype.ka=function(t,e){return a()<=r.a.DEBUG&&c("QueryEngine","Using full collection scan to execute query:",he(e)),this.Oa.Pc(t,e,$.min())},t}(),co=function(){function t(t,e,n,r){this.persistence=t,this.$a=e,this.fe=r,this.Ba=new Je(g),this.qa=new kr((function(t){return Rt(t)}),Lt),this.Ua=$.min(),this.Ra=t.Ta(n),this.Qa=t._c(),this.Qc=t.ac(),this.Ka=new uo(this.Qa,this.Ra,this.persistence.Ia()),this.Wc=t.ma(),this.$a.Fa(this.Ka)}return t.prototype.Fr=function(t){var e=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",(function(n){return t.Ur(n,e.Ba)}))},t}();function fo(t,e,n,r){return new co(t,e,n,r)}function ho(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r,i,o;return Object(u.d)(this,(function(u){switch(u.label){case 0:return n=v(t),r=n.Ra,i=n.Ka,[4,n.persistence.runTransaction("Handle user change","readonly",(function(t){var o;return n.Ra.vo(t).next((function(u){return o=u,r=n.persistence.Ta(e),i=new uo(n.Qa,r,n.persistence.Ia()),r.vo(t)})).next((function(e){for(var n=[],r=[],u=fn(),s=0,a=o;s<a.length;s++){var c=a[s];n.push(c.batchId);for(var f=0,h=c.mutations;f<h.length;f++){var l=h[f];u=u.add(l.key)}}for(var p=0,d=e;p<d.length;p++){var v=d[p];r.push(v.batchId);for(var y=0,m=v.mutations;y<m.length;y++){var g=m[y];u=u.add(g.key)}}return i.Va(t,u).next((function(t){return{Wa:t,ja:n,Ga:r}}))}))}))];case 1:return o=u.sent(),[2,(n.Ra=r,n.Ka=i,n.$a.Fa(n.Ka),o)]}}))}))}function lo(t,e){var n=v(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(function(t){var r=e.batch.keys(),i=n.Qa.lc({yc:!0});return function(t,e,n,r){var i=n.batch,o=i.keys(),u=ir.resolve();return o.forEach((function(t){u=u.next((function(){return r.Ar(e,t)})).next((function(e){var o=e,u=n.ar.get(t);d(null!==u),(!o||o.version.u(u)<0)&&(o=i.nr(t,o,n))&&r.Er(o,n.cr)}))})),u.next((function(){return t.Ra.No(e,i)}))}(n,t,e,i).next((function(){return i.apply(t)})).next((function(){return n.Ra.ko(t)})).next((function(){return n.Ka.Va(t,r)}
1))}))}function po(t){var e=v(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(function(t){return e.Qc.Wo(t)}))}function vo(t,e){var n=v(t),r=e.oe,i=n.Ba;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(function(t){var o=n.Qa.lc({yc:!0});i=n.Ba;var u=[];e.rn.forEach((function(e,o){var s=i.get(o);if(s){u.push(n.Qc.ic(t,e.dn,o).next((function(){return n.Qc.nc(t,e._n,o)})));var a=e.resumeToken;if(a.o()>0){var c=s.ae(a,r).ce(t.oo);i=i.Ie(o,c),function(t,e,n){return d(e.resumeToken.o()>0),0===t.resumeToken.o()||e.oe.Et()-t.oe.Et()>=3e8||n._n.size+n.fn.size+n.dn.size>0}(s,c,e)&&u.push(n.Qc.Yo(t,c))}}}));var s=nn();if(e.cn.forEach((function(r,i){e.an.has(r)&&u.push(n.persistence.Io.fc(t,r))})),u.push(yo(t,o,e.cn,r,void 0).next((function(t){s=t}))),!r.isEqual($.min())){var a=n.Qc.Wo(t).next((function(e){return n.Qc.Go(t,t.oo,r)}));u.push(a)}return ir.hs(u).next((function(){return o.apply(t)})).next((function(){return n.Ka.pa(t,s)}))})).then((function(t){return n.Ba=i,t}))}function yo(t,e,n,r,i){var o=fn();return n.forEach((function(t){return o=o.add(t)})),e.getEntries(t,o).next((function(t){var o=nn();return n.forEach((function(n,u){var s=t.get(n),a=(null==i?void 0:i.get(n))||r;u instanceof kt&&u.version.isEqual($.min())?(e.mr(n,a),o=o.Ie(n,u)):null==s||u.version.u(s.version)>0||0===u.version.u(s.version)&&s.hasPendingWrites?(e.Er(u,a),o=o.Ie(n,u)):c("LocalStore","Ignoring outdated watch update for ",n,". Current version:",s.version," Watch version:",u.version)})),o}))}function mo(t,e){var n=v(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(function(t){return void 0===e&&(e=-1),n.Ra.po(t,e)}))}function go(t,e){var n=v(t);return n.persistence.runTransaction("Allocate target","readwrite",(function(t){var r;return n.Qc.ec(t,e).next((function(i){return i?(r=i,ir.resolve(r)):n.Qc.Uo(t).next((function(i){return r=new ve(e,i,0,t.oo),n.Qc.zo(t,r).next((function(){return r}))}))}))})).then((function(t){var r=n.Ba.get(t.targetId);return(null===r||t.oe.u(r.oe)>0)&&(n.Ba=n.Ba.Ie(t.targetId,t),n.qa.set(e,t.targetId)),t}))}function bo(t,e,n){return Object(u.b)(this,void 0,void 0,(function(){var r,i,o,s;return Object(u.d)(this,(function(u){switch(u.label){case 0:r=v(t),i=r.Ba.get(e),o=n?"readwrite":"readwrite-primary",u.label=1;case 1:return u.trys.push([1,4,,5]),n?[3,3]:[4,r.persistence.runTransaction("Release target",o,(function(t){return r.persistence.Io.removeTarget(t,i)}))];case 2:u.sent(),u.label=3;case 3:return[3,5];case 4:if(!cr(s=u.sent()))throw s;return c("LocalStore","Failed to update sequence numbers for target "+e+": "+s),[3,5];case 5:return r.Ba=r.Ba.remove(e),r.qa.delete(i.target),[2]}}))}))}function wo(t,e,n){var r=v(t),i=$.min(),o=fn();return r.persistence.runTransaction("Execute query","readonly",(function(t){return function(t,e,n){var r=v(t),i=r.qa.get(n);return void 0!==i?ir.resolve(r.Ba.get(i)):r.Qc.ec(e,n)}(r,t,se(e)).next((function(e){if(e)return i=e.lastLimboFreeSnapshotVersion,r.Qc.oc(t,e.targetId).next((function(t){o=t}))})).next((function(){return r.$a.Pc(t,e,n?i:$.min(),n?o:fn())})).next((function(t){return{documents:t,za:o}}))}))}function Io(t,e){var n=v(t),r=v(n.Qc),i=n.Ba.get(e);return i?Promise.resolve(i.target):n.persistence.runTransaction("Get target data","readonly",(function(t){return r.Zn(t,e).next((function(t){return t?t.target:null}))}))}function _o(t){var e=v(t);return e.persistence.runTransaction("Get new document changes","readonly",(function(t){return function(t,e,n){var r=v(t),i=nn(),o=bi(n),u=$i(e),s=IDBKeyRange.lowerBound(o,!0);return u.Fs({index:ii.readTimeIndex,range:s},(function(t,e){var n=mi(r.fe,e);i=i.Ie(n.key,n),o=e.readTime})).next((function(){return{tr:i,readTime:wi(o)}}))}(e.Qa,t,e.Ua)})).then((function(t){var n=t.tr,r=t.readTime;return e.Ua=r,n}))}function Eo(t){return Object(u.b)(this,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(n){return[2,(e=v(t)).persistence.runTransaction("Synchronize last document change read time","readonly",(function(t){return function(t){var e=$i(t),n=$.min();return e.Fs({index:ii.readTimeIndex,reverse:!0},(function(t,e,r){e.readTime&&(n=wi(e.readTime)),r.done()})).next((function(){return n}))}(t)})).then((function(t){e.Ua=t}))]}))}))}function Oo(t,e,n,r){return Object(u.b)(this,void 0,void 0,(function(){var i,o,s,a,c,f,h,l,p,d;return Object(u.d)(this,(function(u){switch(u.label){case 0:for(i=v(t),o=fn(),s=nn(),a=an(),c=0,f=n;c<f.length;c++)h=f[c],l=e.Ha(h.metadata.name),h.document&&(o=o.add(l)),s=s.Ie(l,e.Ja(h)),a=a.Ie(l,e.Ya(h.metadata.readTime));return p=i.Qa.lc({yc:!0}),[4,go(i,function(t){return se(te(Z.xt("__bundle__/docs/"+t)))}(r))];case 1:return d=u.sent(),[2,i.persistence.runTransaction("Apply bundle documents","readwrite",(function(t){return yo(t,p,s,$.min(),a).next((function(e){return p.apply(t),e})).next((function(e){return i.Qc.Zo(t,d.targetId).next((function(){return i.Qc.nc(t,o,d.targetId)})).next((function(){return i.Ka.pa(t,e)}))}
1))}))]}}))}))}function To(t,e,n){return void 0===n&&(n=fn()),Object(u.b)(this,void 0,void 0,(function(){var r,i;return Object(u.d)(this,(function(o){switch(o.label){case 0:return[4,go(t,se(Ni(e.bundledQuery)))];case 1:return r=o.sent(),[2,(i=v(t)).persistence.runTransaction("Save named query","readwrite",(function(t){var o=Sn(e.readTime);if(r.oe.u(o)>=0)return i.Wc.lo(t,e);var u=r.ae(I.h,o);return i.Ba=i.Ba.Ie(u.targetId,u),i.Qc.Yo(t,u).next((function(){return i.Qc.Zo(t,r.targetId)})).next((function(){return i.Qc.nc(t,n,r.targetId)})).next((function(){return i.Wc.lo(t,e)}))}))]}}))}))}var No=function(){function t(t){this.fe=t,this.Xa=new Map,this.Za=new Map}return t.prototype.ao=function(t,e){return ir.resolve(this.Xa.get(e))},t.prototype.uo=function(t,e){var n;return this.Xa.set(e.id,{id:(n=e).id,version:n.version,createTime:Sn(n.createTime)}),ir.resolve()},t.prototype.ho=function(t,e){return ir.resolve(this.Za.get(e))},t.prototype.lo=function(t,e){return this.Za.set(e.name,function(t){return{name:t.name,query:Ni(t.bundledQuery),readTime:Sn(t.readTime)}}(e)),ir.resolve()},t}(),jo=function(){function t(){this.tu=new Ze(Ao.eu),this.nu=new Ze(Ao.su)}return t.prototype.bt=function(){return this.tu.bt()},t.prototype.sc=function(t,e){var n=new Ao(t,e);this.tu=this.tu.add(n),this.nu=this.nu.add(n)},t.prototype.iu=function(t,e){var n=this;t.forEach((function(t){return n.sc(t,e)}))},t.prototype.rc=function(t,e){this.ru(new Ao(t,e))},t.prototype.ou=function(t,e){var n=this;t.forEach((function(t){return n.rc(t,e)}))},t.prototype.cu=function(t){var e=this,n=new nt(new Z([])),r=new Ao(n,t),i=new Ao(n,t+1),o=[];return this.nu.Qe([r,i],(function(t){e.ru(t),o.push(t.key)})),o},t.prototype.au=function(){var t=this;this.tu.forEach((function(e){return t.ru(e)}))},t.prototype.ru=function(t){this.tu=this.tu.delete(t),this.nu=this.nu.delete(t)},t.prototype.uu=function(t){var e=new nt(new Z([])),n=new Ao(e,t),r=new Ao(e,t+1),i=fn();return this.nu.Qe([n,r],(function(t){i=i.add(t.key)})),i},t.prototype.Mo=function(t){var e=new Ao(t,0),n=this.tu.We(e);return null!==n&&t.isEqual(n.key)},t}(),Ao=function(){function t(t,e){this.key=t,this.hu=e}return t.eu=function(t,e){return nt.At(t.key,e.key)||g(t.hu,e.hu)},t.su=function(t,e){return g(t.hu,e.hu)||nt.At(t.key,e.key)},t}(),Do=function(){function t(t,e){this.To=t,this.Io=e,this.Ra=[],this.lu=1,this._u=new Ze(Ao.eu)}return t.prototype.Ro=function(t){return ir.resolve(0===this.Ra.length)},t.prototype.Po=function(t,e,n,r){var i=this.lu;this.lu++,this.Ra.length>0&&this.Ra[this.Ra.length-1];var o=new Ar(i,e,n,r);this.Ra.push(o);for(var u=0,s=r;u<s.length;u++){var a=s[u];this._u=this._u.add(new Ao(a.key,i)),this.To.fo(t,a.key.path.yt())}return ir.resolve(o)},t.prototype.yo=function(t,e){return ir.resolve(this.fu(e))},t.prototype.po=function(t,e){var n=e+1,r=this.du(n),i=r<0?0:r;return ir.resolve(this.Ra.length>i?this.Ra[i]:null)},t.prototype.bo=function(){return ir.resolve(0===this.Ra.length?-1:this.lu-1)},t.prototype.vo=function(t){return ir.resolve(this.Ra.slice())},t.prototype.So=function(t,e){var n=this,r=new Ao(e,0),i=new Ao(e,Number.POSITIVE_INFINITY),o=[];return this._u.Qe([r,i],(function(t){var e=n.fu(t.hu);o.push(e)})),ir.resolve(o)},t.prototype.Do=function(t,e){var n=this,r=new Ze(g);return e.forEach((function(t){var e=new Ao(t,0),i=new Ao(t,Number.POSITIVE_INFINITY);n._u.Qe([e,i],(function(t){r=r.add(t.hu)}))})),ir.resolve(this.wu(r))},t.prototype.xo=function(t,e){var n=e.path,r=n.length+1,i=n;nt.qt(i)||(i=i.child(""));var o=new Ao(new nt(i),0),u=new Ze(g);return this._u.Ke((function(t){var e=t.key.path;return!!n.vt(e)&&(e.length===r&&(u=u.add(t.hu)),!0)}),o),ir.resolve(this.wu(u))},t.prototype.wu=function(t){var e=this,n=[];return t.forEach((function(t){var r=e.fu(t);null!==r&&n.push(r)})),n},t.prototype.No=function(t,e){var n=this;d(0===this.Eu(e.batchId,"removed")),this.Ra.shift();var r=this._u;return ir.forEach(e.mutations,(function(i){var o=new Ao(i.key,e.batchId);return r=r.delete(o),n.Io.Oo(t,i.key)})).next((function(){n._u=r}))},t.prototype.Fo=function(t){}
1,t.prototype.Mo=function(t,e){var n=new Ao(e,0),r=this._u.We(n);return ir.resolve(e.isEqual(r&&r.key))},t.prototype.ko=function(t){return this.Ra.length,ir.resolve()},t.prototype.Eu=function(t,e){return this.du(t)},t.prototype.du=function(t){return 0===this.Ra.length?0:t-this.Ra[0].batchId},t.prototype.fu=function(t){var e=this.du(t);return e<0||e>=this.Ra.length?null:this.Ra[e]},t}(),ko=function(){function t(t,e){this.To=t,this.Tu=e,this.docs=new Je(nt.At),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,u=this.Tu(e);return this.docs=this.docs.Ie(r,{Ir:e,size:u,readTime:n}),this.size+=u-o,this.To.fo(t,r.path.yt())},t.prototype.mr=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},t.prototype.Ar=function(t,e){var n=this.docs.get(e);return ir.resolve(n?n.Ir:null)},t.prototype.getEntries=function(t,e){var n=this,r=rn();return e.forEach((function(t){var e=n.docs.get(t);r=r.Ie(t,e?e.Ir:null)})),ir.resolve(r)},t.prototype.Pc=function(t,e,n){for(var r=un(),i=new nt(e.path.child("")),o=this.docs.Ve(i);o.Ce();){var u=o.De(),s=u.key,a=u.value,c=a.Ir,f=a.readTime;if(!e.path.vt(s.path))break;f.u(n)<=0||c instanceof Dt&&le(e,c)&&(r=r.Ie(c.key,c))}return ir.resolve(r)},t.prototype.Iu=function(t,e){return ir.forEach(this.docs,(function(t){return e(t)}))},t.prototype.lc=function(t){return new So(this)},t.prototype.dc=function(t){return ir.resolve(this.size)},t}(),So=function(t){function e(e){var n=this;return(n=t.call(this)||this).gc=e,n}return Object(u.c)(e,t),e.prototype.yr=function(t){var e=this,n=[];return this._r.forEach((function(r,i){i&&i.Ir?n.push(e.gc.Er(t,i.Ir,e.wr(r))):e.gc.mr(r)})),ir.hs(n)},e.prototype.Rr=function(t,e){return this.gc.Ar(t,e)},e.prototype.Pr=function(t,e){return this.gc.getEntries(t,e)},e}(Sr),xo=function(){function t(t){this.persistence=t,this.mu=new kr((function(t){return Rt(t)}),Lt),this.lastRemoteSnapshotVersion=$.min(),this.highestTargetId=0,this.Au=0,this.Ru=new jo,this.targetCount=0,this.Pu=Fi.Bo()}return t.prototype.Un=function(t,e){return this.mu.forEach((function(t,n){return e(n)})),ir.resolve()},t.prototype.Wo=function(t){return ir.resolve(this.lastRemoteSnapshotVersion)},t.prototype.jo=function(t){return ir.resolve(this.Au)},t.prototype.Uo=function(t){return this.highestTargetId=this.Pu.next(),ir.resolve(this.highestTargetId)},t.prototype.Go=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.Au&&(this.Au=e),ir.resolve()},t.prototype.Ho=function(t){this.mu.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.Pu=new Fi(e),this.highestTargetId=e),t.sequenceNumber>this.Au&&(this.Au=t.sequenceNumber)},t.prototype.zo=function(t,e){return this.Ho(e),this.targetCount+=1,ir.resolve()},t.prototype.Yo=function(t,e){return this.Ho(e),ir.resolve()},t.prototype.Xo=function(t,e){return this.mu.delete(e.target),this.Ru.cu(e.targetId),this.targetCount-=1,ir.resolve()},t.prototype.Br=function(t,e,n){var r=this,i=0,o=[];return this.mu.forEach((function(u,s){s.sequenceNumber<=e&&null===n.get(s.targetId)&&(r.mu.delete(u),o.push(r.Zo(t,s.targetId)),i++)})),ir.hs(o).next((function(){return i}))},t.prototype.tc=function(t){return ir.resolve(this.targetCount)},t.prototype.ec=function(t,e){var n=this.mu.get(e)||null;return ir.resolve(n)},t.prototype.nc=function(t,e,n){return this.Ru.iu(e,n),ir.resolve()},t.prototype.ic=function(t,e,n){this.Ru.ou(e,n);var r=this.persistence.Io,i=[];return r&&e.forEach((function(e){i.push(r.Oo(t,e))})),ir.hs(i)},t.prototype.Zo=function(t,e){return this.Ru.cu(e),ir.resolve()},t.prototype.oc=function(t,e){var n=this.Ru.uu(e);return ir.resolve(n)},t.prototype.Mo=function(t,e){return ir.resolve(this.Ru.Mo(e))},t}(),Po=function(){function t(t,e){var n=this;this.yu={},this.Fc=new Tr(0),this.Oc=!1,this.Oc=!0,this.Io=t(this),this.Qc=new xo(this),this.To=new ki,this.Kc=function(t,e){return new ko(t,(function(t){return n.Io.gu(t)}))}(this.To),this.fe=new yi(e),this.Wc=new No(this.fe)}return t.prototype.start=function(){return Promise.resolve()},t.prototype.$=function(){return this.Oc=!1,Promise.resolve()},Object.defineProperty(t.prototype,"Nr",{get:function(){return this.Oc}
1,enumerable:!1,configurable:!0}),t.prototype.Xc=function(){},t.prototype.Zc=function(){},t.prototype.Ia=function(){return this.To},t.prototype.Ta=function(t){var e=this.yu[t.I()];return e||(e=new Do(this.To,this.Io),this.yu[t.I()]=e),e},t.prototype.ac=function(){return this.Qc},t.prototype._c=function(){return this.Kc},t.prototype.ma=function(){return this.Wc},t.prototype.runTransaction=function(t,e,n){var r=this;c("MemoryPersistence","Starting transaction:",t);var i=new Ro(this.Fc.next());return this.Io.Vu(),n(i).next((function(t){return r.Io.pu(i).next((function(){return t}))})).cs().then((function(t){return i.ki(),t}))},t.prototype.bu=function(t,e){return ir.ls(Object.values(this.yu).map((function(n){return function(){return n.Mo(t,e)}})))},t}(),Ro=function(t){function e(e){var n=this;return(n=t.call(this)||this).oo=e,n}return Object(u.c)(e,t),e}(_r),Lo=function(){function t(t){this.persistence=t,this.vu=new jo,this.Su=null}return t.Du=function(e){return new t(e)},Object.defineProperty(t.prototype,"Cu",{get:function(){if(this.Su)return this.Su;throw p()},enumerable:!1,configurable:!0}),t.prototype.sc=function(t,e,n){return this.vu.sc(n,e),this.Cu.delete(n.toString()),ir.resolve()},t.prototype.rc=function(t,e,n){return this.vu.rc(n,e),this.Cu.add(n.toString()),ir.resolve()},t.prototype.Oo=function(t,e){return this.Cu.add(e.toString()),ir.resolve()},t.prototype.removeTarget=function(t,e){var n=this;this.vu.cu(e.targetId).forEach((function(t){return n.Cu.add(t.toString())}));var r=this.persistence.ac();return r.oc(t,e.targetId).next((function(t){t.forEach((function(t){return n.Cu.add(t.toString())}))})).next((function(){return r.Xo(t,e)}))},t.prototype.Vu=function(){this.Su=new Set},t.prototype.pu=function(t){var e=this,n=this.persistence._c().lc();return ir.forEach(this.Cu,(function(r){var i=nt.Lt(r);return e.xu(t,i).next((function(t){t||n.mr(i)}))})).next((function(){return e.Su=null,n.apply(t)}))},t.prototype.fc=function(t,e){var n=this;return this.xu(t,e).next((function(t){t?n.Cu.delete(e.toString()):n.Cu.add(e.toString())}))},t.prototype.gu=function(t){return 0},t.prototype.xu=function(t,e){var n=this;return ir.ls([function(){return ir.resolve(n.vu.Mo(e))},function(){return n.persistence.ac().Mo(t,e)},function(){return n.persistence.bu(t,e)}])},t}();function Uo(t,e){return"firestore_clients_"+t+"_"+e}function Co(t,e,n){var r="firestore_mutations_"+t+"_"+n;return e.T()&&(r+="_"+e.uid),r}function Vo(t,e){return"firestore_targets_"+t+"_"+e}var Mo=function(){function t(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r}return t.Nu=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),u=void 0;return o&&i.error&&(o="string"==typeof i.error.message&&"string"==typeof i.error.code)&&(u=new E(i.error.code,i.error.message)),o?new t(e,n,i.state,u):(f("SharedClientState","Failed to parse mutation state for ID '"+n+"': "+r),null)},t.prototype.Fu=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}(),qo=function(){function t(t,e,n){this.targetId=t,this.state=e,this.error=n}return t.Nu=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 E(r.error.code,r.error.message)),i?new t(e,r.state,o):(f("SharedClientState","Failed to parse target state for ID '"+e+"': "+n),null)},t.prototype.Fu=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}(),Fo=function(){function t(t,e){this.clientId=t,this.activeTargetIds=e}return t.Nu=function(e,n){for(var r=JSON.parse(n),i="object"==typeof r&&r.activeTargetIds instanceof Array,o=ln(),u=0;i&&u<r.activeTargetIds.length;++u)i=F(r.activeTargetIds[u]),o=o.add(r.activeTargetIds[u]);
1return i?new t(e,o):(f("SharedClientState","Failed to parse client data for instance '"+e+"': "+n),null)},t}(),Bo=function(){function t(t,e){this.clientId=t,this.onlineState=e}return t.Nu=function(e){var n=JSON.parse(e);return"object"==typeof n&&-1!==["Unknown","Online","Offline"].indexOf(n.onlineState)&&"string"==typeof n.clientId?new t(n.clientId,n.onlineState):(f("SharedClientState","Failed to parse online state: "+e),null)},t}(),Go=function(){function t(){this.activeTargetIds=ln()}return t.prototype.Ou=function(t){this.activeTargetIds=this.activeTargetIds.add(t)},t.prototype.ku=function(t){this.activeTargetIds=this.activeTargetIds.delete(t)},t.prototype.Fu=function(){var t={activeTargetIds:this.activeTargetIds.Dt(),updateTimeMs:Date.now()};return JSON.stringify(t)},t}(),zo=function(){function t(t,e,n,r,i){this.window=t,this.js=e,this.persistenceKey=n,this.Mu=r,this.Lu=null,this.$u=null,this.Hi=null,this.Bu=this.qu.bind(this),this.Uu=new Je(g),this.Nr=!1,this.Qu=[];var o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=i,this.Ku=Uo(this.persistenceKey,this.Mu),this.Wu=function(t){return"firestore_sequence_number_"+t}(this.persistenceKey),this.Uu=this.Uu.Ie(this.Mu,new Go),this.ju=new RegExp("^firestore_clients_"+o+"_([^_]*)$"),this.Gu=new RegExp("^firestore_mutations_"+o+"_(\\d+)(?:_(.*))?$"),this.zu=new RegExp("^firestore_targets_"+o+"_(\\d+)$"),this.Hu=function(t){return"firestore_online_state_"+t}(this.persistenceKey),this.Ju=function(t){return"firestore_bundle_loaded_"+t}(this.persistenceKey),this.window.addEventListener("storage",this.Bu)}return t.G=function(t){return!(!t||!t.localStorage)},t.prototype.start=function(){return Object(u.b)(this,void 0,void 0,(function(){var t,e,n,r,i,o,s,a,c,f,h,l=this;return Object(u.d)(this,(function(u){switch(u.label){case 0:return[4,this.Lu.Ea()];case 1:for(t=u.sent(),e=0,n=t;e<n.length;e++)(r=n[e])!==this.Mu&&(i=this.getItem(Uo(this.persistenceKey,r)))&&(o=Fo.Nu(r,i))&&(this.Uu=this.Uu.Ie(o.clientId,o));for(this.Yu(),(s=this.storage.getItem(this.Hu))&&(a=this.Xu(s))&&this.Zu(a),c=0,f=this.Qu;c<f.length;c++)h=f[c],this.qu(h);return this.Qu=[],this.window.addEventListener("unload",(function(){return l.$()})),this.Nr=!0,[2]}}))}))},t.prototype.Xi=function(t){this.setItem(this.Wu,JSON.stringify(t))},t.prototype.th=function(){return this.eh(this.Uu)},t.prototype.nh=function(t){var e=!1;return this.Uu.forEach((function(n,r){r.activeTargetIds.has(t)&&(e=!0)})),e},t.prototype.sh=function(t){this.ih(t,"pending")},t.prototype.rh=function(t,e,n){this.ih(t,e,n),this.oh(t)},t.prototype.ah=function(t){var e="not-current";if(this.nh(t)){var n=this.storage.getItem(Vo(this.persistenceKey,t));if(n){var r=qo.Nu(t,n);r&&(e=r.state)}}return this.uh.Ou(t),this.Yu(),e},t.prototype.hh=function(t){this.uh.ku(t),this.Yu()},t.prototype.lh=function(t){return this.uh.activeTargetIds.has(t)},t.prototype._h=function(t){this.removeItem(Vo(this.persistenceKey,t))},t.prototype.fh=function(t,e,n){this.dh(t,e,n)},t.prototype.wh=function(t,e,n){var r=this;e.forEach((function(t){r.oh(t)})),this.currentUser=t,n.forEach((function(t){r.sh(t)}))},t.prototype.Eh=function(t){this.Th(t)},t.prototype.Ih=function(){this.mh()},t.prototype.$=function(){this.Nr&&(this.window.removeEventListener("storage",this.Bu),this.removeItem(this.Ku),this.Nr=!1)},t.prototype.getItem=function(t){var e=this.storage.getItem(t);return c("SharedClientState","READ",t,e),e},t.prototype.setItem=function(t,e){c("SharedClientState","SET",t,e),this.storage.setItem(t,e)},t.prototype.removeItem=function(t){c("SharedClientState","REMOVE",t),this.storage.removeItem(t)},t.prototype.qu=function(t){var e=this,n=t;if(n.storageArea===this.storage){if(c("SharedClientState","EVENT",n.key,n.newValue),n.key===this.Ku)return void f("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.js.ea((function(){return Object(u.b)(e,void 0,void 0,(function(){var t,e,r,i,o,s;return Object(u.d)(this,(function(u){if(this.Nr){if(null!==n.key)if(this.ju.test(n.key)){if(null==n.newValue)return t=this.Ah(n.key),[2,this.Rh(t,null)];if(e=this.Ph(n.key,n.newValue))return[2,this.Rh(e.clientId,e)]}else if(this.Gu.test(n.key)){if(null!==n.newValue&&(r=this.yh(n.key,n.newValue)))return[2,this.gh(r)]}else if(this.zu.test(n.key)){if(null!==n.newValue&&(i=this.Vh(n.key,n.newValue)))return[2,this.ph(i)]}else if(n.key===this.Hu){if(null!==n.newValue&&(o=this.Xu(n.newValue)))return[2,this.Zu(o)]}else if(n.key===this.Wu)(s=function(t){var e=Tr.Zi;if(null!=t)try{var n=JSON.parse(t);d("number"==typeof n),e=n}
1catch(t){f("SharedClientState","Failed to read sequence number from WebStorage",t)}return e}(n.newValue))!==Tr.Zi&&this.Hi(s);else if(n.key===this.Ju)return[2,this.Lu.bh()]}else this.Qu.push(n);return[2]}))}))}))}},Object.defineProperty(t.prototype,"uh",{get:function(){return this.Uu.get(this.Mu)},enumerable:!1,configurable:!0}),t.prototype.Yu=function(){this.setItem(this.Ku,this.uh.Fu())},t.prototype.ih=function(t,e,n){var r=new Mo(this.currentUser,t,e,n),i=Co(this.persistenceKey,this.currentUser,t);this.setItem(i,r.Fu())},t.prototype.oh=function(t){var e=Co(this.persistenceKey,this.currentUser,t);this.removeItem(e)},t.prototype.Th=function(t){var e={clientId:this.Mu,onlineState:t};this.storage.setItem(this.Hu,JSON.stringify(e))},t.prototype.dh=function(t,e,n){var r=Vo(this.persistenceKey,t),i=new qo(t,e,n);this.setItem(r,i.Fu())},t.prototype.mh=function(){this.setItem(this.Ju,"value-not-used")},t.prototype.Ah=function(t){var e=this.ju.exec(t);return e?e[1]:null},t.prototype.Ph=function(t,e){var n=this.Ah(t);return Fo.Nu(n,e)},t.prototype.yh=function(t,e){var n=this.Gu.exec(t),r=Number(n[1]),i=void 0!==n[2]?n[2]:null;return Mo.Nu(new D(i),r,e)},t.prototype.Vh=function(t,e){var n=this.zu.exec(t),r=Number(n[1]);return qo.Nu(r,e)},t.prototype.Xu=function(t){return Bo.Nu(t)},t.prototype.gh=function(t){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(e){return t.user.uid===this.currentUser.uid?[2,this.Lu.Sh(t.batchId,t.state,t.error)]:(c("SharedClientState","Ignoring mutation for non-active user "+t.user.uid),[2])}))}))},t.prototype.ph=function(t){return this.Lu.Dh(t.targetId,t.state,t.error)},t.prototype.Rh=function(t,e){var n=this,r=e?this.Uu.Ie(t,e):this.Uu.remove(t),i=this.eh(this.Uu),o=this.eh(r),u=[],s=[];return o.forEach((function(t){i.has(t)||u.push(t)})),i.forEach((function(t){o.has(t)||s.push(t)})),this.Lu.Ch(u,s).then((function(){n.Uu=r}))},t.prototype.Zu=function(t){this.Uu.get(t.clientId)&&this.$u(t.onlineState)},t.prototype.eh=function(t){var e=ln();return t.forEach((function(t,n){e=e.je(n.activeTargetIds)})),e},t}(),Ko=function(){function t(){this.xh=new Go,this.Nh={},this.$u=null,this.Hi=null}return t.prototype.sh=function(t){},t.prototype.rh=function(t,e,n){},t.prototype.ah=function(t){return this.xh.Ou(t),this.Nh[t]||"not-current"},t.prototype.fh=function(t,e,n){this.Nh[t]=e},t.prototype.hh=function(t){this.xh.ku(t)},t.prototype.lh=function(t){return this.xh.activeTargetIds.has(t)},t.prototype._h=function(t){delete this.Nh[t]},t.prototype.th=function(){return this.xh.activeTargetIds},t.prototype.nh=function(t){return this.xh.activeTargetIds.has(t)},t.prototype.start=function(){return this.xh=new Go,Promise.resolve()},t.prototype.wh=function(t,e,n){},t.prototype.Eh=function(t){},t.prototype.$=function(){},t.prototype.Xi=function(t){},t.prototype.Ih=function(){},t}();function Qo(){return"undefined"!=typeof window?window:null}function Wo(){return"undefined"!=typeof document?document:null}var Ho=function(){function t(t,e){this.ks=t,this.$u=e,this.state="Unknown",this.Fh=0,this.Oh=null,this.kh=!0}return t.prototype.Mh=function(){var t=this;0===this.Fh&&(this.Lh("Unknown"),this.Oh=this.ks.ni("online_state_timeout",1e4,(function(){return t.Oh=null,t.$h("Backend didn't respond within 10 seconds."),t.Lh("Offline"),Promise.resolve()})))},t.prototype.Bh=function(t){"Online"===this.state?this.Lh("Unknown"):(this.Fh++,this.Fh>=1&&(this.qh(),this.$h("Connection failed 1 times. Most recent error: "+t.toString()),this.Lh("Offline")))},t.prototype.set=function(t){this.qh(),this.Fh=0,"Online"===t&&(this.kh=!1),this.Lh(t)},t.prototype.Lh=function(t){t!==this.state&&(this.state=t,this.$u(t))},t.prototype.$h=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.kh?(f(e),this.kh=!1):c("OnlineStateTracker",e)},t.prototype.qh=function(){null!==this.Oh&&(this.Oh.cancel(),this.Oh=null)},t}(),Yo=function(t,e,n,r,i){var o=this;this.Uh=t,this.Qh=e,this.ks=n,this.Kh={},this.Wh=[],this.jh=new Map,this.Gh=new Set,this.zh=[],this.Hh=i,this.Hh.L((function(t){n.Ws((function(){return Object(u.b)(o,void 0,void 0,(function(){return Object(u.d)(this,(function(t){switch(t.label){case 0:return iu(this)?(c("RemoteStore","Restarting streams for network reach
1ability change."),[4,function(t){return Object(u.b)(this,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(n){switch(n.label){case 0:return(e=v(t)).Gh.add(4),[4,$o(e)];case 1:return n.sent(),e.Jh.set("Unknown"),e.Gh.delete(4),[4,Jo(e)];case 2:return n.sent(),[2]}}))}))}(this)]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))}))})),this.Jh=new Ho(n,r)};function Jo(t){return Object(u.b)(this,void 0,void 0,(function(){var e,n;return Object(u.d)(this,(function(r){switch(r.label){case 0:if(!iu(t))return[3,4];e=0,n=t.zh,r.label=1;case 1:return e<n.length?[4,(0,n[e])(!0)]:[3,4];case 2:r.sent(),r.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))}function $o(t){return Object(u.b)(this,void 0,void 0,(function(){var e,n;return Object(u.d)(this,(function(r){switch(r.label){case 0:e=0,n=t.zh,r.label=1;case 1:return e<n.length?[4,(0,n[e])(!1)]:[3,4];case 2:r.sent(),r.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))}function Xo(t,e){var n=v(t);n.jh.has(e.targetId)||(n.jh.set(e.targetId,e),ru(n)?nu(n):bu(n).li()&&tu(n,e))}function Zo(t,e){var n=v(t),r=bu(n);n.jh.delete(e),r.li()&&eu(n,e),0===n.jh.size&&(r.li()?r.di():iu(n)&&n.Jh.set("Unknown"))}function tu(t,e){t.Yh.Dn(e.targetId),bu(t).gi(e)}function eu(t,e){t.Yh.Dn(e),bu(t).Vi(e)}function nu(t){t.Yh=new _n({Xn:function(e){return t.Kh.Xn(e)},Zn:function(e){return t.jh.get(e)||null}}),bu(t).start(),t.Jh.Mh()}function ru(t){return iu(t)&&!bu(t).hi()&&t.jh.size>0}function iu(t){return 0===v(t).Gh.size}function ou(t){t.Yh=void 0}function uu(t){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(e){return t.jh.forEach((function(e,n){tu(t,e)})),[2]}))}))}function su(t,e){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(n){return ou(t),ru(t)?(t.Jh.Bh(e),nu(t)):t.Jh.set("Unknown"),[2]}))}))}function au(t,e,n){return Object(u.b)(this,void 0,void 0,(function(){var r,i,o;return Object(u.d)(this,(function(s){switch(s.label){case 0:if(t.Jh.set("Online"),!(e instanceof wn&&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 Object(u.b)(this,void 0,void 0,(function(){var n,r,i,o;return Object(u.d)(this,(function(u){switch(u.label){case 0:n=e.cause,r=0,i=e.targetIds,u.label=1;case 1:return r<i.length?(o=i[r],t.jh.has(o)?[4,t.Kh.Xh(o,n)]:[3,3]):[3,5];case 2:u.sent(),t.jh.delete(o),t.Yh.removeTarget(o),u.label=3;case 3:u.label=4;case 4:return r++,[3,1];case 5:return[2]}}
1))}))}(t,e)];case 2:return s.sent(),[3,5];case 3:return r=s.sent(),c("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),r),[4,cu(t,r)];case 4:return s.sent(),[3,5];case 5:return[3,13];case 6:if(e instanceof gn?t.Yh.Ln(e):e instanceof bn?t.Yh.jn(e):t.Yh.qn(e),n.isEqual($.min()))return[3,13];s.label=7;case 7:return s.trys.push([7,11,,13]),[4,po(t.Uh)];case 8:return i=s.sent(),n.u(i)>=0?[4,function(t,e){var n=t.Yh.Hn(e);return n.rn.forEach((function(n,r){if(n.resumeToken.o()>0){var i=t.jh.get(r);i&&t.jh.set(r,i.ae(n.resumeToken,e))}})),n.on.forEach((function(e){var n=t.jh.get(e);if(n){t.jh.set(e,n.ae(I.h,n.oe)),eu(t,e);var r=new ve(n.target,e,1,n.sequenceNumber);tu(t,r)}})),t.Kh.Zh(n)}(t,n)]:[3,10];case 9:s.sent(),s.label=10;case 10:return[3,13];case 11:return c("RemoteStore","Failed to raise snapshot:",o=s.sent()),[4,cu(t,o)];case 12:return s.sent(),[3,13];case 13:return[2]}}))}))}function cu(t,e,n){return Object(u.b)(this,void 0,void 0,(function(){var r=this;return Object(u.d)(this,(function(i){switch(i.label){case 0:if(!cr(e))throw e;return t.Gh.add(1),[4,$o(t)];case 1:return i.sent(),t.Jh.set("Offline"),n||(n=function(){return po(t.Uh)}),t.ks.ea((function(){return Object(u.b)(r,void 0,void 0,(function(){return Object(u.d)(this,(function(e){switch(e.label){case 0:return c("RemoteStore","Retrying IndexedDB access"),[4,n()];case 1:return e.sent(),t.Gh.delete(1),[4,Jo(t)];case 2:return e.sent(),[2]}}))}))})),[2]}}))}))}function fu(t,e){return e().catch((function(n){return cu(t,n,e)}))}function hu(t){return Object(u.b)(this,void 0,void 0,(function(){var e,n,r,i,o;return Object(u.d)(this,(function(u){switch(u.label){case 0:e=v(t),n=wu(e),r=e.Wh.length>0?e.Wh[e.Wh.length-1].batchId:-1,u.label=1;case 1:if(!function(t){return iu(t)&&t.Wh.length<10}(e))return[3,7];u.label=2;case 2:return u.trys.push([2,4,,6]),[4,mo(e.Uh,r)];case 3:return null===(i=u.sent())?(0===e.Wh.length&&n.di(),[3,7]):(r=i.batchId,function(t,e){t.Wh.push(e);var n=wu(t);n.li()&&n.bi&&n.vi(e.mutations)}(e,i),[3,6]);case 4:return o=u.sent(),[4,cu(e,o)];case 5:return u.sent(),[3,6];case 6:return[3,1];case 7:return lu(e)&&pu(e),[2]}}))}))}function lu(t){return iu(t)&&!wu(t).hi()&&t.Wh.length>0}function pu(t){wu(t).start()}function du(t){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(e){return wu(t).Ci(),[2]}))}))}function vu(t){return Object(u.b)(this,void 0,void 0,(function(){var e,n,r,i;return Object(u.d)(this,(function(o){for(e=wu(t),n=0,r=t.Wh;n<r.length;n++)i=r[n],e.vi(i.mutations);return[2]}))}))}function yu(t,e,n){return Object(u.b)(this,void 0,void 0,(function(){var r,i;return Object(u.d)(this,(function(o){switch(o.label){case 0:return r=t.Wh.shift(),i=Dr.from(r,e,n),[4,fu(t,(function(){return t.Kh.tl(i)}))];case 1:return o.sent(),[4,hu(t)];case 2:return o.sent(),[2]}}))}))}function mu(t,e){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(n){switch(n.label){case 0:return e&&wu(t).bi?[4,function(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r;return Object(u.d)(this,(function(i){switch(i.label){case 0:return K(r=e.code)&&r!==_.ABORTED?(n=t.Wh.shift(),wu(t).fi(),[4,fu(t,(function(){return t.Kh.el(n.batchId,e)}))]):[3,3];case 1:return i.sent(),[4,hu(t)];case 2:i.sent(),i.label=3;case 3:return[2]}}
1))}))}(t,e)]:[3,2];case 1:n.sent(),n.label=2;case 2:return lu(t)&&pu(t),[2]}}))}))}function gu(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n;return Object(u.d)(this,(function(r){switch(r.label){case 0:return n=v(t),e?(n.Gh.delete(2),[4,Jo(n)]):[3,2];case 1:return r.sent(),[3,5];case 2:return e?[3,4]:(n.Gh.add(2),[4,$o(n)]);case 3:r.sent(),n.Jh.set("Unknown"),r.label=4;case 4:r.label=5;case 5:return[2]}}))}))}function bu(t){var e=this;return t.nl||(t.nl=function(t,e,n){var r=v(t);return r.Ni(),new gr(e,r.ri,r.credentials,r.fe,n)}(t.Qh,t.ks,{Y:uu.bind(null,t),Z:su.bind(null,t),yi:au.bind(null,t)}),t.zh.push((function(n){return Object(u.b)(e,void 0,void 0,(function(){return Object(u.d)(this,(function(e){switch(e.label){case 0:return n?(t.nl.fi(),ru(t)?nu(t):t.Jh.set("Unknown"),[3,3]):[3,1];case 1:return[4,t.nl.stop()];case 2:e.sent(),ou(t),e.label=3;case 3:return[2]}}))}))}))),t.nl}function wu(t){var e=this;return t.sl||(t.sl=function(t,e,n){var r=v(t);return r.Ni(),new br(e,r.ri,r.credentials,r.fe,n)}(t.Qh,t.ks,{Y:du.bind(null,t),Z:mu.bind(null,t),Di:vu.bind(null,t),Si:yu.bind(null,t)}),t.zh.push((function(n){return Object(u.b)(e,void 0,void 0,(function(){return Object(u.d)(this,(function(e){switch(e.label){case 0:return n?(t.sl.fi(),[4,hu(t)]):[3,2];case 1:return e.sent(),[3,4];case 2:return[4,t.sl.stop()];case 3:e.sent(),t.Wh.length>0&&(c("RemoteStore","Stopping write stream with "+t.Wh.length+" pending writes"),t.Wh=[]),e.label=4;case 4:return[2]}}
1))}))}))),t.sl}var Iu=function(){this.il=void 0,this.listeners=[]},_u=function(){this.queries=new kr((function(t){return fe(t)}),ce),this.onlineState="Unknown",this.rl=new Set};function Eu(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r,i,o,s,a,c;return Object(u.d)(this,(function(u){switch(u.label){case 0:if(n=v(t),r=e.query,i=!1,(o=n.queries.get(r))||(i=!0,o=new Iu),!i)return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),s=o,[4,n.ol(r)];case 2:return s.il=u.sent(),[3,4];case 3:return a=u.sent(),c=vr(a,"Initialization of query '"+he(e.query)+"' failed"),[2,void e.onError(c)];case 4:return n.queries.set(r,o),o.listeners.push(e),e.cl(n.onlineState),o.il&&e.al(o.il)&&ju(n),[2]}}))}))}function Ou(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r,i,o,s;return Object(u.d)(this,(function(u){return n=v(t),r=e.query,i=!1,(o=n.queries.get(r))&&(s=o.listeners.indexOf(e))>=0&&(o.listeners.splice(s,1),i=0===o.listeners.length),i?[2,(n.queries.delete(r),n.ul(r))]:[2]}))}))}function Tu(t,e){for(var n=v(t),r=!1,i=0,o=e;i<o.length;i++){var u=o[i],s=u.query,a=n.queries.get(s);if(a){for(var c=0,f=a.listeners;c<f.length;c++)f[c].al(u)&&(r=!0);a.il=u}}r&&ju(n)}function Nu(t,e,n){var r=v(t),i=r.queries.get(e);if(i)for(var o=0,u=i.listeners;o<u.length;o++)u[o].onError(n);r.queries.delete(e)}function ju(t){t.rl.forEach((function(t){t.next()}))}var Au=function(){function t(t,e,n){this.query=t,this.hl=e,this.ll=!1,this._l=null,this.onlineState="Unknown",this.options=n||{}}return t.prototype.al=function(t){if(!this.options.includeMetadataChanges){for(var e=[],n=0,r=t.docChanges;n<r.length;n++){var i=r[n];3!==i.type&&e.push(i)}t=new vn(t.query,t.docs,t.Ze,e,t.tn,t.fromCache,t.en,!0)}var o=!1;return this.ll?this.fl(t)&&(this.hl.next(t),o=!0):this.dl(t,this.onlineState)&&(this.wl(t),o=!0),this._l=t,o},t.prototype.onError=function(t){this.hl.error(t)},t.prototype.cl=function(t){this.onlineState=t;var e=!1;return this._l&&!this.ll&&this.dl(this._l,t)&&(this.wl(this._l),e=!0),e},t.prototype.dl=function(t,e){if(!t.fromCache)return!0;var n="Offline"!==e;return!(this.options.El&&n||t.docs.bt()&&"Offline"!==e)},t.prototype.fl=function(t){if(t.docChanges.length>0)return!0;var e=this._l&&this._l.hasPendingWrites!==t.hasPendingWrites;return!(!t.en&&!e)&&!0===this.options.includeMetadataChanges},t.prototype.wl=function(t){t=vn.sn(t.query,t.docs,t.tn,t.fromCache),this.ll=!0,this.hl.next(t)},t}(),Du=function(){function t(t,e){this.payload=t,this.byteLength=e}return t.prototype.Tl=function(){return"metadata"in this.payload},t}(),ku=function(){function t(t){this.fe=t}return t.prototype.Ha=function(t){return Ln(this.fe,t)},t.prototype.Ja=function(t){return t.metadata.exists?Fn(this.fe,t.document,!1):new kt(this.Ha(t.metadata.name),this.Ya(t.metadata.readTime))},t.prototype.Ya=function(t){return Sn(t)},t}(),Su=function(){function t(t,e,n){this.Il=t,this.Uh=e,this.fe=n,this.queries=[],this.documents=[],this.progress=xu(t)}return t.prototype.ml=function(t){this.progress.bytesLoaded+=t.byteLength;var e=this.progress.documentsLoaded;return t.payload.namedQuery?this.queries.push(t.payload.namedQuery):t.payload.documentMetadata?(this.documents.push({metadata:t.payload.documentMetadata}),t.payload.documentMetadata.exists||++e):t.payload.document&&(this.documents[this.documents.length-1].document=t.payload.document,++e),e!==this.progress.documentsLoaded?(this.progress.documentsLoaded=e,Object.assign({},this.progress)):null},t.prototype.Al=function(t){for(var e=new Map,n=new ku(this.fe),r=0,i=t;r<i.length;r++){var o=i[r];if(o.metadata.queries)for(var u=n.Ha(o.metadata.name),s=0,a=o.metadata.queries;s<a.length;s++){var c=a[s],f=(e.get(c)||fn()).add(u);e.set(c,f)}}return e},t.prototype.complete=function(){return Object(u.b)(this,void 0,void 0,(function(){var t,e,n,r,i;return Object(u.d)(this,(function(o){switch(o.label){case 0:return[4,Oo(this.Uh,new ku(this.fe),this.documents,this.Il.id)];case 1:t=o.sent(),e=this.Al(this.documents),n=0,r=this.queries,o.label=2;case 2:return n<r.length?(i=r[n],[4,To(this.Uh,i,e.get(i.name))]):[3,5];case 3:o.sent(),o.label=4;case 4:return n++,[3,2];case 5:return[2,(this.progress.taskState="Success",new jr(Object.assign({},this.progress),t))]}}))}))},t}();function xu(t){return{taskState:"Running",documentsLoaded:0,bytesLoaded:0,totalDocuments:t.totalDocuments,totalBytes:t.totalBytes}}var Pu=function(t){this.key=t},Ru=function(t){this.key=t},Lu=function(){function t(t,e){this.query=t,this.Rl=e,this.Pl=null,this.ln=!1,this.yl=fn(),this.tn=fn(),this.gl=pe(t),this.Vl=new pn(this.gl)}return Object.defineProperty(t.prototype,"pl",{get:function(){return this.Rl}
1,enumerable:!1,configurable:!0}),t.prototype.bl=function(t,e){var n=this,r=e?e.vl:new dn,i=e?e.Vl:this.Vl,o=e?e.tn:this.tn,u=i,s=!1,a=ee(this.query)&&i.size===this.query.limit?i.last():null,c=ne(this.query)&&i.size===this.query.limit?i.first():null;if(t.Pe((function(t,e){var f=i.get(t),h=e instanceof Dt?e:null;h&&(h=le(n.query,h)?h:null);var l=!!f&&n.tn.has(f.key),p=!!h&&(h.Jt||n.tn.has(h.key)&&h.hasCommittedMutations),d=!1;f&&h?f.data().isEqual(h.data())?l!==p&&(r.track({type:3,doc:h}),d=!0):n.Sl(f,h)||(r.track({type:2,doc:h}),d=!0,(a&&n.gl(h,a)>0||c&&n.gl(h,c)<0)&&(s=!0)):!f&&h?(r.track({type:0,doc:h}),d=!0):f&&!h&&(r.track({type:1,doc:f}),d=!0,(a||c)&&(s=!0)),d&&(h?(u=u.add(h),o=p?o.add(t):o.delete(t)):(u=u.delete(t),o=o.delete(t)))})),ee(this.query)||ne(this.query))for(;u.size>this.query.limit;){var f=ee(this.query)?u.last():u.first();u=u.delete(f.key),o=o.delete(f.key),r.track({type:1,doc:f})}return{Vl:u,vl:r,La:s,tn:o}},t.prototype.Sl=function(t,e){return t.Jt&&e.hasCommittedMutations&&!e.Jt},t.prototype.yr=function(t,e,n){var r=this,i=this.Vl;this.Vl=t.Vl,this.tn=t.tn;var o=t.vl.Xe();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 p()}};return n(t)-n(e)}(t.type,e.type)||r.gl(t.doc,e.doc)})),this.Dl(n);var u=e?this.Cl():[],s=0===this.yl.size&&this.ln?1:0,a=s!==this.Pl;return this.Pl=s,0!==o.length||a?{snapshot:new vn(this.query,t.Vl,i,o,t.tn,0===s,a,!1),xl:u}:{xl:u}},t.prototype.cl=function(t){return this.ln&&"Offline"===t?(this.ln=!1,this.yr({Vl:this.Vl,vl:new dn,tn:this.tn,La:!1},!1)):{xl:[]}},t.prototype.Nl=function(t){return!this.Rl.has(t)&&!!this.Vl.has(t)&&!this.Vl.get(t).Jt},t.prototype.Dl=function(t){var e=this;t&&(t._n.forEach((function(t){return e.Rl=e.Rl.add(t)})),t.fn.forEach((function(t){})),t.dn.forEach((function(t){return e.Rl=e.Rl.delete(t)})),this.ln=t.ln)},t.prototype.Cl=function(){var t=this;if(!this.ln)return[];var e=this.yl;this.yl=fn(),this.Vl.forEach((function(e){t.Nl(e.key)&&(t.yl=t.yl.add(e.key))}));var n=[];return e.forEach((function(e){t.yl.has(e)||n.push(new Ru(e))})),this.yl.forEach((function(t){e.has(t)||n.push(new Pu(t))})),n},t.prototype.Fl=function(t){this.Rl=t.za,this.yl=fn();var e=this.bl(t.documents);return this.yr(e,!0)},t.prototype.Ol=function(){return vn.sn(this.query,this.Vl,this.tn,0===this.Pl)},t}(),Uu=function(t,e,n){this.query=t,this.targetId=e,this.view=n},Cu=function(t){this.key=t,this.kl=!1},Vu=function(){function t(t,e,n,r,i,o){this.Uh=t,this.Ml=e,this.Ll=n,this.$l=r,this.currentUser=i,this.Bl=o,this.ql={},this.Ul=new kr((function(t){return fe(t)}),ce),this.Ql=new Map,this.Kl=[],this.Wl=new Je(nt.At),this.jl=new Map,this.Gl=new jo,this.zl={},this.Hl=new Map,this.Jl=Fi.qo(),this.onlineState="Unknown",this.Yl=void 0}return Object.defineProperty(t.prototype,"Xl",{get:function(){return!0===this.Yl},enumerable:!1,configurable:!0}),t}();function Mu(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r,i,o,s,a;return Object(u.d)(this,(function(u){switch(u.label){case 0:return n=ds(t),(o=n.Ul.get(e))?(r=o.targetId,n.$l.ah(r),i=o.view.Ol(),[3,4]):[3,1];case 1:return[4,go(n.Uh,se(e))];case 2:return s=u.sent(),a=n.$l.ah(s.targetId),r=s.targetId,[4,qu(n,e,r,"current"===a)];case 3:i=u.sent(),n.Xl&&Xo(n.Ml,s),u.label=4;case 4:return[2,i]}}))}))}function qu(t,e,n,r){return Object(u.b)(this,void 0,void 0,(function(){var i,o,s,a,c,f;return Object(u.d)(this,(function(h){switch(h.label){case 0:return t.Zl=function(e,n,r){return function(t,e,n,r){return Object(u.b)(this,void 0,void 0,(function(){var i,o,s;return Object(u.d)(this,(function(u){switch(u.label){case 0:return(i=e.view.bl(n)).La?[4,wo(t.Uh,e.query,!1).then((function(t){var n=t.documents;return e.view.bl(n,i)}))]:[3,2];case 1:i=u.sent(),u.label=2;case 2:return o=r&&r.rn.get(e.targetId),s=e.view.yr(i,t.Xl,o),[2,(Zu(t,e.targetId,s.xl),s.snapshot)]}}))}))}(t,e,n,r)},[4,wo(t.Uh,e,!0)];case 1:return i=h.sent(),o=new Lu(e,i.za),s=o.bl(i.documents),a=mn.hn(n,r&&"Offline"!==t.onlineState),c=o.yr(s,t.Xl,a),Zu(t,n,c.xl),f=new Uu(e,n,o),[2,(t.Ul.set(e,f),t.Ql.has(n)?t.Ql.get(n).push(e):t.Ql.set(n,[e]),c.snapshot)]}}))}))}function Fu(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r,i;return Object(u.d)(this,(function(o){switch(o.label){case 0:return n=v(t),r=n.Ul.get(e),(i=n.Ql.get(r.targetId)).length>1?[2,(n.Ql.set(r.targetId,i.filter((function(t){return!ce(t,e)}))),void n.Ul.delete(e))]:n.Xl?(n.$l.hh(r.targetId),n.$l.nh(r.targetId)?[3,2]:[4,bo(n.Uh,r.targetId,!1).then((function(){n.$l._h(r.targetId),Zo(n.Ml,r.targetId),$u(n,r.targetId)})).catch(Nr)]):[3,3];case 1:o.sent(),o.label=2;case 2:return[3,5];case 3:return $u(n,r.targetId),[4,bo(n.Uh,r.targetId,!0)];case 4:o.sent(),o.label=5;case 5:return[2]}}
1))}))}function Bu(t,e,n){return Object(u.b)(this,void 0,void 0,(function(){var r,i,o,s;return Object(u.d)(this,(function(u){switch(u.label){case 0:r=vs(t),u.label=1;case 1:return u.trys.push([1,5,,6]),[4,function(t,e){var n,r=v(t),i=J.now(),o=e.reduce((function(t,e){return t.add(e.key)}),fn());return r.persistence.runTransaction("Locally write mutations","readwrite",(function(t){return r.Ka.Va(t,o).next((function(o){n=o;for(var u=[],s=0,a=e;s<a.length;s++){var c=a[s],f=Ve(c,n.get(c.key));null!=f&&u.push(new Be(c.key,f,jt(f.proto.mapValue),Pe.exists(!0)))}return r.Ra.Po(t,i,u,e)}))})).then((function(t){var e=t.rr(n);return{batchId:t.batchId,_r:e}}))}(r.Uh,e)];case 2:return i=u.sent(),r.$l.sh(i.batchId),function(t,e,n){var r=t.zl[t.currentUser.I()];r||(r=new Je(g)),r=r.Ie(e,n),t.zl[t.currentUser.I()]=r}(r,i.batchId,n),[4,ns(r,i._r)];case 3:return u.sent(),[4,hu(r.Ml)];case 4:return u.sent(),[3,6];case 5:return o=u.sent(),s=vr(o,"Failed to persist write"),n.reject(s),[3,6];case 6:return[2]}}))}))}function Gu(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r;return Object(u.d)(this,(function(i){switch(i.label){case 0:n=v(t),i.label=1;case 1:return i.trys.push([1,4,,6]),[4,vo(n.Uh,e)];case 2:return r=i.sent(),e.rn.forEach((function(t,e){var r=n.jl.get(e);r&&(d(t._n.size+t.fn.size+t.dn.size<=1),t._n.size>0?r.kl=!0:t.fn.size>0?d(r.kl):t.dn.size>0&&(d(r.kl),r.kl=!1))})),[4,ns(n,r,e)];case 3:return i.sent(),[3,6];case 4:return[4,Nr(i.sent())];case 5:return i.sent(),[3,6];case 6:return[2]}}
1))}))}function zu(t,e,n){var r=v(t);if(r.Xl&&0===n||!r.Xl&&1===n){var i=[];r.Ul.forEach((function(t,n){var r=n.view.cl(e);r.snapshot&&i.push(r.snapshot)})),function(t,e){var n=v(t);n.onlineState=e;var r=!1;n.queries.forEach((function(t,n){for(var i=0,o=n.listeners;i<o.length;i++)o[i].cl(e)&&(r=!0)})),r&&ju(n)}(r.Ll,e),i.length&&r.ql.yi(i),r.onlineState=e,r.Xl&&r.$l.Eh(e)}}function Ku(t,e,n){return Object(u.b)(this,void 0,void 0,(function(){var r,i,o,s,a,c;return Object(u.d)(this,(function(u){switch(u.label){case 0:return(r=v(t)).$l.fh(e,"rejected",n),i=r.jl.get(e),(o=i&&i.key)?(s=(s=new Je(nt.At)).Ie(o,new kt(o,$.min())),a=fn().add(o),c=new yn($.min(),new Map,new Ze(g),s,a),[4,Gu(r,c)]):[3,2];case 1:return u.sent(),r.Wl=r.Wl.remove(o),r.jl.delete(e),es(r),[3,4];case 2:return[4,bo(r.Uh,e,!1).then((function(){return $u(r,e,n)})).catch(Nr)];case 3:u.sent(),u.label=4;case 4:return[2]}}))}))}function Qu(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r,i;return Object(u.d)(this,(function(o){switch(o.label){case 0:n=v(t),r=e.batch.batchId,o.label=1;case 1:return o.trys.push([1,4,,6]),[4,lo(n.Uh,e)];case 2:return i=o.sent(),Ju(n,r,null),Yu(n,r),n.$l.rh(r,"acknowledged"),[4,ns(n,i)];case 3:return o.sent(),[3,6];case 4:return[4,Nr(o.sent())];case 5:return o.sent(),[3,6];case 6:return[2]}}
1))}))}function Wu(t,e,n){return Object(u.b)(this,void 0,void 0,(function(){var r,i;return Object(u.d)(this,(function(o){switch(o.label){case 0:r=v(t),o.label=1;case 1:return o.trys.push([1,4,,6]),[4,function(t,e){var n=v(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(function(t){var r;return n.Ra.yo(t,e).next((function(e){return d(null!==e),r=e.keys(),n.Ra.No(t,e)})).next((function(){return n.Ra.ko(t)})).next((function(){return n.Ka.Va(t,r)}))}))}(r.Uh,e)];case 2:return i=o.sent(),Ju(r,e,n),Yu(r,e),r.$l.rh(e,"rejected",n),[4,ns(r,i)];case 3:return o.sent(),[3,6];case 4:return[4,Nr(o.sent())];case 5:return o.sent(),[3,6];case 6:return[2]}}))}))}function Hu(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r,i,o,s;return Object(u.d)(this,(function(u){switch(u.label){case 0:iu((n=v(t)).Ml)||c("SyncEngine","The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled."),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,function(t){var e=v(t);return e.persistence.runTransaction("Get highest unacknowledged batch id","readonly",(function(t){return e.Ra.bo(t)}))}(n.Uh)];case 2:return-1===(r=u.sent())?[2,void e.resolve()]:((i=n.Hl.get(r)||[]).push(e),n.Hl.set(r,i),[3,4]);case 3:return o=u.sent(),s=vr(o,"Initialization of waitForPendingWrites() operation failed"),e.reject(s),[3,4];case 4:return[2]}}
1))}))}function Yu(t,e){(t.Hl.get(e)||[]).forEach((function(t){t.resolve()})),t.Hl.delete(e)}function Ju(t,e,n){var r=v(t),i=r.zl[r.currentUser.I()];if(i){var o=i.get(e);o&&(n?o.reject(n):o.resolve(),i=i.remove(e)),r.zl[r.currentUser.I()]=i}}function $u(t,e,n){void 0===n&&(n=null),t.$l.hh(e);for(var r=0,i=t.Ql.get(e);r<i.length;r++){var o=i[r];t.Ul.delete(o),n&&t.ql.t_(o,n)}t.Ql.delete(e),t.Xl&&t.Gl.cu(e).forEach((function(e){t.Gl.Mo(e)||Xu(t,e)}))}function Xu(t,e){var n=t.Wl.get(e);null!==n&&(Zo(t.Ml,n),t.Wl=t.Wl.remove(e),t.jl.delete(n),es(t))}function Zu(t,e,n){for(var r=0,i=n;r<i.length;r++){var o=i[r];o instanceof Pu?(t.Gl.sc(o.key,e),ts(t,o)):o instanceof Ru?(c("SyncEngine","Document no longer in limbo: "+o.key),t.Gl.rc(o.key,e),t.Gl.Mo(o.key)||Xu(t,o.key)):p()}}function ts(t,e){var n=e.key;t.Wl.get(n)||(c("SyncEngine","New document in limbo: "+n),t.Kl.push(n),es(t))}function es(t){for(;t.Kl.length>0&&t.Wl.size<t.Bl;){var e=t.Kl.shift(),n=t.Jl.next();t.jl.set(n,new Cu(e)),t.Wl=t.Wl.Ie(e,n),Xo(t.Ml,new ve(se(te(e.path)),n,2,Tr.Zi))}}function ns(t,e,n){return Object(u.b)(this,void 0,void 0,(function(){var r,i,o,s;return Object(u.d)(this,(function(a){switch(a.label){case 0:return r=v(t),i=[],o=[],s=[],r.Ul.bt()?[3,3]:(r.Ul.forEach((function(t,u){s.push(r.Zl(u,e,n).then((function(t){if(t){r.Xl&&r.$l.fh(u.targetId,t.fromCache?"not-current":"current"),i.push(t);var e=so.Na(u.targetId,t);o.push(e)}})))})),[4,Promise.all(s)]);case 1:return a.sent(),r.ql.yi(i),[4,function(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r,i,o,s,a,f,h,l;return Object(u.d)(this,(function(u){switch(u.label){case 0:n=v(t),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(function(t){return ir.forEach(e,(function(e){return ir.forEach(e.Ca,(function(r){return n.persistence.Io.sc(t,e.targetId,r)})).next((function(){return ir.forEach(e.xa,(function(r){return n.persistence.Io.rc(t,e.targetId,r)}))}))}))}))];case 2:return u.sent(),[3,4];case 3:if(!cr(r=u.sent()))throw r;return c("LocalStore","Failed to update sequence numbers: "+r),[3,4];case 4:for(i=0,o=e;i<o.length;i++)s=o[i],a=s.targetId,s.fromCache||(f=n.Ba.get(a),h=f.oe,l=f.ue(h),n.Ba=n.Ba.Ie(a,l));return[2]}}))}))}(r.Uh,o)];case 2:a.sent(),a.label=3;case 3:return[2]}}
1))}))}function rs(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r;return Object(u.d)(this,(function(i){switch(i.label){case 0:return(n=v(t)).currentUser.isEqual(e)?[3,3]:(c("SyncEngine","User change. New user:",e.I()),[4,ho(n.Uh,e)]);case 1:return r=i.sent(),n.currentUser=e,function(t,e){t.Hl.forEach((function(t){t.forEach((function(t){t.reject(new E(_.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.Hl.clear()}(n),n.$l.wh(e,r.ja,r.Ga),[4,ns(n,r.Wa)];case 2:i.sent(),i.label=3;case 3:return[2]}}))}))}function is(t,e){var n=v(t),r=n.jl.get(e);if(r&&r.kl)return fn().add(r.key);var i=fn(),o=n.Ql.get(e);if(!o)return i;for(var u=0,s=o;u<s.length;u++){var a=s[u],c=n.Ul.get(a);i=i.je(c.view.pl)}return i}function os(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r,i;return Object(u.d)(this,(function(o){switch(o.label){case 0:return[4,wo((n=v(t)).Uh,e.query,!0)];case 1:return r=o.sent(),i=e.view.Fl(r),[2,(n.Xl&&Zu(n,e.targetId,i.xl),i)]}}))}))}function us(t){return Object(u.b)(this,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(n){return[2,_o((e=v(t)).Uh).then((function(t){return ns(e,t)}))]}))}))}function ss(t,e,n,r){return Object(u.b)(this,void 0,void 0,(function(){var i,o;return Object(u.d)(this,(function(u){switch(u.label){case 0:return[4,function(t,e){var n=v(t),r=v(n.Ra);return n.persistence.runTransaction("Lookup mutation documents","readonly",(function(t){return r.Vo(t,e).next((function(e){return e?n.Ka.Va(t,e):ir.resolve(null)}))}))}((i=v(t)).Uh,e)];case 1:return null===(o=u.sent())?[3,6]:"pending"!==n?[3,3]:[4,hu(i.Ml)];case 2:return u.sent(),[3,4];case 3:"acknowledged"===n||"rejected"===n?(Ju(i,e,r||null),Yu(i,e),function(t,e){v(v(t).Ra).Fo(e)}(i.Uh,e)):p(),u.label=4;case 4:return[4,ns(i,o)];case 5:return u.sent(),[3,7];case 6:c("SyncEngine","Cannot apply mutation batch with id: "+e),u.label=7;case 7:return[2]}}
1))}))}function as(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,f;return Object(u.d)(this,(function(u){switch(u.label){case 0:return ds(n=v(t)),vs(n),!0!==e||!0===n.Yl?[3,3]:(r=n.$l.th(),[4,cs(n,r.Dt())]);case 1:return i=u.sent(),n.Yl=!0,[4,gu(n.Ml,!0)];case 2:for(u.sent(),o=0,s=i;o<s.length;o++)a=s[o],Xo(n.Ml,a);return[3,7];case 3:return!1!==e||!1===n.Yl?[3,7]:(c=[],f=Promise.resolve(),n.Ql.forEach((function(t,e){n.$l.lh(e)?c.push(e):f=f.then((function(){return $u(n,e),bo(n.Uh,e,!0)})),Zo(n.Ml,e)})),[4,f]);case 4:return u.sent(),[4,cs(n,c)];case 5:return u.sent(),function(t){var e=v(t);e.jl.forEach((function(t,n){Zo(e.Ml,n)})),e.Gl.au(),e.jl=new Map,e.Wl=new Je(nt.At)}(n),n.Yl=!1,[4,gu(n.Ml,!1)];case 6:u.sent(),u.label=7;case 7:return[2]}}))}))}function cs(t,e,n){return Object(u.b)(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,f,h,l,p,d,y,m;return Object(u.d)(this,(function(u){switch(u.label){case 0:n=v(t),r=[],i=[],o=0,s=e,u.label=1;case 1:return o<s.length?(a=s[o],c=void 0,(f=n.Ql.get(a))&&0!==f.length?[4,go(n.Uh,se(f[0]))]:[3,7]):[3,13];case 2:c=u.sent(),h=0,l=f,u.label=3;case 3:return h<l.length?(p=l[h],d=n.Ul.get(p),[4,os(n,d)]):[3,6];case 4:(y=u.sent()).snapshot&&i.push(y.snapshot),u.label=5;case 5:return h++,[3,3];case 6:return[3,11];case 7:return[4,Io(n.Uh,a)];case 8:return m=u.sent(),[4,go(n.Uh,m)];case 9:return c=u.sent(),[4,qu(n,fs(m),a,!1)];case 10:u.sent(),u.label=11;case 11:r.push(c),u.label=12;case 12:return o++,[3,1];case 13:return[2,(n.ql.yi(i),r)]}}))}))}function fs(t){return Zt(t.path,t.collectionGroup,t.orderBy,t.filters,t.limit,"F",t.startAt,t.endAt)}function hs(t){var e=v(t);return v(v(e.Uh).persistence).Ea()}function ls(t,e,n,r){return Object(u.b)(this,void 0,void 0,(function(){var i,o,s;return Object(u.d)(this,(function(u){switch(u.label){case 0:return(i=v(t)).Yl?(c("SyncEngine","Ignoring unexpected query state notification."),[3,8]):[3,1];case 1:if(!i.Ql.has(e))return[3,8];switch(n){case"current":case"not-current":return[3,2];case"rejected":return[3,5]}return[3,7];case 2:return[4,_o(i.Uh)];case 3:return o=u.sent(),s=yn.un(e,"current"===n),[4,ns(i,o,s)];case 4:return u.sent(),[3,8];case 5:return[4,bo(i.Uh,e,!0)];case 6:return u.sent(),$u(i,e,r),[3,8];case 7:p(),u.label=8;case 8:return[2]}}
1))}))}function ps(t,e,n){return Object(u.b)(this,void 0,void 0,(function(){var r,i,o,s,a,f,h,l,p,d;return Object(u.d)(this,(function(v){switch(v.label){case 0:if(!(r=ds(t)).Yl)return[3,10];i=0,o=e,v.label=1;case 1:return i<o.length?(s=o[i],r.Ql.has(s)?(c("SyncEngine","Adding an already active target "+s),[3,5]):[4,Io(r.Uh,s)]):[3,6];case 2:return a=v.sent(),[4,go(r.Uh,a)];case 3:return f=v.sent(),[4,qu(r,fs(a),f.targetId,!1)];case 4:v.sent(),Xo(r.Ml,f),v.label=5;case 5:return i++,[3,1];case 6:h=function(t){return Object(u.d)(this,(function(e){switch(e.label){case 0:return r.Ql.has(t)?[4,bo(r.Uh,t,!1).then((function(){Zo(r.Ml,t),$u(r,t)})).catch(Nr)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))},l=0,p=n,v.label=7;case 7:return l<p.length?(d=p[l],[5,h(d)]):[3,10];case 8:v.sent(),v.label=9;case 9:return l++,[3,7];case 10:return[2]}}))}))}function ds(t){var e=v(t);return e.Ml.Kh.Zh=Gu.bind(null,e),e.Ml.Kh.Xn=is.bind(null,e),e.Ml.Kh.Xh=Ku.bind(null,e),e.ql.yi=Tu.bind(null,e.Ll),e.ql.t_=Nu.bind(null,e.Ll),e}function vs(t){var e=v(t);return e.Ml.Kh.tl=Qu.bind(null,e),e.Ml.Kh.el=Wu.bind(null,e),e}function ys(t,e,n){var r=v(t);(function(t,e,n){return Object(u.b)(this,void 0,void 0,(function(){var r,i,o,s,a,c;return Object(u.d)(this,(function(u){switch(u.label){case 0:return u.trys.push([0,14,,15]),[4,e.getMetadata()];case 1:return r=u.sent(),[4,function(t,e){var n=v(t),r=Sn(e.createTime);return n.persistence.runTransaction("hasNewerBundle","readonly",(function(t){return n.Wc.ao(t,e.id)})).then((function(t){return!!t&&t.createTime.u(r)>=0}))}(t.Uh,r)];case 2:return u.sent()?[4,e.close()]:[3,4];case 3:return[2,(u.sent(),void n.e_(function(t){return{taskState:"Success",documentsLoaded:t.totalDocuments,bytesLoaded:t.totalBytes,totalDocuments:t.totalDocuments,totalBytes:t.totalBytes}}(r)))];case 4:return n.n_(xu(r)),i=new Su(r,t.Uh,e.fe),[4,e.s_()];case 5:o=u.sent(),u.label=6;case 6:return o?[4,i.ml(o)]:[3,10];case 7:return(s=u.sent())&&n.n_(s),[4,e.s_()];case 8:o=u.sent(),u.label=9;case 9:return[3,6];case 10:return[4,i.complete()];case 11:return a=u.sent(),[4,ns(t,a.tr,void 0)];case 12:return u.sent(),[4,function(t,e){var n=v(t);return n.persistence.runTransaction("Save bundle","readwrite",(function(t){return n.Wc.uo(t,e)}))}(t.Uh,r)];case 13:return u.sent(),n.e_(a.progress),[3,15];case 14:return h("SyncEngine","Loading bundle failed with "+(c=u.sent())),n.i_(c),[3,15];case 15:return[2]}}
1))}))})(r,e,n).then((function(){r.$l.Ih()}))}var ms=function(){function t(){this.synchronizeTabs=!1}return t.prototype.initialize=function(t){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(e){switch(e.label){case 0:return this.fe=rr(t.rt.O),this.$l=this.r_(t),this.persistence=this.o_(t),[4,this.persistence.start()];case 1:return e.sent(),this.c_=this.a_(t),this.Uh=this.u_(t),[2]}}))}))},t.prototype.a_=function(t){return null},t.prototype.u_=function(t){return fo(this.persistence,new ao,t.h_,this.fe)},t.prototype.o_=function(t){return new Po(Lo.Du,this.fe)},t.prototype.r_=function(t){return new Ko},t.prototype.terminate=function(){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(t){switch(t.label){case 0:return this.c_&&this.c_.stop(),[4,this.$l.$()];case 1:return t.sent(),[4,this.persistence.$()];case 2:return t.sent(),[2]}}))}))},t}(),gs=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).l_=e,i.cacheSizeBytes=n,i.forceOwnership=r,i.synchronizeTabs=!1,i}return Object(u.c)(e,t),e.prototype.initialize=function(e){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(n){switch(n.label){case 0:return[4,t.prototype.initialize.call(this,e)];case 1:return n.sent(),[4,Eo(this.Uh)];case 2:return n.sent(),[4,this.l_.initialize(this,e)];case 3:return n.sent(),[4,vs(this.l_.Lu)];case 4:return n.sent(),[4,hu(this.l_.Ml)];case 5:return n.sent(),[2]}}))}))},e.prototype.u_=function(t){return fo(this.persistence,new ao,t.h_,this.fe)},e.prototype.a_=function(t){var e=this.persistence.Io.vr;return new Rr(e,t.ks)},e.prototype.o_=function(t){var e=oo(t.rt.O,t.rt.persistenceKey),n=void 0!==this.cacheSizeBytes?Or.Ki(this.cacheSizeBytes):Or.Gi;return new no(this.synchronizeTabs,e,t.clientId,n,t.ks,Qo(),Wo(),this.fe,this.$l,!!this.forceOwnership)},e.prototype.r_=function(t){return new Ko},e}(ms),bs=function(t){function e(e,n){var r=this;return(r=t.call(this,e,n,!1)||this).l_=e,r.cacheSizeBytes=n,r.synchronizeTabs=!0,r}return Object(u.c)(e,t),e.prototype.initialize=function(e){return Object(u.b)(this,void 0,void 0,(function(){var n,r=this;return Object(u.d)(this,(function(i){switch(i.label){case 0:return[4,t.prototype.initialize.call(this,e)];case 1:return i.sent(),n=this.l_.Lu,this.$l instanceof zo?(this.$l.Lu={Sh:ss.bind(null,n),Dh:ls.bind(null,n),Ch:ps.bind(null,n),Ea:hs.bind(null,n),bh:us.bind(null,n)},[4,this.$l.start()]):[3,3];case 2:i.sent(),i.label=3;case 3:return[4,this.persistence.Yc((function(t){return Object(u.b)(r,void 0,void 0,(function(){return Object(u.d)(this,(function(e){switch(e.label){case 0:return[4,as(this.l_.Lu,t)];case 1:return e.sent(),this.c_&&(t&&!this.c_.Nr?this.c_.start(this.Uh):t||this.c_.stop()),[2]}}))}))}))];case 4:return i.sent(),[2]}}))}))},e.prototype.r_=function(t){var e=Qo();if(!zo.G(e))throw new E(_.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var n=oo(t.rt.O,t.rt.persistenceKey);return new zo(e,t.ks,n,t.clientId,t.h_)},e}(gs),ws=function(){function t(){}return t.prototype.initialize=function(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n=this;return Object(u.d)(this,(function(r){switch(r.label){case 0:return this.Uh?[3,2]:(this.Uh=t.Uh,this.$l=t.$l,this.Qh=this.__(e),this.Ml=this.f_(e),this.Ll=this.d_(e),this.Lu=this.w_(e,!t.synchronizeTabs),this.$l.$u=function(t){return zu(n.Lu,t,1)},this.Ml.Kh.E_=rs.bind(null,this.Lu),[4,gu(this.Ml,this.Lu.Xl)]);case 1:r.sent(),r.label=2;case 2:return[2]}}
1))}))},t.prototype.d_=function(t){return new _u},t.prototype.__=function(t){var e,n=rr(t.rt.O),r=(e=t.rt,new Y(e));return function(t,e,n){return new wr(t,e,n)}(t.credentials,r,n)},t.prototype.f_=function(t){var e,n,r,i,o,u=this;return e=this.Uh,n=this.Qh,r=t.ks,i=function(t){return zu(u.Lu,t,0)},o=V.G()?new V:new C,new Yo(e,n,r,i,o)},t.prototype.w_=function(t,e){return function(t,e,n,r,i,o,u){var s=new Vu(t,e,n,r,i,o);return u&&(s.Yl=!0),s}(this.Uh,this.Ml,this.Ll,this.$l,t.h_,t.Bl,e)},t.prototype.terminate=function(){return function(t){return Object(u.b)(this,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(n){switch(n.label){case 0:return e=v(t),c("RemoteStore","RemoteStore shutting down."),e.Gh.add(5),[4,$o(e)];case 1:return n.sent(),e.Hh.$(),e.Jh.set("Unknown"),[2]}}))}))}(this.Ml)},t}();function Is(t,e){void 0===e&&(e=10240);var n=0;return{read:function(){return Object(u.b)(this,void 0,void 0,(function(){var r;return Object(u.d)(this,(function(i){return n<t.byteLength?(r={value:t.slice(n,n+e),done:!1},[2,(n+=e,r)]):[2,{done:!0}]}))}))},cancel:function(){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(t){return[2]}))}))},releaseLock:function(){}}}var _s=function(){function t(t){this.observer=t,this.muted=!1}return t.prototype.next=function(t){this.observer.next&&this.T_(this.observer.next,t)},t.prototype.error=function(t){this.observer.error?this.T_(this.observer.error,t):console.error("Uncaught Error in snapshot listener:",t)},t.prototype.I_=function(){this.muted=!0},t.prototype.T_=function(t,e){var n=this;this.muted||setTimeout((function(){n.muted||t(e)}),0)},t}(),Es=function(){function t(t,e){var n=this;this.m_=t,this.fe=e,this.metadata=new H,this.buffer=new Uint8Array,this.A_=new TextDecoder("utf-8"),this.R_().then((function(t){t&&t.Tl()?n.metadata.resolve(t.payload.metadata):n.metadata.reject(new Error("The first element of the bundle is not a metadata, it is\n             "+JSON.stringify(null==t?void 0:t.payload)))}),(function(t){return n.metadata.reject(t)}))}return t.prototype.close=function(){return this.m_.cancel()},t.prototype.getMetadata=function(){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(t){return[2,this.metadata.promise]}))}))},t.prototype.s_=function(){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(t){switch(t.label){case 0:return[4,this.getMetadata()];case 1:return[2,(t.sent(),this.R_())]}}))}))},t.prototype.R_=function(){return Object(u.b)(this,void 0,void 0,(function(){var t,e,n,r;return Object(u.d)(this,(function(i){switch(i.label){case 0:return[4,this.P_()];case 1:return null===(t=i.sent())?[2,null]:(e=this.A_.decode(t),n=Number(e),isNaN(n)&&this.y_("length string ("+e+") is not valid number"),[4,this.g_(n)]);case 2:return r=i.sent(),[2,new Du(JSON.parse(r),t.length+n)]}}))}))},t.prototype.V_=function(){return this.buffer.findIndex((function(t){return t==="{".charCodeAt(0)}))},t.prototype.P_=function(){return Object(u.b)(this,void 0,void 0,(function(){var t,e;return Object(u.d)(this,(function(n){switch(n.label){case 0:return this.V_()<0?[4,this.p_()]:[3,3];case 1:if(n.sent())return[3,3];n.label=2;case 2:return[3,0];case 3:return 0===this.buffer.length?[2,null]:((t=this.V_())<0&&this.y_("Reached the end of bundle when a length string is expected."),e=this.buffer.slice(0,t),[2,(this.buffer=this.buffer.slice(t),e)])}}))}))},t.prototype.g_=function(t){return Object(u.b)(this,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(n){switch(n.label){case 0:return this.buffer.length<t?[4,this.p_()]:[3,3];case 1:n.sent()&&this.y_("Reached the end of bundle when more is expected."),n.label=2;case 2:return[3,0];case 3:return e=this.A_.decode(this.buffer.slice(0,t)),[2,(this.buffer=this.buffer.slice(t),e)]}}))}))},t.prototype.y_=function(t){throw this.m_.cancel(),new Error("Invalid bundle format: "+t)},t.prototype.p_=function(){return Object(u.b)(this,void 0,void 0,(function(){var t,e;return Object(u.d)(this,(function(n){switch(n.label){case 0:return[4,this.m_.read()];
1case 1:return(t=n.sent()).done||((e=new Uint8Array(this.buffer.length+t.value.length)).set(this.buffer),e.set(t.value,this.buffer.length),this.buffer=e),[2,t.done]}}))}))},t}(),Os=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=0;n<t.length;++n)if(0===t[n].length)throw new E(_.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this.b_=new et(t)}return t.prototype.isEqual=function(t){return this.b_.isEqual(t.b_)},t}(),Ts=function(t){this._methodName=t},Ns=function(){function t(t,e,n){this.v_=e,this.S_=n,this.type="document",this.firestore=t}return Object.defineProperty(t.prototype,"D_",{get:function(){return this.S_.path},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this.S_.path.Vt()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return this.S_.path.Ct()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return new As(this.firestore,this.v_,this.S_.path.yt())},enumerable:!1,configurable:!0}),t.prototype.withConverter=function(e){return new t(this.firestore,e,this.S_)},t}(),js=function(){function t(t,e,n){this.v_=e,this.C_=n,this.type="query",this.firestore=t}return t.prototype.withConverter=function(e){return new t(this.firestore,e,this.C_)},t}(),As=function(t){function e(e,n,r){var i=this;return(i=t.call(this,e,n,te(r))||this).firestore=e,i.D_=r,i.type="collection",i}return Object(u.c)(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this.C_.path.Vt()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this.C_.path.Ct()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){var t=this.D_.yt();return t.bt()?null:new Ns(this.firestore,null,new nt(t))},enumerable:!1,configurable:!0}),e.prototype.withConverter=function(t){return new e(this.firestore,t,this.D_)},e}(js);function Ds(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];if(t instanceof T&&(t=t._),Ur("collection","path",e),t instanceof Qr)return qr(n=Z.xt.apply(Z,Object(u.g)([e],r))),new As(t,null,n);if(!(t instanceof Ns||t instanceof As))throw new E(_.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");return qr(n=Z.xt.apply(Z,Object(u.g)([t.path],r)).child(Z.xt(e))),new As(t.firestore,null,n)}function ks(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];if(t instanceof T&&(t=t._),1===arguments.length&&(e=m.t()),Ur("doc","path",e),t instanceof Qr)return Mr(n=Z.xt.apply(Z,Object(u.g)([e],r))),new Ns(t,null,new nt(n));if(!(t instanceof Ns||t instanceof As))throw new E(_.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");return Mr(n=t.D_.child(Z.xt.apply(Z,Object(u.g)([e],r)))),new Ns(t.firestore,t instanceof As?t.v_:null,new nt(n))}function Ss(t,e){return t instanceof T&&(t=t._),e instanceof T&&(e=e._),(t instanceof Ns||t instanceof As)&&(e instanceof Ns||e instanceof As)&&t.firestore===e.firestore&&t.path===e.path&&t.v_===e.v_}function xs(t,e){return t instanceof T&&(t=t._),e instanceof T&&(e=e._),t instanceof js&&e instanceof js&&t.firestore===e.firestore&&ce(t.C_,e.C_)&&t.v_===e.v_}var Ps=function(){function t(t,e){if(!isFinite(t)||t<-90||t>90)throw new E(_.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new E(_.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this.x_=t,this.N_=e}return Object.defineProperty(t.prototype,"latitude",{get:function(){return this.x_},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"longitude",{get:function(){return this.N_},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(t){return this.x_===t.x_&&this.N_===t.N_},t.prototype.toJSON=function(){return{latitude:this.x_,longitude:this.N_}},t.prototype.dt=function(t){return g(this.x_,t.x_)||g(this.N_,t.N_)},t}(),Rs=/^__.*__$/,Ls=function(){function t(t,e,n){this.data=t,this.Te=e,this.fieldTransforms=n}return t.prototype.F_=function(t,e){return null!==this.Te?new Be(t,this.data,this.Te,e,this.fieldTransforms):new Fe(t,this.data,e,this.fieldTransforms)},t}(),Us=function(){function t(t,e,n){this.data=t,this.Te=e,this.fieldTransforms=n}return t.prototype.F_=function(t,e){return new Be(t,this.data,this.Te,e,this.fieldTransforms)},t}();function Cs(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw p()}}var Vs=function(){function t(t,e,n,r,i,o){this.settings=t,this.O=e,this.fe=n,this.ignoreUndefinedProperties=r,void 0===i&&this.O_(),this.fieldTransforms=i||[],this.Te=o||[]}return Object.defineProperty(t.prototype,"path",{get:function(){return this.settings.path}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"k_",{get:function(){return this.settings.k_},enumerable:!1,configurable:!0}),t.prototype.M_=function(e){return new t(Object.assign(Object.assign({},this.settings),e),this.O,this.fe,this.ignoreUndefinedProperties,this.fieldTransforms,this.Te)},t.prototype.L_=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.M_({path:n,B_:!1});return r.q_(t),r},t.prototype.U_=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.M_({path:n,B_:!1});return r.O_(),r},t.prototype.Q_=function(t){return this.M_({path:void 0,B_:!0})},t.prototype.K_=function(t){return ia(t,this.settings.methodName,this.settings.W_||!1,this.path,this.settings.j_)},t.prototype.contains=function(t){return void 0!==this.Te.find((function(e){return t.vt(e)}))||void 0!==this.fieldTransforms.find((function(e){return t.vt(e.field)}))},t.prototype.O_=function(){if(this.path)for(var t=0;t<this.path.length;t++)this.q_(this.path.get(t))},t.prototype.q_=function(t){if(0===t.length)throw this.K_("Document fields must not be empty");if(Cs(this.k_)&&Rs.test(t))throw this.K_('Document fields cannot begin and end with "__"')},t}(),Ms=function(){function t(t,e,n){this.O=t,this.ignoreUndefinedProperties=e,this.fe=n||rr(t)}return t.prototype.G_=function(t,e,n,r){return void 0===r&&(r=!1),new Vs({k_:t,methodName:e,j_:n,path:et.Nt(),B_:!1,W_:r},this.O,this.fe,this.ignoreUndefinedProperties)},t}();function qs(t){var e=t.so(),n=rr(t.zr);return new Ms(t.zr,!!e.ignoreUndefinedProperties,n)}function Fs(t,e,n,r,i,o){void 0===o&&(o={});var u=t.G_(o.merge||o.mergeFields?2:0,e,n,i);ta("Data must be an object, but it was:",u,r);var s,a,c=Xs(r,u);if(o.merge)s=new ut(u.Te),a=u.fieldTransforms;else if(o.mergeFields){for(var f=[],h=0,l=o.mergeFields;h<l.length;h++){var p=ea(e,l[h],n);if(!u.contains(p))throw new E(_.INVALID_ARGUMENT,"Field '"+p+"' is specified in your field mask but missing from your input data.");oa(f,p)||f.push(p)}s=new ut(f),a=u.fieldTransforms.filter((function(t){return s.Qt(t.field)}))}else s=null,a=u.fieldTransforms;return new Ls(new Tt(c),s,a)}var Bs=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(u.c)(e,t),e.prototype.z_=function(t){if(2!==t.k_)throw 1===t.k_?t.K_(this._methodName+"() can only appear at the top level of your update data"):t.K_(this._methodName+"() cannot be used with set() unless you pass {merge:true}");return t.Te.push(t.path),null},e.prototype.isEqual=function(t){return t instanceof e},e}(Ts);function Gs(t,e,n){return new Vs({k_:3,j_:e.settings.j_,methodName:t._methodName,B_:n},e.O,e.fe,e.ignoreUndefinedProperties)}var zs=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(u.c)(e,t),e.prototype.z_=function(t){return new Se(t.path,new Ee)},e.prototype.isEqual=function(t){return t instanceof e},e}(Ts),Ks=function(t){function e(e,n){var r=this;return(r=t.call(this,e)||this).H_=n,r}return Object(u.c)(e,t),e.prototype.z_=function(t){var e=Gs(this,t,!0),n=this.H_.map((function(t){return $s(t,e)})),r=new Oe(n);return new Se(t.path,r)},e.prototype.isEqual=function(t){return this===t},e}(Ts),Qs=function(t){function e(e,n){var r=this;return(r=t.call(this,e)||this).H_=n,r}return Object(u.c)(e,t),e.prototype.z_=function(t){var e=Gs(this,t,!0),n=this.H_.map((function(t){return $s(t,e)})),r=new Ne(n);return new Se(t.path,r)},e.prototype.isEqual=function(t){return this===t},e}(Ts),Ws=function(t){function e(e,n){var r=this;return(r=t.call(this,e)||this).J_=n,r}return Object(u.c)(e,t),e.prototype.z_=function(t){var e=new Ae(t.fe,ge(t.fe,this.J_));return new Se(t.path,e)},e.prototype.isEqual=function(t){return this===t},e}(Ts);function Hs(t,e,n,r){var i=t.G_(1,e,n);ta("Data must be an object, but it was:",i,r);var o=[],u=new Nt;it(r,(function(t,r){var s=ra(e,t,n);r instanceof T&&(r=r._);var a=i.U_(s);if(r instanceof Bs)o.push(s);else{var c=$s(r,a);null!=c&&(o.push(s),u.set(s,c))}}));var s=new ut(o);return new Us(u.Gt(),s,i.fieldTransforms)}function Ys(t,e,n,r,i,o){var u=t.G_(1,e,n),s=[ea(e,r,n)],a=[i];
1if(o.length%2!=0)throw new E(_.INVALID_ARGUMENT,"Function "+e+"() needs to be called with an even number of arguments that alternate between field names and values.");for(var c=0;c<o.length;c+=2)s.push(ea(e,o[c])),a.push(o[c+1]);for(var f=[],h=new Nt,l=s.length-1;l>=0;--l)if(!oa(f,s[l])){var p=s[l],d=a[l];d instanceof T&&(d=d._);var v=u.U_(p);if(d instanceof Bs)f.push(p);else{var y=$s(d,v);null!=y&&(f.push(p),h.set(p,y))}}var m=new ut(f);return new Us(h.Gt(),m,u.fieldTransforms)}function Js(t,e,n,r){return void 0===r&&(r=!1),$s(n,t.G_(r?4:3,e))}function $s(t,e){if(t instanceof T&&(t=t._),Zs(t))return ta("Unsupported field value:",e,t),Xs(t,e);if(t instanceof Ts)return function(t,e){if(!Cs(e.k_))throw e.K_(t._methodName+"() can only be used with update() and set()");if(!e.path)throw e.K_(t._methodName+"() is not currently supported inside arrays");var n=t.z_(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(e.path&&e.Te.push(e.path),t instanceof Array){if(e.settings.B_&&4!==e.k_)throw e.K_("Nested arrays are not supported");return function(t,e){for(var n=[],r=0,i=0,o=t;i<o.length;i++){var u=$s(o[i],e.Q_(r));null==u&&(u={nullValue:"NULL_VALUE"}),n.push(u),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(t instanceof T&&(t=t._),null===t)return{nullValue:"NULL_VALUE"};if("number"==typeof t)return ge(e.fe,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){var n=J.fromDate(t);return{timestampValue:An(e.fe,n)}}if(t instanceof J)return n=new J(t.seconds,1e3*Math.floor(t.nanoseconds/1e3)),{timestampValue:An(e.fe,n)};if(t instanceof Ps)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof O)return{bytesValue:Dn(e.fe,t.l)};if(t instanceof Ns){n=e.O;var r=t.firestore.zr;if(!r.isEqual(n))throw e.K_("Document reference is for database "+r.projectId+"/"+r.database+" but should be for database "+n.projectId+"/"+n.database);return{referenceValue:xn(t.firestore.zr||e.O,t.S_.path)}}if(void 0===t&&e.ignoreUndefinedProperties)return null;throw e.K_("Unsupported field value: "+Fr(t))}(t,e)}function Xs(t,e){var n={};return ot(t)?e.path&&e.path.length>0&&e.Te.push(e.path):it(t,(function(t,r){var i=$s(r,e.L_(t));null!=i&&(n[t]=i)})),{mapValue:{fields:n}}}function Zs(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof J||t instanceof Ps||t instanceof O||t instanceof Ns||t instanceof Ts)}function ta(t,e,n){if(!Zs(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){var r=Fr(n);throw"an object"===r?e.K_(t+" a custom object"):e.K_(t+" "+r)}}function ea(t,e,n){if(e instanceof T&&(e=e._),e instanceof Os)return e.b_;if("string"==typeof e)return ra(t,e);throw ia("Field path arguments must be of type string or FieldPath.",t,!1,void 0,n)}var na=new RegExp("[~\\*/\\[\\]]");function ra(t,e,n){if(e.search(na)>=0)throw ia("Invalid field path ("+e+"). Paths must not contain '~', '*', '/', '[', or ']'",t,!1,void 0,n);try{return(new(Os.bind.apply(Os,Object(u.g)([void 0],e.split("."))))).b_}catch(r){throw ia("Invalid field path ("+e+"). Paths must not be empty, begin with '.', end with '.', or contain '..'",t,!1,void 0,n)}}function ia(t,e,n,r,i){var o=r&&!r.bt(),u=void 0!==i,s="Function "+e+"() called with invalid data";n&&(s+=" (via `toFirestore()`)");var a="";return(o||u)&&(a+=" (found",o&&(a+=" in field "+r),u&&(a+=" in document "+i),a+=")"),new E(_.INVALID_ARGUMENT,(s+=". ")+t+a)}function oa(t,e){return t.some((function(t){return t.isEqual(e)}))}var ua=function(){function t(t){this.Qh=t,this.Y_=new Map,this.mutations=[],this.X_=!1,this.Z_=null,this.tf=new Set}return t.prototype.ef=function(t){return Object(u.b)(this,void 0,void 0,(function(){var e,n=this;return Object(u.d)(this,(function(r){switch(r.label){case 0:if(this.nf(),this.mutations.length>0)throw new E(_.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r,i,o,s,a;return Object(u.d)(this,(function(u){switch(u.label){case 0:return n=v(t),r=Vn(n.fe)+"/documents",i={documents:e.map((function(t){return Rn(n.fe,t)}))},[4,n._t("BatchGetDocuments",r,i)];case 1:return o=u.sent(),s=new Map,o.forEach((function(t){var e=function(t,e){return"found"in e?function(t,e){d(!!e.found),e.found.name,e.found.updateTime;var n=Ln(t,e.found.name),r=Sn(e.found.updateTime),i=new Tt({mapValue:{fields:e.found.fields}});return new Dt(n,r,i,{})}(t,e):"missing"in e?function(t,e){d(!!e.missing),d(!!e.readTime);var n=Ln(t,e.missing),r=Sn(e.readTime);return new kt(n,r)}(t,e):p()}(n.fe,t);s.set(e.key.toString(),e)})),a=[],[2,(e.forEach((function(t){var e=s.get(t.toString());d(!!e),a.push(e)})),a)]}}))}))}(this.Qh,t)];
1case 1:return[2,((e=r.sent()).forEach((function(t){t instanceof kt||t instanceof Dt?n.sf(t):p()})),e)]}}))}))},t.prototype.set=function(t,e){this.write(e.F_(t,this.Ee(t))),this.tf.add(t.toString())},t.prototype.update=function(t,e){try{this.write(e.F_(t,this.rf(t)))}catch(t){this.Z_=t}this.tf.add(t.toString())},t.prototype.delete=function(t){this.write(new We(t,this.Ee(t))),this.tf.add(t.toString())},t.prototype.commit=function(){return Object(u.b)(this,void 0,void 0,(function(){var t,e=this;return Object(u.d)(this,(function(n){switch(n.label){case 0:if(this.nf(),this.Z_)throw this.Z_;return t=this.Y_,this.mutations.forEach((function(e){t.delete(e.key.toString())})),t.forEach((function(t,n){var r=nt.Lt(n);e.mutations.push(new He(r,e.Ee(r)))})),[4,function(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r,i;return Object(u.d)(this,(function(o){switch(o.label){case 0:return n=v(t),r=Vn(n.fe)+"/documents",i={writes:e.map((function(t){return Bn(n.fe,t)}))},[4,n.at("Commit",r,i)];case 1:return o.sent(),[2]}}))}))}(this.Qh,this.mutations)];case 1:return n.sent(),this.X_=!0,[2]}}))}))},t.prototype.sf=function(t){var e;if(t instanceof Dt)e=t.version;else{if(!(t instanceof kt))throw p();e=$.min()}var n=this.Y_.get(t.key.toString());if(n){if(!e.isEqual(n))throw new E(_.ABORTED,"Document version changed between two reads.")}else this.Y_.set(t.key.toString(),e)},t.prototype.Ee=function(t){var e=this.Y_.get(t.toString());return!this.tf.has(t.toString())&&e?Pe.updateTime(e):Pe.de()},t.prototype.rf=function(t){var e=this.Y_.get(t.toString());if(!this.tf.has(t.toString())&&e){if(e.isEqual($.min()))throw new E(_.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Pe.updateTime(e)}return Pe.exists(!0)},t.prototype.write=function(t){this.nf(),this.mutations.push(t)},t.prototype.nf=function(){},t}(),sa=function(){function t(t,e,n,r){this.ks=t,this.Qh=e,this.updateFunction=n,this.Bs=r,this.cf=5,this.ui=new yr(this.ks,"transaction_retry")}return t.prototype.run=function(){this.af()},t.prototype.af=function(){var t=this;this.ui.ti((function(){return Object(u.b)(t,void 0,void 0,(function(){var t,e,n=this;return Object(u.d)(this,(function(r){return t=new ua(this.Qh),(e=this.uf(t))&&e.then((function(e){n.ks.Ws((function(){return t.commit().then((function(){n.Bs.resolve(e)})).catch((function(t){n.hf(t)}))}))})).catch((function(t){n.hf(t)})),[2]}))}))}))},t.prototype.uf=function(t){try{var e=this.updateFunction(t);return!M(e)&&e.catch&&e.then?e:(this.Bs.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.Bs.reject(t),null}},t.prototype.hf=function(t){var e=this;this.cf>0&&this.lf(t)?(this.cf-=1,this.ks.Ws((function(){return e.af(),Promise.resolve()}))):this.Bs.reject(t)},t.prototype.lf=function(t){if("FirebaseError"===t.name){var e=t.code;return"aborted"===e||"failed-precondition"===e||!K(e)}return!1},t}(),aa=function(){function t(t,e,n){var r=this;this.credentials=t,this.ks=e,this.rt=n,this.user=D.UNAUTHENTICATED,this.clientId=m.t(),this._f=function(){},this.S=new H,this.credentials.V((function(t){c("FirestoreClient","Received user=",t.uid),r.user.isEqual(t)||(r.user=t,r._f(t)),r.S.resolve()}))}return t.prototype.getConfiguration=function(){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(t){switch(t.label){case 0:return[4,this.S.promise];case 1:return[2,(t.sent(),{ks:this.ks,rt:this.rt,clientId:this.clientId,credentials:this.credentials,h_:this.user,Bl:100})]}}))}))},t.prototype.ff=function(t){var e=this;this._f=t,this.S.promise.then((function(){return e._f(e.user)}))},t.prototype.df=function(){if(this.ks.wf)throw new E(_.FAILED_PRECONDITION,"The client has already been terminated.")},t.prototype.terminate=function(){var t=this;this.ks.Ef();var e=new H;return this.ks.Tf((function(){return Object(u.b)(t,void 0,void 0,(function(){var t,n;return Object(u.d)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),this.If?[4,this.If.terminate()]:[3,2];case 1:r.sent(),r.label=2;case 2:return this.mf?[4,this.mf.terminate()]:[3,4];case 3:r.sent(),r.label=4;case 4:return this.credentials.p(),e.resolve(),[3,6];case 5:return t=r.sent(),n=vr(t,"Failed to shutdown persistence"),e.reject(n),[3,6];case 6:return[2]}}
1))}))})),e.promise},t}();function ca(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r=this;return Object(u.d)(this,(function(i){switch(i.label){case 0:return t.ks.Af(),c("FirestoreClient","Initializing OfflineComponentProvider"),[4,t.getConfiguration()];case 1:return n=i.sent(),[4,e.initialize(n)];case 2:return i.sent(),t.ff((function(n){return t.ks.ea((function(){return Object(u.b)(r,void 0,void 0,(function(){return Object(u.d)(this,(function(t){switch(t.label){case 0:return[4,ho(e.Uh,n)];case 1:return t.sent(),[2]}}))}))}))})),e.persistence.Xc((function(){return t.terminate()})),t.mf=e,[2]}}))}))}function fa(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r;return Object(u.d)(this,(function(i){switch(i.label){case 0:return t.ks.Af(),[4,ha(t)];case 1:return n=i.sent(),c("FirestoreClient","Initializing OnlineComponentProvider"),[4,t.getConfiguration()];case 2:return r=i.sent(),[4,e.initialize(n,r)];case 3:return i.sent(),t.ff((function(n){return t.ks.ea((function(){return function(t,e){return Object(u.b)(this,void 0,void 0,(function(){var n,r;return Object(u.d)(this,(function(i){switch(i.label){case 0:return(n=v(t)).ks.Af(),c("RemoteStore","RemoteStore received new credentials"),r=iu(n),n.Gh.add(3),[4,$o(n)];case 1:return i.sent(),r&&n.Jh.set("Unknown"),[4,n.Kh.E_(e)];case 2:return i.sent(),n.Gh.delete(3),[4,Jo(n)];case 3:return i.sent(),[2]}}))}))}(e.Ml,n)}))})),t.If=e,[2]}}))}))}function ha(t){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(e){switch(e.label){case 0:return t.mf?[3,2]:(c("FirestoreClient","Using default OfflineComponentProvider"),[4,ca(t,new ms)]);case 1:e.sent(),e.label=2;case 2:return[2,t.mf]}}))}))}function la(t){return Object(u.b)(this,void 0,void 0,(function(){return Object(u.d)(this,(function(e){switch(e.label){case 0:return t.If?[3,2]:(c("FirestoreClient","Using default OnlineComponentProvider"),[4,fa(t,new ws)]);case 1:e.sent(),e.label=2;case 2:return[2,t.If]}}))}))}function pa(t){return ha(t).then((function(t){return t.persistence}))}function da(t){return ha(t).then((function(t){return t.Uh}))}function va(t){return la(t).then((function(t){return t.Ml}))}function ya(t){return la(t).then((function(t){return t.Lu}))}function ma(t){return Object(u.b)(this,void 0,void 0,(function(){var e,n;return Object(u.d)(this,(function(r){switch(r.label){case 0:return[4,la(t)];case 1:return e=r.sent(),[2,((n=e.Ll).ol=Mu.bind(null,e.Lu),n.ul=Fu.bind(null,e.Lu),n)]}}))}))}function ga(t,e,n){var r=this;void 0===n&&(n={});var i=new H;return t.ks.Ws((function(){return Object(u.b)(r,void 0,void 0,(function(){var r;return Object(u.d)(this,(function(o){switch(o.label){case 0:return r=function(t,e,n,r,i){var o=new _s({next:function(o){e.Ws((function(){return Ou(t,u)}));var s=o.docs.has(n);!s&&o.fromCache?i.reject(new E(_.UNAVAILABLE,"Failed to get document because the client is offline.")):s&&o.fromCache&&r&&"server"===r.source?i.reject(new E(_.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)}}),u=new Au(te(n.path),o,{includeMetadataChanges:!0,El:!0});return Eu(t,u)},[4,ma(t)];case 1:return[2,r.apply(void 0,[o.sent(),t.ks,e,n,i])]}}))}))})),i.promise}function ba(t,e,n){var r=this;void 0===n&&(n={});var i=new H;return t.ks.Ws((function(){return Object(u.b)(r,void 0,void 0,(function(){var r;return Object(u.d)(this,(function(o){switch(o.label){case 0:return r=function(t,e,n,r,i){var o=new _s({next:function(n){e.Ws((function(){return Ou(t,u)})),n.fromCache&&"server"===r.source?i.reject(new E(_.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)}}),u=new Au(n,o,{includeMetadataChanges:!0,El:!0});return Eu(t,u)},[4,ma(t)];case 1:return[2,r.apply(void 0,[o.sent(),t.ks,e,n,i])]}}))}))})),i.promise}var wa=function(){function t(){var t=this;this.Rf=Promise.resolve(),this.Pf=[],this.yf=!1,this.gf=[],this.Vf=null,this.pf=!1,this.bf=[],this.ui=new yr(this,"async_queue_retry"),this.vf=function(){var e=Wo();e&&c("AsyncQueue","Visibility state changed to "+e.visibilityState),t.ui.si()};var e=Wo();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.vf)}return Object.defineProperty(t.prototype,"wf",{get:function(){return this.yf}
1,enumerable:!1,configurable:!0}),t.prototype.Ws=function(t){this.enqueue(t)},t.prototype.Tf=function(t){this.Sf(),this.Df(t)},t.prototype.Ef=function(){if(!this.yf){this.yf=!0;var t=Wo();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.vf)}},t.prototype.enqueue=function(t){return this.Sf(),this.yf?new Promise((function(t){})):this.Df(t)},t.prototype.ea=function(t){var e=this;this.Ws((function(){return e.Pf.push(t),e.Cf()}))},t.prototype.Cf=function(){return Object(u.b)(this,void 0,void 0,(function(){var t,e=this;return Object(u.d)(this,(function(n){switch(n.label){case 0:if(0===this.Pf.length)return[3,5];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.Pf[0]()];case 2:return n.sent(),this.Pf.shift(),this.ui.reset(),[3,4];case 3:if(!cr(t=n.sent()))throw t;return c("AsyncQueue","Operation failed with retryable error: "+t),[3,4];case 4:this.Pf.length>0&&this.ui.ti((function(){return e.Cf()})),n.label=5;case 5:return[2]}}))}))},t.prototype.Df=function(t){var e=this,n=this.Rf.then((function(){return e.pf=!0,t().catch((function(t){throw e.Vf=t,e.pf=!1,f("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.pf=!1,t}))}));return this.Rf=n,n},t.prototype.ni=function(t,e,n){var r=this;this.Sf(),this.bf.indexOf(t)>-1&&(e=0);var i=dr.qs(this,t,e,n,(function(t){return r.xf(t)}));return this.gf.push(i),i},t.prototype.Sf=function(){this.Vf&&p()},t.prototype.Af=function(){},t.prototype.Nf=function(){return Object(u.b)(this,void 0,void 0,(function(){var t;return Object(u.d)(this,(function(e){switch(e.label){case 0:return[4,t=this.Rf];case 1:e.sent(),e.label=2;case 2:if(t!==this.Rf)return[3,0];e.label=3;case 3:return[2]}}
1))}))},t.prototype.Ff=function(t){for(var e=0,n=this.gf;e<n.length;e++)if(n[e].Ms===t)return!0;return!1},t.prototype.Of=function(t){var e=this;return this.Nf().then((function(){e.gf.sort((function(t,e){return t.Ls-e.Ls}));for(var n=0,r=e.gf;n<r.length;n++){var i=r[n];if(i.Ks(),"all"!==t&&i.Ms===t)break}return e.Nf()}))},t.prototype.kf=function(t){this.bf.push(t)},t.prototype.xf=function(t){var e=this.gf.indexOf(t);this.gf.splice(e,1)},t}(),Ia=-1,_a=function(t){function e(e,n){var r=this;return(r=t.call(this,e,n)||this).Mf=new wa,r.Wr="name"in e?e.name:"[DEFAULT]",r}return Object(u.c)(e,t),e.prototype.io=function(){return this.Lf||Oa(this),this.Lf.terminate()},e}(Qr);function Ea(t){return t.Lf||Oa(t),t.Lf.df(),t.Lf}function Oa(t){var e=t.so(),n=function(t,e,n){return new L(t,e,n.host,n.ssl,n.experimentalForceLongPolling,n.experimentalAutoDetectLongPolling)}(t.zr,t.Wr,e);t.Lf=new aa(t.Hr,t.Mf,n)}function Ta(t,e,n){var r=this,i=new H;return t.ks.enqueue((function(){return Object(u.b)(r,void 0,void 0,(function(){var r;return Object(u.d)(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,ca(t,n)];case 1:return o.sent(),[4,fa(t,e)];case 2:return o.sent(),i.resolve(),[3,4];case 3:if(!function(t){return"FirebaseError"===t.name?t.code===_.FAILED_PRECONDITION||t.code===_.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code}(r=o.sent()))throw r;return console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+r),i.reject(r),[3,4];case 4:return[2]}}
1))}))})).then((function(){return i.promise}))}function Na(t){if(t.Yr||t.Xr)throw new E(_.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.")}var ja=function(){function t(){}return t.prototype.$f=function(t,e){switch(void 0===e&&(e="none"),pt(t)){case 0:return null;case 1:return t.booleanValue;case 2:return ct(t.integerValue||t.doubleValue);case 3:return this.Bf(t.timestampValue);case 4:return this.qf(t,e);case 5:return t.stringValue;case 6:return this.Uf(ft(t.bytesValue));case 7:return this.Qf(t.referenceValue);case 8:return this.Kf(t.geoPointValue);case 9:return this.Wf(t.arrayValue,e);case 10:return this.jf(t.mapValue,e);default:throw p()}},t.prototype.jf=function(t,e){var n=this,r={};return it(t.fields||{},(function(t,i){r[t]=n.$f(i,e)})),r},t.prototype.Kf=function(t){return new Ps(ct(t.latitude),ct(t.longitude))},t.prototype.Wf=function(t,e){var n=this;return(t.values||[]).map((function(t){return n.$f(t,e)}))},t.prototype.qf=function(t,e){switch(e){case"previous":var n=function t(e){var n=e.mapValue.fields.__previous_value__;return ht(n)?t(n):n}(t);return null==n?null:this.$f(n,e);case"estimate":return this.Bf(lt(t));default:return null}},t.prototype.Bf=function(t){var e=at(t);return new J(e.seconds,e.nanos)},t.prototype.Gf=function(t,e){var n=Z.xt(t);d(nr(n));var r=new U(n.get(1),n.get(3)),i=new nt(n.Pt(5));return r.isEqual(e)||f("Document "+i+" contains a document reference within a different database ("+r.projectId+"/"+r.database+") which is not supported. It will be treated as a reference in the current database ("+e.projectId+"/"+e.database+") instead."),i},t}(),Aa=function(){function t(t,e,n,r,i){this.zf=t,this.Hf=e,this.S_=n,this.Jf=r,this.v_=i}return Object.defineProperty(t.prototype,"id",{get:function(){return this.S_.path.Vt()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ref",{get:function(){return new Ns(this.zf,this.v_,this.S_)},enumerable:!1,configurable:!0}),t.prototype.exists=function(){return null!==this.Jf},t.prototype.data=function(){if(this.Jf){if(this.v_){var t=new Da(this.zf,this.Hf,this.S_,this.Jf,null);return this.v_.fromFirestore(t)}return this.Hf.$f(this.Jf.Yt())}},t.prototype.get=function(t){if(this.Jf){var e=this.Jf.data().field(ka("DocumentSnapshot.get",t));if(null!==e)return this.Hf.$f(e)}},t}(),Da=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(u.c)(e,t),e.prototype.data=function(){return t.prototype.data.call(this)},e}(Aa);function ka(t,e){return"string"==typeof e?ra(t,e):e instanceof T?e._.b_:e.b_}function Sa(t){if(ne(t)&&0===t.ne.length)throw new E(_.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var xa=function(){};function Pa(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0,i=e;r<i.length;r++){var o=i[r];t=o.Yf(t)}return t}var Ra=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).Xf=e,i.Zf=n,i.td=r,i.type="where",i}return Object(u.c)(e,t),e.prototype.Yf=function(t){var e=qs(t.firestore),n=function(t,e,n,r,i,o,u){var s;if(i.Ot()){if("array-contains"===o||"array-contains-any"===o)throw new E(_.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+o+"' queries on FieldPath.documentId().");if("in"===o||"not-in"===o){Fa(u,o);for(var a=[],c=0,f=u;c<f.length;c++){var h=f[c];a.push(qa(r,t,h))}s={arrayValue:{values:a}}}else s=qa(r,t,u)}else"in"!==o&&"not-in"!==o&&"array-contains-any"!==o||Fa(u,o),s=Js(n,"where",u,"in"===o||"not-in"===o);var l=Ct.create(i,o,s);return function(t,e){if(e.ee()){var n=ie(t);if(null!==n&&!n.isEqual(e.field))throw new E(_.INVALID_ARGUMENT,"Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on '"+n.toString()+"' and '"+e.field.toString()+"'");var r=re(t);null!==r&&Ba(t,e.field,r)}var i=function(t,e){for(var n=0,r=t.filters;n<r.length;n++){var i=r[n];if(e.indexOf(i.op)>=0)return i.op}return null}(t,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","
1not-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 E(_.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+e.op.toString()+"' filter."):new E(_.INVALID_ARGUMENT,"Invalid query. You cannot use '"+e.op.toString()+"' filters with '"+i.toString()+"' filters.")}(t,l),l}(t.C_,0,e,t.firestore.zr,this.Xf,this.Zf,this.td);return new js(t.firestore,t.v_,function(t,e){var n=t.filters.concat([e]);return new Xt(t.path,t.collectionGroup,t.ne.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}(t.C_,n))},e}(xa),La=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).Xf=e,r.ed=n,r.type="orderBy",r}return Object(u.c)(e,t),e.prototype.Yf=function(t){var e=function(t,e,n){if(null!==t.startAt)throw new E(_.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==t.endAt)throw new E(_.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");var r=new Ht(e,n);return function(t,e){if(null===re(t)){var n=ie(t);null!==n&&Ba(t,n,e.field)}}(t,r),r}(t.C_,this.Xf,this.ed);return new js(t.firestore,t.v_,function(t,e){var n=t.ne.concat([e]);return new Xt(t.path,t.collectionGroup,n,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(t.C_,e))},e}(xa),Ua=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).type=e,i.nd=n,i.sd=r,i}return Object(u.c)(e,t),e.prototype.Yf=function(t){return new js(t.firestore,t.v_,ae(t.C_,this.nd,this.sd))},e}(xa),Ca=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).type=e,i.rd=n,i.od=r,i}return Object(u.c)(e,t),e.prototype.Yf=function(t){var e=Ma(t,this.type,this.rd,this.od);return new js(t.firestore,t.v_,function(t,e){return new Xt(t.path,t.collectionGroup,t.ne.slice(),t.filters.slice(),t.limit,t.limitType,e,t.endAt)}(t.C_,e))},e}(xa),Va=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).type=e,i.rd=n,i.od=r,i}return Object(u.c)(e,t),e.prototype.Yf=function(t){var e=Ma(t,this.type,this.rd,this.od);return new js(t.firestore,t.v_,function(t,e){return new Xt(t.path,t.collectionGroup,t.ne.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,e)}(t.C_,e))},e}(xa);function Ma(t,e,n,r){if(n[0]instanceof T&&(n[0]=n[0]._),n[0]instanceof Aa)return function(t,e,n,r,i){if(!r)throw new E(_.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+n+"().");for(var o=[],u=0,s=ue(t);u<s.length;u++){var a=s[u];if(a.field.Ot())o.push(bt(e,r.key));else{var c=r.field(a.field);if(ht(c))throw new E(_.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+a.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===c){var f=a.field.Ct();throw new E(_.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '"+f+"' (used as the orderBy) does not exist.")}o.push(c)}}return new Qt(o,i)}(t.C_,t.firestore.zr,e,n[0].Jf,r);var i=qs(t.firestore);return function(t,e,n,r,i,o){var u=t.ne;if(i.length>u.length)throw new E(_.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=[],a=0;a<i.length;a++){var c=i[a];if(u[a].field.Ot()){if("string"!=typeof c)throw new E(_.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+r+"(), but got a "+typeof c);if(!oe(t)&&-1!==c.indexOf("/"))throw new E(_.INVALID_ARGUMENT,"Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to "+r+"() must be a plain document ID, but '"+c+"' contains a slash.");var f=t.path.child(Z.xt(c));if(!nt.qt(f))throw new E(_.INVALID_ARGUMENT,"Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to "+r+"() must result in a valid document path, but '"+f+"' is not because it c
1ontains an odd number of segments.");var h=new nt(f);s.push(bt(e,h))}else{var l=Js(n,r,c);s.push(l)}}return new Qt(s,o)}(t.C_,t.firestore.zr,i,e,n,r)}function qa(t,e,n){if(n instanceof T&&(n=n._),"string"==typeof n){if(""===n)throw new E(_.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!oe(e)&&-1!==n.indexOf("/"))throw new E(_.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(Z.xt(n));if(!nt.qt(r))throw new E(_.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 bt(t,new nt(r))}if(n instanceof Ns)return bt(t,n.S_);throw new E(_.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+Fr(n)+".")}function Fa(t,e){if(!Array.isArray(t)||0===t.length)throw new E(_.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+e.toString()+"' filters.");if(t.length>10)throw new E(_.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters support a maximum of 10 elements in the value array.")}function Ba(t,e,n){if(!n.isEqual(e))throw new E(_.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 argument to orderBy(), but your first orderBy() is on field '"+n.toString()+"' instead.")}function Ga(t,e,n){return t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e}var za=function(t){function e(e){var n=this;return(n=t.call(this)||this).firestore=e,n}return Object(u.c)(e,t),e.prototype.Uf=function(t){return new O(t)},e.prototype.Qf=function(t){var e=this.Gf(t,this.firestore.zr);return new Ns(this.firestore,null,e)},e}(ja);function Ka(t){return function(t,e){if("object"!=typeof t||null===t)return!1;for(var n=t,r=0,i=["next","error","complete"];r<i.length;r++){var o=i[r];if(o in n&&"function"==typeof n[o])return!0}return!1}(t)}var Qa=function(){function t(t,e){this.hasPendingWrites=t,this.fromCache=e}return t.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},t}(),Wa=function(t){function e(e,n,r,i,o,u){var s=this;return(s=t.call(this,e,n,r,i,u)||this).zf=e,s.ad=e,s.metadata=o,s}return Object(u.c)(e,t),e.prototype.exists=function(){return t.prototype.exists.call(this)},e.prototype.data=function(t){if(void 0===t&&(t={}),this.Jf){if(this.v_){var e=new Ha(this.zf,this.Hf,this.S_,this.Jf,this.metadata,null);return this.v_.fromFirestore(e,t)}return this.Hf.$f(this.Jf.Yt(),t.serverTimestamps)}},e.prototype.get=function(t,e){if(void 0===e&&(e={}),this.Jf){var n=this.Jf.data().field(ka("DocumentSnapshot.get",t));if(null!==n)return this.Hf.$f(n,e.serverTimestamps)}},e}(Aa),Ha=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(u.c)(e,t),e.prototype.data=function(e){return void 0===e&&(e={}),t.prototype.data.call(this,e)},e}(Wa),Ya=function(){function t(t,e,n,r){this.zf=t,this.Hf=e,this.ud=r,this.metadata=new Qa(r.hasPendingWrites,r.fromCache),this.query=n}return Object.defineProperty(t.prototype,"docs",{get:function(){var t=[];return this.forEach((function(e){return t.push(e)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.ud.docs.size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this.size},enumerable:!1,configurable:!0}),t.prototype.forEach=function(t,e){var n=this;this.ud.docs.forEach((function(r){t.call(e,new Ha(n.zf,n.Hf,r.key,r,new Qa(n.ud.tn.has(r.key),n.ud.fromCache),n.query.v_))}))},t.prototype.docChanges=function(t){void 0===t&&(t={});var e=!!t.includeMetadataChanges;
1if(e&&this.ud.nn)throw new E(_.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this.hd&&this.ld===e||(this.hd=function(t,e){if(t.ud.Ze.bt()){var n=0;return t.ud.docChanges.map((function(e){var r=new Ha(t.zf,t.Hf,e.doc.key,e.doc,new Qa(t.ud.tn.has(e.doc.key),t.ud.fromCache),t.query.v_);return e.doc,{type:"added",doc:r,oldIndex:-1,newIndex:n++}}))}var r=t.ud.Ze;return t.ud.docChanges.filter((function(t){return e||3!==t.type})).map((function(e){var n=new Ha(t.zf,t.Hf,e.doc.key,e.doc,new Qa(t.ud.tn.has(e.doc.key),t.ud.fromCache),t.query.v_),i=-1,o=-1;return 0!==e.type&&(i=r.indexOf(e.doc.key),r=r.delete(e.doc.key)),1!==e.type&&(o=(r=r.add(e.doc)).indexOf(e.doc.key)),{type:Ja(e.type),doc:n,oldIndex:i,newIndex:o}}))}(this,e),this.ld=e),this.hd},t}();function Ja(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return p()}}function $a(t,e){return t instanceof Wa&&e instanceof Wa?t.zf===e.zf&&t.S_.isEqual(e.S_)&&(null===t.Jf?null===e.Jf:t.Jf.isEqual(e.Jf))&&t.v_===e.v_:t instanceof Ya&&e instanceof Ya&&t.zf===e.zf&&xs(t.query,e.query)&&t.metadata.isEqual(e.metadata)&&t.ud.isEqual(e.ud)}var Xa=function(t){function e(e){var n=this;return(n=t.call(this)||this).firestore=e,n}return Object(u.c)(e,t),e.prototype.Uf=function(t){return new O(t)},e.prototype.Qf=function(t){var e=this.Gf(t,this.firestore.zr);return new Ns(this.firestore,null,e)},e}(ja);function Za(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];t=Br(t,Ns);var o=Br(t.firestore,_a),u=qs(o);return e instanceof T&&(e=e._),ec(o,[("string"==typeof e||e instanceof Os?Ys(u,"updateDoc",t.S_,e,n,r):Hs(u,"updateDoc",t.S_,e)).F_(t.S_,Pe.exists(!0))])}function tc(t){for(var e,n,r,i=[],o=1;o<arguments.length;o++)i[o-1]=arguments[o];t instanceof T&&(t=t._);var s={includeMetadataChanges:!1},a=0;"object"!=typeof i[a]||Ka(i[a])||(s=i[a],a++);var c,f,h,l={includeMetadataChanges:s.includeMetadataChanges};if(Ka(i[a])){var p=i[a];i[a]=null===(e=p.next)||void 0===e?void 0:e.bind(p),i[a+1]=null===(n=p.error)||void 0===n?void 0:n.bind(p),i[a+2]=null===(r=p.complete)||void 0===r?void 0:r.bind(p)}if(t instanceof Ns)f=Br(t.firestore,_a),h=te(t.S_.path),c={next:function(e){i[a]&&i[a](nc(f,t,e))},error:i[a+1],complete:i[a+2]};else{var d=Br(t,js);f=Br(d.firestore,_a),h=d.C_;var v=new Xa(f);c={next:function(t){i[a]&&i[a](new Ya(f,v,d,t))},error:i[a+1],complete:i[a+2]},Sa(t.C_)}return function(t,e,n,r){var i=this,o=new _s(r),s=new Au(e,o,n);return t.ks.Ws((function(){return Object(u.b)(i,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(n){switch(n.label){case 0:return e=Eu,[4,ma(t)];case 1:return[2,e.apply(void 0,[n.sent(),s])]}}))}))})),function(){o.I_(),t.ks.Ws((function(){return Object(u.b)(i,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(n){switch(n.label){case 0:return e=Ou,[4,ma(t)];case 1:return[2,e.apply(void 0,[n.sent(),s])]}}))}))}))}}(Ea(f),h,l,c)}function ec(t,e){return function(t,e){var n=this,r=new H;return t.ks.Ws((function(){return Object(u.b)(n,void 0,void 0,(function(){var n;return Object(u.d)(this,(function(i){switch(i.label){case 0:return n=Bu,[4,ya(t)];case 1:return[2,n.apply(void 0,[i.sent(),e,r])]}}))}))})),r.promise}(Ea(t),e)}function nc(t,e,n){var r=n.docs.get(e.S_),i=new Xa(t);return new Wa(t,i,e.S_,r,new Qa(n.hasPendingWrites,n.fromCache),e.v_)}var rc=function(){function t(t,e){this.zf=t,this._d=e,this.fd=[],this.dd=!1,this.wd=qs(t)}return t.prototype.set=function(t,e,n){this.Ed();var r=ic(t,this.zf),i=Ga(r.v_,e,n),o=Fs(this.wd,"WriteBatch.set",r.S_,i,null!==r.v_,n);return this.fd.push(o.F_(r.S_,Pe.de())),this},t.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];this.Ed();var o,u=ic(t,this.zf);return e instanceof T&&(e=e._),o="string"==typeof e||e instanceof Os?Ys(this.wd,"WriteBatch.update",u.S_,e,n,r):Hs(this.wd,"WriteBatch.update",u.S_,e),this.fd.push(o.F_(u.S_,Pe.exists(!0))),this},t.prototype.delete=function(t){this.Ed();var e=ic(t,this.zf);return this.fd=this.fd.concat(new We(e.S_,Pe.de())),this},t.prototype.commit=function(){return this.Ed(),this.dd=!0,this.fd.length>0?this._d(this.fd):Promise.resolve()},t.prototype.Ed=function(){if(this.dd)throw new E(_.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},t}();function ic(t,e){if(t instanceof T&&(t=t._),t.firestore!==e)throw new E(_.INVA
1LID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}var oc=function(t){function e(e,n){var r=this;return(r=t.call(this,e,n)||this).zf=e,r}return Object(u.c)(e,t),e.prototype.get=function(e){var n=this,r=ic(e,this.zf),i=new Xa(this.zf);return t.prototype.get.call(this,e).then((function(t){return new Wa(n.zf,i,r.S_,t.Jf,new Qa(!1,!1),r.v_)}))},e}(function(){function t(t,e){this.zf=t,this.Td=e,this.wd=qs(t)}return t.prototype.get=function(t){var e=this,n=ic(t,this.zf),r=new za(this.zf);return this.Td.ef([n.S_]).then((function(t){if(!t||1!==t.length)return p();var i=t[0];if(i instanceof kt)return new Aa(e.zf,r,n.S_,null,n.v_);if(i instanceof Dt)return new Aa(e.zf,r,i.key,i,n.v_);throw p()}))},t.prototype.set=function(t,e,n){var r=ic(t,this.zf),i=Ga(r.v_,e,n),o=Fs(this.wd,"Transaction.set",r.S_,i,null!==r.v_,n);return this.Td.set(r.S_,o),this},t.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];var o,u=ic(t,this.zf);return e instanceof T&&(e=e._),o="string"==typeof e||e instanceof Os?Ys(this.wd,"Transaction.update",u.S_,e,n,r):Hs(this.wd,"Transaction.update",u.S_,e),this.Td.update(u.S_,o),this},t.prototype.delete=function(t){var e=ic(t,this.zf);return this.Td.delete(e.S_),this},t}()),uc=function(){function t(){}return t.prototype.enableIndexedDbPersistence=function(t,e){return function(t,e){Na(t=Br(t,_a));var n=Ea(t),r=t.so(),i=new ws;return Ta(n,i,new gs(i,r.cacheSizeBytes,null==e?void 0:e.forceOwnership))}(t._,{forceOwnership:e})},t.prototype.enableMultiTabIndexedDbPersistence=function(t){return function(t){Na(t=Br(t,_a));var e=Ea(t),n=t.so(),r=new ws;return Ta(e,r,new bs(r,n.cacheSizeBytes))}(t._)},t.prototype.clearIndexedDbPersistence=function(t){return function(t){var e=this;if(t.Yr&&!t.Xr)throw new E(_.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");var n=new H;return t.Mf.Tf((function(){return Object(u.b)(e,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,function(t){return Object(u.b)(this,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(n){switch(n.label){case 0:return ur.G()?(e=t+"main",[4,ur.delete(e)]):[2,Promise.resolve()];case 1:return n.sent(),[2]}}))}))}(oo(t.zr,t.Wr))];case 1:return r.sent(),n.resolve(),[3,3];case 2:return e=r.sent(),n.reject(e),[3,3];case 3:return[2]}}
1))}))})),n.promise}(t._)},t}(),sc=function(t){function e(e,n,r){var i=this;return(i=t.call(this,n)||this).Id=r,i.INTERNAL={delete:function(){return i.terminate()}},e instanceof U||(i.md=e),i}return Object(u.c)(e,t),Object.defineProperty(e.prototype,"zr",{get:function(){return this._.zr},enumerable:!1,configurable:!0}),e.prototype.settings=function(t){t.merge&&delete(t=Object.assign(Object.assign({},this._.no()),t)).merge,this._.eo(t)},e.prototype.useEmulator=function(t,e){"firestore.googleapis.com"!==this._.no().host&&h("Host has been set in both settings() and useEmulator(), emulator host will be used"),this.settings({host:t+":"+e,ssl:!1,merge:!0})},e.prototype.enableNetwork=function(){return function(t){var e=this;return t.ks.enqueue((function(){return Object(u.b)(e,void 0,void 0,(function(){var e,n;return Object(u.d)(this,(function(r){switch(r.label){case 0:return[4,pa(t)];case 1:return e=r.sent(),[4,va(t)];case 2:return n=r.sent(),[2,(e.Zc(!0),function(t){var e=v(t);return e.Gh.delete(0),Jo(e)}(n))]}}))}))}))}(Ea(Br(this._,_a)))},e.prototype.disableNetwork=function(){return function(t){var e=this;return t.ks.enqueue((function(){return Object(u.b)(e,void 0,void 0,(function(){var e,n;return Object(u.d)(this,(function(r){switch(r.label){case 0:return[4,pa(t)];case 1:return e=r.sent(),[4,va(t)];case 2:return n=r.sent(),[2,(e.Zc(!1),function(t){return Object(u.b)(this,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(n){switch(n.label){case 0:return(e=v(t)).Gh.add(0),[4,$o(e)];case 1:return n.sent(),e.Jh.set("Offline"),[2]}}))}))}(n))]}}))}))}))}(Ea(Br(this._,_a)))},e.prototype.enablePersistence=function(t){var e=!1,n=!1;return t&&Vr("synchronizeTabs",e=!!t.synchronizeTabs,"experimentalForceOwningTab",n=!!t.experimentalForceOwningTab),e?this.Id.enableMultiTabIndexedDbPersistence(this):this.Id.enableIndexedDbPersistence(this,n)},e.prototype.clearPersistence=function(){return this.Id.clearIndexedDbPersistence(this)},e.prototype.terminate=function(){return this.app._removeServiceInstance("firestore"),this.app._removeServiceInstance("firestore-exp"),this._._delete()},e.prototype.waitForPendingWrites=function(){return function(t){var e=this,n=new H;return t.ks.Ws((function(){return Object(u.b)(e,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(r){switch(r.label){case 0:return e=Hu,[4,ya(t)];case 1:return[2,e.apply(void 0,[r.sent(),n])]}}))}))})),n.promise}(Ea(Br(this._,_a)))},e.prototype.onSnapshotsInSync=function(t){return function(t,e){return function(t,e){var n=this,r=new _s(e);return t.ks.Ws((function(){return Object(u.b)(n,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(n){switch(n.label){case 0:return e=function(t,e){v(t).rl.add(e),e.next()},[4,ma(t)];case 1:return[2,e.apply(void 0,[n.sent(),r])]}}))}))})),function(){r.I_(),t.ks.Ws((function(){return Object(u.b)(n,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(n){switch(n.label){case 0:return e=function(t,e){v(t).rl.delete(e)},[4,ma(t)];case 1:return[2,e.apply(void 0,[n.sent(),r])]}}))}))}))}}(Ea(t=Br(t,_a)),Ka(e)?e:{next:e})}(this._,t)},Object.defineProperty(e.prototype,"app",{get:function(){if(!this.md)throw new E(_.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.md},enumerable:!1,configurable:!0}),e.prototype.collection=function(t){try{return new Ic(this,Ds(this._,t))}catch(t){throw pc(t,"collection()","Firestore.collection()")}},e.prototype.doc=function(t){try{return new lc(this,ks(this._,t))}catch(t){throw pc(t,"doc()","Firestore.doc()")}},e.prototype.collectionGroup=function(t){try{return new gc(this,function(t,e){if(t=Br(t,Qr),Ur("collectionGroup","collection id",e),e.indexOf("/")>=0)throw new E(_.INVALID_ARGUMENT,"Invalid collection ID '"+e+"' passed to function collectionGroup(). Collection IDs must not contain '/'.");return new js(t,null,function(t){return new Xt(Z.Nt(),t)}(e))}(this._,t))}catch(t){throw pc(t,"collectionGroup()","Firestore.collectionGroup()")}},e.prototype.runTransaction=function(t){var e=this;return function(t,e){return function(t,e){var n=this,r=new H;return t.ks.Ws((function(){return Object(u.b)(n,void 0,void 0,(function(){var n;return Object(u.d)(this,(function(i){switch(i.label){case 0:return[4,function(t){return la(t).then((function(t){return t.Qh}))}(t)];case 1:return n=i.sent(),new sa(t.ks,n,e,r).run(),[2]}}))}))})),r.promise}(Ea(t),(function(n){return e(new oc(t,n))}
1))}(this._,(function(n){return t(new fc(e,n))}))},e.prototype.batch=function(){var t=this;return Ea(this._),new hc(new rc(this._,(function(e){return ec(t._,e)})))},e.prototype.loadBundle=function(t){throw new E(_.FAILED_PRECONDITION,'"loadBundle()" does not exist, have you imported "firebase/firestore/bundle"?')},e.prototype.namedQuery=function(t){throw new E(_.FAILED_PRECONDITION,'"namedQuery()" does not exist, have you imported "firebase/firestore/bundle"?')},e}(T),ac=function(t){function e(e){var n=this;return(n=t.call(this)||this).firestore=e,n}return Object(u.c)(e,t),e.prototype.Uf=function(t){return new A(new O(t))},e.prototype.Qf=function(t){var e=this.Gf(t,this.firestore.zr);return lc.Ad(e,this.firestore,null)},e}(ja);function cc(t){var e;e=t,s.setLogLevel(e)}var fc=function(t){function e(e,n){var r=this;return(r=t.call(this,n)||this).zf=e,r}return Object(u.c)(e,t),e.prototype.get=function(t){var e=this,n=_c(t);return this._.get(n).then((function(t){return new yc(e.zf,t)}))},e.prototype.set=function(t,e,n){var r=_c(t);return n?(Cr("Transaction.set",n),this._.set(r,e,n)):this._.set(r,e),this},e.prototype.update=function(t,e,n){for(var r,i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];var s=_c(t);return 2===arguments.length?this._.update(s,e):(r=this._).update.apply(r,Object(u.g)([s,e,n],i)),this},e.prototype.delete=function(t){var e=_c(t);return this._.delete(e),this},e}(T),hc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(u.c)(e,t),e.prototype.set=function(t,e,n){var r=_c(t);return n?(Cr("WriteBatch.set",n),this._.set(r,e,n)):this._.set(r,e),this},e.prototype.update=function(t,e,n){for(var r,i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];var s=_c(t);return 2===arguments.length?this._.update(s,e):(r=this._).update.apply(r,Object(u.g)([s,e,n],i)),this},e.prototype.delete=function(t){var e=_c(t);return this._.delete(e),this},e.prototype.commit=function(){return this._.commit()},e}(T),lc=function(t){function e(e,n){var r=this;return(r=t.call(this,n)||this).firestore=e,r.Hf=new ac(e),r}return Object(u.c)(e,t),e.Rd=function(t,n,r){if(t.length%2!=0)throw new E(_.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.Ct()+" has "+t.length);return new e(n,new Ns(n._,r,new nt(t)))},e.Ad=function(t,n,r){return new e(n,new Ns(n._,r,t))},Object.defineProperty(e.prototype,"id",{get:function(){return this._.id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return new Ic(this.firestore,this._.parent)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this._.path},enumerable:!1,configurable:!0}),e.prototype.collection=function(t){try{return new Ic(this.firestore,Ds(this._,t))}catch(t){throw pc(t,"collection()","DocumentReference.collection()")}},e.prototype.isEqual=function(t){return t instanceof T&&(t=t._),t instanceof Ns&&Ss(this._,t)},e.prototype.set=function(t,e){e=Cr("DocumentReference.set",e);try{return function(t,e,n){t=Br(t,Ns);var r=Br(t.firestore,_a),i=Ga(t.v_,e,n);return ec(r,[Fs(qs(r),"setDoc",t.S_,i,null!==t.v_,n).F_(t.S_,Pe.de())])}(this._,t,e)}catch(t){throw pc(t,"setDoc()","DocumentReference.set()")}},e.prototype.update=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];try{return 1===arguments.length?Za(this._,t):Za.apply(void 0,Object(u.g)([this._,t,e],n))}catch(t){throw pc(t,"updateDoc()","DocumentReference.update()")}},e.prototype.delete=function(){return ec(Br((t=this._).firestore,_a),[new We(t.S_,Pe.de())]);var t},e.prototype.onSnapshot=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=dc(e),i=vc(e,(function(e){return new yc(t.firestore,new Wa(t.firestore._,t.Hf,e.S_,e.Jf,e.metadata,t._.v_))}));return tc(this._,r,i)},e.prototype.get=function(t){var e=this;return("cache"===(null==t?void 0:t.source)?function(t){t=Br(t,Ns);var e=Br(t.firestore,_a),n=Ea(e),r=new Xa(e);return function(t,e){var n=this,r=new H;return t.ks.Ws((function(){return Object(u.b)(n,void 0,void 0,(function(){var n;return Object(u.d)(this,(function(i){switch(i.label){case 0:return n=function(t,e,n){return Object(u.b)(this,void 0,void 0,(function(){var r,i;return Object(u.d)(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,function(t,e){var n=v(t);return n.persistence.runTransaction("read document","readonly",(function(t){return n.Ka.Pa(t,e)}))}(t,e)];case 1:return(i=o.sent())instanceof Dt?n.resolve(i):i instanceof kt?n.resolve(null):n.reject(new E(_.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 r=o.sent(),i=vr(r,"Failed to get document '"+e+" from cache"),n.reject(i),[3,3];case 3:return[2]}}
1))}))},[4,da(t)];case 1:return[2,n.apply(void 0,[i.sent(),e,r])]}}))}))})),r.promise}(n,t.S_).then((function(n){return new Wa(e,r,t.S_,n,new Qa(n instanceof Dt&&n.Jt,!0),t.v_)}))}(this._):"server"===(null==t?void 0:t.source)?function(t){t=Br(t,Ns);var e=Br(t.firestore,_a);return ga(Ea(e),t.S_,{source:"server"}).then((function(n){return nc(e,t,n)}))}(this._):function(t){t=Br(t,Ns);var e=Br(t.firestore,_a);return ga(Ea(e),t.S_).then((function(n){return nc(e,t,n)}))}(this._)).then((function(t){return new yc(e.firestore,new Wa(e.firestore._,e.Hf,t.S_,t.Jf,t.metadata,e._.v_))}))},e.prototype.withConverter=function(t){return new e(this.firestore,this._.withConverter(t))},e}(T);function pc(t,e,n){return t.message=t.message.replace(e,n),t}function dc(t){for(var e=0,n=t;e<n.length;e++){var r=n[e];if("object"==typeof r&&!Ka(r))return r}return{}}function vc(t,e){var n,r,i;return{next:function(t){i.next&&i.next(e(t))},error:null===(n=(i=Ka(t[0])?t[0]:Ka(t[1])?t[1]:"function"==typeof t[0]?{next:t[0],error:t[1],complete:t[2]}:{next:t[1],error:t[2],complete:t[3]}).error)||void 0===n?void 0:n.bind(i),complete:null===(r=i.complete)||void 0===r?void 0:r.bind(i)}}var yc=function(t){function e(e,n){var r=this;return(r=t.call(this,n)||this).zf=e,r}return Object(u.c)(e,t),Object.defineProperty(e.prototype,"ref",{get:function(){return new lc(this.zf,this._.ref)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this._.id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"metadata",{get:function(){return this._.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"exists",{get:function(){return this._.exists()},enumerable:!1,configurable:!0}),e.prototype.data=function(t){return this._.data(t)},e.prototype.get=function(t,e){return this._.get(t,e)},e.prototype.isEqual=function(t){return $a(this._,t._)},e}(T),mc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(u.c)(e,t),e.prototype.data=function(t){return this._.data(t)},e}(yc),gc=function(t){function e(e,n){var r=this;return(r=t.call(this,n)||this).firestore=e,r.Hf=new ac(e),r}return Object(u.c)(e,t),e.prototype.where=function(t,n,r){try{return new e(this.firestore,Pa(this._,function(t,e,n){var r=e,i=ka("where",t);return new Ra(i,r,n)}(t,n,r)))}catch(t){throw pc(t,/(orderBy|where)\(\)/,"Query.$1()")}},e.prototype.orderBy=function(t,n){try{return new e(this.firestore,Pa(this._,function(t,e){void 0===e&&(e="asc");var n=e,r=ka("orderBy",t);return new La(r,n)}(t,n)))}catch(t){throw pc(t,/(orderBy|where)\(\)/,"Query.$1()")}},e.prototype.limit=function(t){try{return new e(this.firestore,Pa(this._,function(t){return Gr("limit",t),new Ua("limit",t,"F")}(t)))}catch(t){throw pc(t,"limit()","Query.limit()")}},e.prototype.limitToLast=function(t){try{return new e(this.firestore,Pa(this._,function(t){return Gr("limitToLast",t),new Ua("limitToLast",t,"L")}(t)))}catch(t){throw pc(t,"limitToLast()","Query.limitToLast()")}},e.prototype.startAt=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return new e(this.firestore,Pa(this._,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Ca("startAt",t,!0)}.apply(void 0,t)))}catch(t){throw pc(t,"startAt()","Query.startAt()")}},e.prototype.startAfter=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return new e(this.firestore,Pa(this._,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Ca("startAfter",t,!1)}.apply(void 0,t)))}catch(t){throw pc(t,"startAfter()","Query.startAfter()")}},e.prototype.endBefore=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return new e(this.firestore,Pa(this._,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Va("endBefore",t,!0)}.apply(void 0,t)))}catch(t){throw pc(t,"endBefore()","Query.endBefore()")}},e.prototype.endAt=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return new e(this.firestore,Pa(this._,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Va("endAt",t,!1)}.apply(void 0,t)))}catch(t){throw pc(t,"endAt()","Query.endAt()")}},e.prototype.isEqual=function(t){return xs(this._,t._)},e.prototype.get=function(t){var e=this;
1return("cache"===(null==t?void 0:t.source)?function(t){t=Br(t,js);var e=Br(t.firestore,_a),n=Ea(e),r=new Xa(e);return function(t,e){var n=this,r=new H;return t.ks.Ws((function(){return Object(u.b)(n,void 0,void 0,(function(){var n;return Object(u.d)(this,(function(i){switch(i.label){case 0:return n=function(t,e,n){return Object(u.b)(this,void 0,void 0,(function(){var r,i,o,s,a;return Object(u.d)(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),[4,wo(t,e,!0)];case 1:return a=u.sent(),r=new Lu(e,a.za),i=r.bl(a.documents),o=r.yr(i,!1),n.resolve(o.snapshot),[3,3];case 2:return s=u.sent(),a=vr(s,"Failed to execute query '"+e+" against cache"),n.reject(a),[3,3];case 3:return[2]}}))}))},[4,da(t)];case 1:return[2,n.apply(void 0,[i.sent(),e,r])]}}))}))})),r.promise}(n,t.C_).then((function(n){return new Ya(e,r,t,n)}))}(this._):"server"===(null==t?void 0:t.source)?function(t){t=Br(t,js);var e=Br(t.firestore,_a),n=Ea(e),r=new Xa(e);return ba(n,t.C_,{source:"server"}).then((function(n){return new Ya(e,r,t,n)}))}(this._):function(t){t=Br(t,js);var e=Br(t.firestore,_a),n=Ea(e),r=new Xa(e);return Sa(t.C_),ba(n,t.C_).then((function(n){return new Ya(e,r,t,n)}))}(this._)).then((function(t){return new wc(e.firestore,new Ya(e.firestore._,e.Hf,e._,t.ud))}))},e.prototype.onSnapshot=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=dc(e),i=vc(e,(function(e){return new wc(t.firestore,new Ya(t.firestore._,t.Hf,t._,e.ud))}));return tc(this._,r,i)},e.prototype.withConverter=function(t){return new e(this.firestore,this._.withConverter(t))},e}(T),bc=function(t){function e(e,n){var r=this;return(r=t.call(this,n)||this).zf=e,r}return Object(u.c)(e,t),Object.defineProperty(e.prototype,"type",{get:function(){return this._.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"doc",{get:function(){return new mc(this.zf,this._.doc)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"oldIndex",{get:function(){return this._.oldIndex},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"newIndex",{get:function(){return this._.newIndex},enumerable:!1,configurable:!0}),e}(T),wc=function(t){function e(e,n){var r=this;return(r=t.call(this,n)||this).zf=e,r}return Object(u.c)(e,t),Object.defineProperty(e.prototype,"query",{get:function(){return new gc(this.zf,this._.query)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"metadata",{get:function(){return this._.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"empty",{get:function(){return this._.empty},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"docs",{get:function(){var t=this;return this._.docs.map((function(e){return new mc(t.zf,e)}))},enumerable:!1,configurable:!0}),e.prototype.docChanges=function(t){var e=this;return this._.docChanges(t).map((function(t){return new bc(e.zf,t)}))},e.prototype.forEach=function(t,e){var n=this;this._.forEach((function(r){t.call(e,new mc(n.zf,r))}))},e.prototype.isEqual=function(t){return $a(this._,t._)},e}(T),Ic=function(t){function e(e,n){var r=this;return(r=t.call(this,e,n)||this).firestore=e,r._=n,r}return Object(u.c)(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this._.id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this._.path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){var t=this._.parent;return t?new lc(this.firestore,t):null},enumerable:!1,configurable:!0}),e.prototype.doc=function(t){try{return new lc(this.firestore,void 0===t?ks(this._):ks(this._,t))}catch(t){throw pc(t,"doc()","CollectionReference.doc()")}},e.prototype.add=function(t){var e=this;return function(t,e){var n=Br(t.firestore,_a),r=ks(t),i=Ga(t.v_,e);return ec(n,[Fs(qs(t.firestore),"addDoc",r.S_,i,null!==t.v_,{}).F_(r.S_,Pe.exists(!1))]).then((function(){return r}))}(this._,t).then((function(t){return new lc(e.firestore,t)}))},e.prototype.isEqual=function(t){return Ss(this._,t._)},e.prototype.withConverter=function(t){return new e(this.firestore,this._.withConverter(t))},e}(gc);function _c(t){return t instanceof T&&(t=t._),Br(t,Ns)}var Ec=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.call(this,new(Os.bind.apply(Os,Object(u.g)([void 0],e))))||this}return Object(u.c)(e,t),e.documentId=function(){return new e(et.kt().Ct())},e.prototype.isEqual=function(t){return t instanceof T&&(t=t._),t instanceof Os&&this._.b_.isEqual(t.b_)},e}(T),Oc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(u.c)(e,t),e.serverTimestamp=function(){var t=new zs("serverTimestamp");return t._methodName="FieldValue.serverTimestamp",new e(t)},e.delete=function(){var t=new Bs("deleteField");return t._methodName="FieldValue.delete",new e(t)},e.arrayUnion=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Ks("arrayUnion",t)}.apply(void 0,t);return r._methodName="FieldValue.arrayUnion",new e(r)},e.arrayRemove=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Qs("arrayRemove",t)}.apply(void 0,t);return r._methodName="FieldValue.arrayRemove",new e(r)},e.increment=function(t){var n=function(t){return new Ws("increment",t)}(t);return n._methodName="FieldValue.increment",new e(n)},e.prototype.isEqual=function(t){return this._.isEqual(t._)},e}(T),Tc=function(){function t(){this.Pd={},this.yd=new H,this.gd={taskState:"Running",totalBytes:0,totalDocuments:0,bytesLoaded:0,documentsLoaded:0}}return t.prototype.onProgress=function(t,e,n){this.Pd={next:t,error:e,complete:n}},t.prototype.catch=function(t){return this.yd.promise.catch(t)},t.prototype.then=function(t,e){return this.yd.promise.then(t,e)},t.prototype.e_=function(t){this.n_(t),this.Pd.complete&&this.Pd.complete(),this.yd.resolve(t)},t.prototype.i_=function(t){this.gd.taskState="Error",this.Pd.next&&this.Pd.next(this.gd),this.Pd.error&&this.Pd.error(t),this.yd.reject(t)},t.prototype.n_=function(t){this.gd=t,this.Pd.next&&this.Pd.next(t)},t}();function Nc(t,e){var n=new Tc;return function(t,e,n,r){var i=this,o=function(t,e){return function(t,e){return new Es(t,e)}(function(t,e){if(t instanceof Uint8Array)return Is(t,e);if(t instanceof ArrayBuffer)return Is(new Uint8Array(t),e);if(t instanceof ReadableStream)return t.getReader();throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream")}
1("string"==typeof t?(new TextEncoder).encode(t):t),e)}(n,rr(e));t.ks.Ws((function(){return Object(u.b)(i,void 0,void 0,(function(){var e;return Object(u.d)(this,(function(n){switch(n.label){case 0:return e=ys,[4,ya(t)];case 1:return e.apply(void 0,[n.sent(),o,r]),[2]}}))}))}))}(Ea(t._),t.zr,e,n),n}function jc(t,e){return function(t,e){var n=this;return t.ks.enqueue((function(){return Object(u.b)(n,void 0,void 0,(function(){var n;return Object(u.d)(this,(function(r){switch(r.label){case 0:return n=function(t,e){var n=v(t);return n.persistence.runTransaction("Get named query","readonly",(function(t){return n.Wc.ho(t,e)}))},[4,da(t)];case 1:return[2,n.apply(void 0,[r.sent(),e])]}}))}))}))}(Ea(t._),e).then((function(e){return e?new gc(t,new js(t._,null,e.query)):null}))}}).call(this,n("8oxB"))}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.