diff --git a/web/__/firebase/8.9.1/firebase-firestore.js b/web/__/firebase/8.9.1/firebase-firestore.js new file mode 100644 index 00000000..b3968b7d --- /dev/null +++ b/web/__/firebase/8.9.1/firebase-firestore.js @@ -0,0 +1,2 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).firebase)}(this,function(mm){"use strict";try{!function(){function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var e=t(mm),r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var o=function(){return(o=Object.assign||function(t){for(var e,n=1,r=arguments.length;ns[0]&&e[1]>6,c=63&c;u||(c=64,s||(h=64)),r.push(n[o>>2],n[(3&o)<<4|a>>4],n[h],n[c])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(function(t){for(var e=[],n=0,r=0;r>6|192:(55296==(64512&i)&&r+1>18|240,e[n++]=i>>12&63|128):e[n++]=i>>12|224,e[n++]=i>>6&63|128),e[n++]=63&i|128)}return e}(t),e)},decodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){for(var e=[],n=0,r=0;n>10)),e[r++]=String.fromCharCode(56320+(1023&i))):(o=t[n++],s=t[n++],e[r++]=String.fromCharCode((15&a)<<12|(63&o)<<6|63&s))}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray:function(t,e){this.init_();for(var n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i>4),64!==a&&(r.push(s<<4&240|a>>2),64!==u&&r.push(a<<6&192|u))}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var t=0;t=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};function h(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function i(){return!function(){try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(t){return}}()&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}var u,c="FirebaseError",l=(n(f,u=Error),f);function f(t,e,n){e=u.call(this,e)||this;return e.code=t,e.customData=n,e.name=c,Object.setPrototypeOf(e,f.prototype),Error.captureStackTrace&&Error.captureStackTrace(e,d.prototype.create),e}var d=(p.prototype.create=function(t){for(var e=[],n=1;n"})):"Error",t=this.serviceName+": "+t+" ("+o+").";return new l(o,t,i)},p);function p(t,e,n){this.service=t,this.serviceName=e,this.errors=n}var m,v=/\{\$([^}]+)}/g;function w(t){return t&&t._delegate?t._delegate:t}(N=m=m||{})[N.DEBUG=0]="DEBUG",N[N.VERBOSE=1]="VERBOSE",N[N.INFO=2]="INFO",N[N.WARN=3]="WARN",N[N.ERROR=4]="ERROR",N[N.SILENT=5]="SILENT";function b(t,e){for(var n=[],r=2;r=t.length?void 0:t)&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var N,C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},k={},R=C||self;function x(){}function O(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function L(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var P="closure_uid_"+(1e9*Math.random()>>>0),M=0;function F(t,e,n){return t.call.apply(t.bind,arguments)}function V(e,n,t){if(!e)throw Error();if(2parseFloat(dt)){ot=String(pt);break t}}ot=dt}var yt={};function gt(){return t=function(){for(var t=0,e=X(String(ot)).split("."),n=X("9").split("."),r=Math.max(e.length,n.length),i=0;0==t&&i>>0);function Vt(e){return"function"==typeof e?e:(e[Ft]||(e[Ft]=function(t){return e.handleEvent(t)}),e[Ft])}function Ut(){j.call(this),this.i=new At(this),(this.P=this).I=null}function qt(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e?e=new wt(e,t):e instanceof wt?e.target=e.target||t:(s=e,rt(e=new wt(r,t),s)),s=!0,n)for(var i=n.length-1;0<=i;i--)var o=e.g=n[i],s=Bt(o,r,!0,e)&&s;if(s=Bt(o=e.g=t,r,!0,e)&&s,s=Bt(o,r,!1,e)&&s,n)for(i=0;io.length?Oe:(o=o.substr(a,s),i.C=a+s,o)))==Oe){4==e&&(t.o=4,ve(14),u=!1),le(t.j,t.m,null,"[Incomplete Response]");break}if(r==xe){t.o=4,ve(15),le(t.j,t.m,n,"[Invalid Chunk]"),u=!1;break}le(t.j,t.m,r,null),Ke(t,r)}Me(t)&&r!=Oe&&r!=xe&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,ve(16),u=!1),t.i=t.i&&u,u?0>4&15).toString(16)+(15&t).toString(16)}Ye.prototype.toString=function(){var t=[],e=this.j;e&&t.push(on(e,an,!0),":");var n=this.i;return!n&&"file"!=e||(t.push("//"),(e=this.s)&&t.push(on(e,an,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.i&&"/"!=n.charAt(0)&&t.push("/"),t.push(on(n,"/"==n.charAt(0)?cn:un,!0))),(n=this.h.toString())&&t.push("?",n),(n=this.o)&&t.push("#",on(n,ln)),t.join("")};var an=/[#\/\?@]/g,un=/[#\?:]/g,cn=/[#\?]/g,hn=/[#\?@]/g,ln=/#/g;function fn(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function dn(n){n.g||(n.g=new Qe,n.h=0,n.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n2*t.i&&He(t)))}function yn(t,e){return dn(t),e=mn(t,e),ze(t.g.h,e)}function gn(t,e,n){pn(t,e),0=t.j}function In(t){return t.h?1:t.g?t.g.size:0}function _n(t,e){return t.h?t.h==e:t.g&&t.g.has(e)}function Sn(t,e){t.g?t.g.add(e):t.h=e}function An(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Dn(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null==t.g||0===t.g.size)return z(t.i);var r=t.i;try{for(var i=D(t.g.values()),o=i.next();!o.done;o=i.next())var s=o.value,r=r.concat(s.D)}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function Nn(){}function Cn(){this.g=new Nn}function kn(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}function Rn(t){this.l=t.$b||null,this.j=t.ib||!1}function xn(t,e){Ut.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=On,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}wn.prototype.cancel=function(){var e,t;if(this.i=Dn(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=D(this.g.values()),r=n.next();!r.done;r=n.next())r.value.cancel()}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.g.clear()}},Nn.prototype.stringify=function(t){return R.JSON.stringify(t,void 0)},Nn.prototype.parse=function(t){return R.JSON.parse(t,void 0)},B(Rn,Te),Rn.prototype.g=function(){return new xn(this.l,this.j)},Rn.prototype.i=(bn={},function(){return bn}),B(xn,Ut);var On=0;function Ln(t){t.j.read().then(t.Sa.bind(t)).catch(t.ha.bind(t))}function Pn(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Mn(t)}function Mn(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(N=xn.prototype).open=function(t,e){if(this.readyState!=On)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Mn(this)},N.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||R).fetch(new Request(this.B,e)).then(this.Va.bind(this),this.ha.bind(this))},N.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted."),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,Pn(this)),this.readyState=On},N.Va=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Mn(this)),this.g&&(this.readyState=3,Mn(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ta.bind(this),this.ha.bind(this));else if(void 0!==R.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Ln(this)}else t.text().then(this.Ua.bind(this),this.ha.bind(this))},N.Sa=function(t){var e;this.g&&(this.u&&t.value?this.response.push(t.value):this.u||(e=t.value||new Uint8Array(0),(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)),(t.done?Pn:Mn)(this),3==this.readyState&&Ln(this))},N.Ua=function(t){this.g&&(this.response=this.responseText=t,Pn(this))},N.Ta=function(t){this.g&&(this.response=t,Pn(this))},N.ha=function(){this.g&&Pn(this)},N.setRequestHeader=function(t,e){this.v.append(t,e)},N.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},N.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(xn.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Fn=R.JSON.parse;function Vn(t){Ut.call(this),this.headers=new Qe,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=Un,this.K=this.L=!1}B(Vn,Ut);var Un="",qn=/^https?$/i,Bn=["POST","PUT"];function jn(t){return"content-type"==t.toLowerCase()}function Kn(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Gn(t),Hn(t)}function Gn(t){t.D||(t.D=!0,qt(t,"complete"),qt(t,"error"))}function Qn(t){if(t.h&&void 0!==k&&(!t.C[1]||4!=Wn(t)||2!=t.ba()))if(t.v&&4==Wn(t))ne(t.Fa,0,t);else if(qt(t,"readystatechange"),4==Wn(t)){t.h=!1;try{var e,n,r,i,o=t.ba();t:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var s=!0;break t;default:s=!1}if((e=s)||((n=0===o)&&(!(i=String(t.H).match(We)[1]||null)&&R.self&&R.self.location&&(i=(r=R.self.location.protocol).substr(0,r.length-1)),n=!qn.test(i?i.toLowerCase():"")),e=n),e)qt(t,"complete"),qt(t,"success");else{t.m=6;try{var a=2=r.i.j-(r.m?1:0)||(r.m?(r.l=i.D.concat(r.l),0):1==r.G||2==r.G||r.C>=(r.Xa?0:r.Ya)||(r.m=be(U(r.Ha,r,i),dr(r,r.C)),r.C++,0))))&&(2!=s||!ur(t)))switch(o&&0e.length?1:0},gi),ai=(n(yi,si=C),yi.prototype.construct=function(t,e,n){return new yi(t,e,n)},yi.prototype.canonicalString=function(){return this.toArray().join("/")},yi.prototype.toString=function(){return this.canonicalString()},yi.fromString=function(){for(var t=[],e=0;et.length&&Qr(),void 0===n?n=t.length-e:n>t.length-e&&Qr(),this.segments=t,this.offset=e,this.len=n}li.EMPTY_BYTE_STRING=new li("");var mi=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function vi(t){if(Hr(!!t),"string"!=typeof t)return{seconds:wi(t.seconds),nanos:wi(t.nanos)};var e=0,n=mi.exec(t);Hr(!!n),n[1]&&(n=((n=n[1])+"000000000").substr(0,9),e=Number(n));t=new Date(t);return{seconds:Math.floor(t.getTime()/1e3),nanos:e}}function wi(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function bi(t){return"string"==typeof t?li.fromBase64String(t):li.fromUint8Array(t)}function Ei(t){return"server_timestamp"===(null===(t=((null===(t=null==t?void 0:t.mapValue)||void 0===t?void 0:t.fields)||{}).__type__)||void 0===t?void 0:t.stringValue)}function Ti(t){t=vi(t.mapValue.fields.__local_write_time__.timestampValue);return new Jr(t.seconds,t.nanos)}function Ii(t){return null==t}function _i(t){return 0===t&&1/t==-1/0}function Si(t){return"number"==typeof t&&Number.isInteger(t)&&!_i(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}var Ai=(Di.fromPath=function(t){return new Di(ai.fromString(t))},Di.fromName=function(t){return new Di(ai.fromString(t).popFirst(5))},Di.prototype.hasCollectionId=function(t){return 2<=this.path.length&&this.path.get(this.path.length-2)===t},Di.prototype.isEqual=function(t){return null!==t&&0===ai.comparator(this.path,t.path)},Di.prototype.toString=function(){return this.path.toString()},Di.comparator=function(t,e){return ai.comparator(t.path,e.path)},Di.isDocumentKey=function(t){return t.length%2==0},Di.fromSegments=function(t){return new Di(new ai(t.slice()))},Di);function Di(t){this.path=t}function Ni(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?Ei(t)?4:10:Qr()}function Ci(r,i){var t,e,n=Ni(r);if(n!==Ni(i))return!1;switch(n){case 0:return!0;case 1:return r.booleanValue===i.booleanValue;case 4:return Ti(r).isEqual(Ti(i));case 3:return function(t){if("string"==typeof r.timestampValue&&"string"==typeof t.timestampValue&&r.timestampValue.length===t.timestampValue.length)return r.timestampValue===t.timestampValue;var e=vi(r.timestampValue),t=vi(t.timestampValue);return e.seconds===t.seconds&&e.nanos===t.nanos}(i);case 5:return r.stringValue===i.stringValue;case 6:return e=i,bi(r.bytesValue).isEqual(bi(e.bytesValue));case 7:return r.referenceValue===i.referenceValue;case 8:return t=i,wi((e=r).geoPointValue.latitude)===wi(t.geoPointValue.latitude)&&wi(e.geoPointValue.longitude)===wi(t.geoPointValue.longitude);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return wi(t.integerValue)===wi(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){t=wi(t.doubleValue),e=wi(e.doubleValue);return t===e?_i(t)===_i(e):isNaN(t)&&isNaN(e)}return!1}(r,i);case 9:return Xr(r.arrayValue.values||[],i.arrayValue.values||[],Ci);case 10:return function(){var t,e=r.mapValue.fields||{},n=i.mapValue.fields||{};if(ni(e)!==ni(n))return!1;for(t in e)if(e.hasOwnProperty(t)&&(void 0===n[t]||!Ci(e[t],n[t])))return!1;return!0}();default:return Qr()}}function ki(t,e){return void 0!==(t.values||[]).find(function(t){return Ci(t,e)})}function Ri(t,e){var n,r,i,o=Ni(t),s=Ni(e);if(o!==s)return Yr(o,s);switch(o){case 0:return 0;case 1:return Yr(t.booleanValue,e.booleanValue);case 2:return r=e,i=wi(t.integerValue||t.doubleValue),r=wi(r.integerValue||r.doubleValue),i":return 0=":return 0<=t;default:return Qr()}},Ji.prototype.g=function(){return 0<=["<","<=",">",">=","!=","not-in"].indexOf(this.op)},Ji);function Ji(t,e,n){var r=this;return(r=Xi.call(this)||this).field=t,r.op=e,r.value=n,r}var Zi,to,eo,no=(n(ao,eo=$i),ao.prototype.matches=function(t){t=Ai.comparator(t.key,this.key);return this.m(t)},ao),ro=(n(so,to=$i),so.prototype.matches=function(e){return this.keys.some(function(t){return t.isEqual(e.key)})},so),io=(n(oo,Zi=$i),oo.prototype.matches=function(e){return!this.keys.some(function(t){return t.isEqual(e.key)})},oo);function oo(t,e){var n=this;return(n=Zi.call(this,t,"not-in",e)||this).keys=uo(0,e),n}function so(t,e){var n=this;return(n=to.call(this,t,"in",e)||this).keys=uo(0,e),n}function ao(t,e,n){var r=this;return(r=eo.call(this,t,e,n)||this).key=Ai.fromName(n.referenceValue),r}function uo(t,e){return((null===(e=e.arrayValue)||void 0===e?void 0:e.values)||[]).map(function(t){return Ai.fromName(t.referenceValue)})}var co,ho,lo,fo,po=(n(To,fo=$i),To.prototype.matches=function(t){t=t.data.field(this.field);return Mi(t)&&ki(t.arrayValue,this.value)},To),yo=(n(Eo,lo=$i),Eo.prototype.matches=function(t){t=t.data.field(this.field);return null!==t&&ki(this.value.arrayValue,t)},Eo),go=(n(bo,ho=$i),bo.prototype.matches=function(t){if(ki(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;t=t.data.field(this.field);return null!==t&&!ki(this.value.arrayValue,t)},bo),mo=(n(wo,co=$i),wo.prototype.matches=function(t){var e=this,t=t.data.field(this.field);return!(!Mi(t)||!t.arrayValue.values)&&t.arrayValue.values.some(function(t){return ki(e.value.arrayValue,t)})},wo),vo=function(t,e){this.position=t,this.before=e};function wo(t,e){return co.call(this,t,"array-contains-any",e)||this}function bo(t,e){return ho.call(this,t,"not-in",e)||this}function Eo(t,e){return lo.call(this,t,"in",e)||this}function To(t,e){return fo.call(this,t,"array-contains",e)||this}function Io(t){return(t.before?"b":"a")+":"+t.position.map(Oi).join(",")}var _o=function(t,e){void 0===e&&(e="asc"),this.field=t,this.dir=e};function So(t,e,n){for(var r=0,i=0;i":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},pa=function(t,e){this.databaseId=t,this.I=e};function ya(t,e){return t.I?new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+e.nanoseconds).slice(-9)+"Z":{seconds:""+e.seconds,nanos:e.nanoseconds}}function ga(t,e){return t.I?e.toBase64():e.toUint8Array()}function ma(t){return Hr(!!t),Zr.fromTimestamp((t=vi(t),new Jr(t.seconds,t.nanos)))}function va(t,e){return new ai(["projects",t.projectId,"databases",t.database]).child("documents").child(e).canonicalString()}function wa(t){t=ai.fromString(t);return Hr(Ua(t)),t}function ba(t,e){return va(t.databaseId,e.path)}function Ea(t,e){e=wa(e);if(e.get(1)!==t.databaseId.projectId)throw new Fr(Mr.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+e.get(1)+" vs "+t.databaseId.projectId);if(e.get(3)!==t.databaseId.database)throw new Fr(Mr.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+e.get(3)+" vs "+t.databaseId.database);return new Ai(Sa(e))}function Ta(t,e){return va(t.databaseId,e)}function Ia(t){t=wa(t);return 4===t.length?ai.emptyPath():Sa(t)}function _a(t){return new ai(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function Sa(t){return Hr(4";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return Qr()}}(),t.fieldFilter.value)}function Va(t){switch(t.unaryFilter.op){case"IS_NAN":var e=Ma(t.unaryFilter.field);return $i.create(e,"==",{doubleValue:NaN});case"IS_NULL":e=Ma(t.unaryFilter.field);return $i.create(e,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var n=Ma(t.unaryFilter.field);return $i.create(n,"!=",{doubleValue:NaN});case"IS_NOT_NULL":n=Ma(t.unaryFilter.field);return $i.create(n,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return Qr()}}function Ua(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)}function qa(t){for(var e="",n=0;n",t),this.store.put(t));return _u(t)},Iu.prototype.add=function(t){return Br("SimpleDb","ADD",this.store.name,t,t),_u(this.store.add(t))},Iu.prototype.get=function(e){var n=this;return _u(this.store.get(e)).next(function(t){return Br("SimpleDb","GET",n.store.name,e,t=void 0===t?null:t),t})},Iu.prototype.delete=function(t){return Br("SimpleDb","DELETE",this.store.name,t),_u(this.store.delete(t))},Iu.prototype.count=function(){return Br("SimpleDb","COUNT",this.store.name),_u(this.store.count())},Iu.prototype.Nt=function(t,e){var e=this.cursor(this.options(t,e)),n=[];return this.xt(e,function(t,e){n.push(e)}).next(function(){return n})},Iu.prototype.Ft=function(t,e){Br("SimpleDb","DELETE ALL",this.store.name);e=this.options(t,e);e.kt=!1;e=this.cursor(e);return this.xt(e,function(t,e,n){return n.delete()})},Iu.prototype.$t=function(t,e){e?n=t:(n={},e=t);var n=this.cursor(n);return this.xt(n,e)},Iu.prototype.Ot=function(r){var t=this.cursor({});return new hu(function(n,e){t.onerror=function(t){t=Au(t.target.error);e(t)},t.onsuccess=function(t){var e=t.target.result;e?r(e.primaryKey,e.value).next(function(t){t?e.continue():n()}):n()}})},Iu.prototype.xt=function(t,i){var o=[];return new hu(function(r,e){t.onerror=function(t){e(t.target.error)},t.onsuccess=function(t){var e,n=t.target.result;n?(e=new du(n),(t=i(n.primaryKey,n.value,e))instanceof hu&&(t=t.catch(function(t){return e.done(),hu.reject(t)}),o.push(t)),e.isDone?r():null===e.Dt?n.continue():n.continue(e.Dt)):r()}}).next(function(){return hu.waitFor(o)})},Iu.prototype.options=function(t,e){var n;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},Iu.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.kt?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},Iu);function Iu(t){this.store=t}function _u(t){return new hu(function(e,n){t.onsuccess=function(t){t=t.target.result;e(t)},t.onerror=function(t){t=Au(t.target.error);n(t)}})}var Su=!1;function Au(t){var e=fu._t(h());if(12.2<=e&&e<13){e="An internal error was encountered in the Indexed Database server";if(0<=t.message.indexOf(e)){var n=new Fr("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '"+e+"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");return Su||(Su=!0,setTimeout(function(){throw n},0)),n}}return t}var Du,Nu=(n(Cu,Du=C),Cu);function Cu(t,e){var n=this;return(n=Du.call(this)||this).Mt=t,n.currentSequenceNumber=e,n}function ku(t,e){return fu.It(t.Mt,e)}var Ru=(Fu.prototype.applyToRemoteDocument=function(t,e){for(var n,r,i,o,s,a,u=e.mutationResults,c=0;c=i),o=Gu(r.R,e)),n.done()}).next(function(){return o})},lc.prototype.getHighestUnacknowledgedBatchId=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),r=-1;return dc(t).$t({index:Ha.userMutationsIndex,range:e,reverse:!0},function(t,e,n){r=e.batchId,n.done()}).next(function(){return r})},lc.prototype.getAllMutationBatches=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return dc(t).Nt(Ha.userMutationsIndex,n).next(function(t){return t.map(function(t){return Gu(e.R,t)})})},lc.prototype.getAllMutationBatchesAffectingDocumentKey=function(o,s){var a=this,t=za.prefixForPath(this.userId,s.path),t=IDBKeyRange.lowerBound(t),u=[];return pc(o).$t({range:t},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=ja(i);if(r===a.userId&&s.path.isEqual(i))return dc(o).get(t).next(function(t){if(!t)throw Qr();Hr(t.userId===a.userId),u.push(Gu(a.R,t))});n.done()}).next(function(){return u})},lc.prototype.getAllMutationBatchesAffectingDocumentKeys=function(e,t){var s=this,a=new Ks(Yr),n=[];return t.forEach(function(o){var t=za.prefixForPath(s.userId,o.path),t=IDBKeyRange.lowerBound(t),t=pc(e).$t({range:t},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=ja(i);r===s.userId&&o.path.isEqual(i)?a=a.add(t):n.done()});n.push(t)}),hu.waitFor(n).next(function(){return s.Wt(e,a)})},lc.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var o=this,s=e.path,a=s.length+1,e=za.prefixForPath(this.userId,s),e=IDBKeyRange.lowerBound(e),u=new Ks(Yr);return pc(t).$t({range:e},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=ja(i);r===o.userId&&s.isPrefixOf(i)?i.length===a&&(u=u.add(t)):n.done()}).next(function(){return o.Wt(t,u)})},lc.prototype.Wt=function(e,t){var n=this,r=[],i=[];return t.forEach(function(t){i.push(dc(e).get(t).next(function(t){if(null===t)throw Qr();Hr(t.userId===n.userId),r.push(Gu(n.R,t))}))}),hu.waitFor(i).next(function(){return r})},lc.prototype.removeMutationBatch=function(e,n){var r=this;return uc(e.Mt,this.userId,n).next(function(t){return e.addOnCommittedListener(function(){r.Gt(n.batchId)}),hu.forEach(t,function(t){return r.referenceDelegate.markPotentiallyOrphaned(e,t)})})},lc.prototype.Gt=function(t){delete this.Kt[t]},lc.prototype.performConsistencyCheck=function(e){var i=this;return this.checkEmpty(e).next(function(t){if(!t)return hu.resolve();var t=IDBKeyRange.lowerBound(za.prefixForUser(i.userId)),r=[];return pc(e).$t({range:t},function(t,e,n){t[0]===i.userId?(t=ja(t[1]),r.push(t)):n.done()}).next(function(){Hr(0===r.length)})})},lc.prototype.containsKey=function(t,e){return fc(t,this.userId,e)},lc.prototype.zt=function(t){var e=this;return yc(t).get(this.userId).next(function(t){return t||new Qa(e.userId,-1,"")})},lc);function lc(t,e,n,r){this.userId=t,this.R=e,this.Ut=n,this.referenceDelegate=r,this.Kt={}}function fc(t,o,e){var e=za.prefixForPath(o,e.path),s=e[1],e=IDBKeyRange.lowerBound(e),a=!1;return pc(t).$t({range:e,kt:!0},function(t,e,n){var r=t[0],i=t[1];t[2],r===o&&i===s&&(a=!0),n.done()}).next(function(){return a})}function dc(t){return ku(t,Ha.store)}function pc(t){return ku(t,za.store)}function yc(t){return ku(t,Qa.store)}var gc=(wc.prototype.next=function(){return this.Ht+=2,this.Ht},wc.Jt=function(){return new wc(0)},wc.Yt=function(){return new wc(-1)},wc),mc=(vc.prototype.allocateTargetId=function(n){var r=this;return this.Xt(n).next(function(t){var e=new gc(t.highestTargetId);return t.highestTargetId=e.next(),r.Zt(n,t).next(function(){return t.highestTargetId})})},vc.prototype.getLastRemoteSnapshotVersion=function(t){return this.Xt(t).next(function(t){return Zr.fromTimestamp(new Jr(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))})},vc.prototype.getHighestSequenceNumber=function(t){return this.Xt(t).next(function(t){return t.highestListenSequenceNumber})},vc.prototype.setTargetsMetadata=function(e,n,r){var i=this;return this.Xt(e).next(function(t){return t.highestListenSequenceNumber=n,r&&(t.lastRemoteSnapshotVersion=r.toTimestamp()),n>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=n),i.Zt(e,t)})},vc.prototype.addTargetData=function(e,n){var r=this;return this.te(e,n).next(function(){return r.Xt(e).next(function(t){return t.targetCount+=1,r.ee(n,t),r.Zt(e,t)})})},vc.prototype.updateTargetData=function(t,e){return this.te(t,e)},vc.prototype.removeTargetData=function(e,t){var n=this;return this.removeMatchingKeysForTargetId(e,t.targetId).next(function(){return bc(e).delete(t.targetId)}).next(function(){return n.Xt(e)}).next(function(t){return Hr(0e.highestTargetId&&(e.highestTargetId=t.targetId,n=!0),t.sequenceNumber>e.highestListenSequenceNumber&&(e.highestListenSequenceNumber=t.sequenceNumber,n=!0),n},vc.prototype.getTargetCount=function(t){return this.Xt(t).next(function(t){return t.targetCount})},vc.prototype.getTargetData=function(t,r){var e=zi(r),e=IDBKeyRange.bound([e,Number.NEGATIVE_INFINITY],[e,Number.POSITIVE_INFINITY]),i=null;return bc(t).$t({range:e,index:Za.queryTargetsIndexName},function(t,e,n){e=Qu(e);Wi(r,e.target)&&(i=e,n.done())}).next(function(){return i})},vc.prototype.addMatchingKeys=function(n,t,r){var i=this,o=[],s=Tc(n);return t.forEach(function(t){var e=qa(t.path);o.push(s.put(new tu(r,e))),o.push(i.referenceDelegate.addReference(n,r,t))}),hu.waitFor(o)},vc.prototype.removeMatchingKeys=function(n,t,r){var i=this,o=Tc(n);return hu.forEach(t,function(t){var e=qa(t.path);return hu.waitFor([o.delete([r,e]),i.referenceDelegate.removeReference(n,r,t)])})},vc.prototype.removeMatchingKeysForTargetId=function(t,e){t=Tc(t),e=IDBKeyRange.bound([e],[e+1],!1,!0);return t.delete(e)},vc.prototype.getMatchingKeysForTargetId=function(t,e){var e=IDBKeyRange.bound([e],[e+1],!1,!0),t=Tc(t),r=$s();return t.$t({range:e,kt:!0},function(t,e,n){t=ja(t[1]),t=new Ai(t);r=r.add(t)}).next(function(){return r})},vc.prototype.containsKey=function(t,e){var e=qa(e.path),e=IDBKeyRange.bound([e],[$r(e)],!1,!0),i=0;return Tc(t).$t({index:tu.documentTargetsIndex,kt:!0,range:e},function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())}).next(function(){return 0h.params.maximumSequenceNumbersToCollect?(Br("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+h.params.maximumSequenceNumbersToCollect+" from "+t),h.params.maximumSequenceNumbersToCollect):t,s=Date.now(),h.nthSequenceNumber(e,i)}).next(function(t){return r=t,a=Date.now(),h.removeTargets(e,r,n)}).next(function(t){return o=t,u=Date.now(),h.removeOrphanedDocuments(e,r)}).next(function(t){return c=Date.now(),qr()<=m.DEBUG&&Br("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(s-l)+"ms\n\tDetermined least recently used "+i+" in "+(a-s)+"ms\n\tRemoved "+o+" targets in "+(u-a)+"ms\n\tRemoved "+t+" documents in "+(c-u)+"ms\nTotal Duration: "+(c-l)+"ms"),hu.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:o,documentsRemoved:t})})},kc),Nc=(Cc.prototype.he=function(t){var n=this.de(t);return this.db.getTargetCache().getTargetCount(t).next(function(e){return n.next(function(t){return e+t})})},Cc.prototype.de=function(t){var e=0;return this.le(t,function(t){e++}).next(function(){return e})},Cc.prototype.forEachTarget=function(t,e){return this.db.getTargetCache().forEachTarget(t,e)},Cc.prototype.le=function(t,n){return this.we(t,function(t,e){return n(e)})},Cc.prototype.addReference=function(t,e,n){return Oc(t,n)},Cc.prototype.removeReference=function(t,e,n){return Oc(t,n)},Cc.prototype.removeTargets=function(t,e,n){return this.db.getTargetCache().removeTargets(t,e,n)},Cc.prototype.markPotentiallyOrphaned=Oc,Cc.prototype._e=function(t,e){return r=e,i=!1,yc(n=t).Ot(function(t){return fc(n,t,r).next(function(t){return t&&(i=!0),hu.resolve(!t)})}).next(function(){return i});var n,r,i},Cc.prototype.removeOrphanedDocuments=function(n,r){var i=this,o=this.db.getRemoteDocumentCache().newChangeBuffer(),s=[],a=0;return this.we(n,function(e,t){t<=r&&(t=i._e(n,e).next(function(t){if(!t)return a++,o.getEntry(n,e).next(function(){return o.removeEntry(e),Tc(n).delete([0,qa(e.path)])})}),s.push(t))}).next(function(){return hu.waitFor(s)}).next(function(){return o.apply(n)}).next(function(){return a})},Cc.prototype.removeTarget=function(t,e){e=e.withSequenceNumber(t.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(t,e)},Cc.prototype.updateLimboDocument=Oc,Cc.prototype.we=function(t,r){var i,t=Tc(t),o=Or.o;return t.$t({index:tu.documentTargetsIndex},function(t,e){var n=t[0];t[1];t=e.path,e=e.sequenceNumber;0===n?(o!==Or.o&&r(new Ai(ja(i)),o),o=e,i=t):o=Or.o}).next(function(){o!==Or.o&&r(new Ai(ja(i)),o)})},Cc.prototype.getCacheSize=function(t){return this.db.getRemoteDocumentCache().getSize(t)},Cc);function Cc(t,e){this.db=t,this.garbageCollector=new Dc(this,e)}function kc(t,e){this.ae=t,this.params=e}function Rc(t,e){this.garbageCollector=t,this.asyncQueue=e,this.oe=!1,this.ce=null}function xc(t){this.ne=t,this.buffer=new Ks(_c),this.se=0}function Oc(t,e){return Tc(t).put((t=t.currentSequenceNumber,new tu(0,qa(e.path),t)))}var Lc,Pc=(Bc.prototype.get=function(t){var e=this.mapKeyFn(t),e=this.inner[e];if(void 0!==e)for(var n=0,r=e;n "+n),1))},Xc.prototype.We=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.ke=function(){t.Se.enqueueAndForget(function(){return t.inForeground="visible"===t.document.visibilityState,t.je()})},this.document.addEventListener("visibilitychange",this.ke),this.inForeground="visible"===this.document.visibilityState)},Xc.prototype.an=function(){this.ke&&(this.document.removeEventListener("visibilitychange",this.ke),this.ke=null)},Xc.prototype.Ge=function(){var t,e=this;"function"==typeof(null===(t=this.window)||void 0===t?void 0:t.addEventListener)&&(this.Fe=function(){e.un(),i()&&navigator.appVersion.match("Version/14")&&e.Se.enterRestrictedMode(!0),e.Se.enqueueAndForget(function(){return e.shutdown()})},this.window.addEventListener("pagehide",this.Fe))},Xc.prototype.hn=function(){this.Fe&&(this.window.removeEventListener("pagehide",this.Fe),this.Fe=null)},Xc.prototype.cn=function(t){var e;try{var n=null!==(null===(e=this.Qe)||void 0===e?void 0:e.getItem(this.on(t)));return Br("IndexedDbPersistence","Client '"+t+"' "+(n?"is":"is not")+" zombied in LocalStorage"),n}catch(t){return jr("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},Xc.prototype.un=function(){if(this.Qe)try{this.Qe.setItem(this.on(this.clientId),String(Date.now()))}catch(t){jr("Failed to set zombie client id.",t)}},Xc.prototype.ln=function(){if(this.Qe)try{this.Qe.removeItem(this.on(this.clientId))}catch(t){}},Xc.prototype.on=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},Xc);function Xc(t,e,n,r,i,o,s,a,u,c){if(this.allowTabSynchronization=t,this.persistenceKey=e,this.clientId=n,this.Se=i,this.window=o,this.document=s,this.De=u,this.Ce=c,this.Ne=null,this.xe=!1,this.isPrimary=!1,this.networkEnabled=!0,this.Fe=null,this.inForeground=!1,this.ke=null,this.$e=null,this.Oe=Number.NEGATIVE_INFINITY,this.Me=function(t){return Promise.resolve()},!Xc.yt())throw new Fr(Mr.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new Nc(this,r),this.Le=e+"main",this.R=new Lu(a),this.Be=new fu(this.Le,11,new Qc(this.R)),this.qe=new mc(this.referenceDelegate,this.R),this.Ut=new tc,this.Ue=(e=this.R,a=this.Ut,new Mc(e,a)),this.Ke=new Wu,this.window&&this.window.localStorage?this.Qe=this.window.localStorage:(this.Qe=null,!1===c&&jr("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}function $c(t){return ku(t,Ka.store)}function Jc(t){return ku(t,ru.store)}function Zc(t,e){var n=t.projectId;return t.isDefaultDatabase||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}function th(t,e){this.progress=t,this.wn=e}var eh=(uh.prototype.mn=function(e,n){var r=this;return this._n.getAllMutationBatchesAffectingDocumentKey(e,n).next(function(t){return r.yn(e,n,t)})},uh.prototype.yn=function(t,e,r){return this.Ue.getEntry(t,e).next(function(t){for(var e=0,n=r;ee?this._n[e]:null)},Bh.prototype.getHighestUnacknowledgedBatchId=function(){return hu.resolve(0===this._n.length?-1:this.ss-1)},Bh.prototype.getAllMutationBatches=function(t){return hu.resolve(this._n.slice())},Bh.prototype.getAllMutationBatchesAffectingDocumentKey=function(t,e){var n=this,r=new Sh(e,0),e=new Sh(e,Number.POSITIVE_INFINITY),i=[];return this.rs.forEachInRange([r,e],function(t){t=n.os(t.ns);i.push(t)}),hu.resolve(i)},Bh.prototype.getAllMutationBatchesAffectingDocumentKeys=function(t,e){var n=this,r=new Ks(Yr);return e.forEach(function(t){var e=new Sh(t,0),t=new Sh(t,Number.POSITIVE_INFINITY);n.rs.forEachInRange([e,t],function(t){r=r.add(t.ns)})}),hu.resolve(this.us(r))},Bh.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var n=e.path,r=n.length+1,e=n;Ai.isDocumentKey(e)||(e=e.child(""));var e=new Sh(new Ai(e),0),i=new Ks(Yr);return this.rs.forEachWhile(function(t){var e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(i=i.add(t.ns)),!0)},e),hu.resolve(this.us(i))},Bh.prototype.us=function(t){var e=this,n=[];return t.forEach(function(t){t=e.os(t);null!==t&&n.push(t)}),n},Bh.prototype.removeMutationBatch=function(n,r){var i=this;Hr(0===this.hs(r.batchId,"removed")),this._n.shift();var o=this.rs;return hu.forEach(r.mutations,function(t){var e=new Sh(t.key,r.batchId);return o=o.delete(e),i.referenceDelegate.markPotentiallyOrphaned(n,t.key)}).next(function(){i.rs=o})},Bh.prototype.Gt=function(t){},Bh.prototype.containsKey=function(t,e){var n=new Sh(e,0),n=this.rs.firstAfterOrEqual(n);return hu.resolve(e.isEqual(n&&n.key))},Bh.prototype.performConsistencyCheck=function(t){return this._n.length,hu.resolve()},Bh.prototype.hs=function(t,e){return this.cs(t)},Bh.prototype.cs=function(t){return 0===this._n.length?0:t-this._n[0].batchId},Bh.prototype.os=function(t){t=this.cs(t);return t<0||t>=this._n.length?null:this._n[t]},Bh),Dh=(qh.prototype.addEntry=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,i=this.ls(e);return this.docs=this.docs.insert(r,{document:e.clone(),size:i,readTime:n}),this.size+=i-o,this.Ut.addToCollectionParentIndex(t,r.path.popLast())},qh.prototype.removeEntry=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},qh.prototype.getEntry=function(t,e){var n=this.docs.get(e);return hu.resolve(n?n.document.clone():Ki.newInvalidDocument(e))},qh.prototype.getEntries=function(t,e){var n=this,r=Qs;return e.forEach(function(t){var e=n.docs.get(t);r=r.insert(t,e?e.document.clone():Ki.newInvalidDocument(t))}),hu.resolve(r)},qh.prototype.getDocumentsMatchingQuery=function(t,e,n){for(var r=Qs,i=new Ai(e.path.child("")),o=this.docs.getIteratorFrom(i);o.hasNext();){var s=o.getNext(),a=s.key,u=s.value,s=u.document,u=u.readTime;if(!e.path.isPrefixOf(a.path))break;u.compareTo(n)<=0||Bo(e,s)&&(r=r.insert(s.key,s.clone()))}return hu.resolve(r)},qh.prototype.fs=function(t,e){return hu.forEach(this.docs,function(t){return e(t)})},qh.prototype.newChangeBuffer=function(t){return new Nh(this)},qh.prototype.getSize=function(t){return hu.resolve(this.size)},qh),Nh=(n(Uh,Th=_),Uh.prototype.applyChanges=function(n){var r=this,i=[];return this.changes.forEach(function(t,e){e.document.isValidDocument()?i.push(r.Ie.addEntry(n,e.document,r.getReadTime(t))):r.Ie.removeEntry(t)}),hu.waitFor(i)},Uh.prototype.getFromCache=function(t,e){return this.Ie.getEntry(t,e)},Uh.prototype.getAllFromCache=function(t,e){return this.Ie.getEntries(t,e)},Uh),Ch=(Vh.prototype.forEachTarget=function(t,n){return this.ds.forEach(function(t,e){return n(e)}),hu.resolve()},Vh.prototype.getLastRemoteSnapshotVersion=function(t){return hu.resolve(this.lastRemoteSnapshotVersion)},Vh.prototype.getHighestSequenceNumber=function(t){return hu.resolve(this.ws)},Vh.prototype.allocateTargetId=function(t){return this.highestTargetId=this.ys.next(),hu.resolve(this.highestTargetId)},Vh.prototype.setTargetsMetadata=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.ws&&(this.ws=e),hu.resolve()},Vh.prototype.te=function(t){this.ds.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.ys=new gc(e),this.highestTargetId=e),t.sequenceNumber>this.ws&&(this.ws=t.sequenceNumber)},Vh.prototype.addTargetData=function(t,e){return this.te(e),this.targetCount+=1,hu.resolve()},Vh.prototype.updateTargetData=function(t,e){return this.te(e),hu.resolve()},Vh.prototype.removeTargetData=function(t,e){return this.ds.delete(e.target),this._s.Zn(e.targetId),--this.targetCount,hu.resolve()},Vh.prototype.removeTargets=function(n,r,i){var o=this,s=0,a=[];return this.ds.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.ds.delete(t),a.push(o.removeMatchingKeysForTargetId(n,e.targetId)),s++)}),hu.waitFor(a).next(function(){return s})},Vh.prototype.getTargetCount=function(t){return hu.resolve(this.targetCount)},Vh.prototype.getTargetData=function(t,e){e=this.ds.get(e)||null;return hu.resolve(e)},Vh.prototype.addMatchingKeys=function(t,e,n){return this._s.Jn(e,n),hu.resolve()},Vh.prototype.removeMatchingKeys=function(e,t,n){this._s.Xn(t,n);var r=this.persistence.referenceDelegate,i=[];return r&&t.forEach(function(t){i.push(r.markPotentiallyOrphaned(e,t))}),hu.waitFor(i)},Vh.prototype.removeMatchingKeysForTargetId=function(t,e){return this._s.Zn(e),hu.resolve()},Vh.prototype.getMatchingKeysForTargetId=function(t,e){e=this._s.es(e);return hu.resolve(e)},Vh.prototype.containsKey=function(t,e){return hu.resolve(this._s.containsKey(e))},Vh),kh=(Fh.prototype.start=function(){return Promise.resolve()},Fh.prototype.shutdown=function(){return this.xe=!1,Promise.resolve()},Object.defineProperty(Fh.prototype,"started",{get:function(){return this.xe},enumerable:!1,configurable:!0}),Fh.prototype.setDatabaseDeletedListener=function(){},Fh.prototype.setNetworkEnabled=function(){},Fh.prototype.getIndexManager=function(){return this.Ut},Fh.prototype.getMutationQueue=function(t){var e=this.gs[t.toKey()];return e||(e=new Ah(this.Ut,this.referenceDelegate),this.gs[t.toKey()]=e),e},Fh.prototype.getTargetCache=function(){return this.qe},Fh.prototype.getRemoteDocumentCache=function(){return this.Ue},Fh.prototype.getBundleCache=function(){return this.Ke},Fh.prototype.runTransaction=function(t,e,n){var r=this;Br("MemoryPersistence","Starting transaction:",t);var i=new Rh(this.Ne.next());return this.referenceDelegate.Es(),n(i).next(function(t){return r.referenceDelegate.Ts(i).next(function(){return t})}).toPromise().then(function(t){return i.raiseOnCommittedEvent(),t})},Fh.prototype.Is=function(e,n){return hu.or(Object.values(this.gs).map(function(t){return function(){return t.containsKey(e,n)}}))},Fh),Rh=(n(Mh,Eh=C),Mh),xh=(Ph.bs=function(t){return new Ph(t)},Object.defineProperty(Ph.prototype,"vs",{get:function(){if(this.Rs)return this.Rs;throw Qr()},enumerable:!1,configurable:!0}),Ph.prototype.addReference=function(t,e,n){return this.As.addReference(n,e),this.vs.delete(n.toString()),hu.resolve()},Ph.prototype.removeReference=function(t,e,n){return this.As.removeReference(n,e),this.vs.add(n.toString()),hu.resolve()},Ph.prototype.markPotentiallyOrphaned=function(t,e){return this.vs.add(e.toString()),hu.resolve()},Ph.prototype.removeTarget=function(t,e){var n=this;this.As.Zn(e.targetId).forEach(function(t){return n.vs.add(t.toString())});var r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(t,e.targetId).next(function(t){t.forEach(function(t){return n.vs.add(t.toString())})}).next(function(){return r.removeTargetData(t,e)})},Ph.prototype.Es=function(){this.Rs=new Set},Ph.prototype.Ts=function(n){var r=this,i=this.persistence.getRemoteDocumentCache().newChangeBuffer();return hu.forEach(this.vs,function(t){var e=Ai.fromPath(t);return r.Ps(n,e).next(function(t){t||i.removeEntry(e)})}).next(function(){return r.Rs=null,i.apply(n)})},Ph.prototype.updateLimboDocument=function(t,e){var n=this;return this.Ps(t,e).next(function(t){t?n.vs.delete(e.toString()):n.vs.add(e.toString())})},Ph.prototype.ps=function(t){return 0},Ph.prototype.Ps=function(t,e){var n=this;return hu.or([function(){return hu.resolve(n.As.containsKey(e))},function(){return n.persistence.getTargetCache().containsKey(t,e)},function(){return n.persistence.Is(t,e)}])},Ph),Oh=(Lh.prototype.isAuthenticated=function(){return null!=this.uid},Lh.prototype.toKey=function(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"},Lh.prototype.isEqual=function(t){return t.uid===this.uid},Lh);function Lh(t){this.uid=t}function Ph(t){this.persistence=t,this.As=new _h,this.Rs=null}function Mh(t){var e=this;return(e=Eh.call(this)||this).currentSequenceNumber=t,e}function Fh(t,e){var n=this;this.gs={},this.Ne=new Or(0),this.xe=!1,this.xe=!0,this.referenceDelegate=t(this),this.qe=new Ch(this),this.Ut=new Ju,this.Ue=(t=this.Ut,new Dh(t,function(t){return n.referenceDelegate.ps(t)})),this.R=new Lu(e),this.Ke=new Ih(this.R)}function Vh(t){this.persistence=t,this.ds=new Pc(zi,Wi),this.lastRemoteSnapshotVersion=Zr.min(),this.highestTargetId=0,this.ws=0,this._s=new _h,this.targetCount=0,this.ys=gc.Jt()}function Uh(t){var e=this;return(e=Th.call(this)||this).Ie=t,e}function qh(t,e){this.Ut=t,this.ls=e,this.docs=new Ms(Ai.comparator),this.size=0}function Bh(t,e){this.Ut=t,this.referenceDelegate=e,this._n=[],this.ss=1,this.rs=new Ks(Sh.Gn)}function jh(t,e){this.key=t,this.ns=e}function Kh(){this.Wn=new Ks(Sh.Gn),this.zn=new Ks(Sh.Hn)}function Gh(t){this.R=t,this.Qn=new Map,this.jn=new Map}function Qh(t,e){return"firestore_clients_"+t+"_"+e}function Hh(t,e,n){n="firestore_mutations_"+t+"_"+n;return e.isAuthenticated()&&(n+="_"+e.uid),n}function zh(t,e){return"firestore_targets_"+t+"_"+e}Oh.UNAUTHENTICATED=new Oh(null),Oh.GOOGLE_CREDENTIALS=new Oh("google-credentials-uid"),Oh.FIRST_PARTY=new Oh("first-party-uid");var Wh,Yh=(vl.Vs=function(t,e,n){var r,i=JSON.parse(n),o="object"==typeof i&&-1!==["pending","acknowledged","rejected"].indexOf(i.state)&&(void 0===i.error||"object"==typeof i.error);return o&&i.error&&(o="string"==typeof i.error.message&&"string"==typeof i.error.code)&&(r=new Fr(i.error.code,i.error.message)),o?new vl(t,e,i.state,r):(jr("SharedClientState","Failed to parse mutation state for ID '"+e+"': "+n),null)},vl.prototype.Ss=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},vl),Xh=(ml.Vs=function(t,e){var n,r=JSON.parse(e),i="object"==typeof r&&-1!==["not-current","current","rejected"].indexOf(r.state)&&(void 0===r.error||"object"==typeof r.error);return i&&r.error&&(i="string"==typeof r.error.message&&"string"==typeof r.error.code)&&(n=new Fr(r.error.code,r.error.message)),i?new ml(t,r.state,n):(jr("SharedClientState","Failed to parse target state for ID '"+t+"': "+e),null)},ml.prototype.Ss=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},ml),$h=(gl.Vs=function(t,e){for(var n=JSON.parse(e),r="object"==typeof n&&n.activeTargetIds instanceof Array,i=Js,o=0;r&&othis.Bi&&(this.qi=this.Bi)},Ml.prototype.Gi=function(){null!==this.Ui&&(this.Ui.skipDelay(),this.Ui=null)},Ml.prototype.cancel=function(){null!==this.Ui&&(this.Ui.cancel(),this.Ui=null)},Ml.prototype.Wi=function(){return(Math.random()-.5)*this.qi},Ml),_=(Pl.prototype.tr=function(){return 1===this.state||2===this.state||4===this.state},Pl.prototype.er=function(){return 2===this.state},Pl.prototype.start=function(){3!==this.state?this.auth():this.nr()},Pl.prototype.stop=function(){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.tr()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},Pl.prototype.sr=function(){this.state=0,this.Zi.reset()},Pl.prototype.ir=function(){var t=this;this.er()&&null===this.Xi&&(this.Xi=this.Se.enqueueAfterDelay(this.zi,6e4,function(){return t.rr()}))},Pl.prototype.cr=function(t){this.ur(),this.stream.send(t)},Pl.prototype.rr=function(){return y(this,void 0,void 0,function(){return g(this,function(t){return this.er()?[2,this.close(0)]:[2]})})},Pl.prototype.ur=function(){this.Xi&&(this.Xi.cancel(),this.Xi=null)},Pl.prototype.close=function(e,n){return y(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.ur(),this.Zi.cancel(),this.Yi++,3!==e?this.Zi.reset():n&&n.code===Mr.RESOURCE_EXHAUSTED?(jr(n.toString()),jr("Using maximum backoff delay to prevent overloading the backend."),this.Zi.Qi()):n&&n.code===Mr.UNAUTHENTICATED&&this.Ji.invalidateToken(),null!==this.stream&&(this.ar(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.Ri(n)];case 1:return t.sent(),[2]}})})},Pl.prototype.ar=function(){},Pl.prototype.auth=function(){var n=this;this.state=1;var t=this.hr(this.Yi),e=this.Yi;this.Ji.getToken().then(function(t){n.Yi===e&&n.lr(t)},function(e){t(function(){var t=new Fr(Mr.UNKNOWN,"Fetching auth token failed: "+e.message);return n.dr(t)})})},Pl.prototype.lr=function(t){var e=this,n=this.hr(this.Yi);this.stream=this.wr(t),this.stream.Ii(function(){n(function(){return e.state=2,e.listener.Ii()})}),this.stream.Ri(function(t){n(function(){return e.dr(t)})}),this.stream.onMessage(function(t){n(function(){return e.onMessage(t)})})},Pl.prototype.nr=function(){var t=this;this.state=4,this.Zi.ji(function(){return y(t,void 0,void 0,function(){return g(this,function(t){return this.state=0,this.start(),[2]})})})},Pl.prototype.dr=function(t){return Br("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},Pl.prototype.hr=function(e){var n=this;return function(t){n.Se.enqueueAndForget(function(){return n.Yi===e?t():(Br("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},Pl),Dl=(n(Ll,Sl=_),Ll.prototype.wr=function(t){return this.Hi.Oi("Listen",t)},Ll.prototype.onMessage=function(t){this.Zi.reset();var e=function(t,e){if("targetChange"in e){e.targetChange;var n="NO_CHANGE"===(o=e.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===o?1:"REMOVE"===o?2:"CURRENT"===o?3:"RESET"===o?4:Qr(),r=e.targetChange.targetIds||[],i=(s=e.targetChange.resumeToken,t.I?(Hr(void 0===s||"string"==typeof s),li.fromBase64String(s||"")):(Hr(void 0===s||s instanceof Uint8Array),li.fromUint8Array(s||new Uint8Array))),o=(a=e.targetChange.cause)&&(u=void 0===(c=a).code?Mr.UNKNOWN:Ps(c.code),new Fr(u,c.message||"")),s=new ra(n,r,i,o||null)}else if("documentChange"in e){e.documentChange,(n=e.documentChange).document,n.document.name,n.document.updateTime;var r=Ea(t,n.document.name),i=ma(n.document.updateTime),a=new Bi({mapValue:{fields:n.document.fields}}),u=(o=Ki.newFoundDocument(r,i,a),n.targetIds||[]),c=n.removedTargetIds||[];s=new ea(u,c,o.key,o)}else if("documentDelete"in e)e.documentDelete,(n=e.documentDelete).document,r=Ea(t,n.document),i=n.readTime?ma(n.readTime):Zr.min(),a=Ki.newNoDocument(r,i),o=n.removedTargetIds||[],s=new ea([],o,a.key,a);else if("documentRemove"in e)e.documentRemove,(n=e.documentRemove).document,r=Ea(t,n.document),i=n.removedTargetIds||[],s=new ea([],i,r,null);else{if(!("filter"in e))return Qr();e.filter;e=e.filter;e.targetId,n=e.count||0,r=new As(n),i=e.targetId,s=new na(i,r)}return s}(this.R,t),t=function(t){if(!("targetChange"in t))return Zr.min();t=t.targetChange;return(!t.targetIds||!t.targetIds.length)&&t.readTime?ma(t.readTime):Zr.min()}(t);return this.listener._r(e,t)},Ll.prototype.mr=function(t){var e,n,r,i={};i.database=_a(this.R),i.addTarget=(e=this.R,(r=Yi(r=(n=t).target)?{documents:ka(e,r)}:{query:Ra(e,r)}).targetId=n.targetId,0this.query.limit;){var n=ko(this.query)?h.last():h.first(),h=h.delete(n.key),c=c.delete(n.key);a.track({type:1,doc:n})}return{fo:h,mo:a,Nn:l,mutatedKeys:c}},Of.prototype.yo=function(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations},Of.prototype.applyChanges=function(t,e,n){var o=this,r=this.fo;this.fo=t.fo,this.mutatedKeys=t.mutatedKeys;var i=t.mo.jr();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.lo(t.doc,e.doc);function n(t){switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Qr()}}var r,i}),this.po(n);var s=e?this.Eo():[],n=0===this.ho.size&&this.current?1:0,e=n!==this.ao;return this.ao=n,0!==i.length||e?{snapshot:new cf(this.query,t.fo,r,i,t.mutatedKeys,0==n,e,!1),To:s}:{To:s}},Of.prototype.zr=function(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({fo:this.fo,mo:new uf,mutatedKeys:this.mutatedKeys,Nn:!1},!1)):{To:[]}},Of.prototype.Io=function(t){return!this.uo.has(t)&&!!this.fo.has(t)&&!this.fo.get(t).hasLocalMutations},Of.prototype.po=function(t){var e=this;t&&(t.addedDocuments.forEach(function(t){return e.uo=e.uo.add(t)}),t.modifiedDocuments.forEach(function(t){}),t.removedDocuments.forEach(function(t){return e.uo=e.uo.delete(t)}),this.current=t.current)},Of.prototype.Eo=function(){var e=this;if(!this.current)return[];var n=this.ho;this.ho=$s(),this.fo.forEach(function(t){e.Io(t.key)&&(e.ho=e.ho.add(t.key))});var r=[];return n.forEach(function(t){e.ho.has(t)||r.push(new Df(t))}),this.ho.forEach(function(t){n.has(t)||r.push(new Af(t))}),r},Of.prototype.Ao=function(t){this.uo=t.Bn,this.ho=$s();t=this._o(t.documents);return this.applyChanges(t,!0)},Of.prototype.Ro=function(){return cf.fromInitialDocuments(this.query,this.fo,this.mutatedKeys,0===this.ao)},Of),Cf=function(t,e,n){this.query=t,this.targetId=e,this.view=n},kf=function(t){this.key=t,this.bo=!1},Rf=(Object.defineProperty(xf.prototype,"isPrimaryClient",{get:function(){return!0===this.$o},enumerable:!1,configurable:!0}),xf);function xf(t,e,n,r,i,o){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.vo={},this.Po=new Pc(Uo,Vo),this.Vo=new Map,this.So=new Set,this.Do=new Ms(Ai.comparator),this.Co=new Map,this.No=new _h,this.xo={},this.Fo=new Map,this.ko=gc.Yt(),this.onlineState="Unknown",this.$o=void 0}function Of(t,e){this.query=t,this.uo=e,this.ao=null,this.current=!1,this.ho=$s(),this.mutatedKeys=$s(),this.lo=jo(t),this.fo=new af(this.lo)}function Lf(i,o,s,a){return y(this,void 0,void 0,function(){var e,n,r;return g(this,function(t){switch(t.label){case 0:return i.Oo=function(t,e,n){return function(r,i,o,s){return y(this,void 0,void 0,function(){var e,n;return g(this,function(t){switch(t.label){case 0:return(e=i.view._o(o)).Nn?[4,mh(r.localStore,i.query,!1).then(function(t){t=t.documents;return i.view._o(t,e)})]:[3,2];case 1:e=t.sent(),t.label=2;case 2:return n=s&&s.targetChanges.get(i.targetId),n=i.view.applyChanges(e,r.isPrimaryClient,n),[2,(Gf(r,i.targetId,n.To),n.snapshot)]}})})}(i,t,e,n)},[4,mh(i.localStore,o,!0)];case 1:return n=t.sent(),r=new Nf(o,n.Bn),e=r._o(n.documents),n=ta.createSynthesizedTargetChangeForCurrentChange(s,a&&"Offline"!==i.onlineState),n=r.applyChanges(e,i.isPrimaryClient,n),Gf(i,s,n.To),r=new Cf(o,s,r),[2,(i.Po.set(o,r),i.Vo.has(s)?i.Vo.get(s).push(o):i.Vo.set(s,[o]),n.snapshot)]}})})}function Pf(f,d,p){return y(this,void 0,void 0,function(){var s,l;return g(this,function(t){switch(t.label){case 0:l=Zf(f),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,(i=l.localStore,a=d,c=i,h=Jr.now(),o=a.reduce(function(t,e){return t.add(e.key)},$s()),c.persistence.runTransaction("Locally write mutations","readwrite",function(s){return c.Mn.pn(s,o).next(function(t){u=t;for(var e=[],n=0,r=a;n, or >=) must be on the same field. But you have inequality filters on '"+n.toString()+"' and '"+e.field.toString()+"'");n=xo(t);null!==n&&og(0,e.field,n)}t=function(t,e){for(var n=0,r=t.filters;ns.length)throw new Fr(Mr.INVALID_ARGUMENT,"Too many arguments provided to "+r+"(). The number of arguments must be less than or equal to the number of orderBy() clauses");for(var a=[],u=0;u, or >=) on field '"+e.toString()+"' and so you must also use '"+e.toString()+"' as your first argument to orderBy(), but your first orderBy() is on field '"+n.toString()+"' instead.")}sg.prototype.convertValue=function(t,e){switch(void 0===e&&(e="none"),Ni(t)){case 0:return null;case 1:return t.booleanValue;case 2:return wi(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(bi(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw Qr()}},sg.prototype.convertObject=function(t,n){var r=this,i={};return ri(t.fields,function(t,e){i[t]=r.convertValue(e,n)}),i},sg.prototype.convertGeoPoint=function(t){return new xp(wi(t.latitude),wi(t.longitude))},sg.prototype.convertArray=function(t,e){var n=this;return(t.values||[]).map(function(t){return n.convertValue(t,e)})},sg.prototype.convertServerTimestamp=function(t,e){switch(e){case"previous":var n=function t(e){e=e.mapValue.fields.__previous_value__;return Ei(e)?t(e):e}(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Ti(t));default:return null}},sg.prototype.convertTimestamp=function(t){t=vi(t);return new Jr(t.seconds,t.nanos)},sg.prototype.convertDocumentKey=function(t,e){var n=ai.fromString(t);Hr(Ua(n));t=new Pd(n.get(1),n.get(3)),n=new Ai(n.popFirst(5));return t.isEqual(e)||jr("Document "+n+" contains a document reference within a different database ("+t.projectId+"/"+t.database+") which is not supported. It will be treated as a reference in the current database ("+e.projectId+"/"+e.database+") instead."),n},_=sg;function sg(){}function ag(t,e,n){return t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e}var ug,cg=(n(fg,ug=_),fg.prototype.convertBytes=function(t){return new kp(t)},fg.prototype.convertReference=function(t){t=this.convertDocumentKey(t,this.firestore._databaseId);return new op(this.firestore,null,t)},fg),hg=(lg.prototype.set=function(t,e,n){this._verifyNotCommitted();t=dg(t,this._firestore),e=ag(t.converter,e,n),n=zp(this._dataReader,"WriteBatch.set",t._key,e,null!==t.converter,n);return this._mutations.push(n.toMutation(t._key,ls.none())),this},lg.prototype.update=function(t,e,n){for(var r=[],i=3;iPinball +