1!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(Rv){"use strict";try{(function(){function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var e,l,n,r=t(Rv),i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function o(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function m(t,s,u,a){return new(u=u||Promise)(function(n,e){function r(t){try{o(a.next(t))}catch(t){e(t)}}function i(t){try{o(a.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(r,i)}o((a=a.apply(t,s||[])).next())})}function w(n,r){var i,o,s,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,o=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(s=0<(s=u.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){u.label=e[1];break}if(6===e[0]&&u.label<s[1]){u.label=s[1],s=e;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(e);break}s[2]&&u.ops.pop(),u.trys.pop();continue}e=r.call(n,u)}catch(t){e=[6,t],o=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}function s(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],s=0,u=o.length;s<u;s++,i++)r[i]=o[s];return r}function u(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e<n;e++)for(var o=arguments[e],s=0,u=o.length;s<u;s++,i++)r[i]=o[s];return r}(n=l=l||{})[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 a(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!(e<t.logLevel)){var i=(new Date).toISOString(),o=f[e];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: "+e+")");console[o].apply(console,u(["["+i+"] "+t.name+":"],n))}}var c={debug:l.DEBUG,verbose:l.VERBOSE,info:l.INFO,warn:l.WARN,error:l.ERROR,silent:l.SILENT},h=l.INFO,f=((e={})[l.DEBUG]="log",e[l.VERBOSE]="log",e[l.INFO]="info",e[l.WARN]="warn",e[l.ERROR]="error",e),p=(Object.defineProperty(d.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in l))throw new TypeError('Invalid value "'+t+'" assigned to `logLevel`');this._logLevel=t},enumerable:!1,configurable:!0}),d.prototype.setLogLevel=function(t){this._logLevel="string"==typeof t?c[t]:t},Object.defineProperty(d.prototype,"logHandler",{get:function(){return this._logHandler},set:function(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(t){this._userLogHandler=t},enumerable:!1,configurable:!0}),d.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,u([this,l.DEBUG],t)),this._logHandler.apply(this,u([this,l.DEBUG],t))},d.prototype.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,u([this,l.VERBOSE],t)),this._logHandler.apply(this,u([this,l.VERBOSE],t))},d.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,u([this,l.INFO],t)),this._logHandler.apply(this,u([this,l.INFO],t))},d.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,u([this,l.WARN],t)),this._logHandler.apply(this,u([this,l.WARN],t))},d.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,u([this,l.ERROR],t)),this._logHandler.apply(this,u([this,l.ERROR],t))},d);function d(t){this.name=t,this._logLevel=h,this._logHandler=a,this._userLogHandler=null}function v(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}var y,g="FirebaseError",b=(o(I,y=Error),I);function I(t,e){var n=y.call(this,e)||this;return n.code=t,n.name=g,Object.setPrototypeOf(n,I.prototype),Error.captureStackTrace&&Error.captureStackTrace(n,E.prototype.create),n}var E=(T.prototype.create=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r,i=e[0]||{},o=this.service+"/"+t,s=this.errors[t],u=s?(r=i,s.replace(_,function(t,e){var n=r[e];return null!=n?String(n):"<"+e+"?>"})):"Error",a=this.serviceName+": "+u+" ("+o+").",c=new b(o,a),h=0,f=Object.keys(i);h<f.length;h++){var l=f[h];"_"!==l.slice(-1)&&(l in c&&console.warn('Overwriting FirebaseError base field "'+l+'" can cause unexpected behavior.'),c[l]=i[l])}return c},T);function T(t,e,n){this.service=t,this.serviceName=e,this.errors=n}var _=/\{\$([^}]+)}/g,A=function(t,e){return(A=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){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var S,D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},x={},O=D||self;function R(){}function k(t){var e=typeof t;return"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}function L(t){var e=k(t);return"array"==e||"object"==e&&"number"==typeof t.length}function C(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var P="closure_uid_"+(1e9*Math.random()>>>0),U=0;function V(t,e,n){return t.call.apply(t.bind,arguments)}function M(e,n,t){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var t=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(t,r),e.apply(n,t)}}return function(){return e.apply(n,arguments)}}function F(t,e,n){return(F=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?V:M).apply(null,arguments)}
1function q(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}var j=Date.now;function G(t,e){function n(){}n.prototype=e.prototype,t.S=e.prototype,t.prototype=new n,t.prototype.constructor=t}function B(){this.j=this.j,this.i=this.i}B.prototype.j=!1,B.prototype.ja=function(){var t;!this.j&&(this.j=!0,this.G(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,P)&&t[P]||(t[P]=++U))},B.prototype.G=function(){if(this.i)for(;this.i.length;)this.i.shift()()};var z=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1},H=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,n){for(var r=t.length,i="string"==typeof t?t.split(""):t,o=0;o<r;o++)o in i&&e.call(n,i[o],o,t)};function Q(t){return Array.prototype.concat.apply([],arguments)}function K(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function W(t){return/^[\s\xa0]*$/.test(t)}var Y,X=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function $(t,e){return-1!=t.indexOf(e)}function J(t,e){return t<e?-1:e<t?1:0}t:{var Z=O.navigator;if(Z){var tt=Z.userAgent;if(tt){Y=tt;break t}}Y=""}function et(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function nt(t){var e,n={};for(e in t)n[e]=t[e];return n}var rt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function it(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var o=0;o<rt.length;o++)n=rt[o],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function ot(t){return ot[" "](t),t}ot[" "]=R;var st,ut,at=$(Y,"Opera"),ct=$(Y,"Trident")||$(Y,"MSIE"),ht=$(Y,"Edge"),ft=ht||ct,lt=$(Y,"Gecko")&&!($(Y.toLowerCase(),"webkit")&&!$(Y,"Edge"))&&!($(Y,"Trident")||$(Y,"MSIE"))&&!$(Y,"Edge"),pt=$(Y.toLowerCase(),"webkit")&&!$(Y,"Edge");function dt(){var t=O.document;return t?t.documentMode:void 0}t:{var vt="",yt=(ut=Y,lt?/rv:([^\);]+)(\)|;)/.exec(ut):ht?/Edge\/([\d\.]+)/.exec(ut):ct?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(ut):pt?/WebKit\/(\S+)/.exec(ut):at?/(?:Version)[ \/]?(\S+)/.exec(ut):void 0);if(yt&&(vt=yt?yt[1]:""),ct){var gt=dt();if(null!=gt&>>parseFloat(vt)){st=String(gt);break t}}st=vt}var mt={};function wt(u){return t=u,e=function(){for(var t=0,e=X(String(st)).split("."),n=X(String(u)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var o=e[i]||"",s=n[i]||"";do{if(o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],0==o[0].length&&0==s[0].length)break;t=J(0==o[1].length?0:parseInt(o[1],10),0==s[1].length?0:parseInt(s[1],10))||J(0==o[2].length,0==s[2].length)||J(o[2],s[2]),o=o[3],s=s[3]}while(0==t)}return 0<=t},n=mt,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t);var t,e,n}var bt=O.document&&ct?dt()||(parseInt(st,10)||void 0):void 0,It=!ct||9<=Number(bt),Et=ct&&!wt("9"),Tt=function(){if(!O.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{O.addEventListener("test",R,e),O.removeEventListener("test",R,e)}catch(t){}return t}();function _t(t,e){this.type=t,this.a=this.target=e,this.defaultPrevented=!1}function At(t,e){if(_t.call(this,t?t.type:""),this.relatedTarget=this.a=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.pointerId=0,this.pointerType="",this.c=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.a=e,e=t.relatedTarget){if(lt){t:{try{ot(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:Nt[t.pointerType]||"",(this.c=t).defaultPrevented&&this.b()}}_t.prototype.b=function(){this.defaultPrevented=!0},G(At,_t);var Nt={2:"touch",3:"pen",4:"mouse"};At.prototype.b=function(){At.S.b.call(this);var t=this.c;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,Et)try{(t.ctrlKey||112<=t.keyCode&&t.keyCode<=123)&&(t.keyCode=-1)}catch(t){}};var St="closure_listenable_"+(1e6*Math.random()|0),Dt=0;function xt(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ca=i,this.key=++Dt,this.Y=this.Z=!1}function Ot(t){t.Y=!0,t.listener=null,t.proxy=null,t.src=null,t.ca=null}function Rt(t){this.src=t,this.a={},this.b=0}function kt(t,e){var n,r,i,o=e.type;o in t.a&&(n=t.a[o],(i=0<=(r=z(n,e)))&&Array.prototype.splice.call(n,r,1),i&&(Ot(e),0==t.a[o].length&&(delete t.a[o],t.b--)))}function Lt(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.Y&&o.listener==e&&o.capture==!!n&&o.ca==r)return i}return-1}Rt.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var s=Lt(t,e,r,i);return-1<s?(e=t[s],n||(e.Z=!1)):((e=new xt(e,this.src,o,!!r,i)).Z=n,t.push(e)),e};var Ct="closure_lm_"+(1e6*Math.random()|0),Pt={};function Ut(t,e,n,r,i){if(r&&r.once)return function t(e,n,r,i,o){if(Array.isArray(n)){for(var s=0;s<n.length;s++)t(e,n[s],r,i,o);return null}r=zt(r);return e&&e[St]?e.wa(n,r,C(i)?!!i.capture:!!i,o):Vt(e,n,r,!0,i,o)}(t,e,n,r,i);if(Array.isArray(e)){for(var o=0;o<e.length;o++)Ut(t,e[o],n,r,i);return null}return n=zt(n),t&&t[St]?t.va(e,n,C(r)?!!r.capture:!!r,i):Vt(t,e,n,!1,r,i)}function Vt(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s=C(i)?!!i.capture:!!i;if(s&&!It)return null;var u,a,c=Gt(t);if(c||(t[Ct]=c=new Rt(t)),(n=c.add(e,n,r,s,o)).proxy)return n;if(u=jt,r=a=It?function(t){return u.call(a.src,a.listener,t)}:function(t){if(!(t=u.call(a.src,a.listener,t)))return t},(n.proxy=r).src=t,r.listener=n,t.addEventListener)Tt||(i=s),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(Ft(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function Mt(t){var e,n,r;"number"!=typeof t&&t&&!t.Y&&((e=t.src)&&e[St]?kt(e.c,t):(n=t.type,r=t.proxy,e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Ft(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=Gt(e))?(kt(n,t),0==n.b&&(n.src=null,e[Ct]=null)):Ot(t)))}function Ft(t){return t in Pt?Pt[t]:Pt[t]="on"+t}function qt(t,e){var n=t.listener,r=t.ca||t.src;return t.Z&&Mt(t),n.call(r,e)}function jt(t,e){if(t.Y)return!0;
1if(It)return qt(t,new At(e,this));if(!e)t:{e=["window","event"];for(var n=O,r=0;r<e.length;r++)if(null==(n=n[e[r]])){e=null;break t}e=n}return qt(t,e=new At(e,this))}function Gt(t){return(t=t[Ct])instanceof Rt?t:null}var Bt="__closure_events_fn_"+(1e9*Math.random()>>>0);function zt(e){return"function"==k(e)?e:(e[Bt]||(e[Bt]=function(t){return e.handleEvent(t)}),e[Bt])}function Ht(){B.call(this),this.c=new Rt(this),(this.J=this).C=null}function Qt(t,e,n,r){if(!(e=t.c.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o<e.length;++o){var s,u,a=e[o];a&&!a.Y&&a.capture==n&&(s=a.listener,u=a.ca||a.src,a.Z&&kt(t.c,a),i=!1!==s.call(u,r)&&i)}return i&&!r.defaultPrevented}G(Ht,B),Ht.prototype[St]=!0,(S=Ht.prototype).addEventListener=function(t,e,n,r){Ut(this,t,e,n,r)},S.removeEventListener=function(t,e,n,r){!function t(e,n,r,i,o){if(Array.isArray(n))for(var s=0;s<n.length;s++)t(e,n[s],r,i,o);else i=C(i)?!!i.capture:!!i,r=zt(r),e&&e[St]?(e=e.c,(n=String(n).toString())in e.a&&-1<(r=Lt(s=e.a[n],r,i,o))&&(Ot(s[r]),Array.prototype.splice.call(s,r,1),0==s.length&&(delete e.a[n],e.b--))):(e=e&&Gt(e))&&(n=e.a[n.toString()],e=-1,n&&(e=Lt(n,r,i,o)),(r=-1<e?n[e]:null)&&Mt(r))}(this,t,e,n,r)},S.dispatchEvent=function(t){var e,n=this.C;if(n)for(e=[];n;n=n.C)e.push(n);n=this.J;var r=t.type||t;if("string"==typeof t?t=new _t(t,n):t instanceof _t?t.target=t.target||n:(s=t,it(t=new _t(r,n),s)),s=!0,e)for(var i=e.length-1;0<=i;i--)var o=t.a=e[i],s=Qt(o,r,!0,t)&&s;if(s=Qt(o=t.a=n,r,!0,t)&&s,s=Qt(o,r,!1,t)&&s,e)for(i=0;i<e.length;i++)s=Qt(o=t.a=e[i],r,!1,t)&&s;return s},S.G=function(){if(Ht.S.G.call(this),this.c){var t,e=this.c;for(t in e.a){for(var n=e.a[t],r=0;r<n.length;r++)Ot(n[r]);delete e.a[t],e.b--}}this.C=null},S.va=function(t,e,n,r){return this.c.add(String(t),e,!1,n,r)},S.wa=function(t,e,n,r){return this.c.add(String(t),e,!0,n,r)};var Kt=O.JSON.stringify;function Wt(){this.b=this.a=null}var Yt,Xt=($t.prototype.get=function(){var t;return 0<this.b?(this.b--,t=this.a,this.a=t.next,t.next=null):t=this.c(),t},new $t(function(){return new Jt},function(t){t.reset()},100));function $t(t,e,n){this.f=n,this.c=t,this.g=e,this.b=0,this.a=null}function Jt(){this.next=this.b=this.a=null}function Zt(t,e){var n;Yt||(n=O.Promise.resolve(void 0),Yt=function(){n.then(ne)}),te||(Yt(),te=!0),ee.add(t,e)}Wt.prototype.add=function(t,e){var n=Xt.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},Jt.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null};var te=!(Jt.prototype.reset=function(){this.next=this.b=this.a=null}),ee=new Wt;function ne(){for(var t,e,n;n=e=void 0,n=null,(e=ee).a&&(n=e.a,e.a=e.a.next,e.a||(e.b=null),n.next=null),t=n;){try{t.a.call(t.b)}catch(t){!function(t){O.setTimeout(function(){throw t},0)}(t)}var r=Xt;r.g(t),r.b<r.f&&(r.b++,t.next=r.a,r.a=t)}te=!1}function re(t,e){Ht.call(this),this.b=t||1,this.a=e||O,this.f=F(this.Ya,this),this.g=j()}function ie(t){t.aa=!1,t.M&&(t.a.clearTimeout(t.M),t.M=null)}function oe(t,e,n){if("function"==k(t))n&&(t=F(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=F(t.handleEvent,t)}return 2147483647<Number(e)?-1:O.setTimeout(t,e||0)}G(re,Ht),(S=re.prototype).aa=!1,S.M=null,S.Ya=function(){var t;this.aa&&(0<(t=j()-this.g)&&t<.8*this.b?this.M=this.a.setTimeout(this.f,this.b-t):(this.M&&(this.a.clearTimeout(this.M),this.M=null),this.dispatchEvent("tick"),this.aa&&(ie(this),this.start())))},S.start=function(){this.aa=!0,this.M||(this.M=this.a.setTimeout(this.f,this.b),this.g=j())},S.G=function(){re.S.G.call(this),ie(this),delete this.a};var se,ue,ae,ce=(A(ue=fe,ae=se=B),ue.prototype=null===ae?Object.create(ae):(he.prototype=ae.prototype,new he),fe.prototype.f=function(t){this.b=arguments,this.a?this.c=!0:function t(e){e.a=oe(function(){e.a=null,e.c&&(e.c=!1,t(e))},e.h);var n=e.b;e.b=null,e.g.apply(null,n)}(this)},fe.prototype.G=function(){se.prototype.G.call(this),this.a&&(O.clearTimeout(this.a),this.a=null,this.c=!1,this.b=null)},fe);function he(){this.constructor=ue}function fe(t,e,n){var r=se.call(this)||this;return r.g=null!=n?t.bind(n):t,r.h=e,r.b=null,r.c=!1,r.a=null,r}function le(t){B.call(this),this.b=t,this.a={}}G(le,B);var pe=[];function de(t,e,n,r){Array.isArray(n)||(n&&(pe[0]=n.toString()),n=pe);for(var i=0;i<n.length;i++){var o=Ut(e,n[i],r||t.handleEvent,!1,t.b||t);
1if(!o)break;t.a[o.key]=o}}function ve(t){et(t.a,function(t,e){this.a.hasOwnProperty(e)&&Mt(t)},t),t.a={}}function ye(){this.a=!0}function ge(t,e,n,r){t.info(function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.a)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(r.length<2)){var i=r[1];if(Array.isArray(i)&&!(i.length<1)){var o=i[0];if("noop"!=o&&"stop"!=o&&"close"!=o)for(var s=1;s<i.length;s++)i[s]=""}}}return Kt(n)}catch(t){return e}}(t,n)+(r?" "+r:"")})}le.prototype.G=function(){le.S.G.call(this),ve(this)},le.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},ye.prototype.info=function(){};var me=null;function we(){return me=me||new Ht}function be(t){_t.call(this,"serverreachability",t)}function Ie(t){var e=we();e.dispatchEvent(new be(e))}function Ee(t){_t.call(this,"statevent",t)}function Te(t){var e=we();e.dispatchEvent(new Ee(e))}function _e(t){_t.call(this,"timingevent",t)}function Ae(t,e){if("function"!=k(t))throw Error("Fn must not be null and must be a function");return O.setTimeout(function(){t()},e)}G(be,_t),G(Ee,_t),G(_e,_t);var Ne={NO_ERROR:0,Za:1,gb:2,fb:3,bb:4,eb:5,hb:6,Da:7,TIMEOUT:8,kb:9},Se={ab:"complete",ob:"success",Ea:"error",Da:"abort",mb:"ready",nb:"readystatechange",TIMEOUT:"timeout",ib:"incrementaldata",lb:"progress",cb:"downloadprogress",pb:"uploadprogress"};function De(){}function xe(t){var e;return(e=t.a)||(e=t.a={}),e}function Oe(){}De.prototype.a=null;var Re,ke={OPEN:"a",$a:"b",Ea:"c",jb:"d"};function Le(){_t.call(this,"d")}function Ce(){_t.call(this,"c")}function Pe(){}function Ue(t,e,n,r){this.g=t,this.c=e,this.f=n,this.T=r||1,this.J=new le(this),this.P=Ve,t=ft?125:void 0,this.R=new re(t),this.B=null,this.b=!1,this.j=this.l=this.i=this.H=this.u=this.U=this.o=null,this.s=[],this.a=null,this.D=0,this.h=this.m=null,this.N=-1,this.A=!1,this.O=0,this.F=null,this.W=this.C=this.V=this.I=!1}G(Le,_t),G(Ce,_t),G(Pe,De),Re=new Pe;var Ve=45e3,Me={},Fe={};function qe(t,e,n){t.H=1,t.i=an(en(e)),t.j=n,t.I=!0,je(t,null)}function je(t,e){t.u=j(),Be(t),t.l=en(t.i);var s,u,a,c,h,f,n=t.l,r=t.T;Array.isArray(r)||(r=[String(r)]),In(n.b,"t",r),t.D=0,t.a=dr(t.g,t.g.C?e:null),0<t.O&&(t.F=new ce(F(t.Ca,t,t.a),t.O)),de(t.J,t.a,"readystatechange",t.Wa),e=t.B?nt(t.B):{},t.j?(t.m||(t.m="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.a.ba(t.l,t.m,t.j,e)):(t.m="GET",t.a.ba(t.l,t.m,null,e)),Ie(1),s=t.c,u=t.m,a=t.l,c=t.f,h=t.T,f=t.j,s.info(function(){if(s.a)if(f)for(var t="",e=f.split("&"),n=0;n<e.length;n++){var r,i,o=e[n].split("=");1<o.length&&(r=o[0],o=o[1],t=2<=(i=r.split("_")).length&&"type"==i[1]?t+(r+"=")+o+"&":t+(r+"=redacted&"))}else t=null;else t=f;return"XMLHTTP REQ ("+c+") [attempt "+h+"]: "+u+"\n"+a+"\n"+t})}function Ge(t,e,n){for(var r,i,o,s,u=!0;!t.A&&t.D<n.length;){var a=(i=n,s=o=void 0,o=(r=t).D,-1==(s=i.indexOf("\n",o))?Fe:(o=Number(i.substring(o,s)),isNaN(o)?Me:(s+=1)+o>i.length?Fe:(i=i.substr(s,o),r.D=s+o,i)));if(a==Fe){4==e&&(t.h=4,Te(14),u=!1),ge(t.c,t.f,null,"[Incomplete Response]");break}if(a==Me){t.h=4,Te(15),ge(t.c,t.f,n,"[Invalid Chunk]"),u=!1;break}ge(t.c,t.f,a,null),We(t,a)}4==e&&0==n.length&&(t.h=1,Te(16),u=!1),t.b=t.b&&u,u?0<n.length&&!t.W&&(t.W=!0,(e=t.g).a==t&&e.V&&!e.F&&(e.c.info("Great, no buffering proxy detected. Bytes received: "+n.length),sr(e),e.F=!0)):(ge(t.c,t.f,n,"[Invalid Chunked Response]"),Ke(t),Qe(t))}function Be(t){t.U=j()+t.P,ze(t,t.P)}function ze(t,e){if(null!=t.o)throw Error("WatchDog timer not null");t.o=Ae(F(t.Ua,t),e)}function He(t){t.o&&(O.clearTimeout(t.o),t.o=null)}function Qe(t){0==t.g.v||t.A||cr(t.g,t)}function Ke(t){He(t);var e=t.F;e&&"function"==typeof e.ja&&e.ja(),t.F=null,ie(t.R),ve(t.J),t.a&&(e=t.a,t.a=null,e.abort(),e.ja())}function We(t,e){try{var n,r,i,o,s,u,a,c,h,f,l,p=t.g;if(0!=p.v&&(p.a==t||Dn(p.b,t)))if(p.I=t.N,!t.C&&Dn(p.b,t)&&3==p.v){try{var d=p.ka.a.parse(e)}catch(t){d=null}if(Array.isArray(d)&&3==d.length){var v=d;if(0==v[0]){t:if(!p.j){if(p.a){if(!(p.a.u+3e3<t.u))break t;ar(p),$n(p)}or(p),Te(18)}}else p.oa=v[1],0<p.oa-p.P&&v[2]<37500&&p.H&&0==p.o&&!p.m&&(p.m=Ae(F(p.Ra,p),6e3));if(Sn(p.b)<=1&&p.ea){try{p.ea()}catch(t){}p.ea=void 0}}else fr(p,11)}else if(!t.C&&p.a!=t||ar(p),!W(e))for(e=d=p.ka.a.parse(e),d=0;d<e.length;d++){v=e[d],p.P=v[0],v=v[1],2==p.v?"c"==v[0]?(p.J=v[1],p.ga=v[2],null!=(n=v[3])&&(p.ha=n,p.c.info("VER="+p.ha)),null!=(r=v[4])&&(p.pa=r,p.c.info("SVER="+p.pa)),null!=(i=v[5])&&"number"==typeof i&&0<i&&(o=1.5*i,p.D=o,p.c.info("backChannelRequestTimeoutMs_="+o)),o=p,(s=t.a)&&(!(u=s.a?s.a.getResponseHeader("X-Client-Wire-Protocol"):null)||!(a=o.b).a&&($(u,"spdy")||$(u,"quic")||$(u,"h2"))&&(a.f=a.g,a.a=new Set,a.b&&(xn(a,a.b),a.b=null)),!o.A||(c=s.a?s.a.getResponseHeader("X-HTTP-Session-Id"):null)&&(o.na=c,un(o.B,o.A,c))),p.v=3,p.f&&p.f.ta(),p.V&&(p.N=j()-t.u,p.c.info("Handshake RTT: "+p.N+"ms")),h=t,(o=p).la=pr(o,o.C?o.ga:null,o.fa),h.C?(On(o.b,h),f=h,(l=o.D)&&f.setTimeout(l),f.o&&(He(f),Be(f)),o.a=h):ir(o),0<p.g.length&&tr(p)):"stop"
1!=v[0]&&"close"!=v[0]||fr(p,7):3==p.v&&("stop"==v[0]||"close"==v[0]?"stop"==v[0]?fr(p,7):Xn(p):"noop"!=v[0]&&p.f&&p.f.sa(v),p.o=0)}Ie(4)}catch(t){}}function Ye(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(L(t)||"string"==typeof t)H(t,e,void 0);else{if(t.L&&"function"==typeof t.L)var n=t.L();else if(t.K&&"function"==typeof t.K)n=void 0;else if(L(t)||"string"==typeof t){n=[];for(var r=t.length,i=0;i<r;i++)n.push(i)}else for(i in n=[],r=0,t)n[r++]=i;i=(r=function(t){if(t.K&&"function"==typeof t.K)return t.K();if("string"==typeof t)return t.split("");if(L(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t)).length;for(var o=0;o<i;o++)e.call(void 0,r[o],n&&n[o],t)}}function Xe(t,e){this.b={},this.a=[],this.c=0;var n=arguments.length;if(1<n){if(n%2)throw Error("Uneven number of arguments");for(var r=0;r<n;r+=2)this.set(arguments[r],arguments[r+1])}else if(t)if(t instanceof Xe)for(n=t.L(),r=0;r<n.length;r++)this.set(n[r],t.get(n[r]));else for(r in t)this.set(r,t[r])}function $e(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];Je(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){for(var i={},n=e=0;e<t.a.length;)Je(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function Je(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(S=Ue.prototype).setTimeout=function(t){this.P=t},S.Wa=function(t){t=t.target;var e=this.F;e&&3==Qn(t)?e.f():this.Ca(t)},S.Ca=function(t){try{if(t==this.a)t:{var e=Qn(this.a),n=this.a.ua(),r=this.a.X();if(!(e<3||3==e&&!ft&&!this.a.$())){this.A||4!=e||7==n||Ie(8==n||r<=0?3:2),He(this);var i=this.a.X();this.N=i;var o=this.a.$();if(this.b=200==i,c=this.c,h=this.m,f=this.l,l=this.f,p=this.T,d=e,v=i,c.info(function(){return"XMLHTTP RESP ("+l+") [ attempt "+p+"]: "+h+"\n"+f+"\n"+d+" "+v}),this.b){if(this.V&&!this.C){e:{if(this.a){var s,u=this.a;if((s=u.a?u.a.getResponseHeader("X-HTTP-Initial-Response"):null)&&!W(s)){var a=s;break e}}a=null}if(!a){this.b=!1,this.h=3,Te(12),Ke(this),Qe(this);break t}ge(this.c,this.f,a,"Initial handshake response via X-HTTP-Initial-Response"),this.C=!0,We(this,a)}this.I?(Ge(this,e,o),ft&&this.b&&3==e&&(de(this.J,this.R,"tick",this.Va),this.R.start())):(ge(this.c,this.f,o,null),We(this,o)),4==e&&Ke(this),this.b&&!this.A&&(4==e?cr(this.g,this):(this.b=!1,Be(this)))}else 400==i&&0<o.indexOf("Unknown SID")?(this.h=3,Te(12)):(this.h=0,Te(13)),Ke(this),Qe(this)}}}catch(t){}var c,h,f,l,p,d,v},S.Va=function(){var t,e;this.a&&(t=Qn(this.a),e=this.a.$(),this.D<e.length&&(He(this),Ge(this,t,e),this.b&&4!=t&&Be(this)))},S.cancel=function(){this.A=!0,Ke(this)},S.Ua=function(){this.o=null;var t,e,n=j();0<=n-this.U?(t=this.c,e=this.l,t.info(function(){return"TIMEOUT: "+e}),2!=this.H&&(Ie(3),Te(17)),Ke(this),this.h=2,Qe(this)):ze(this,this.U-n)},(S=Xe.prototype).K=function(){$e(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},S.L=function(){return $e(this),this.a.concat()},S.get=function(t,e){return Je(this.b,t)?this.b[t]:e},S.set=function(t,e){Je(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e}
1,S.forEach=function(t,e){for(var n=this.L(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var Ze=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function tn(t,e){var n;this.c=this.j=this.f="",this.h=null,this.i=this.g="",this.a=!1,t instanceof tn?(this.a=void 0!==e?e:t.a,nn(this,t.f),this.j=t.j,rn(this,t.c),on(this,t.h),this.g=t.g,e=t.b,(n=new gn).c=e.c,e.a&&(n.a=new Xe(e.a),n.b=e.b),sn(this,n),this.i=t.i):t&&(n=String(t).match(Ze))?(this.a=!!e,nn(this,n[1]||"",!0),this.j=cn(n[2]||""),rn(this,n[3]||"",!0),on(this,n[4]),this.g=cn(n[5]||"",!0),sn(this,n[6]||"",!0),this.i=cn(n[7]||"")):(this.a=!!e,this.b=new gn(null,this.a))}function en(t){return new tn(t)}function nn(t,e,n){t.f=n?cn(e,!0):e,t.f&&(t.f=t.f.replace(/:$/,""))}function rn(t,e,n){t.c=n?cn(e,!0):e}function on(t,e){if(e){if(e=Number(e),isNaN(e)||e<0)throw Error("Bad port number "+e);t.h=e}else t.h=null}function sn(t,e,n){var r,i;e instanceof gn?(t.b=e,r=t.b,(i=t.a)&&!r.f&&(mn(r),r.c=null,r.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(wn(this,e),In(this,n,t))},r)),r.f=i):(n||(e=hn(e,vn)),t.b=new gn(e,t.a))}function un(t,e,n){t.b.set(e,n)}function an(t){return un(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^j()).toString(36)),t}function cn(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function hn(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,fn),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function fn(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}tn.prototype.toString=function(){var t=[],e=this.f;e&&t.push(hn(e,ln,!0),":");var n=this.c;return!n&&"file"!=e||(t.push("//"),(e=this.j)&&t.push(hn(e,ln,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.h)&&t.push(":",String(n))),(n=this.g)&&(this.c&&"/"!=n.charAt(0)&&t.push("/"),t.push(hn(n,"/"==n.charAt(0)?dn:pn,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",hn(n,yn)),t.join("")};var ln=/[#\/\?@]/g,pn=/[#\?:]/g,dn=/[#\?]/g,vn=/[#\?@]/g,yn=/#/g;function gn(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function mn(n){n.a||(n.a=new Xe,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r,i=t[n].indexOf("="),o=null;0<=i?(r=t[n].substring(0,i),o=t[n].substring(i+1)):r=t[n],e(r,o?decodeURIComponent(o.replace(/\+/g," ")):"")}}}(n.c,function(t,e){n.add(decodeURIComponent(t.replace(/\+/g," ")),e)}))}function wn(t,e){mn(t),e=En(t,e),Je(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,Je((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&$e(t)))}function bn(t,e){return mn(t),e=En(t,e),Je(t.a.b,e)}function In(t,e,n){wn(t,e),0<n.length&&(t.c=null,t.a.set(En(t,e),K(n)),t.b+=n.length)}function En(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}function Tn(t,e){this.b=t,this.a=e}function _n(t){this.g=t||An,t=O.PerformanceNavigationTiming?0<(t=O.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):!!(O.ia&&O.ia.ya&&O.ia.ya()&&O.ia.ya().qb),this.f=t?this.g:1,this.a=null,1<this.f&&(this.a=new Set),this.b=null,this.c=[]}(S=gn.prototype).add=function(t,e){mn(this),this.c=null,t=En(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},S.forEach=function(n,r){mn(this),this.a.forEach(function(t,e){H(t,function(t){n.call(r,t,e,this)},this)},this)},S.L=function(){mn(this);for(var t=this.a.K(),e=this.a.L(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},S.K=function(t){mn(this);var e=[];if("string"==typeof t)bn(this,t)&&(e=Q(e,this.a.get(En(this,t))));else{t=this.a.K();for(var n=0;n<t.length;n++)e=Q(e,t[n])}return e},S.set=function(t,e){return mn(this),this.c=null,bn(this,t=En(this,t))&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},S.get=function(t,e){return t&&0<(t=this.K(t)).length?String(t[0]):e},S.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var t=[],e=this.a.L(),n=0;n<e.length;n++)for(var r=e[n],i=encodeURIComponent(String(r)),r=this.K(r),o=0;o<r.length;o++){var s=i;""!==r[o]&&(s+="="+encodeURIComponent(String(r[o]))),t.push(s)}return this.c=t.join("&")};var An=10;function Nn(t){return t.b||t.a&&t.a.size>=t.f}function Sn(t){return t.b?1:t.a?t.a.size:0}function Dn(t,e){return t.b?t.b==e:t.a&&t.a.has(e)}function xn(t,e){t.a?t.a.add(e):t.b=e}function On(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function Rn(t){var e,n;if(null!=t.b)return t.c.concat(t.b.s);if(null==t.a||0===t.a.size)return K(t.c);var r=t.c;try{for(var i=N(t.a.values()),o=i.next();!o.done;o=i.next())var s=o.value,r=r.concat(s.s)}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function kn(){}function Ln(){this.a=new kn}function Cn(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}_n.prototype.cancel=function(){var e,t;if(this.c=Rn(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=N(this.a.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.a.clear()}},kn.prototype.stringify=function(t){return O.JSON.stringify(t,void 0)},kn.prototype.parse=function(t){return O.JSON.parse(t,void 0)};var Pn=O.JSON.parse;function Un(t){Ht.call(this),this.headers=new Xe,this.H=t||null,this.b=!1,this.s=this.a=null,this.B="",this.h=0,this.f="",this.g=this.A=this.l=this.u=!1,this.o=0,this.m=null,this.I=Vn,this.D=this.F=!1}G(Un,Ht);var Vn="",Mn=/^https?$/i,Fn=["POST","PUT"];function qn(t){return"content-type"==t.toLowerCase()}function jn(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,Gn(t),zn(t)}function Gn(t){t.u||(t.u=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function Bn(t){if(t.b&&void 0!==x&&(!t.s[1]||4!=Qn(t)||2!=t.X()))if(t.l&&4==Qn(t))oe(t.za,0,t);else if(t.dispatchEvent("readystatechange"),4==Qn(t)){t.b=!1;try{var e,n,r,i,o=t.X();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.B).match(Ze)[1]||null)&&O.self&&O.self.location&&(i=(r=O.self.location.protocol).substr(0,r.length-1)),n=!Mn.test(i?i.toLowerCase():"")),e=n),e)t.dispatchEvent("complete"),t.dispatchEvent("success");else{t.h=6;try{var u=2<Qn(t)?t.a.statusText:""}catch(t){u=""}t.f=u+" ["+t.X()+"]",Gn(t)}}finally{zn(t)}}}function zn(t,e){if(t.a){Hn(t);var n=t.a,r=t.s[0]?R:null;
1t.a=null,t.s=null,e||t.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){}}}function Hn(t){t.a&&t.D&&(t.a.ontimeout=null),t.m&&(O.clearTimeout(t.m),t.m=null)}function Qn(t){return t.a?t.a.readyState:0}function Kn(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}var i;r||(i="",et(n,function(t,e){i+=e,i+=":",i+=t,i+="\r\n"}),n=i,"string"==typeof t?null!=n&&encodeURIComponent(String(n)):un(t,e,n))}function Wn(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Yn(t){this.pa=0,this.g=[],this.c=new ye,this.ga=this.la=this.B=this.fa=this.a=this.na=this.A=this.W=this.i=this.O=this.l=null,this.La=this.R=0,this.Ia=Wn("failFast",!1,t),this.H=this.m=this.j=this.h=this.f=null,this.T=!0,this.I=this.oa=this.P=-1,this.U=this.o=this.u=0,this.Fa=Wn("baseRetryDelayMs",5e3,t),this.Ma=Wn("retryDelaySeedMs",1e4,t),this.Ja=Wn("forwardChannelMaxRetries",2,t),this.ma=Wn("forwardChannelRequestTimeoutMs",2e4,t),this.Ka=t&&t.g||void 0,this.D=void 0,this.C=t&&t.supportsCrossDomainXhr||!1,this.J="",this.b=new _n(t&&t.concurrentRequestLimit),this.ka=new Ln,this.da=t&&t.fastHandshake||!1,this.Ga=t&&t.b||!1,t&&t.f&&(this.c.a=!1),t&&t.forceLongPolling&&(this.T=!1),this.V=!this.da&&this.T&&t&&t.c||!1,this.ea=void 0,this.N=0,this.F=!1,this.s=null}function Xn(t){var e,n;Jn(t),3==t.v&&(e=t.R++,un(n=en(t.B),"SID",t.J),un(n,"RID",e),un(n,"TYPE","terminate"),nr(t,n),(e=new Ue(t,t.c,e,void 0)).H=2,e.i=an(en(n)),n=!1,O.navigator&&O.navigator.sendBeacon&&(n=O.navigator.sendBeacon(e.i.toString(),"")),!n&&O.Image&&((new Image).src=e.i,n=!0),n||(e.a=dr(e.g,null),e.a.ba(e.i)),e.u=j(),Be(e)),lr(t)}function $n(t){t.a&&(sr(t),t.a.cancel(),t.a=null)}function Jn(t){$n(t),t.j&&(O.clearTimeout(t.j),t.j=null),ar(t),t.b.cancel(),t.h&&("number"==typeof t.h&&O.clearTimeout(t.h),t.h=null)}function Zn(t,e){t.g.push(new Tn(t.La++,e)),3==t.v&&tr(t)}function tr(t){Nn(t.b)||t.h||(t.h=!0,Zt(t.Ba,t),t.u=0)}function er(t,e){var n=e?e.f:t.R++,r=en(t.B);un(r,"SID",t.J),un(r,"RID",n),un(r,"AID",t.P),nr(t,r),t.i&&t.l&&Kn(r,t.i,t.l),n=new Ue(t,t.c,n,t.u+1),null===t.i&&(n.B=t.l),e&&(t.g=e.s.concat(t.g)),e=rr(t,n,1e3),n.setTimeout(Math.round(.5*t.ma)+Math.round(.5*t.ma*Math.random())),xn(t.b,n),qe(n,r,e)}function nr(t,n){t.f&&Ye({},function(t,e){un(n,e,t)})}function rr(t,e,n){n=Math.min(t.g.length,n);var r=t.f?F(t.f.Ha,t.f,t):null;t:for(var i=t.g,o=-1;;){var s=["count="+n];-1==o?0<n?(o=i[0].b,s.push("ofs="+o)):o=0:s.push("ofs="+o);for(var u=!0,a=0;a<n;a++){var c=i[a].b,h=i[a].a;if((c-=o)<0)o=Math.max(0,i[a].b-100),u=!1;else try{!function(t,r,e){var i=e||"";try{Ye(t,function(t,e){var n=t;C(t)&&(n=Kt(t)),r.push(i+e+"="+encodeURIComponent(n))})}catch(t){throw r.push(i+"type="+encodeURIComponent("_badmap")),t}}(h,s,"req"+c+"_")}catch(t){r&&r(h)}}if(u){r=s.join("&");break t}}return t=t.g.splice(0,n),e.s=t,r}function ir(t){t.a||t.j||(t.U=1,Zt(t.Aa,t),t.o=0)}function or(t){return!(t.a||t.j||3<=t.o)&&(t.U++,t.j=Ae(F(t.Aa,t),hr(t,t.o)),t.o++,1)}function sr(t){null!=t.s&&(O.clearTimeout(t.s),t.s=null)}function ur(t){t.a=new Ue(t,t.c,"rpc",t.U),null===t.i&&(t.a.B=t.l),t.a.O=0;var e=en(t.la);un(e,"RID","rpc"),un(e,"SID",t.J),un(e,"CI",t.H?"0":"1"),un(e,"AID",t.P),nr(t,e),un(e,"TYPE","xmlhttp"),t.i&&t.l&&Kn(e,t.i,t.l),t.D&&t.a.setTimeout(t.D);var n=t.a;t=t.ga,n.H=1,n.i=an(en(e)),n.j=null,n.I=!0,je(n,t)}function ar(t){null!=t.m&&(O.clearTimeout(t.m),t.m=null)}function cr(t,e){var n,r=null;if(t.a==e){ar(t),sr(t),t.a=null;var i=2}else{if(!Dn(t.b,e))return;r=e.s,On(t.b,e),i=1}if(t.I=e.N,0!=t.v)if(e.b){1==i?(r=e.j?e.j.length:0,e=j()-e.u,n=t.u,(i=we()).dispatchEvent(new _e(i)),tr(t)):ir(t)}else if(3==(n=e.h)||0==n&&0<t.I||!(1==i&&function(t,e){if(!(Sn(t.b)>=t.b.f-(t.h?1:0))){if(t.h)return t.g=e.s.concat(t.g),1;if(!(1==t.v||2==t.v||t.u>=(t.Ia?0:t.Ja)))return t.h=Ae(F(t.Ba,t,e),hr(t,t.u)),t.u++,1}}(t,e)||2==i&&or(t)))switch(r&&0<r.length&&(e=t.b,e.c=e.c.concat(r)),n){case 1:fr(t,5);break;case 4:fr(t,10);break;case 3:fr(t,6);break;default:fr(t,2)}}function hr(t,e){var n=t.Fa+Math.floor(Math.random()*t.Ma);return t.f||(n*=2),n*e}function fr(t,e){var n,r,i,o,s,u;t.c.info("Error code "+e),2==e?(n=null,t.f&&(n=null),r=F(t.Xa,t),n||(n=new tn("//www.google.com/images/cleardot.gif"),O.location&&"http"==O.location.protocol||nn(n,"https"),an(n)),i=n.toString(),o=r,u=new ye,O.Image?((s=new Image).onload=q(Cn,u,s,"TestLoadImage: loaded",!0,o),s.onerror=q(Cn,u,s,"TestLoadImage: error",!1,o),s.onabort=q(Cn,u,s,"TestLoadImage: abort",!1,o),s.ontimeout=q(Cn,u,s,"TestLoadImage: timeout",!1,o),O.setTimeout(function(){s.ontimeout&&s.ontimeout()},1e4),s.src=i):o(!1)):Te(2),t.v=0,t.f&&t.f.ra(e),lr(t),Jn(t)}function lr(t){t.v=0,t.I=-1,t.f&&(0==Rn(t.b).length&&0==t.g.length||(t.b.c.length=0,K(t.g),t.g.length=0),t.f.qa())}function pr(t,e,n){var r,i,o,s,u,a,c,h=(r=n)instanceof tn?en(r):new tn(r,void 0);return""!=h.c?(e&&rn(h,e+"."+h.c),on(h,h.h)):(i=O.location,o=i.protocol,s=e?e+"."+i.hostname:i.hostname,u=+i.port,a=n,c=new tn(null,void 0),o&&nn(c,o),s&&rn(c,s),u&&on(c,u),a&&(c.g=a),h=c),t.W&&et(t.W,function(t,e){un(h,e,t)}),e=t.A,n=t.na,e&&n&&un(h,e,n),un(h,"VER",t.ha),nr(t,h),h}function dr(t,e){if(e&&!t.C)throw Error("Can't create secondary domain capable XhrIo object.");
1return(e=new Un(t.Ka)).F=t.C,e}function vr(){}function yr(){if(ct&&!(10<=Number(bt)))throw Error("Environmental error: no available transport.")}function gr(t,e){Ht.call(this),this.a=new Yn(e),this.l=t,this.b=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.a.l=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.a&&(t?t["X-WebChannel-Client-Profile"]=e.a:t={"X-WebChannel-Client-Profile":e.a}),this.a.O=t,(t=e&&e.httpHeadersOverwriteParam)&&!W(t)&&(this.a.i=t),this.h=e&&e.supportsCrossDomainXhr||!1,this.g=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!W(e)&&(this.a.A=e,null!==(t=this.b)&&e in t&&(e in(t=this.b)&&delete t[e])),this.f=new br(this)}function mr(t){Le.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.c=t)?(t=this.c,this.data=null!==e&&t in e?e[t]:void 0):this.data=e}else this.data=t}function wr(){Ce.call(this),this.status=1}function br(t){this.a=t}(S=Un.prototype).ba=function(t,e,n,r){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.B+"; newUri="+t);e=e?e.toUpperCase():"GET",this.B=t,this.f="",this.h=0,this.u=!1,this.b=!0,this.a=new XMLHttpRequest,this.s=this.H?xe(this.H):xe(Re),this.a.onreadystatechange=F(this.za,this);try{this.A=!0,this.a.open(e,String(t),!0),this.A=!1}catch(t){return void jn(this,t)}t=n||"";var i,o=new Xe(this.headers);r&&Ye(r,function(t,e){o.set(e,t)}),r=function(t){t:{for(var e=qn,n=t.length,r="string"==typeof t?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t)){e=i;break t}e=-1}return e<0?null:"string"==typeof t?t.charAt(e):t[e]}(o.L()),n=O.FormData&&t instanceof O.FormData,0<=z(Fn,e)&&!r&&!n&&o.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),o.forEach(function(t,e){this.a.setRequestHeader(e,t)},this),this.I&&(this.a.responseType=this.I),"withCredentials"in this.a&&this.a.withCredentials!==this.F&&(this.a.withCredentials=this.F);try{Hn(this),0<this.o&&((this.D=(i=this.a,ct&&wt(9)&&"number"==typeof i.timeout&&void 0!==i.ontimeout))?(this.a.timeout=this.o,this.a.ontimeout=F(this.xa,this)):this.m=oe(this.xa,this.o,this)),this.l=!0,this.a.send(t),this.l=!1}catch(t){jn(this,t)}},S.xa=function(){void 0!==x&&this.a&&(this.f="Timed out after "+this.o+"ms, aborting",this.h=8,this.dispatchEvent("timeout"),this.abort(8))},S.abort=function(t){this.a&&this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1,this.h=t||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),zn(this))},S.G=function(){this.a&&(this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1),zn(this,!0)),Un.S.G.call(this)},S.za=function(){this.j||(this.A||this.l||this.g?Bn(this):this.Ta())},S.Ta=function(){Bn(this)},S.X=function(){try{return 2<Qn(this)?this.a.status:-1}catch(t){return-1}},S.$=function(){try{return this.a?this.a.responseText:""}catch(t){return""}},S.Na=function(t){if(this.a){var e=this.a.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),Pn(e)}},S.ua=function(){return this.h},S.Qa=function(){return"string"==typeof this.f?this.f:String(this.f)},(S=Yn.prototype).ha=8,S.v=1,S.Ba=function(t){if(this.h)if(this.h=null,1==this.v){if(!t){this.R=Math.floor(1e5*Math.random()),t=this.R++;var e,n=new Ue(this,this.c,t,void 0),r=this.l;if(this.O&&(r?it(r=nt(r),this.O):r=this.O),null===this.i&&(n.B=r),this.da)t:{for(var i=e=0;i<this.g.length;i++){var o=this.g[i];if("__data__"in o.a&&"string"==typeof(o=o.a.__data__)?o=o.length:o=void 0,void 0===o)break;if(4096<(e+=o)){e=i;break t}if(4096===e||i===this.g.length-1){e=i+1;break t}}e=1e3}else e=1e3;e=rr(this,n,e),un(i=en(this.B),"RID",t),un(i,"CVER",22),this.A&&un(i,"X-HTTP-Session-Id",this.A),nr(this,i),this.i&&r&&Kn(i,this.i,r),xn(this.b,n),this.Ga&&un(i,"TYPE","init"),this.da?(un(i,"$req",e),un(i,"SID","null"),n.V=!0,qe(n,i,null)):qe(n,i,e),this.v=2}}else 3==this.v&&(t?er(this,t):0==this.g.length||Nn(this.b)||er(this))},S.Aa=function(){var t;this.j=null,ur(this),this.V&&!(this.F||null==this.a||this.N<=0)&&(t=2*this.N,this.c.info("BP detection timer enabled: "+t),this.s=Ae(F(this.Sa,this),t))},S.Sa=function(){this.s&&(this.s=null,this.c.info("BP detection timeout reached."),this.c.info("Buffering proxy detected and switch to long-polling!"),this.H=!1,this.F=!0,$n(this),ur(this))},S.Ra=function(){null!=this.m&&(this.m=null,$n(this),or(this),Te(19))},S.Xa=function(t){t?(this.c.info("Successfully pinged google.com"),Te(2)):(this.c.info("Failed to ping google.com"),Te(1))},(S=vr.prototype).ta=function(){},S.sa=function(){},S.ra=function(){},S.qa=function(){},S.Ha=function(){},yr.prototype.a=function(t,e){return new gr(t,e)},G(gr,Ht),(S=gr.prototype).addEventListener=function(t,e,n,r){gr.S.addEventListener.call(this,t,e,n,r)},S.removeEventListener=function(t,e,n,r){gr.S.removeEventListener.call(this,t,e,n,r)},S.Oa=function(){this.a.f=this.f,this.h&&(this.a.C=!0);var t=this.a,e=this.l,n=this.b||void 0;Te(0),t.fa=e,t.W=n||{},t.H=t.T,t.B=pr(t,null,t.fa),tr(t)},S.close=function(){Xn(this.a)},S.Pa=function(t){var e;"string"==typeof t?((e={}).__data__=t,Zn(this.a,e)):this.g?((e={}).__data__=Kt(t),Zn(this.a,e)):Zn(this.a,t)},S.G=function(){this.a.f=null,delete this.f,Xn(this.a),delete this.a,gr.S.G.call(this)},G(mr,Le),G(wr,Ce),G(br,vr),br.prototype.ta=function(){this.a.dispatchEvent("a")},br.prototype.sa=function(t){this.a.dispatchEvent(new mr(t))},br.prototype.ra=function(t){this.a.dispatchEvent(new wr)},br.prototype.qa=function(){this.a.dispatchEvent("b")},yr.prototype.createWebChannel=yr.prototype.a,gr.prototype.send=gr.prototype.Pa,gr.prototype.open=gr.prototype.Oa,Ne.
1NO_ERROR=0,Ne.TIMEOUT=8,Ne.HTTP_ERROR=6,Se.COMPLETE="complete",(Oe.EventType=ke).OPEN="a",ke.CLOSE="b",ke.ERROR="c",ke.MESSAGE="d",Ht.prototype.listen=Ht.prototype.va,Un.prototype.listenOnce=Un.prototype.wa,Un.prototype.getLastError=Un.prototype.Qa,Un.prototype.getLastErrorCode=Un.prototype.ua,Un.prototype.getStatus=Un.prototype.X,Un.prototype.getResponseJson=Un.prototype.Na,Un.prototype.getResponseText=Un.prototype.$,Un.prototype.send=Un.prototype.ba;var Ir={createWebChannelTransport:function(){return new yr},ErrorCode:Ne,EventType:Se,WebChannel:Oe,XhrIo:Un},Er=Ir.createWebChannelTransport,Tr=Ir.ErrorCode,_r=Ir.EventType,Ar=Ir.WebChannel,Nr=Ir.XhrIo,Sr=(Dr.prototype.setInstantiationMode=function(t){return this.instantiationMode=t,this},Dr.prototype.setMultipleInstances=function(t){return this.multipleInstances=t,this},Dr.prototype.setServiceProps=function(t){return this.serviceProps=t,this},Dr);function Dr(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}var xr,Or={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"},Rr=(o(Lr,xr=Error),Lr),kr=new p("@firebase/firestore");function Lr(t,e){var n=this;return(n=xr.call(this,e)||this).code=t,n.message=e,n.name="FirebaseError",n.toString=function(){return n.name+": [code="+n.code+"]: "+n.message},n}function Cr(){return kr.logLevel}function Pr(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];kr.logLevel<=l.DEBUG&&(e=n.map(Mr),kr.debug.apply(kr,s(["Firestore (7.21.1): "+t],e)))}function Ur(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];kr.logLevel<=l.ERROR&&(e=n.map(Mr),kr.error.apply(kr,s(["Firestore (7.21.1): "+t],e)))}function Vr(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];kr.logLevel<=l.WARN&&(e=n.map(Mr),kr.warn.apply(kr,s(["Firestore (7.21.1): "+t],e)))}function Mr(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){return e}}function Fr(t){void 0===t&&(t="Unexpected state");var e="FIRESTORE (7.21.1) INTERNAL ASSERTION FAILED: "+t;throw Ur(e),new Error(e)}function qr(t){t||Fr()}function jr(t){var e,n=0;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&n++;return n}function Gr(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function Br(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}var zr,Hr,Qr=(Object.defineProperty(ti.prototype,"length",{get:function(){return this.t},enumerable:!1,configurable:!0}),ti.prototype.isEqual=function(t){return 0===ti.i(this,t)},ti.prototype.child=function(t){var e=this.segments.slice(this.offset,this.limit());return t instanceof ti?t.forEach(function(t){e.push(t)}):e.push(t),this.o(e)},ti.prototype.limit=function(){return this.offset+this.length},ti.prototype.u=function(t){return t=void 0===t?1:t,this.o(this.segments,this.offset+t,this.length-t)},ti.prototype.h=function(){return this.o(this.segments,this.offset,this.length-1)},ti.prototype.l=function(){return this.segments[this.offset]},ti.prototype._=function(){return this.get(this.length-1)},ti.prototype.get=function(t){return this.segments[this.offset+t]},ti.prototype.m=function(){return 0===this.length},ti.prototype.T=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},ti.prototype.I=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},ti.prototype.forEach=function(t){for(var e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])},ti.prototype.A=function(){return this.segments.slice(this.offset,this.limit())},ti.i=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(o<i)return 1}return t.length<e.length?-1:t.length>e.length?1:0},ti),Kr=(o(Zr,Hr=Qr),Zr.prototype.o=function(t,e,n){return new Zr(t,e,n)},Zr.prototype.R=function(){return this.A().join("/")},Zr.prototype.toString=function(){return this.R()}
1,Zr.P=function(t){if(0<=t.indexOf("//"))throw new Rr(Or.INVALID_ARGUMENT,"Invalid path ("+t+"). Paths must not contain // in them.");return new Zr(t.split("/").filter(function(t){return 0<t.length}))},Zr.g=function(){return new Zr([])},Zr),Wr=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Yr=(o(Jr,zr=Qr),Jr.prototype.o=function(t,e,n){return new Jr(t,e,n)},Jr.V=function(t){return Wr.test(t)},Jr.prototype.R=function(){return this.A().map(function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),Jr.V(t)||(t="`"+t+"`"),t}).join(".")},Jr.prototype.toString=function(){return this.R()},Jr.prototype.p=function(){return 1===this.length&&"__name__"===this.get(0)},Jr.v=function(){return new Jr(["__name__"])},Jr.S=function(t){for(var e=[],n="",r=0,i=function(){if(0===n.length)throw new Rr(Or.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");e.push(n),n=""},o=!1;r<t.length;){var s=t[r];if("\\"===s){if(r+1===t.length)throw new Rr(Or.INVALID_ARGUMENT,"Path has trailing escape character: "+t);var u=t[r+1];if("\\"!==u&&"."!==u&&"`"!==u)throw new Rr(Or.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=u,r+=2}else"`"===s?o=!o:"."!==s||o?n+=s:i(),r++}if(i(),o)throw new Rr(Or.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new Jr(e)},Jr.g=function(){return new Jr([])},Jr),Xr=($r.D=function(t){return new $r(Kr.P(t))},$r.C=function(t){return new $r(Kr.P(t).u(5))},$r.prototype.N=function(t){return 2<=this.path.length&&this.path.get(this.path.length-2)===t},$r.prototype.isEqual=function(t){return null!==t&&0===Kr.i(this.path,t.path)},$r.prototype.toString=function(){return this.path.toString()},$r.i=function(t,e){return Kr.i(t.path,e.path)},$r.F=function(t){return t.length%2==0},$r.$=function(t){return new $r(new Kr(t.slice()))},$r);function $r(t){this.path=t}function Jr(){return null!==zr&&zr.apply(this,arguments)||this}function Zr(){return null!==Hr&&Hr.apply(this,arguments)||this}function ti(t,e,n){void 0===e?e=0:e>t.length&&Fr(),void 0===n?n=t.length-e:n>t.length-e&&Fr(),this.segments=t,this.offset=e,this.t=n}function ei(t,e){if(0!==e.length)throw new Rr(Or.INVALID_ARGUMENT,"Function "+t+"() does not support arguments, but was called with "+wi(e.length,"argument")+".")}function ni(t,e,n){if(e.length!==n)throw new Rr(Or.INVALID_ARGUMENT,"Function "+t+"() requires "+wi(n,"argument")+", but was called with "+wi(e.length,"argument")+".")}function ri(t,e,n){if(e.length<n)throw new Rr(Or.INVALID_ARGUMENT,"Function "+t+"() requires at least "+wi(n,"argument")+", but was called with "+wi(e.length,"argument")+".")}function ii(t,e,n,r){if(e.length<n||e.length>r)throw new Rr(Or.INVALID_ARGUMENT,"Function "+t+"() requires between "+n+" and "+r+" arguments, but was called with "+wi(e.length,"argument")+".")}function oi(t,e,n,r){fi(t,e,mi(n)+" argument",r)}function si(t,e,n,r){void 0!==r&&oi(t,e,n,r)}function ui(t,e,n,r){fi(t,e,n+" option",r)}function ai(t,e,n,r){void 0!==r&&ui(t,e,n,r)}function ci(t,e,n,r,a){void 0!==r&&function(t,e,n){for(var r=[],i=0,o=a;i<o.length;i++){var s=o[i];if(s===n)return;r.push(pi(s))}var u=pi(n);throw new Rr(Or.INVALID_ARGUMENT,"Invalid value "+u+" provided to function "+t+'() for option "'+e+'". Acceptable values: '+r.join(", "))}(t,n,r)}function hi(t,e,n,r){if(!e.some(function(t){return t===r}))throw new Rr(Or.INVALID_ARGUMENT,"Invalid value "+pi(r)+" provided to function "+t+"() for its "+mi(n)+" argument. Acceptable values: "+e.join(", "));return r}function fi(t,e,n,r){if(!("object"===e?li(r):"non-empty string"===e?"string"==typeof r&&""!==r:typeof r===e)){var i=pi(r);throw new Rr(Or.INVALID_ARGUMENT,"Function "+t+"() requires its "+n+" to be of type "+e+", but it was: "+i)}}function li(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}function pi(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return 20<e.length&&(e=e.substring(0,20)+"..."),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"!=typeof e)return"function"==typeof e?"a function":Fr();if(e instanceof Array)return"an array";var t=function(){if(e.constructor){var t=/function\s+([^\s(]+)\s*\(/.exec(e.constructor.toString());if(t&&1<t.length)return t[1]}return null}();return t?"a custom "+t+" object":"an object"}
1function di(t,e,n){if(void 0===n)throw new Rr(Or.INVALID_ARGUMENT,"Function "+t+"() requires a valid "+mi(e)+" argument, but it was undefined.")}function vi(n,t,r){Gr(t,function(t,e){if(r.indexOf(t)<0)throw new Rr(Or.INVALID_ARGUMENT,"Unknown option '"+t+"' passed to function "+n+"(). Available options: "+r.join(", "))})}function yi(t,e,n,r){var i=pi(r);return new Rr(Or.INVALID_ARGUMENT,"Function "+t+"() requires its "+mi(n)+" argument to be a "+e+", but it was: "+i)}function gi(t,e,n){if(n<=0)throw new Rr(Or.INVALID_ARGUMENT,"Function "+t+"() requires its "+mi(e)+" argument to be a positive number, but it was: "+n+".")}function mi(t){switch(t){case 1:return"first";case 2:return"second";case 3:return"third";default:return t+"th"}}function wi(t,e){return t+" "+e+(1===t?"":"s")}var bi=(Ii.k=function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length,n="";n.length<20;)for(var r=function(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}(40),i=0;i<r.length;++i)n.length<20&&r[i]<e&&(n+=t.charAt(r[i]%t.length));return n},Ii);function Ii(){}function Ei(t,e){return t<e?-1:e<t?1:0}function Ti(t,n,r){return t.length===n.length&&t.every(function(t,e){return r(t,n[e])})}function _i(t){return t+"\0"}var Ai=(Ni.fromBase64String=function(t){return new Ni(atob(t))},Ni.fromUint8Array=function(t){return new Ni(function(t){for(var e="",n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t))},Ni.prototype.toBase64=function(){return t=this.M,btoa(t);var t},Ni.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.M)},Ni.prototype.O=function(){return 2*this.M.length},Ni.prototype.L=function(t){return Ei(this.M,t.M)},Ni.prototype.isEqual=function(t){return this.M===t.M},Ni);function Ni(t){this.M=t}Ai.B=new Ai("");var Si=(Di.fromBase64String=function(t){try{return new Di(Ai.fromBase64String(t))}catch(t){throw new Rr(Or.INVALID_ARGUMENT,"Failed to construct Bytes from Base64 string: "+t)}},Di.fromUint8Array=function(t){return new Di(Ai.fromUint8Array(t))},Di.prototype.toBase64=function(){return this.q.toBase64()},Di.prototype.toUint8Array=function(){return this.q.toUint8Array()},Di.prototype.toString=function(){return"Bytes(base64: "+this.toBase64()+")"},Di.prototype.isEqual=function(t){return this.q.isEqual(t.q)},Di);function Di(t){this.q=t}function xi(){if("undefined"==typeof Uint8Array)throw new Rr(Or.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function Oi(){if("undefined"==typeof atob)throw new Rr(Or.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}function Ri(t,e,n,r,i){this.U=t,this.persistenceKey=e,this.host=n,this.ssl=r,this.forceLongPolling=i}var ki,Li=(o(Gi,ki=Si),Gi.fromBase64String=function(t){ni("Blob.fromBase64String",arguments,1),oi("Blob.fromBase64String","string",1,t),Oi();try{return new Gi(Ai.fromBase64String(t))}catch(t){throw new Rr(Or.INVALID_ARGUMENT,"Failed to construct Blob from Base64 string: "+t)}},Gi.fromUint8Array=function(t){if(ni("Blob.fromUint8Array",arguments,1),xi(),!(t instanceof Uint8Array))throw yi("Blob.fromUint8Array","Uint8Array",1,t);return new Gi(Ai.fromUint8Array(t))},Gi.prototype.toBase64=function(){return ni("Blob.toBase64",arguments,0),Oi(),ki.prototype.toBase64.call(this)},Gi.prototype.toUint8Array=function(){return ni("Blob.toUint8Array",arguments,0),xi(),ki.prototype.toUint8Array.call(this)},Gi.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},Gi),Ci=(Object.defineProperty(ji.prototype,"W",{get:function(){return"(default)"===this.database},enumerable:!1,configurable:!0}),ji.prototype.isEqual=function(t){return t instanceof ji&&t.projectId===this.projectId&&t.database===this.database},ji.prototype.L=function(t){return Ei(this.projectId,t.projectId)||Ei(this.database,t.database)},ji),Pi=(qi.prototype.get=function(t){var e=this.j(t),n=this.G[e];if(void 0!==n)for(var r=0,i=n;r<i.length;r++){var o=i[r],s=o[0],u=o[1];if(this.K(s,t))return u}},qi.prototype.has=function(t){return void 0!==this.get(t)},qi.prototype.set=function(t,e){var n=this.j(t),r=this.G[n];if(void 0!==r){for(var i=0;i<r.length;i++)if(this.K(r[i][0],t))return void(r[i]=[t,e]);r.push([t,e])}else this.G[n]=[[t,e]]},qi.prototype.delete=function(t){var e=this.j(t),n=this.G[e];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(this.K(n[r][0],t))return 1===n.length?delete this.G[e]:n.splice(r,1),!0;return!1},qi.prototype.forEach=function(u){Gr(this.G,function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],s=i[1];u(o,s)}})},qi.prototype.m=function(){return Br(this.G)},qi),Ui=(Fi.now=function(){return Fi.fromMillis(Date.now())},Fi.fromDate=function(t){return Fi.fromMillis(t.getTime())},Fi.fromMillis=function(t){var e=Math.floor(t/1e3);return new Fi(e,1e6*(t-1e3*e))},Fi.prototype.toDate=function(){return new Date(this.toMillis())},Fi.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},Fi.prototype.H=function(t){return this.seconds===t.seconds?Ei(this.nanoseconds,t.nanoseconds):Ei(this.seconds,t.seconds)},Fi.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},Fi.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},Fi.prototype.toJSON=function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}},Fi.prototype.valueOf=function(){var t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}
1,Fi),Vi=(Mi.Y=function(t){return new Mi(t)},Mi.min=function(){return new Mi(new Ui(0,0))},Mi.prototype.L=function(t){return this.timestamp.H(t.timestamp)},Mi.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},Mi.prototype.J=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},Mi.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},Mi.prototype.X=function(){return this.timestamp},Mi);function Mi(t){this.timestamp=t}function Fi(t,e){if(this.seconds=t,(this.nanoseconds=e)<0)throw new Rr(Or.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(1e9<=e)throw new Rr(Or.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Rr(Or.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(253402300800<=t)throw new Rr(Or.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}function qi(t,e){this.j=t,this.K=e,this.G={}}function ji(t,e){this.projectId=t,this.database=e||"(default)"}function Gi(){return null!==ki&&ki.apply(this,arguments)||this}function Bi(t){return null==t}function zi(t){return 0===t&&1/t==-1/0}function Hi(t){return"number"==typeof t&&Number.isInteger(t)&&!zi(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}var Qi=function(t,e,n,r,i,o,s){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===s&&(s=null),this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=o,this.endAt=s,this.Z=null};function Ki(t,e,n,r,i,o,s){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===s&&(s=null),new Qi(t,e,n,r,i,o,s)}function Wi(t){var e,n=t;return null===n.Z&&(e=n.path.R(),null!==n.collectionGroup&&(e+="|cg:"+n.collectionGroup),e+="|f:",e+=n.filters.map(function(t){return(e=t).field.R()+e.op.toString()+Yo(e.value);var e}).join(","),e+="|ob:",e+=n.orderBy.map(function(t){return(e=t).field.R()+e.dir;var e}).join(","),Bi(n.limit)||(e+="|l:",e+=n.limit),n.startAt&&(e+="|lb:",e+=xa(n.startAt)),n.endAt&&(e+="|ub:",e+=xa(n.endAt)),n.Z=e),n.Z}function Yi(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(var n,r,i=0;i<t.orderBy.length;i++)if(n=t.orderBy[i],r=e.orderBy[i],n.dir!==r.dir||!n.field.isEqual(r.field))return!1;if(t.filters.length!==e.filters.length)return!1;for(var o,s,u=0;u<t.filters.length;u++)if(o=t.filters[u],s=e.filters[u],o.op!==s.op||!o.field.isEqual(s.field)||!Ho(o.value,s.value))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!Ra(t.startAt,e.startAt)&&Ra(t.endAt,e.endAt)}function Xi(t){return Xr.F(t.path)&&null===t.collectionGroup&&0===t.filters.length}function $i(t){this.count=t}var Ji,Zi,to=(eo.prototype.nt=function(t){return new eo(this.target,this.targetId,this.tt,t,this.et,this.lastLimboFreeSnapshotVersion,this.resumeToken)},eo.prototype.st=function(t,e){return new eo(this.target,this.targetId,this.tt,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)},eo.prototype.it=function(t){return new eo(this.target,this.targetId,this.tt,this.sequenceNumber,this.et,t,this.resumeToken)},eo);function eo(t,e,n,r,i,o,s){void 0===i&&(i=Vi.min()),void 0===o&&(o=Vi.min()),void 0===s&&(s=Ai.B),this.target=t,this.targetId=e,this.tt=n,this.sequenceNumber=r,this.et=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=s}function no(t){switch(t){case Or.OK:return Fr(),0;case Or.CANCELLED:case Or.UNKNOWN:case Or.DEADLINE_EXCEEDED:case Or.RESOURCE_EXHAUSTED:case Or.INTERNAL:case Or.UNAVAILABLE:case Or.UNAUTHENTICATED:return;case Or.INVALID_ARGUMENT:case Or.NOT_FOUND:case Or.ALREADY_EXISTS:case Or.PERMISSION_DENIED:case Or.FAILED_PRECONDITION:case Or.ABORTED:case Or.OUT_OF_RANGE:case Or.UNIMPLEMENTED:case Or.DATA_LOSS:return 1;default:return Fr(),0}}function ro(t){if(void 0===t)return Ur("GRPC error has no .code"),Or.UNKNOWN;switch(t){case Ji.OK:return Or.OK;case Ji.CANCELLED:return Or.CANCELLED;case Ji.UNKNOWN:return Or.UNKNOWN;case Ji.DEADLINE_EXCEEDED:return Or.DEADLINE_EXCEEDED;case Ji.RESOURCE_EXHAUSTED:return Or.RESOURCE_EXHAUSTED;case Ji.INTERNAL:return Or.INTERNAL;case Ji.UNAVAILABLE:return Or.UNAVAILABLE;case Ji.UNAUTHENTICATED:return Or.UNAUTHENTICATED;case Ji.INVALID_ARGUMENT:return Or.INVALID_ARGUMENT;case Ji.NOT_FOUND:return Or.NOT_FOUND;case Ji.ALREADY_EXISTS:return Or.ALREADY_EXISTS;case Ji.PERMISSION_DENIED:return Or.PERMISSION_DENIED;case Ji.FAILED_PRECONDITION:return Or.FAILED_PRECONDITION;case Ji.ABORTED:return Or.ABORTED;case Ji.OUT_OF_RANGE:return Or.OUT_OF_RANGE;
1case Ji.UNIMPLEMENTED:return Or.UNIMPLEMENTED;case Ji.DATA_LOSS:return Or.DATA_LOSS;default:return Fr()}}(Zi=Ji=Ji||{})[Zi.OK=0]="OK",Zi[Zi.CANCELLED=1]="CANCELLED",Zi[Zi.UNKNOWN=2]="UNKNOWN",Zi[Zi.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Zi[Zi.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Zi[Zi.NOT_FOUND=5]="NOT_FOUND",Zi[Zi.ALREADY_EXISTS=6]="ALREADY_EXISTS",Zi[Zi.PERMISSION_DENIED=7]="PERMISSION_DENIED",Zi[Zi.UNAUTHENTICATED=16]="UNAUTHENTICATED",Zi[Zi.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Zi[Zi.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Zi[Zi.ABORTED=10]="ABORTED",Zi[Zi.OUT_OF_RANGE=11]="OUT_OF_RANGE",Zi[Zi.UNIMPLEMENTED=12]="UNIMPLEMENTED",Zi[Zi.INTERNAL=13]="INTERNAL",Zi[Zi.UNAVAILABLE=14]="UNAVAILABLE",Zi[Zi.DATA_LOSS=15]="DATA_LOSS";var io=(co.prototype.rt=function(t,e){return new co(this.i,this.root.rt(t,e,this.i).copy(null,null,so.ot,null,null))},co.prototype.remove=function(t){return new co(this.i,this.root.remove(t,this.i).copy(null,null,so.ot,null,null))},co.prototype.get=function(t){for(var e=this.root;!e.m();){var n=this.i(t,e.key);if(0===n)return e.value;n<0?e=e.left:0<n&&(e=e.right)}return null},co.prototype.indexOf=function(t){for(var e=0,n=this.root;!n.m();){var r=this.i(t,n.key);if(0===r)return e+n.left.size;n=r<0?n.left:(e+=n.left.size+1,n.right)}return-1},co.prototype.m=function(){return this.root.m()},Object.defineProperty(co.prototype,"size",{get:function(){return this.root.size},enumerable:!1,configurable:!0}),co.prototype.at=function(){return this.root.at()},co.prototype.ct=function(){return this.root.ct()},co.prototype.ut=function(t){return this.root.ut(t)},co.prototype.forEach=function(n){this.ut(function(t,e){return n(t,e),!1})},co.prototype.toString=function(){var n=[];return this.ut(function(t,e){return n.push(t+":"+e),!1}),"{"+n.join(", ")+"}"},co.prototype.ht=function(t){return this.root.ht(t)},co.prototype.lt=function(){return new oo(this.root,null,this.i,!1)},co.prototype._t=function(t){return new oo(this.root,t,this.i,!1)},co.prototype.ft=function(){return new oo(this.root,null,this.i,!0)},co.prototype.dt=function(t){return new oo(this.root,t,this.i,!0)},co),oo=(ao.prototype.Et=function(){var t=this.Tt.pop(),e={key:t.key,value:t.value};if(this.wt)for(t=t.left;!t.m();)this.Tt.push(t),t=t.right;else for(t=t.right;!t.m();)this.Tt.push(t),t=t.left;return e},ao.prototype.It=function(){return 0<this.Tt.length},ao.prototype.At=function(){if(0===this.Tt.length)return null;var t=this.Tt[this.Tt.length-1];return{key:t.key,value:t.value}},ao),so=(uo.prototype.copy=function(t,e,n,r,i){return new uo(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)},uo.prototype.m=function(){return!1},uo.prototype.ut=function(t){return this.left.ut(t)||t(this.key,this.value)||this.right.ut(t)},uo.prototype.ht=function(t){return this.right.ht(t)||t(this.key,this.value)||this.left.ht(t)},uo.prototype.min=function(){return this.left.m()?this:this.left.min()},uo.prototype.at=function(){return this.min().key},uo.prototype.ct=function(){return this.right.m()?this.key:this.right.ct()},uo.prototype.rt=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.copy(null,null,null,r.left.rt(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.rt(t,e,n))).Rt()},uo.prototype.Pt=function(){if(this.left.m())return uo.EMPTY;var t=this;return t.left.gt()||t.left.left.gt()||(t=t.yt()),(t=t.copy(null,null,null,t.left.Pt(),null)).Rt()},uo.prototype.remove=function(t,e){var n,r=this;if(e(t,r.key)<0)r.left.m()||r.left.gt()||r.left.left.gt()||(r=r.yt()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.gt()&&(r=r.Vt()),r.right.m()||r.right.gt()||r.right.left.gt()||(r=r.bt()),0===e(t,r.key)){if(r.right.m())return uo.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.Pt())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.Rt()},uo.prototype.gt=function(){return this.color},uo.prototype.Rt=function(){var t=this;return t.right.gt()&&!t.left.gt()&&(t=t.vt()),t.left.gt()&&t.left.left.gt()&&(t=t.Vt()),t.left.gt()&&t.right.gt()&&(t=t.St()),t},uo.prototype.yt=function(){var t=this.St();return t.right.left.gt()&&(t=(t=(t=t.copy(null,null,null,null,t.right.Vt())).vt()).St()),t},uo.prototype.bt=function(){var t=this.St();return t.left.left.gt()&&(t=(t=t.Vt()).St()),t},uo.prototype.vt=function(){var t=this.copy(null,null,uo.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},uo.prototype.Vt=function(){var t=this.copy(null,null,uo.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},uo.prototype.St=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)},uo.prototype.Dt=function(){var t=this.Ct();return Math.pow(2,t)<=this.size+1},uo.prototype.Ct=function(){if(this.gt()&&this.left.gt())throw Fr();if(this.right.gt())throw Fr();var t=this.left.Ct();if(t!==this.right.Ct())throw Fr();return t+(this.gt()?0:1)},uo);function uo(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:uo.RED,this.left=null!=r?r:uo.EMPTY,this.right=null!=i?i:uo.EMPTY,this.size=this.left.size+1+this.right.size}function ao(t,e,n,r){this.wt=r,this.Tt=[];for(var i=1;!t.m();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.wt?t.left:t.right;else{if(0===i){this.Tt.push(t);break}this.Tt.push(t),t=this.wt?t.right:t.left}}function co(t,e){this.i=t,this.root=e||so.EMPTY}function ho(){this.size=0}so.EMPTY=null,so.RED=!0,so.ot=!1,so.EMPTY=(Object.defineProperty(ho.prototype,"key",{get:function(){throw Fr()}
1,enumerable:!1,configurable:!0}),Object.defineProperty(ho.prototype,"value",{get:function(){throw Fr()},enumerable:!1,configurable:!0}),Object.defineProperty(ho.prototype,"color",{get:function(){throw Fr()},enumerable:!1,configurable:!0}),Object.defineProperty(ho.prototype,"left",{get:function(){throw Fr()},enumerable:!1,configurable:!0}),Object.defineProperty(ho.prototype,"right",{get:function(){throw Fr()},enumerable:!1,configurable:!0}),ho.prototype.copy=function(t,e,n,r,i){return this},ho.prototype.rt=function(t,e,n){return new so(t,e)},ho.prototype.remove=function(t,e){return this},ho.prototype.m=function(){return!0},ho.prototype.ut=function(t){return!1},ho.prototype.ht=function(t){return!1},ho.prototype.at=function(){return null},ho.prototype.ct=function(){return null},ho.prototype.gt=function(){return!1},ho.prototype.Dt=function(){return!0},ho.prototype.Ct=function(){return 0},new ho);var fo=(yo.prototype.has=function(t){return null!==this.data.get(t)},yo.prototype.first=function(){return this.data.at()},yo.prototype.last=function(){return this.data.ct()},Object.defineProperty(yo.prototype,"size",{get:function(){return this.data.size},enumerable:!1,configurable:!0}),yo.prototype.indexOf=function(t){return this.data.indexOf(t)},yo.prototype.forEach=function(n){this.data.ut(function(t,e){return n(t),!1})},yo.prototype.Nt=function(t,e){for(var n=this.data._t(t[0]);n.It();){var r=n.Et();if(0<=this.i(r.key,t[1]))return;e(r.key)}},yo.prototype.Ft=function(t,e){for(var n=void 0!==e?this.data._t(e):this.data.lt();n.It();)if(!t(n.Et().key))return},yo.prototype.xt=function(t){var e=this.data._t(t);return e.It()?e.Et().key:null},yo.prototype.lt=function(){return new lo(this.data.lt())},yo.prototype._t=function(t){return new lo(this.data._t(t))},yo.prototype.add=function(t){return this.copy(this.data.remove(t).rt(t,!0))},yo.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},yo.prototype.m=function(){return this.data.m()},yo.prototype.$t=function(t){var e=this;return e.size<t.size&&(e=t,t=this),t.forEach(function(t){e=e.add(t)}),e},yo.prototype.isEqual=function(t){if(!(t instanceof yo))return!1;if(this.size!==t.size)return!1;for(var e=this.data.lt(),n=t.data.lt();e.It();){var r=e.Et().key,i=n.Et().key;if(0!==this.i(r,i))return!1}return!0},yo.prototype.A=function(){var e=[];return this.forEach(function(t){e.push(t)}),e},yo.prototype.toString=function(){var e=[];return this.forEach(function(t){return e.push(t)}),"SortedSet("+e.toString()+")"},yo.prototype.copy=function(t){var e=new yo(this.i);return e.data=t,e},yo),lo=(vo.prototype.Et=function(){return this.kt.Et().key},vo.prototype.It=function(){return this.kt.It()},vo),po=new io(Xr.i);function vo(t){this.kt=t}function yo(t){this.i=t,this.data=new io(this.i)}var go=new io(Xr.i);var mo=new io(Xr.i),wo=new fo(Xr.i);function bo(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=wo,r=0,i=t;r<i.length;r++)var o=i[r],n=n.add(o);return n}var Io=new fo(Ei);var Eo=(Mo.Lt=function(t){return new Mo(t.i)},Mo.prototype.has=function(t){return null!=this.Mt.get(t)},Mo.prototype.get=function(t){return this.Mt.get(t)},Mo.prototype.first=function(){return this.Ot.at()},Mo.prototype.last=function(){return this.Ot.ct()},Mo.prototype.m=function(){return this.Ot.m()},Mo.prototype.indexOf=function(t){var e=this.Mt.get(t);return e?this.Ot.indexOf(e):-1},Object.defineProperty(Mo.prototype,"size",{get:function(){return this.Ot.size},enumerable:!1,configurable:!0}),Mo.prototype.forEach=function(n){this.Ot.ut(function(t,e){return n(t),!1})},Mo.prototype.add=function(t){var e=this.delete(t.key);return e.copy(e.Mt.rt(t.key,t),e.Ot.rt(t,null))},Mo.prototype.delete=function(t){var e=this.get(t);return e?this.copy(this.Mt.remove(t),this.Ot.remove(e)):this},Mo.prototype.isEqual=function(t){if(!(t instanceof Mo))return!1;if(this.size!==t.size)return!1;for(var e=this.Ot.lt(),n=t.Ot.lt();e.It();){var r=e.Et().key,i=n.Et().key;if(!r.isEqual(i))return!1}return!0},Mo.prototype.toString=function(){var e=[];return this.forEach(function(t){e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"},Mo.prototype.copy=function(t,e){var n=new Mo;return n.i=this.i,n.Mt=t,n.Ot=e,n},Mo),To=(Vo.prototype.track=function(t){var e=t.doc.key,n=this.Bt.get(e);!n||0!==t.type&&3===n.type?this.Bt=this.Bt.rt(e,t):3===t.type&&1!==n.type?this.Bt=this.Bt.rt(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.Bt=this.Bt.rt(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.Bt=this.Bt.rt(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.Bt=this.Bt.remove(e):1===t.type&&2===n.type?this.Bt=this.Bt.rt(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.Bt=this.Bt.rt(e,{type:2,doc:t.doc}
1):Fr()},Vo.prototype.qt=function(){var n=[];return this.Bt.ut(function(t,e){n.push(e)}),n},Vo),_o=(Uo.Kt=function(t,e,n,r){var i=[];return e.forEach(function(t){i.push({type:0,doc:t})}),new Uo(t,e,Eo.Lt(e),i,n,r,!0,!1)},Object.defineProperty(Uo.prototype,"hasPendingWrites",{get:function(){return!this.Qt.m()},enumerable:!1,configurable:!0}),Uo.prototype.isEqual=function(t){if(!(this.fromCache===t.fromCache&&this.Wt===t.Wt&&this.Qt.isEqual(t.Qt)&&Ju(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.Ut.isEqual(t.Ut)))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},Uo),Ao=(Po.Jt=function(t,e){var n=new Map;return n.set(t,No.Xt(t,e)),new Po(Vi.min(),n,Io,po,bo())},Po),No=(Co.Xt=function(t,e){return new Co(Ai.B,e,bo(),bo(),bo())},Co),So=function(t,e,n,r){this.se=t,this.removedTargetIds=e,this.key=n,this.ie=r},Do=function(t,e){this.targetId=t,this.re=e},xo=function(t,e,n,r){void 0===n&&(n=Ai.B),void 0===r&&(r=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r},Oo=(Object.defineProperty(Lo.prototype,"Zt",{get:function(){return this.ue},enumerable:!1,configurable:!0}),Object.defineProperty(Lo.prototype,"resumeToken",{get:function(){return this.ce},enumerable:!1,configurable:!0}),Object.defineProperty(Lo.prototype,"le",{get:function(){return 0!==this.oe},enumerable:!1,configurable:!0}),Object.defineProperty(Lo.prototype,"_e",{get:function(){return this.he},enumerable:!1,configurable:!0}),Lo.prototype.fe=function(t){0<t.O()&&(this.he=!0,this.ce=t)},Lo.prototype.de=function(){var n=bo(),r=bo(),i=bo();return this.ae.forEach(function(t,e){switch(e){case 0:n=n.add(t);break;case 2:r=r.add(t);break;case 1:i=i.add(t);break;default:Fr()}}),new No(this.ce,this.ue,n,r,i)},Lo.prototype.we=function(){this.he=!1,this.ae=qo()},Lo.prototype.me=function(t,e){this.he=!0,this.ae=this.ae.rt(t,e)},Lo.prototype.Te=function(t){this.he=!0,this.ae=this.ae.remove(t)},Lo.prototype.Ee=function(){this.oe+=1},Lo.prototype.Ie=function(){--this.oe},Lo.prototype.Ae=function(){this.he=!0,this.ue=!0},Lo),Ro=(ko.prototype.pe=function(t){for(var e=0,n=t.se;e<n.length;e++){var r=n[e];t.ie instanceof Lu?this.be(r,t.ie):t.ie instanceof Cu&&this.ve(r,t.key,t.ie)}for(var i=0,o=t.removedTargetIds;i<o.length;i++){var s=o[i];this.ve(s,t.key,t.ie)}},ko.prototype.Se=function(n){var r=this;this.De(n,function(t){var e=r.Ce(t);switch(n.state){case 0:r.Ne(t)&&e.fe(n.resumeToken);break;case 1:e.Ie(),e.le||e.we(),e.fe(n.resumeToken);break;case 2:e.Ie(),e.le||r.removeTarget(t);break;case 3:r.Ne(t)&&(e.Ae(),e.fe(n.resumeToken));break;case 4:r.Ne(t)&&(r.Fe(t),e.fe(n.resumeToken));break;default:Fr()}})},ko.prototype.De=function(t,n){var r=this;0<t.targetIds.length?t.targetIds.forEach(n):this.Pe.forEach(function(t,e){r.Ne(e)&&n(e)})},ko.prototype.xe=function(t){var e,n,r=t.targetId,i=t.re.count,o=this.$e(r);o&&(Xi(e=o.target)?0===i?(n=new Xr(e.path),this.ve(r,n,new Cu(n,Vi.min()))):qr(1===i):this.ke(r)!==i&&(this.Fe(r),this.Ve=this.Ve.add(r)))},ko.prototype.Me=function(i){var o=this,s=new Map;this.Pe.forEach(function(t,e){var n,r=o.$e(e);r&&(t.Zt&&Xi(r.target)&&(n=new Xr(r.target.path),null!==o.ge.get(n)||o.Oe(e,n)||o.ve(e,n,new Cu(n,i))),t._e&&(s.set(e,t.de()),t.we()))});var r=bo();this.ye.forEach(function(t,e){var n=!0;e.Ft(function(t){var e=o.$e(t);return!e||2===e.tt||(n=!1)}),n&&(r=r.add(t))});var t=new Ao(i,s,this.Ve,this.ge,r);return this.ge=po,this.ye=Fo(),this.Ve=new fo(Ei),t},ko.prototype.be=function(t,e){var n;this.Ne(t)&&(n=this.Oe(t,e.key)?2:0,this.Ce(t).me(e.key,n),this.ge=this.ge.rt(e.key,e),this.ye=this.ye.rt(e.key,this.Le(e.key).add(t)))},ko.prototype.ve=function(t,e,n){var r;this.Ne(t)&&(r=this.Ce(t),this.Oe(t,e)?r.me(e,1):r.Te(e),this.ye=this.ye.rt(e,this.Le(e).delete(t)),n&&(this.ge=this.ge.rt(e,n)))},ko.prototype.removeTarget=function(t){this.Pe.delete(t)},ko.prototype.ke=function(t){var e=this.Ce(t).de();return this.Re.Be(t).size+e.te.size-e.ne.size},ko.prototype.Ee=function(t){this.Ce(t).Ee()},ko.prototype.Ce=function(t){var e=this.Pe.get(t);return e||(e=new Oo,this.Pe.set(t,e)),e},ko.prototype.Le=function(t){var e=this.ye.get(t);return e||(e=new fo(Ei),this.ye=this.ye.rt(t,e)),e},ko.prototype.Ne=function(t){var e=null!==this.$e(t);return e||Pr("WatchChangeAggregator","Detected inactive target",t),e},ko.prototype.$e=function(t){var e=this.Pe.get(t);return e&&e.le?null:this.Re.qe(t)},ko.prototype.Fe=function(e){var n=this;this.Pe.set(e,new Oo),this.Re.Be(e).forEach(function(t){n.ve(e,t,null)})},ko.prototype.Oe=function(t,e){return this.Re.Be(t).has(e)},ko);function ko(t){this.Re=t,this.Pe=new Map,this.ge=po,this.ye=Fo(),this.Ve=new fo(Ei)}function Lo(){this.oe=0,this.ae=qo(),this.ce=Ai.B,this.ue=!1,this.he=!0}function Co(t,e,n,r,i){this.resumeToken=t,this.Zt=e,this.te=n,this.ee=r,this.ne=i}
1function Po(t,e,n,r,i){this.et=t,this.Gt=e,this.zt=n,this.Ht=r,this.Yt=i}function Uo(t,e,n,r,i,o,s,u){this.query=t,this.docs=e,this.Ut=n,this.docChanges=r,this.Qt=i,this.fromCache=o,this.Wt=s,this.jt=u}function Vo(){this.Bt=new io(Xr.i)}function Mo(n){this.i=n?function(t,e){return n(t,e)||Xr.i(t.key,e.key)}:function(t,e){return Xr.i(t.key,e.key)},this.Mt=go,this.Ot=new io(this.i)}function Fo(){return new io(Xr.i)}function qo(){return new io(Xr.i)}function jo(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 Go(t){var e=Xo(t.mapValue.fields.__local_write_time__.timestampValue);return new Ui(e.seconds,e.nanos)}var Bo=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function zo(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?jo(t)?4:10:Fr()}function Ho(r,i){var t,e,n,o=zo(r);if(o!==zo(i))return!1;switch(o){case 0:return!0;case 1:return r.booleanValue===i.booleanValue;case 4:return Go(r).isEqual(Go(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=Xo(r.timestampValue),n=Xo(t.timestampValue);return e.seconds===n.seconds&&e.nanos===n.nanos}(i);case 5:return r.stringValue===i.stringValue;case 6:return n=i,Jo(r.bytesValue).isEqual(Jo(n.bytesValue));case 7:return r.referenceValue===i.referenceValue;case 8:return e=i,$o((t=r).geoPointValue.latitude)===$o(e.geoPointValue.latitude)&&$o(t.geoPointValue.longitude)===$o(e.geoPointValue.longitude);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return $o(t.integerValue)===$o(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){var n=$o(t.doubleValue),r=$o(e.doubleValue);return n===r?zi(n)===zi(r):isNaN(n)&&isNaN(r)}return!1}(r,i);case 9:return Ti(r.arrayValue.values||[],i.arrayValue.values||[],Ho);case 10:return function(){var t,e=r.mapValue.fields||{},n=i.mapValue.fields||{};if(jr(e)!==jr(n))return!1;for(t in e)if(e.hasOwnProperty(t)&&(void 0===n[t]||!Ho(e[t],n[t])))return!1;return!0}();default:return Fr()}}function Qo(t,e){return void 0!==(t.values||[]).find(function(t){return Ho(t,e)})}function Ko(t,e){var n,r,i,o,s,u,a,c,h,f,l=zo(t),p=zo(e);if(l!==p)return Ei(l,p);switch(l){case 0:return 0;case 1:return Ei(t.booleanValue,e.booleanValue);case 2:return c=e,h=$o(t.integerValue||t.doubleValue),f=$o(c.integerValue||c.doubleValue),h<f?-1:f<h?1:h===f?0:isNaN(h)?isNaN(f)?0:-1:1;case 3:return Wo(t.timestampValue,e.timestampValue);case 4:return Wo(Go(t),Go(e));case 5:return Ei(t.stringValue,e.stringValue);case 6:return o=t.bytesValue,s=e.bytesValue,u=Jo(o),a=Jo(s),u.L(a);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=Ei(n[i],r[i]);if(0!==o)return o}return Ei(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return n=t.geoPointValue,r=e.geoPointValue,0!==(i=Ei($o(n.latitude),$o(r.latitude)))?i:Ei($o(n.longitude),$o(r.longitude));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=Ko(n[i],r[i]);if(o)return o}return Ei(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 s=0;s<r.length&&s<o.length;++s){var u=Ei(r[s],o[s]);if(0!==u)return u;var a=Ko(n[r[s]],i[o[s]]);if(0!==a)return a}return Ei(r.length,o.length)}(t.mapValue,e.mapValue);default:throw Fr()}}function Wo(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Ei(t,e);var n=Xo(t),r=Xo(e),i=Ei(n.seconds,r.seconds);return 0!==i?i:Ei(n.nanos,r.nanos)}function Yo(t){return function s(i){return"nullValue"in i?"null":"booleanValue"in i?""+i.booleanValue:"integerValue"in i?""+i.integerValue:"doubleValue"in i?""+i.doubleValue:"timestampValue"in i?"time("+(t=Xo(i.timestampValue)).seconds+","+t.nanos+")":"stringValue"in i?i.stringValue:"bytesValue"in i?Jo(i.bytesValue).toBase64():"referenceValue"in i?(n=i.referenceValue,Xr.C(n).toString()):"geoPointValue"in i?"geo("+(e=i.geoPointValue).latitude+","+e.longitude+")":"arrayValue"in i?function(){for(var t="[",e=!0,n=0,r=i.arrayValue.values||[];n<r.length;n++){e?e=!1:t+=",",t+=s(r[n])}return t+"]"}():"mapValue"in i?function(t){for(var e="{",n=!0,r=0,i=Object.keys(t.fields||{}).sort();r<i.length;r++){var o=i[r];n?n=!1:e+=",",e+=o+":"+s(t.fields[o])}return e+"}"}(i.mapValue):Fr();var t,e,n}(t)}function Xo(t){if(qr(!!t),"string"!=typeof t)return{seconds:$o(t.seconds),nanos:$o(t.nanos)};var e,n=0,r=Bo.exec(t);qr(!!r),r[1]&&(e=((e=r[1])+"000000000").substr(0,9),n=Number(e));var i=new Date(t);return{seconds:Math.floor(i.getTime()/1e3),nanos:n}}function $o(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function Jo(t){return"string"==typeof t?Ai.fromBase64String(t):Ai.fromUint8Array(t)}function Zo(t,e){return{referenceValue:"projects/"+t.projectId+"/databases/"+t.database+"/documents/"+e.path.R()}}function ts(t){return t&&"integerValue"in t}function es(t){return!!t&&"arrayValue"in t}function ns(t){return t&&"nullValue"in t}function rs(t){return t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function is(t){return t&&"mapValue"in t}var os={asc:"ASCENDING",desc:"DESCENDING"},ss={"<":"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"},us=function(t,e){this.U=t,this.Ue=e};function as(t){return{integerValue:""+t}}function cs(t,e){if(t.Ue){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:zi(e)?"-0":e}}function hs(t,e){return Hi(e)?as(e):cs(t,e)}function fs(t,e){return t.Ue?new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+e.nanoseconds).slice(-9)+"Z":{seconds:""+e.seconds,nanos:e.nanoseconds}}function ls(t,e){return t.Ue?e.toBase64():e.toUint8Array()}function ps(t){return qr(!!t),Vi.Y((e=Xo(t),new Ui(e.seconds,e.nanos)));var e}function ds(t,e){return new Kr(["projects",t.projectId,"databases",t.database]).child("documents").child(e).R()}function vs(t){var e=Kr.P(t);return qr(Rs(e)),e}function ys(t,e){return ds(t.U,e.path)}function gs(t,e){var n=vs(e);return qr(n.get(1)===t.U.projectId),qr(!n.get(3)&&!t.U.database||n.get(3)===t.U.database),new Xr(Is(n))}function ms(t,e){return ds(t.U,e)}function ws(t){var e=vs(t);return 4===e.length?Kr.g():Is(e)}function bs(t){return new Kr(["projects",t.U.projectId,"databases",t.U.database]).R()}function Is(t){return qr(4<t.length&&"documents"===t.get(4)),t.u(5)}function Es(t,e,n){return{name:ys(t,e),fields:n.proto.mapValue.fields}}function Ts(t,e){var n,r,i,o,s,u;if(e instanceof hu)n={update:Es(t,e.key,e.value)};else if(e instanceof Iu)n={delete:ys(t,e.key)};else if(e instanceof fu)n={update:Es(t,e.key,e.data),updateMask:(r=e.Qe,i=[],r.fields.forEach(function(t){return i.push(t.R())}),{fieldPaths:i})};else if(e instanceof yu)n={transform:{document:ys(t,e.key),fieldTransforms:e.fieldTransforms.map(function(t){var e=t.transform;if(e instanceof Us)return{fieldPath:t.field.R(),setToServerValue:"REQUEST_TIME"};if(e instanceof Vs)return{fieldPath:t.field.R(),appendMissingElements:{values:e.elements}};if(e instanceof Gs)return{fieldPath:t.field.R(),removeAllFromArray:{values:e.elements}};if(e instanceof Qs)return{fieldPath:t.field.R(),increment:e.We};throw Fr()})}};else{if(!(e instanceof Eu))return Fr();n={verify:ys(t,e.key)}}return e.Ke.je||(n.currentDocument=void 0!==(o=e.Ke).updateTime?{updateTime:(s=t,u=o.updateTime,fs(s,u.X()))}:void 0!==o.exists?{exists:o.exists}:Fr()),n}function _s(e,t){var n,r,i=t.currentDocument?void 0!==(n=t.currentDocument).updateTime?tu.updateTime(ps(n.updateTime)):void 0!==n.exists?tu.exists(n.exists):tu.Ge():tu.Ge();if(t.update){t.update.name;var o=gs(e,t.update.name),s=new Tu({mapValue:{fields:t.update.fields}});if(t.updateMask){var u=(r=t.updateMask.fieldPaths||[],new Xs(r.map(function(t){return Yr.S(t)})));return new fu(o,s,u,i)}return new hu(o,s,i)}if(t.delete){var a=gs(e,t.delete);return new Iu(a,i)}if(t.transform){var c=gs(e,t.transform.document),h=t.transform.fieldTransforms.map(function(t){return function(t,e){var n,r,i=null;"setToServerValue"in e?(qr("REQUEST_TIME"===e.setToServerValue),i=new Us):"appendMissingElements"in e?(n=e.appendMissingElements.values||[],i=new Vs(n)):"removeAllFromArray"in e?(r=e.removeAllFromArray.values||[],i=new Gs(r)):"increment"in e?i=new Qs(t,e.increment):Fr();var o=Yr.S(e.fieldPath);return new $s(o,i)}(e,t)});return qr(!0===i.exists),new yu(c,h)}if(t.verify){var f=gs(e,t.verify);return new Eu(f,i)}return Fr()}function As(t,e){return{documents:[ms(t,e.path)]}}function Ns(t,e){var n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=ms(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=ms(t,r.h()),n.structuredQuery.from=[{collectionId:r._()}]);var i=function(t){if(0!==t.length){var e=t.map(function(t){if("=="===t.op){if(rs(t.value))return{unaryFilter:{field:xs(t.field),op:"IS_NAN"}};if(ns(t.value))return{unaryFilter:{field:xs(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(rs(t.value))return{unaryFilter:{field:xs(t.field),op:"IS_NOT_NA
1N"}};if(ns(t.value))return{unaryFilter:{field:xs(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:xs(t.field),op:(e=t.op,ss[e]),value:t.value}};var e});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{field:xs((e=t).field),direction:(n=e.dir,os[n])};var e,n})}(e.orderBy);o&&(n.structuredQuery.orderBy=o);var s,u=(s=e.limit,t.Ue||Bi(s)?s:{value:s});return null!==u&&(n.structuredQuery.limit=u),e.startAt&&(n.structuredQuery.startAt=Ss(e.startAt)),e.endAt&&(n.structuredQuery.endAt=Ss(e.endAt)),n}function Ss(t){return{before:t.before,values:t.position}}function Ds(t){var e=!!t.before,n=t.values||[];return new _a(n,e)}function xs(t){return{fieldPath:t.R()}}function Os(t){return Yr.S(t.fieldPath)}function Rs(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)}function ks(){this.ze=void 0}function Ls(t,e){return t instanceof Qs?ts(n=e)||n&&"doubleValue"in n?e:{integerValue:0}:null;var n}var Cs,Ps,Us=(o(Fs,Ps=ks),Fs),Vs=(o(Ms,Cs=ks),Ms);function Ms(t){var e=this;return(e=Cs.call(this)||this).elements=t,e}function Fs(){return null!==Ps&&Ps.apply(this,arguments)||this}function qs(t,e){for(var n=Ys(e),r=0,i=t.elements;r<i.length;r++)!function(e){n.some(function(t){return Ho(t,e)})||n.push(e)}(i[r]);return{arrayValue:{values:n}}}var js,Gs=(o(Bs,js=ks),Bs);function Bs(t){var e=this;return(e=js.call(this)||this).elements=t,e}function zs(t,e){for(var n=Ys(e),r=0,i=t.elements;r<i.length;r++)!function(e){n=n.filter(function(t){return!Ho(t,e)})}(i[r]);return{arrayValue:{values:n}}}var Hs,Qs=(o(Ks,Hs=ks),Ks);function Ks(t,e){var n=this;return(n=Hs.call(this)||this).serializer=t,n.We=e,n}function Ws(t){return $o(t.integerValue||t.doubleValue)}function Ys(t){return es(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}var Xs=(Js.prototype.He=function(t){for(var e=0,n=this.fields;e<n.length;e++)if(n[e].T(t))return!0;return!1},Js.prototype.isEqual=function(t){return Ti(this.fields,t.fields,function(t,e){return t.isEqual(e)})},Js),$s=function(t,e){this.field=t,this.transform=e};function Js(t){(this.fields=t).sort(Yr.i)}function Zs(t,e){this.version=t,this.transformResults=e}var tu=(eu.Ge=function(){return new eu},eu.exists=function(t){return new eu(void 0,t)},eu.updateTime=function(t){return new eu(t)},Object.defineProperty(eu.prototype,"je",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!1,configurable:!0}),eu.prototype.isEqual=function(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)},eu);function eu(t,e){this.updateTime=t,this.exists=e}function nu(t,e){return void 0!==t.updateTime?e instanceof Lu&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e instanceof Lu}function ru(){}function iu(t,e,n){return t instanceof hu?new Lu(t.key,n.version,t.value,{hasCommittedMutations:!0}):t instanceof fu?function(t,e,n){if(!nu(t.Ke,e))return new Pu(t.key,n.version);var r=du(t,e);return new Lu(t.key,n.version,r,{hasCommittedMutations:!0})}(t,e,n):t instanceof yu?function(t,e,n){if(qr(null!=n.transformResults),!nu(t.Ke,e))return new Pu(t.key,n.version);var r=e,i=function(t,e,n){var r=[];qr(t.length===n.length);for(var i,o,s,u=0;u<n.length;u++){var a=t[u],c=a.transform,h=null;e instanceof Lu&&(h=e.field(a.field)),r.push((i=c,o=h,s=n[u],i instanceof Vs?qs(i,o):i instanceof Gs?zs(i,o):s))}return r}(t.fieldTransforms,e,n.transformResults),o=n.version,s=mu(t,r.data(),i);return new Lu(t.key,o,s,{hasCommittedMutations:!0})}(t,e,n):new Cu(t.key,n.version,{hasCommittedMutations:!0})}function ou(t,e,n,r){return t instanceof hu?function(t,e){if(!nu(t.Ke,e))return e;var n=uu(e);return new Lu(t.key,n,t.value,{Ye:!0})}(t,e):t instanceof fu?function(t,e){if(!nu(t.Ke,e))return e;var n=uu(e),r=du(t,e);return new Lu(t.key,n,r,{Ye:!0})}(t,e):t instanceof yu?function(t,e,n,r){if(!nu(t.Ke,e))return e;var i=e,o=function(t,e,n,r){for(var i,o,s,u,a,c,h,f=[],l=0,p=t;l<p.length;l++){var d=p[l],v=d.transform,y=null;n instanceof Lu&&(y=n.field(d.field)),null===y&&r instanceof Lu&&(y=r.field(d.field)),f.push((o=y,s=e,h=c=a=u=void 0,(i=v)instanceof Us?(h={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}},o&&(h.fields.__previous_value__=o),{mapValue:h}):i instanceof Vs?qs(i,o):i instanceof Gs?zs(i,o):(a=Ls(u=i,o),c=Ws(a)+Ws(u.We),ts(a)&&ts(u.We)?as(c):cs(u.serializer,c))))}return f}(t.fieldTransforms,n,e,r),s=mu(t,i.data(),o);return new Lu(t.key,i.version,s,{Ye:!0})}(t,e,r,n):(o=e,nu((i=t).Ke,o)?new Cu(i.key,Vi.min()):o);var i,o}function su(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.Ke.isEqual(e.Ke)&&(0===t.type?t.value.isEqual(e.value):1===t.type?t.data.isEqual(e.data)&&t.Qe.isEqual(e.Qe):2!==t.type||Ti(t.fieldTransforms,t.fieldTransforms,function(t,e){return r=e,(n=t).field.isEqual(r.field)&&(i=n.transform,o=r.transform,i instanceof Vs&&o instanceof Vs||i instanceof Gs&&o instanceof Gs?Ti(i.elements,o.elements,Ho):i instanceof Qs&&o instanceof Qs?Ho(i.We,o.We):i instanceof Us&&o instanceof Us);var n,r,i,o}))}function uu(t){return t instanceof Lu?t.version:Vi.min()}var au,cu,hu=(o(pu,cu=ru),pu),fu=(o(lu,au=ru),lu);function lu(t,e,n,r){var i=this;return(i=au.call(this)||this).key=t,i.data=e,i.Qe=n,i.Ke=r,i.type=1,i}function pu(t,e,n){var r=this;return(r=cu.call(this)||this).key=t,r.value=e,r.Ke=n,r.type=0,r}function du(t,e){return n=t,r=e instanceof Lu?e.data():Tu.empty(),i=new _u(r),n.Qe.fields.forEach(function(t){var e;t.m()||(null!==(e=n.data.field(t))?i.set(t,e):i.delete(t))}),i.Je();var n,r,i}var vu,yu=(o(gu,vu=ru),gu);function gu(t,e){var n=this;return(n=vu.call(this)||this).key=t,n.fieldTransforms=e,n.type=2,n.Ke=tu.exists(!0),n}function mu(t,e,n){for(var r=new _u(e),i=0;i<t.fieldTransforms.length;i++){var o=t.fieldTransforms[i];r.set(o.field,n[i])}return r.Je()}var wu,bu,Iu=(o(Du,bu=ru),Du),Eu=(o(Su,wu=ru),Su),Tu=(Nu.empty=function(){return new Nu({mapValue:{}})},Nu.prototype.field=function(t){if(t.m())return this.proto;for(var e=this.proto,n=0;n<t.length-1;++n){if(!e.mapValue.fields)return null;if(!is(e=e.mapValue.fields[t.get(n)]))return null}return(e=(e.mapValue.fields||{})[t._()])||null},Nu.prototype.isEqual=function(t){return Ho(this.proto,t.proto)},Nu),_u=(Au.prototype.set=function(t,e){return this.tn(t,e),this},Au.prototype.delete=function(t){return this.tn(t,null),this},Au.prototype.tn=function(t,e){for(var n=this.Ze,r=0;r<t.length-1;++r)var i=t.get(r),o=n.get(i),n=(o instanceof Map||(o=o&&10===zo(o)?new Map(Object.entries(o.mapValue.fields||{})):new Map,n.set(i,o)),o);n.set(t._(),e)},Au.prototype.Je=function(){var t=this.en(Yr.g(),this.Ze);return null!=t?new Tu(t):this.Xe},Au.prototype.en=function(r,t){var i=this,o=!1,e=this.Xe.field(r),s=is(e)?Object.assign({},e.mapValue.fields):{};return t.forEach(function(t,e){var n;t instanceof Map?null!=(n=i.en(r.child(e),t))&&(s[e]=n,o=!0):null!==t?(s[e]=t,o=!0):s.hasOwnProperty(e)&&(delete s[e],o=!0)}),o?{mapValue:{fields:s}}:null},Au);function Au(t){void 0===t&&(t=Tu.empty()),this.Xe=t,this.Ze=new Map}function Nu(t){this.proto=t}function Su(t,e){var n=this;return(n=wu.call(this)||this).key=t,n.Ke=e,n.type=4,n}function Du(t,e){var n=this;return(n=bu.call(this)||this).key=t,n.Ke=e,n.type=3,n}function xu(t,e){this.key=t,this.version=e}var Ou,Ru,ku,Lu=(o(Fu,ku=xu),Fu.prototype.field=function(t){return this.nn.field(t)},Fu.prototype.data=function(){return this.nn},Fu.prototype.sn=function(){return this.nn.proto},Fu.prototype.isEqual=function(t){return t instanceof Fu&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.Ye===t.Ye&&this.hasCommittedMutations===t.hasCommittedMutations&&this.nn.isEqual(t.
1nn)},Fu.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+this.nn.toString()+", {hasLocalMutations: "+this.Ye+"}), {hasCommittedMutations: "+this.hasCommittedMutations+"})"},Object.defineProperty(Fu.prototype,"hasPendingWrites",{get:function(){return this.Ye||this.hasCommittedMutations},enumerable:!1,configurable:!0}),Fu),Cu=(o(Mu,Ru=xu),Mu.prototype.toString=function(){return"NoDocument("+this.key+", "+this.version+")"},Object.defineProperty(Mu.prototype,"hasPendingWrites",{get:function(){return this.hasCommittedMutations},enumerable:!1,configurable:!0}),Mu.prototype.isEqual=function(t){return t instanceof Mu&&t.hasCommittedMutations===this.hasCommittedMutations&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},Mu),Pu=(o(Vu,Ou=xu),Vu.prototype.toString=function(){return"UnknownDocument("+this.key+", "+this.version+")"},Object.defineProperty(Vu.prototype,"hasPendingWrites",{get:function(){return!0},enumerable:!1,configurable:!0}),Vu.prototype.isEqual=function(t){return t instanceof Vu&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},Vu),Uu=function(t,e,n,r,i,o,s,u){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===s&&(s=null),void 0===u&&(u=null),this.path=t,this.collectionGroup=e,this.rn=n,this.filters=r,this.limit=i,this.on=o,this.startAt=s,this.endAt=u,this.an=null,this.cn=null,this.startAt,this.endAt};function Vu(){return null!==Ou&&Ou.apply(this,arguments)||this}function Mu(t,e,n){var r=this;return(r=Ru.call(this,t,e)||this).hasCommittedMutations=!(!n||!n.hasCommittedMutations),r}function Fu(t,e,n,r){var i=this;return(i=ku.call(this,t,e)||this).nn=n,i.Ye=!!r.Ye,i.hasCommittedMutations=!!r.hasCommittedMutations,i}function qu(t,e,n,r,i,o,s,u){return new Uu(t,e,n,r,i,o,s,u)}function ju(t){return new Uu(t)}function Gu(t){return!Bi(t.limit)&&"F"===t.on}function Bu(t){return!Bi(t.limit)&&"L"===t.on}function zu(t){return 0<t.rn.length?t.rn[0].field:null}function Hu(t){for(var e=0,n=t.filters;e<n.length;e++){var r=n[e];if(r.un())return r.field}return null}function Qu(t){return null!==t.collectionGroup}function Ku(t){var e=t;if(null===e.an){e.an=[];var n=Hu(e),r=zu(e);if(null!==n&&null===r)n.p()||e.an.push(new ka(n)),e.an.push(new ka(Yr.v(),"asc"));else{for(var i,o=!1,s=0,u=e.rn;s<u.length;s++){var a=u[s];e.an.push(a),a.field.p()&&(o=!0)}o||(i=0<e.rn.length?e.rn[e.rn.length-1].dir:"asc",e.an.push(new ka(Yr.v(),i)))}}return e.an}function Wu(t){var e=t;if(!e.cn)if("F"===e.on)e.cn=Ki(e.path,e.collectionGroup,Ku(e),e.filters,e.limit,e.startAt,e.endAt);else{for(var n=[],r=0,i=Ku(e);r<i.length;r++){var o=i[r],s="desc"===o.dir?"asc":"desc";n.push(new ka(o.field,s))}var u=e.endAt?new _a(e.endAt.position,!e.endAt.before):null,a=e.startAt?new _a(e.startAt.position,!e.startAt.before):null;e.cn=Ki(e.path,e.collectionGroup,n,e.filters,e.limit,u,a)}return e.cn}function Yu(t,e,n){return new Uu(t.path,t.collectionGroup,t.rn.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Xu(t,e){return new Uu(t.path,t.collectionGroup,t.rn.slice(),t.filters.slice(),t.limit,t.on,e,t.endAt)}function $u(t,e){return new Uu(t.path,t.collectionGroup,t.rn.slice(),t.filters.slice(),t.limit,t.on,t.startAt,e)}function Ju(t,e){return Yi(Wu(t),Wu(e))&&t.on===e.on}function Zu(t){return Wi(Wu(t))+"|lt:"+t.on}function ta(t){return"Query(target="+(e=Wu(t),n=e.path.R(),null!==e.collectionGroup&&(n+=" collectionGroup="+e.collectionGroup),0<e.filters.length&&(n+=", filters: ["+e.filters.map(function(t){return(e=t).field.R()+" "+e.op+" "+Yo(e.value);var e}).join(", ")+"]"),Bi(e.limit)||(n+=", limit: "+e.limit),0<e.orderBy.length&&(n+=", orderBy: ["+e.orderBy.map(function(t){return(e=t).field.R()+" ("+e.dir+")";var e}).join(", ")+"]"),e.startAt&&(n+=", startAt: "+xa(e.startAt)),e.endAt&&(n+=", endAt: "+xa(e.endAt)),"Target("+n+")")+"; limitType="+t.on+")";var e,n}function ea(i,t){return r=i,o=t.key.path,(null!==r.collectionGroup?t.key.N(r.collectionGroup)&&r.path.T(o):Xr.F(r.path)?r.path.isEqual(o):r.path.I(o))&&function(t){for(var e=0,n=i.rn;e<n.length;e++){var r=n[e];if(!r.field.p()&&null===t.field(r.field))return}return 1}(t)&&function(t){for(var e=0,n=i.filters;e<n.length;e++)if(!n[e].matches(t))return;return 1}(t)&&(n=t,(!(e=i).startAt||Oa(e.startAt,Ku(e),n))&&(!e.endAt||!Oa(e.endAt,Ku(e),n)));var e,n,r,o}function na(u){return function(t,e){for(var n=!1,r=0,i=Ku(u);r<i.length;r++){var o=i[r],s=function(t,i,e){var n=t.field.p()?Xr.i(i.key,e.key):function(t,e){var n=i.field(t),r=e.field(t);return null!==n&&null!==r?Ko(n,r):Fr()}(t.field,e);switch(t.dir){case"asc":return n;
1case"desc":return-1*n;default:return Fr()}}(o,t,e);if(0!==s)return s;n=n||o.field.p()}return 0}}var ra,ia=(o(oa,ra=function(){}),oa.create=function(t,e,n){if(t.p())return"in"===e||"not-in"===e?this.hn(t,e,n):new ca(t,e,n);if(ns(n)){if("=="!==e&&"!="!==e)throw new Rr(Or.INVALID_ARGUMENT,"Invalid query. Null only supports '==' and '!=' comparisons.");return new oa(t,e,n)}if(rs(n)){if("=="!==e&&"!="!==e)throw new Rr(Or.INVALID_ARGUMENT,"Invalid query. NaN only supports '==' and '!=' comparisons.");return new oa(t,e,n)}return"array-contains"===e?new ba(t,n):"in"===e?new Ia(t,n):"not-in"===e?new Ea(t,n):"array-contains-any"===e?new Ta(t,n):new oa(t,e,n)},oa.hn=function(t,e,n){return new("in"===e?ha:fa)(t,n)},oa.prototype.matches=function(t){var e=t.field(this.field);return"!="===this.op?null!==e&&this.ln(Ko(e,this.value)):null!==e&&zo(this.value)===zo(e)&&this.ln(Ko(e,this.value))},oa.prototype.ln=function(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return 0<t;case">=":return 0<=t;default:return Fr()}},oa.prototype.un=function(){return 0<=["<","<=",">",">=","!=","not-in"].indexOf(this.op)},oa);function oa(t,e,n){var r=this;return(r=ra.call(this)||this).field=t,r.op=e,r.value=n,r}var sa,ua,aa,ca=(o(da,aa=ia),da.prototype.matches=function(t){var e=Xr.i(t.key,this.key);return this.ln(e)},da),ha=(o(pa,ua=ia),pa.prototype.matches=function(e){return this.keys.some(function(t){return t.isEqual(e.key)})},pa),fa=(o(la,sa=ia),la.prototype.matches=function(e){return!this.keys.some(function(t){return t.isEqual(e.key)})},la);function la(t,e){var n=this;return(n=sa.call(this,t,"not-in",e)||this).keys=va(0,e),n}function pa(t,e){var n=this;return(n=ua.call(this,t,"in",e)||this).keys=va(0,e),n}function da(t,e,n){var r=this;return(r=aa.call(this,t,e,n)||this).key=Xr.C(n.referenceValue),r}function va(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map(function(t){return Xr.C(t.referenceValue)})}var ya,ga,ma,wa,ba=(o(Da,wa=ia),Da.prototype.matches=function(t){var e=t.field(this.field);return es(e)&&Qo(e.arrayValue,this.value)},Da),Ia=(o(Sa,ma=ia),Sa.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&Qo(this.value.arrayValue,e)},Sa),Ea=(o(Na,ga=ia),Na.prototype.matches=function(t){if(Qo(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;var e=t.field(this.field);return null!==e&&!Qo(this.value.arrayValue,e)},Na),Ta=(o(Aa,ya=ia),Aa.prototype.matches=function(t){var e=this,n=t.field(this.field);return!(!es(n)||!n.arrayValue.values)&&n.arrayValue.values.some(function(t){return Qo(e.value.arrayValue,t)})},Aa),_a=function(t,e){this.position=t,this.before=e};function Aa(t,e){return ya.call(this,t,"array-contains-any",e)||this}function Na(t,e){return ga.call(this,t,"not-in",e)||this}function Sa(t,e){return ma.call(this,t,"in",e)||this}function Da(t,e){return wa.call(this,t,"array-contains",e)||this}function xa(t){return(t.before?"b":"a")+":"+t.position.map(Yo).join(",")}function Oa(t,e,n){for(var r=0,i=0;i<t.position.length;i++){var o=e[i],s=t.position[i],r=o.field.p()?Xr.i(Xr.C(s.referenceValue),n.key):Ko(s,n.field(o.field));if("desc"===o.dir&&(r*=-1),0!==r)break}return t.before?r<=0:r<0}function Ra(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(!Ho(t.position[n],e.position[n]))return!1;return!0}var ka=function(t,e){void 0===e&&(e="asc"),this.field=t,this.dir=e};function La(){var n=this;this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}var Ca,Pa=(za.prototype.reset=function(){this.Tn=0},za.prototype.An=function(){this.Tn=this.mn},za.prototype.Rn=function(t){var e=this;this.cancel();var n=Math.floor(this.Tn+this.Pn()),r=Math.max(0,Date.now()-this.In),i=Math.max(0,n-r);0<i&&Pr("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.Tn+" ms, delay with jitter: "+n+" ms, last attempt: "+r+" ms ago)"),this.En=this._n.gn(this.fn,i,function(){return e.In=Date.now(),t()}),this.Tn*=this.wn,this.Tn<this.dn&&(this.Tn=this.dn),this.Tn>this.mn&&(this.Tn=this.mn)},za.prototype.yn=function(){null!==this.En&&(this.En.Vn(),this.En=null)},za.prototype.cancel=function(){null!==this.En&&(this.En.cancel(),this.En=null)},za.prototype.Pn=function(){return(Math.random()-.5)*this.Tn},za),Ua=(Ba.prototype.catch=function(t){return this.next(void 0,t)},Ba.prototype.next=function(r,i){var o=this;return this.Sn&&Fr(),this.Sn=!0,this.vn?this.error?this.Dn(i,this.error):this.Cn(r,this.result):new Ba(function(e,n){o.pn=function(t){o.Cn(r,t).next(e,n)},o.bn=function(t){o.Dn(i,t).next(e,n)}})},Ba.prototype.Nn=function(){var n=this;return new Promise(function(t,e){n.next(t,e)})},Ba.prototype.Fn=function(t){try{var e=t();return e instanceof Ba?e:Ba.resolve(e)}catch(t){return Ba.reject(t)}},Ba.prototype.Cn=function(t,e){return t?this.Fn(function(){return t(e)}):Ba.resolve(e)},Ba.prototype.Dn=function(t,e){return t?this.Fn(function(){return t(e)}):Ba.reject(e)},Ba.resolve=function(n){return new Ba(function(t,e){t(n)})},Ba.reject=function(n){return new Ba(function(t,e){e(n)})},Ba.xn=function(t){return new Ba(function(e,n){var r=0,i=0,o=!1;t.forEach(function(t){++r,t.next(function(){++i,o&&i===r&&e()},function(t){return n(t)})}),o=!0,i===r&&e()})},Ba.$n=function(t){for(var n=Ba.resolve(!1),e=0,r=t;e<r.length;e++)!function(e){n=n.next(function(t){return t?Ba.resolve(t):e()})}(r[e]);return n}
1,Ba.forEach=function(t,n){var r=this,i=[];return t.forEach(function(t,e){i.push(n.call(r,t,e))}),this.xn(i)},Ba),Va=(Ga.delete=function(t){return Pr("SimpleDb","Removing database:",t),Xa(window.indexedDB.deleteDatabase(t)).Nn()},Ga.On=function(){if("undefined"==typeof indexedDB)return!1;if(Ga.Ln())return!0;var t=v(),e=Ga.Mn(t),n=0<e&&e<10,r=Ga.Bn(t),i=0<r&&r<4.5;return!(0<t.indexOf("MSIE ")||0<t.indexOf("Trident/")||0<t.indexOf("Edge/")||n||i)},Ga.Ln=function(){var t;return"undefined"!=typeof process&&"YES"===(null===(t=process.env)||void 0===t?void 0:t.qn)},Ga.Un=function(t,e){return t.store(e)},Ga.Mn=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)},Ga.Bn=function(t){var e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)},Ga.prototype.Qn=function(){return m(this,void 0,void 0,function(){var e,o=this;return w(this,function(t){switch(t.label){case 0:return this.db?[3,2]:(Pr("SimpleDb","Opening database:",this.name),e=this,[4,new Promise(function(n,r){var i=indexedDB.open(o.name,o.version);i.onsuccess=function(t){var e=t.target.result;n(e)},i.onblocked=function(){r(new Fa("Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=function(t){var e=t.target.error;"VersionError"===e.name?r(new Rr(Or.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 Fa(e))},i.onupgradeneeded=function(t){Pr("SimpleDb",'Database "'+o.name+'" requires upgrade from version:',t.oldVersion);var e=t.target.result;o.kn.createOrUpgrade(e,i.transaction,t.oldVersion,o.version).next(function(){Pr("SimpleDb","Database upgrade to version "+o.version+" complete")})}})]);case 1:e.db=t.sent(),t.label=2;case 2:return[2,(this.Wn&&(this.db.onversionchange=function(t){return o.Wn(t)}),this.db)]}})})},Ga.prototype.jn=function(e){this.Wn=e,this.db&&(this.db.onversionchange=function(t){return e(t)})},Ga.prototype.runTransaction=function(r,c,h){return m(this,void 0,void 0,function(){var s,u,e,a,n;return w(this,function(t){switch(t.label){case 0:s="readonly"===r,u=0,e=function(){var e,n,r,i,o;return w(this,function(t){switch(t.label){case 0:++u,t.label=1;case 1:return t.trys.push([1,4,,5]),[4,a.Qn()];case 2:return a.db=t.sent(),e=Qa.open(a.db,s?"readonly":"readwrite",c),n=h(e).catch(function(t){return e.abort(t),Ua.reject(t)}).Nn(),r={},n.catch(function(){}),[4,e.Kn];case 3:return[2,(r.value=(t.sent(),n),r)];case 4:return i=t.sent(),o="FirebaseError"!==i.name&&u<3,Pr("SimpleDb","Transaction failed with error:",i.message,"Retrying:",o),a.close(),o?[3,5]:[2,{value:Promise.reject(i)}];case 5:return[2]}})},a=this,t.label=1;case 1:return[5,e()];case 2:if("object"==typeof(n=t.sent()))return[2,n.value];t.label=3;case 3:return[3,1];case 4:return[2]}})})},Ga.prototype.close=function(){this.db&&this.db.close(),this.db=void 0},Ga),Ma=(Object.defineProperty(ja.prototype,"vn",{get:function(){return this.zn},enumerable:!1,configurable:!0}),Object.defineProperty(ja.prototype,"Yn",{get:function(){return this.Hn},enumerable:!1,configurable:!0}),Object.defineProperty(ja.prototype,"cursor",{set:function(t){this.Gn=t},enumerable:!1,configurable:!0}),ja.prototype.done=function(){this.zn=!0},ja.prototype.Jn=function(t){this.Hn=t},ja.prototype.delete=function(){return Xa(this.Gn.delete())},ja),Fa=(o(qa,Ca=Rr),qa);function qa(t){var e=this;return(e=Ca.call(this,Or.UNAVAILABLE,"IndexedDB transaction failed: "+t)||this).name="IndexedDbTransactionError",e}function ja(t){this.Gn=t,this.zn=!1,this.Hn=null}function Ga(t,e,n){this.name=t,this.version=e,this.kn=n,12.2===Ga.Mn(v())&&Ur("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.")}function Ba(t){var e=this;this.pn=null,this.bn=null,this.result=void 0,this.error=void 0,this.vn=!1,this.Sn=!1,t(function(t){e.vn=!0,e.result=t,e.pn&&e.pn(t)},function(t){e.vn=!0,e.error=t,e.bn&&e.bn(t)})}function za(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this._n=t,this.fn=e,this.dn=n,this.wn=r,this.mn=i,this.Tn=0,this.En=null,this.In=Date.now(),this.reset()}function Ha(t){return"IndexedDbTransactionError"===t.name}var Qa=(Ya.open=function(t,e,n){try{return new Ya(t.transaction(n,e))}catch(t){throw new Fa(t)}},Object.defineProperty(Ya.prototype,"Kn",{get:function(){return this.Xn.promise}
1,enumerable:!1,configurable:!0}),Ya.prototype.abort=function(t){t&&this.Xn.reject(t),this.aborted||(Pr("SimpleDb","Aborting transaction:",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())},Ya.prototype.store=function(t){var e=this.transaction.objectStore(t);return new Ka(e)},Ya),Ka=(Wa.prototype.put=function(t,e){var n=void 0!==e?(Pr("SimpleDb","PUT",this.store.name,t,e),this.store.put(e,t)):(Pr("SimpleDb","PUT",this.store.name,"<auto-key>",t),this.store.put(t));return Xa(n)},Wa.prototype.add=function(t){return Pr("SimpleDb","ADD",this.store.name,t,t),Xa(this.store.add(t))},Wa.prototype.get=function(e){var n=this;return Xa(this.store.get(e)).next(function(t){return void 0===t&&(t=null),Pr("SimpleDb","GET",n.store.name,e,t),t})},Wa.prototype.delete=function(t){return Pr("SimpleDb","DELETE",this.store.name,t),Xa(this.store.delete(t))},Wa.prototype.count=function(){return Pr("SimpleDb","COUNT",this.store.name),Xa(this.store.count())},Wa.prototype.Zn=function(t,e){var n=this.cursor(this.options(t,e)),r=[];return this.ts(n,function(t,e){r.push(e)}).next(function(){return r})},Wa.prototype.es=function(t,e){Pr("SimpleDb","DELETE ALL",this.store.name);var n=this.options(t,e);n.ns=!1;var r=this.cursor(n);return this.ts(r,function(t,e,n){return n.delete()})},Wa.prototype.ss=function(t,e){var n;e?n=t:(n={},e=t);var r=this.cursor(n);return this.ts(r,e)},Wa.prototype.rs=function(i){var t=this.cursor({});return new Ua(function(n,r){t.onerror=function(t){var e=Ja(t.target.error);r(e)},t.onsuccess=function(t){var e=t.target.result;e?i(e.primaryKey,e.value).next(function(t){t?e.continue():n()}):n()}})},Wa.prototype.ts=function(t,s){var u=[];return new Ua(function(o,e){t.onerror=function(t){e(t.target.error)},t.onsuccess=function(t){var e,n,r,i=t.target.result;i?(e=new Ma(i),(n=s(i.primaryKey,i.value,e))instanceof Ua&&(r=n.catch(function(t){return e.done(),Ua.reject(t)}),u.push(r)),e.vn?o():null===e.Yn?i.continue():i.continue(e.Yn)):o()}}).next(function(){return Ua.xn(u)})},Wa.prototype.options=function(t,e){var n=void 0;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},Wa.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)},Wa);function Wa(t){this.store=t}function Ya(t){var n=this;this.transaction=t,this.aborted=!1,this.Xn=new La,this.transaction.oncomplete=function(){n.Xn.resolve()},this.transaction.onabort=function(){t.error?n.Xn.reject(new Fa(t.error)):n.Xn.resolve()},this.transaction.onerror=function(t){var e=Ja(t.target.error);n.Xn.reject(new Fa(e))}}function Xa(t){return new Ua(function(n,r){t.onsuccess=function(t){var e=t.target.result;n(e)},t.onerror=function(t){var e=Ja(t.target.error);r(e)}})}var $a=!1;function Ja(t){var e=Va.Mn(v());if(12.2<=e&&e<13){var n="An internal error was encountered in the Indexed Database server";if(0<=t.message.indexOf(n)){var r=new Rr("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 $a||($a=!0,setTimeout(function(){throw r},0)),r}}return t}function Za(){return"undefined"!=typeof window?window:null}function tc(){return"undefined"!=typeof document?document:null}var ec=(ic.ls=function(t,e,n,r,i){var o=new ic(t,e,Date.now()+n,r,i);return o.start(n),o},ic.prototype.start=function(t){var e=this;this._s=setTimeout(function(){return e.fs()},t)},ic.prototype.Vn=function(){return this.fs()},ic.prototype.cancel=function(t){null!==this._s&&(this.clearTimeout(),this.hs.reject(new Rr(Or.CANCELLED,"Operation cancelled"+(t?": "+t:"")))
1)},ic.prototype.fs=function(){var e=this;this.os.ds(function(){return null!==e._s?(e.clearTimeout(),e.op().then(function(t){return e.hs.resolve(t)})):Promise.resolve()})},ic.prototype.clearTimeout=function(){null!==this._s&&(this.us(this),clearTimeout(this._s),this._s=null)},ic),nc=(Object.defineProperty(rc.prototype,"Vs",{get:function(){return this.Es},enumerable:!1,configurable:!0}),rc.prototype.ds=function(t){this.enqueue(t)},rc.prototype.ps=function(t){this.bs(),this.vs(t)},rc.prototype.Ss=function(){var t;this.Es||(this.Es=!0,(t=tc())&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.ys))},rc.prototype.enqueue=function(t){return this.bs(),this.Es?new Promise(function(t){}):this.vs(t)},rc.prototype.Ds=function(t){var e=this;this.Ts.push(t),this.ds(function(){return e.Cs()})},rc.prototype.Cs=function(){return m(this,void 0,void 0,function(){var e,n=this;return w(this,function(t){switch(t.label){case 0:if(0===this.Ts.length)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.Ts[0]()];case 2:return t.sent(),this.Ts.shift(),this.gs.reset(),[3,4];case 3:if(!Ha(e=t.sent()))throw e;return Pr("AsyncQueue","Operation failed with retryable error: "+e),[3,4];case 4:0<this.Ts.length&&this.gs.Rn(function(){return n.Cs()}),t.label=5;case 5:return[2]}})})},rc.prototype.vs=function(t){var r=this,e=this.ws.then(function(){return r.Rs=!0,t().catch(function(t){throw r.As=t,r.Rs=!1,Ur("INTERNAL UNHANDLED ERROR: ",(n=(e=t).message||"",e.stack&&(n=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),n)),t;var e,n}).then(function(t){return r.Rs=!1,t})});return this.ws=e},rc.prototype.gn=function(t,e,n){var r=this;this.bs(),-1<this.Ps.indexOf(t)&&(e=0);var i=ec.ls(this,t,e,n,function(t){return r.Ns(t)});return this.Is.push(i),i},rc.prototype.bs=function(){this.As&&Fr()},rc.prototype.Fs=function(){},rc.prototype.xs=function(){return m(this,void 0,void 0,function(){var e;return w(this,function(t){switch(t.label){case 0:return[4,e=this.ws];case 1:t.sent(),t.label=2;case 2:if(e!==this.ws)return[3,0];t.label=3;case 3:return[2]}})})},rc.prototype.$s=function(t){for(var e=0,n=this.Is;e<n.length;e++)if(n[e].fn===t)return!0;return!1},rc.prototype.ks=function(r){var i=this;return this.xs().then(function(){i.Is.sort(function(t,e){return t.cs-e.cs});for(var t=0,e=i.Is;t<e.length;t++){var n=e[t];if(n.Vn(),"all"!==r&&n.fn===r)break}return i.xs()})},rc.prototype.Ms=function(t){this.Ps.push(t)},rc.prototype.Ns=function(t){var e=this.Is.indexOf(t);this.Is.splice(e,1)},rc);function rc(){var e=this;this.ws=Promise.resolve(),this.Ts=[],this.Es=!1,this.Is=[],this.As=null,this.Rs=!1,this.Ps=[],this.gs=new Pa(this,"async_queue_retry"),this.ys=function(){var t=tc();t&&Pr("AsyncQueue","Visibility state changed to ",t.visibilityState),e.gs.yn()};var t=tc();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.ys)}function ic(t,e,n,r,i){this.os=t,this.fn=e,this.cs=n,this.op=r,this.us=i,this.hs=new La,this.then=this.hs.promise.then.bind(this.hs.promise),this.hs.promise.catch(function(t){})}function oc(t,e){if(Ur("AsyncQueue",e+": "+t),Ha(t))return new Rr(Or.UNAVAILABLE,e+": "+t);throw t}function sc(){this.Os=void 0,this.listeners=[]}function uc(){this.Ls=new Pi(Zu,Ju),this.onlineState="Unknown",this.Bs=new Set}function ac(a,c){return m(this,void 0,void 0,function(){var e,n,r,i,o,s,u;return w(this,function(t){switch(t.label){case 0:if(e=a,n=c.query,r=!1,(i=e.Ls.get(n))||(r=!0,i=new sc),!r)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),o=i,[4,e.qs(n)];case 2:return o.Os=t.sent(),[3,4];case 3:return s=t.sent(),u=oc(s,"Initialization of query '"+ta(c.query)+"' failed"),[2,void c.onError(u)];case 4:return e.Ls.set(n,i),i.listeners.push(c),c.Us(e.onlineState),i.Os&&c.Qs(i.Os)&&hc(e),[2]}})})}function cc(s,u){return m(this,void 0,void 0,function(){var e,n,r,i,o;return w(this,function(t){return e=s,n=u.query,r=!1,(i=e.Ls.get(n))&&0<=(o=i.listeners.indexOf(u))&&(i.listeners.splice(o,1),r=0===i.listeners.length),r?[2,(e.Ls.delete(n),e.Ws(n))]:[2]})})}function hc(t){t.Bs.forEach(function(t){t.next()})}var fc=(dc.prototype.Qs=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)}
1t=new _o(t.query,t.docs,t.Ut,e,t.Qt,t.fromCache,t.Wt,!0)}var o=!1;return this.Ks?this.zs(t)&&(this.js.next(t),o=!0):this.Hs(t,this.onlineState)&&(this.Ys(t),o=!0),this.Gs=t,o},dc.prototype.onError=function(t){this.js.error(t)},dc.prototype.Us=function(t){this.onlineState=t;var e=!1;return this.Gs&&!this.Ks&&this.Hs(this.Gs,t)&&(this.Ys(this.Gs),e=!0),e},dc.prototype.Hs=function(t,e){if(!t.fromCache)return!0;var n="Offline"!==e;return!(this.options.Js&&n||t.docs.m()&&"Offline"!==e)},dc.prototype.zs=function(t){if(0<t.docChanges.length)return!0;var e=this.Gs&&this.Gs.hasPendingWrites!==t.hasPendingWrites;return!(!t.Wt&&!e)&&!0===this.options.includeMetadataChanges},dc.prototype.Ys=function(t){t=_o.Kt(t.query,t.docs,t.Qt,t.fromCache),this.Ks=!0,this.js.next(t)},dc),lc=(pc.prototype.Xs=function(){return null!=this.uid},pc.prototype.Zs=function(){return this.Xs()?"uid:"+this.uid:"anonymous-user"},pc.prototype.isEqual=function(t){return t.uid===this.uid},pc);function pc(t){this.uid=t}function dc(t,e,n){this.query=t,this.js=e,this.Ks=!1,this.Gs=null,this.onlineState="Unknown",this.options=n||{}}lc.UNAUTHENTICATED=new lc(null),lc.ti=new lc("google-credentials-uid"),lc.ei=new lc("first-party-uid");var vc=(yc.prototype.si=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},yc.prototype.next=function(){var t=++this.previousValue;return this.ii&&this.ii(t),t},yc);function yc(t,e){var n=this;this.previousValue=t,e&&(e.ni=function(t){return n.si(t)},this.ii=function(t){return e.ri(t)})}function gc(t,e){return"firestore_clients_"+t+"_"+e}function mc(t,e,n){var r="firestore_mutations_"+t+"_"+n;return e.Xs()&&(r+="_"+e.uid),r}function wc(t,e){return"firestore_targets_"+t+"_"+e}vc.oi=-1;var bc=(Qc.ai=function(t,e,n){var r=JSON.parse(n),i="object"==typeof r&&-1!==["pending","acknowledged","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 Rr(r.error.code,r.error.message)),i?new Qc(t,e,r.state,o):(Ur("SharedClientState","Failed to parse mutation state for ID '"+e+"': "+n),null)},Qc.prototype.ci=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)},Qc),Ic=(Hc.ai=function(t,e){var n=JSON.parse(e),r="object"==typeof n&&-1!==["not-current","current","rejected"].indexOf(n.state)&&(void 0===n.error||"object"==typeof n.error),i=void 0;return r&&n.error&&(r="string"==typeof n.error.message&&"string"==typeof n.error.code)&&(i=new Rr(n.error.code,n.error.message)),r?new Hc(t,n.state,i):(Ur("SharedClientState","Failed to parse target state for ID '"+t+"': "+e),null)},Hc.prototype.ci=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)},Hc),Ec=(zc.ai=function(t,e){for(var n=JSON.parse(e),r="object"==typeof n&&n.activeTargetIds instanceof Array,i=Io,o=0;r&&o<n.activeTargetIds.length;++o)r=Hi(n.activeTargetIds[o]),i=i.add(n.activeTargetIds[o]);return r?new zc(t,i):(Ur("SharedClientState","Failed to parse client data for instance '"+t+"': "+e),null)},zc),Tc=(Bc.ai=function(t){var e=JSON.parse(t);return"object"==typeof e&&-1!==["Unknown","Online","Offline"].indexOf(e.onlineState)&&"string"==typeof e.clientId?new Bc(e.clientId,e.onlineState):(Ur("SharedClientState","Failed to parse online state: "+t),null)},Bc),_c=(Gc.prototype.ui=function(t){this.activeTargetIds=this.activeTargetIds.add(t)},Gc.prototype.hi=function(t){this.activeTargetIds=this.activeTargetIds.delete(t)},Gc.prototype.ci=function(){var t={activeTargetIds:this.activeTargetIds.A(),updateTimeMs:Date.now()};return JSON.stringify(t)},Gc),Ac=(jc.On=function(t){return!(!t||!t.localStorage)},jc.prototype.start=function(){return m(this,void 0,void 0,function(){var e,n,r,i,o,s,u,a,c,h,f,l=this;return w(this,function(t){switch(t.label){case 0:return[4,this._i.Vi()];case 1:for(e=t.sent(),n=0,r=e;n<r.length;n++)(i=r[n])!==this.li&&(o=this.getItem(gc(this.persistenceKey,i)))&&
1(s=Ec.ai(i,o))&&(this.mi=this.mi.rt(s.clientId,s));for(this.pi(),(u=this.storage.getItem(this.yi))&&(a=this.bi(u))&&this.vi(a),c=0,h=this.Ei;c<h.length;c++)f=h[c],this.wi(f);return this.Ei=[],this.window.addEventListener("unload",function(){return l.Si()}),this.Ti=!0,[2]}})})},jc.prototype.ri=function(t){this.setItem(this.Ai,JSON.stringify(t))},jc.prototype.Di=function(){return this.Ci(this.mi)},jc.prototype.Ni=function(n){var r=!1;return this.mi.forEach(function(t,e){e.activeTargetIds.has(n)&&(r=!0)}),r},jc.prototype.Fi=function(t){this.xi(t,"pending")},jc.prototype.$i=function(t,e,n){this.xi(t,e,n),this.ki(t)},jc.prototype.Mi=function(t){var e,n,r="not-current";return this.Ni(t)&&(!(e=this.storage.getItem(wc(this.persistenceKey,t)))||(n=Ic.ai(t,e))&&(r=n.state)),this.Oi.ui(t),this.pi(),r},jc.prototype.Li=function(t){this.Oi.hi(t),this.pi()},jc.prototype.Bi=function(t){return this.Oi.activeTargetIds.has(t)},jc.prototype.qi=function(t){this.removeItem(wc(this.persistenceKey,t))},jc.prototype.Ui=function(t,e,n){this.Qi(t,e,n)},jc.prototype.Wi=function(t,e,n){var r=this;e.forEach(function(t){r.ki(t)}),this.currentUser=t,n.forEach(function(t){r.Fi(t)})},jc.prototype.ji=function(t){this.Ki(t)},jc.prototype.Si=function(){this.Ti&&(this.window.removeEventListener("storage",this.di),this.removeItem(this.Ii),this.Ti=!1)},jc.prototype.getItem=function(t){var e=this.storage.getItem(t);return Pr("SharedClientState","READ",t,e),e},jc.prototype.setItem=function(t,e){Pr("SharedClientState","SET",t,e),this.storage.setItem(t,e)},jc.prototype.removeItem=function(t){Pr("SharedClientState","REMOVE",t),this.storage.removeItem(t)},jc.prototype.wi=function(t){var e=this,u=t;if(u.storageArea===this.storage){if(Pr("SharedClientState","EVENT",u.key,u.newValue),u.key===this.Ii)return void Ur("Received WebStorage notification for local change. Another client might have garbage-collected our state");this._n.Ds(function(){return m(e,void 0,void 0,function(){var e,n,r,i,o,s;return w(this,function(t){if(this.Ti){if(null!==u.key)if(this.Ri.test(u.key)){if(null==u.newValue)return e=this.Gi(u.key),[2,this.zi(e,null)];if(n=this.Hi(u.key,u.newValue))return[2,this.zi(n.clientId,n)]}else if(this.Pi.test(u.key)){if(null!==u.newValue&&(r=this.Yi(u.key,u.newValue)))return[2,this.Ji(r)]}else if(this.gi.test(u.key)){if(null!==u.newValue&&(i=this.Xi(u.key,u.newValue)))return[2,this.Zi(i)]}else if(u.key===this.yi){if(null!==u.newValue&&(o=this.bi(u.newValue)))return[2,this.vi(o)]}else u.key===this.Ai&&(s=function(t){var e=vc.oi;if(null!=t)try{var n=JSON.parse(t);qr("number"==typeof n),e=n}catch(t){Ur("SharedClientState","Failed to read sequence number from WebStorage",t)}return e}(u.newValue))!==vc.oi&&this.ni(s)}else this.Ei.push(u);return[2]})})})}},Object.defineProperty(jc.prototype,"Oi",{get:function(){return this.mi.get(this.li)},enumerable:!1,configurable:!0}),jc.prototype.pi=function(){this.setItem(this.Ii,this.Oi.ci())},jc.prototype.xi=function(t,e,n){var r=new bc(this.currentUser,t,e,n),i=mc(this.persistenceKey,this.currentUser,t);this.setItem(i,r.ci())},jc.prototype.ki=function(t){var e=mc(this.persistenceKey,this.currentUser,t);this.removeItem(e)},jc.prototype.Ki=function(t){var e={clientId:this.li,onlineState:t};this.storage.setItem(this.yi,JSON.stringify(e))},jc.prototype.Qi=function(t,e,n){var r=wc(this.persistenceKey,t),i=new Ic(t,e,n);this.setItem(r,i.ci())},jc.prototype.Gi=function(t){var e=this.Ri.exec(t);return e?e[1]:null},jc.prototype.Hi=function(t,e){var n=this.Gi(t);return Ec.ai(n,e)},jc.prototype.Yi=function(t,e){var n=this.Pi.exec(t),r=Number(n[1]),i=void 0!==n[2]?n[2]:null;return bc.ai(new lc(i),r,e)},jc.prototype.Xi=function(t,e){var n=this.gi.exec(t),r=Number(n[1]);return Ic.ai(r,e)},jc.prototype.bi=function(t){return Tc.ai(t)},jc.prototype.Ji=function(e){return m(this,void 0,void 0,function(){return w(this,function(t){return e.user.uid===this.currentUser.uid?[2,this._i.tr(e.batchId,e.state,e.error)]:(Pr("SharedClientState","Ignoring mutation for non-active user "+e.user.uid),[2])})})},jc.prototype.Zi=function(t){return this._i.er(t.targetId,t.state,t.error)},jc.prototype.zi=function(t,e){var n=this,r=e?this.mi.rt(t,e):this.mi.remove(t),i=this.Ci(this.mi),o=this.Ci(r),s=[],u=[];return o.forEach(function(t){i.has(t)||s.push(t)}
1),i.forEach(function(t){o.has(t)||u.push(t)}),this._i.nr(s,u).then(function(){n.mi=r})},jc.prototype.vi=function(t){this.mi.get(t.clientId)&&this.fi(t.onlineState)},jc.prototype.Ci=function(t){var n=Io;return t.forEach(function(t,e){n=n.$t(e.activeTargetIds)}),n},jc),Nc=(qc.prototype.Fi=function(t){},qc.prototype.$i=function(t,e,n){},qc.prototype.Mi=function(t){return this.sr.ui(t),this.ir[t]||"not-current"},qc.prototype.Ui=function(t,e,n){this.ir[t]=e},qc.prototype.Li=function(t){this.sr.hi(t)},qc.prototype.Bi=function(t){return this.sr.activeTargetIds.has(t)},qc.prototype.qi=function(t){delete this.ir[t]},qc.prototype.Di=function(){return this.sr.activeTargetIds},qc.prototype.Ni=function(t){return this.sr.activeTargetIds.has(t)},qc.prototype.start=function(){return this.sr=new _c,Promise.resolve()},qc.prototype.Wi=function(t,e,n){},qc.prototype.ji=function(t){},qc.prototype.Si=function(){},qc.prototype.ri=function(t){},qc),Sc=(Fc.prototype.ar=function(t,e,n){for(var r=n.cr,i=0;i<this.mutations.length;i++){var o=this.mutations[i];o.key.isEqual(t)&&(e=iu(o,e,r[i]))}return e},Fc.prototype.ur=function(t,e){for(var n=0,r=this.baseMutations;n<r.length;n++){var i=r[n];i.key.isEqual(t)&&(e=ou(i,e,e,this.rr))}for(var o=e,s=0,u=this.mutations;s<u.length;s++){var a=u[s];a.key.isEqual(t)&&(e=ou(a,e,o,this.rr))}return e},Fc.prototype.hr=function(n){var r=this,i=n;return this.mutations.forEach(function(t){var e=r.ur(t.key,n.get(t.key));e&&(i=i.rt(t.key,e))}),i},Fc.prototype.keys=function(){return this.mutations.reduce(function(t,e){return t.add(e.key)},bo())},Fc.prototype.isEqual=function(t){return this.batchId===t.batchId&&Ti(this.mutations,t.mutations,su)&&Ti(this.baseMutations,t.baseMutations,su)},Fc),Dc=(Mc.from=function(t,e,n){qr(t.mutations.length===n.length);for(var r=mo,i=t.mutations,o=0;o<i.length;o++)r=r.rt(i[o].key,n[o].version);return new Mc(t,e,n,r)},Mc),xc=(Object.defineProperty(Vc.prototype,"readTime",{get:function(){return this.mr},set:function(t){this.mr=t},enumerable:!1,configurable:!0}),Vc.prototype.Tr=function(t,e){this.Er(),this.readTime=e,this.dr.set(t.key,t)},Vc.prototype.Ir=function(t,e){this.Er(),e&&(this.readTime=e),this.dr.set(t,null)},Vc.prototype.Ar=function(t,e){this.Er();var n=this.dr.get(e);return void 0!==n?Ua.resolve(n):this.Rr(t,e)},Vc.prototype.getEntries=function(t,e){return this.Pr(t,e)},Vc.prototype.apply=function(t){return this.Er(),this.wr=!0,this.gr(t)},Vc.prototype.Er=function(){},Vc),Oc="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",Rc=(Uc.prototype.Vr=function(t){this.yr.push(t)},Uc.prototype.pr=function(){this.yr.forEach(function(t){return t()})},Uc),kc=(Pc.prototype.Dr=function(e,n){var r=this;return this.vr.Cr(e,n).next(function(t){return r.Nr(e,n,t)})},Pc.prototype.Nr=function(t,r,i){return this.br.Ar(t,r).next(function(t){for(var e=0,n=i;e<n.length;e++)t=n[e].ur(r,t);return t})},Pc.prototype.Fr=function(t,e,i){var o=po;return e.forEach(function(t,e){for(var n=0,r=i;n<r.length;n++)e=r[n].ur(t,e);o=o.rt(t,e)}),o},Pc.prototype.$r=function(e,t){var n=this;return this.br.getEntries(e,t).next(function(t){return n.kr(e,t)})},Pc.prototype.kr=function(r,i){var o=this;return this.vr.Mr(r,i).next(function(t){var e=o.Fr(r,i,t),n=po;return e.forEach(function(t,e){e=e||new Cu(t,Vi.min()),n=n.rt(t,e)}),n})},Pc.prototype.Or=function(t,e,n){return r=e,Xr.F(r.path)&&null===r.collectionGroup&&0===r.filters.length?this.Lr(t,e.path):Qu(e)?this.Br(t,e,n):this.qr(t,e,n);var r},Pc.prototype.Lr=function(t,e){return this.Dr(t,new Xr(e)).next(function(t){var e=go;return t instanceof Lu&&(e=e.rt(t.key,t)),e})},Pc.prototype.Br=function(i,o,s){var u=this,a=o.collectionGroup,c=go;return this.Sr.Ur(i,a).next(function(t){return Ua.forEach(t,function(t){var e,n,r=(e=o,n=t.child(a),new Uu(n,null,e.rn.slice(),e.filters.slice(),e.limit,e.on,e.startAt,e.endAt));return u.qr(i,r,s).next(function(t){t.forEach(function(t,e){c=c.rt(t,e)})})}).next(function(){return c})})},Pc.prototype.qr=function(e,n,t){var h,f,r=this;return this.br.Or(e,n,t).next(function(t){return h=t,r.vr.Qr(e,n)}).next(function(t){return f=t,r.Wr(e,f,h).next(function(t){h=t;for(var e=0,n=f;e<n.length;e++)for(var r=n[e],i=0,o=r.mutations;i<o.length;i++){var s=o[i],u=s.key,a=h.get(u),c=ou(s,a,a,r.rr);h=c instanceof Lu?h.rt(u,c):h.remove(u)}})}).next(function(){return h.forEach(function(t,e){ea(n,e)||(h=h.remove(t))}),h})},Pc.prototype.Wr=function(t,e,n){for(var r=bo(),i=0,o=e;i<o.length;i++)for(var s=0,u=o[i].mutations;s<u.length;s++){var a=u[s];
1a instanceof fu&&null===n.get(a.key)&&(r=r.add(a.key))}var c=n;return this.br.getEntries(t,r).next(function(t){return t.forEach(function(t,e){null!==e&&e instanceof Lu&&(c=c.rt(t,e))}),c})},Pc),Lc=(Cc.Gr=function(t,e){for(var n=bo(),r=bo(),i=0,o=e.docChanges;i<o.length;i++){var s=o[i];switch(s.type){case 0:n=n.add(s.doc.key);break;case 1:r=r.add(s.doc.key)}}return new Cc(t,e.fromCache,n,r)},Cc);function Cc(t,e,n,r){this.targetId=t,this.fromCache=e,this.jr=n,this.Kr=r}function Pc(t,e,n){this.br=t,this.vr=e,this.Sr=n}function Uc(){this.yr=[]}function Vc(){this.dr=new Pi(function(t){return t.toString()},function(t,e){return t.isEqual(e)}),this.wr=!1}function Mc(t,e,n,r){this.batch=t,this.lr=e,this.cr=n,this._r=r}function Fc(t,e,n,r){this.batchId=t,this.rr=e,this.baseMutations=n,this.mutations=r}function qc(){this.sr=new _c,this.ir={},this.fi=null,this.ni=null}function jc(t,e,n,r,i){this.window=t,this._n=e,this.persistenceKey=n,this.li=r,this._i=null,this.fi=null,this.ni=null,this.di=this.wi.bind(this),this.mi=new io(Ei),this.Ti=!1,this.Ei=[];var o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=i,this.Ii=gc(this.persistenceKey,this.li),this.Ai="firestore_sequence_number_"+this.persistenceKey,this.mi=this.mi.rt(this.li,new _c),this.Ri=new RegExp("^firestore_clients_"+o+"_([^_]*)$"),this.Pi=new RegExp("^firestore_mutations_"+o+"_(\\d+)(?:_(.*))?$"),this.gi=new RegExp("^firestore_targets_"+o+"_(\\d+)$"),this.yi="firestore_online_state_"+this.persistenceKey,this.window.addEventListener("storage",this.di)}function Gc(){this.activeTargetIds=Io}function Bc(t,e){this.clientId=t,this.onlineState=e}function zc(t,e){this.clientId=t,this.activeTargetIds=e}function Hc(t,e,n){this.targetId=t,this.state=e,this.error=n}function Qc(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r}function Kc(t,e){var n=t[0],r=t[1],i=e[0],o=e[1],s=Ei(n,i);return 0===s?Ei(r,o):s}var Wc=(Jc.prototype.Yr=function(){return++this.Hr},Jc.prototype.Jr=function(t){var e,n=[t,this.Yr()];this.buffer.size<this.zr?this.buffer=this.buffer.add(n):Kc(n,e=this.buffer.last())<0&&(this.buffer=this.buffer.delete(e).add(n))},Object.defineProperty(Jc.prototype,"maxValue",{get:function(){return this.buffer.last()[0]},enumerable:!1,configurable:!0}),Jc),Yc={Xr:!1,Zr:0,eo:0,no:0},Xc=($c.oo=function(t){return new $c(t,$c.ao,$c.co)},$c);function $c(t,e,n){this.so=t,this.io=e,this.ro=n}function Jc(t){this.zr=t,this.buffer=new fo(Kc),this.Hr=0}Xc.uo=-1,Xc.ho=1048576,Xc.lo=41943040,Xc.ao=10,Xc.co=1e3,Xc._o=new Xc(Xc.lo,Xc.ao,Xc.co),Xc.fo=new Xc(Xc.uo,0,0);var Zc=(nh.prototype.start=function(t){this.do.params.so!==Xc.uo&&this.To(t)},nh.prototype.stop=function(){this.mo&&(this.mo.cancel(),this.mo=null)},Object.defineProperty(nh.prototype,"Ti",{get:function(){return null!==this.mo},enumerable:!1,configurable:!0}),nh.prototype.To=function(n){var t=this,e=this.wo?3e5:6e4;Pr("LruGarbageCollector","Garbage collection scheduled in "+e+"ms"),this.mo=this.os.gn("lru_garbage_collection",e,function(){return m(t,void 0,void 0,function(){var e;return w(this,function(t){switch(t.label){case 0:this.mo=null,this.wo=!0,t.label=1;case 1:return t.trys.push([1,3,,7]),[4,n.Eo(this.do)];case 2:return t.sent(),[3,7];case 3:return Ha(e=t.sent())?(Pr("LruGarbageCollector","Ignoring IndexedDB error during garbage collection: ",e),[3,6]):[3,4];case 4:return[4,kf(e)];case 5:t.sent(),t.label=6;case 6:return[3,7];case 7:return[4,this.To(n)];case 8:return t.sent(),[2]}})})})},nh),th=(eh.prototype.Ao=function(t,e){return this.Io.Ro(t).next(function(t){return Math.floor(e/100*t)})},eh.prototype.Po=function(t,e){var n=this;if(0===e)return Ua.resolve(vc.oi);var r=new Wc(e);return this.Io.De(t,function(t){return r.Jr(t.sequenceNumber)}).next(function(){return n.Io.yo(t,function(t){return r.Jr(t)})}).next(function(){return r.maxValue})},eh.prototype.Vo=function(t,e,n){return this.Io.Vo(t,e,n)},eh.prototype.po=function(t,e){return this.Io.po(t,e)},eh.prototype.bo=function(e,n){var r=this;return this.params.so===Xc.uo?(Pr("LruGarbageCollector","Garbage collection skipped; disabled"),Ua.resolve(Yc)):this.vo(e).next(function(t){return t<r.params.so?(Pr("LruGarbageCollector","Garbage collection skipped; Cache size "+t+" is lower than threshold "+r.params.so),Yc):r.So(e,n)})},eh.prototype.vo=function(t){return this.Io.vo(t)},eh.prototype.So=function(e,n){var r,i,o,s,u,a,c,h=this,f=Date.now();return this.Ao(e,this.params.io).next(function(t){return i=t>h.params.ro?(Pr("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+h.params.ro+" from "+t),h.params.ro):t,s=Date.now(),h.Po(e,i)}).next(function(t){return r=t,u=Date.now(),h.Vo(e,r,n)}).next(function(t){return o=t,a=Date.now(),h.po(e,r)}).next(function(t){return c=Date.now(),Cr()<=l.DEBUG&&Pr("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(s-f)+"ms\n\tDetermined least recently used "+i+" in "+(u-s)+"ms\n\tRemoved "+o+" targets in "+(a-u)+"ms\n\tRemoved "+t+" documents in "+(c-a)+"ms\nTotal Duration: "+(c-f)+"ms"),Ua.resolve({Xr:!0,Zr:i,eo:o,no:t})})},eh);function eh(t,e){this.Io=t,this.params=e}function nh(t,e){this.do=t,this.os=e,this.wo=!1,this.mo=null}function rh(t){for(var e="",n=0;n<t.length;n++)0<e.length&&(e=ih(e)),e=function(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}(t.get(n),e);return ih(e)}function ih(t){return t+"\x01\x01"}function oh(t){var e=t.length;if(qr(2<=e),2===e)return qr("\x01"===t.charAt(0)&&"\x01"===t.charAt(1)),Kr.g();for(var n=e-2,r=[],i="",o=0;o<e;){var s=t.indexOf("\x01",o);switch((s<0||n<s)&&Fr(),t.charAt(s+1)){case"\x01":var u=t.substring(o,s),a=void 0;0===i.length?a=u:(a=i+=u,i=""),r.push(a);break;case"\x10":i+=t.substring(o,s),i+="\0";break;case"\x11":i+=t.substring(o,s+1);break;default:Fr()}o=s+2}return new Kr(r)}var sh=function(t){this.Do=t};function uh(t,e){if(e.document)return n=t.Do,r=e.document,i=!!e.hasCommittedMutations,o=gs(n,r.name),s=ps(r.updateTime),u=new Tu({mapValue:{fields:r.fields}}),new Lu(o,s,u,{hasCommittedMutations:!!i});var n,r,i,o,s,u;if(e.noDocument){var a=Xr.$(e.noDocument.path),c=lh(e.noDocument.readTime);return new Cu(a,c,{hasCommittedMutations:!!e.hasCommittedMutations})}if(e.unknownDocument){var h=Xr.$(e.unknownDocument.path),f=lh(e.unknownDocument.version);return new Pu(h,f)}return Fr()}function ah(t,e,n){var r,i,o=ch(n),s=e.key.path.h().A();if(e instanceof Lu){var u={name:ys(r=t.Do,(i=e).key),fields:i.sn().mapValue.fields,updateTime:fs(r,i.version.X())},a=e.hasCommittedMutations;return new Hh(null,null,u,a,o,s)}if(e instanceof Cu){var c=e.key.path.A(),h=fh(e.version),f=e.hasCommittedMutations;return new Hh(null,new Bh(c,h),null,f,o,s)}if(e instanceof Pu){var l=e.key.path.A(),p=fh(e.version);return new Hh(new zh(l,p),null,null,!0,o,s)}return Fr()}function ch(t){var e=t.X();return[e.seconds,e.nanoseconds]}function hh(t){var e=new Ui(t[0],t[1]);return Vi.Y(e)}function fh(t){var e=t.X();return new Ch(e.seconds,e.nanoseconds)}function lh(t){var e=new Ui(t.seconds,t.nanoseconds);return Vi.Y(e)}function ph(e,t){var n=(t.baseMutations||[]).map(function(t){return _s(e.Do,t)}),r=t.mutations.map(function(t){return _s(e.Do,t)}),i=Ui.fromMillis(t.localWriteTimeMs);return new Sc(t.batchId,i,n,r)}function dh(t){var e,n=lh(t.readTime),r=void 0!==t.lastLimboFreeSnapshotVersion?lh(t.lastLimboFreeSnapshotVersion):Vi.min(),i=void 0!==t.query.documents?(qr(1===(e=t.query).documents.length),Wu(ju(ws(e.documents[0])))):function(t){var e,n=ws(t.parent),r=t.structuredQuery,i=r.from?r.from.length:0,o=null;0<i&&(qr(1===i),(e=r.from[0]).allDescendants?o=e.collectionId:n=n.child(e.collectionId));var s=[];r.where&&(s=function t(e){return e?void 0!==e.unaryFilter?[function(t){switch(t.unaryFilter.op){case"IS_NAN":var e=Os(t.unaryFilter.field);return ia.create(e,"==",{doubleValue:NaN});case"IS_NULL":var n=Os(t.unaryFilter.field);return ia.create(n,"==",{nullValue:"NULL_VALUE"});
1case"IS_NOT_NAN":var r=Os(t.unaryFilter.field);return ia.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":var i=Os(t.unaryFilter.field);return ia.create(i,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return Fr()}}(e)]:void 0!==e.fieldFilter?[(n=e,ia.create(Os(n.fieldFilter.field),function(){switch(n.fieldFilter.op){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 Fr()}}(),n.fieldFilter.value))]:void 0!==e.compositeFilter?e.compositeFilter.filters.map(t).reduce(function(t,e){return t.concat(e)}):Fr():[];var n}(r.where));var u=[];r.orderBy&&(u=r.orderBy.map(function(t){return new ka(Os((e=t).field),function(){switch(e.direction){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}());var e}));var a,c,h=null;r.limit&&(a=r.limit,h=Bi(c="object"==typeof a?a.value:a)?null:c);var f=null;r.startAt&&(f=Ds(r.startAt));var l=null;return r.endAt&&(l=Ds(r.endAt)),Wu(qu(n,o,u,s,h,"F",f,l))}(t.query);return new to(i,t.targetId,0,t.lastListenSequenceNumber,n,r,Ai.fromBase64String(t.resumeToken))}function vh(t,e){var n=fh(e.et),r=fh(e.lastLimboFreeSnapshotVersion),i=(Xi(e.target)?As:Ns)(t.Do,e.target),o=e.resumeToken.toBase64();return new Kh(e.targetId,Wi(e.target),n,o,e.sequenceNumber,r,i)}var yh=(gh.Fo=function(t,e,n,r){return qr(""!==t.uid),new gh(t.Xs()?t.uid:"",e,n,r)},gh.prototype.xo=function(t){var r=!0,e=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return bh(t).ss({index:qh.userMutationsIndex,range:e},function(t,e,n){r=!1,n.done()}).next(function(){return r})},gh.prototype.$o=function(d,v,y,g){var m=this,w=Ih(d),b=bh(d);return b.add({}).next(function(t){qr("number"==typeof t);for(var e,n,r,i,o,s=new Sc(t,v,y,g),u=(e=m.serializer,n=m.userId,i=(r=s).baseMutations.map(function(t){return Ts(e.Do,t)}),o=r.mutations.map(function(t){return Ts(e.Do,t)}),new qh(n,r.batchId,r.rr.toMillis(),i,o)),a=[],c=new fo(function(t,e){return Ei(t.R(),e.R())}),h=0,f=g;h<f.length;h++){var l=f[h],p=jh.key(m.userId,l.key.path,t),c=c.add(l.key.path.h());a.push(b.put(u)),a.push(w.put(p,jh.PLACEHOLDER))}return c.forEach(function(t){a.push(m.Sr.ko(d,t))}),d.Vr(function(){m.No[t]=s.keys()}),Ua.xn(a).next(function(){return s})})},gh.prototype.Mo=function(t,e){var n=this;return bh(t).get(e).next(function(t){return t?(qr(t.userId===n.userId),ph(n.serializer,t)):null})},gh.prototype.Oo=function(t,n){var r=this;return this.No[n]?Ua.resolve(this.No[n]):this.Mo(t,n).next(function(t){if(t){var e=t.keys();return r.No[n]=e}return null})},gh.prototype.Lo=function(t,e){var r=this,i=e+1,n=IDBKeyRange.lowerBound([this.userId,i]),o=null;return bh(t).ss({index:qh.userMutationsIndex,range:n},function(t,e,n){e.userId===r.userId&&(qr(e.batchId>=i),o=ph(r.serializer,e)),n.done()}).next(function(){return o})},gh.prototype.Bo=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),r=-1;return bh(t).ss({index:qh.userMutationsIndex,range:e,reverse:!0},function(t,e,n){r=e.batchId,n.done()}).next(function(){return r})},gh.prototype.qo=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return bh(t).Zn(qh.userMutationsIndex,n).next(function(t){return t.map(function(t){return ph(e.serializer,t)})})},gh.prototype.Cr=function(u,a){var c=this,t=jh.prefixForPath(this.userId,a.path),e=IDBKeyRange.lowerBound(t),h=[];return Ih(u).ss({range:e},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=oh(i);if(r===c.userId&&a.path.isEqual(s))return bh(u).get(o).next(function(t){if(!t)throw Fr();qr(t.userId===c.userId),h.push(ph(c.serializer,t))});n.done()}).next(function(){return h})},gh.prototype.Mr=function(r,t){var a=this,c=new fo(Ei),i=[];return t.forEach(function(u){var t=jh.prefixForPath(a.userId,u.path),e=IDBKeyRange.lowerBound(t),n=Ih(r).ss({range:e},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=oh(i);r===a.userId&&u.path.isEqual(s)?c=c.add(o):n.done()});i.push(n)}),Ua.xn(i).next(function(){return a.Uo(r,c)})},gh.prototype.Qr=function(t,e){var u=this,a=e.path,c=a.length+1,n=jh.prefixForPath(this.userId,a),r=IDBKeyRange.lowerBound(n),h=new fo(Ei);return Ih(t).ss({range:r},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=oh(i);r===u.userId&&a.T(s)?s.length===c&&(h=h.add(o)):n.done()}
1).next(function(){return u.Uo(t,h)})},gh.prototype.Uo=function(e,t){var n=this,r=[],i=[];return t.forEach(function(t){i.push(bh(e).get(t).next(function(t){if(null===t)throw Fr();qr(t.userId===n.userId),r.push(ph(n.serializer,t))}))}),Ua.xn(i).next(function(){return r})},gh.prototype.Qo=function(e,n){var r=this;return wh(e.Wo,this.userId,n).next(function(t){return e.Vr(function(){r.jo(n.batchId)}),Ua.forEach(t,function(t){return r.Co.Ko(e,t)})})},gh.prototype.jo=function(t){delete this.No[t]},gh.prototype.Go=function(n){var o=this;return this.xo(n).next(function(t){if(!t)return Ua.resolve();var e=IDBKeyRange.lowerBound(jh.prefixForUser(o.userId)),i=[];return Ih(n).ss({range:e},function(t,e,n){var r;t[0]===o.userId?(r=oh(t[1]),i.push(r)):n.done()}).next(function(){qr(0===i.length)})})},gh.prototype.zo=function(t,e){return mh(t,this.userId,e)},gh.prototype.Ho=function(t){var e=this;return Eh(t).get(this.userId).next(function(t){return t||new Fh(e.userId,-1,"")})},gh);function gh(t,e,n,r){this.userId=t,this.serializer=e,this.Sr=n,this.Co=r,this.No={}}function mh(t,o,e){var n=jh.prefixForPath(o,e.path),s=n[1],r=IDBKeyRange.lowerBound(n),u=!1;return Ih(t).ss({range:r,ns:!0},function(t,e,n){var r=t[0],i=t[1];t[2],r===o&&i===s&&(u=!0),n.done()}).next(function(){return u})}function wh(t,e,n){var r=t.store(qh.store),i=t.store(jh.store),o=[],s=IDBKeyRange.only(n.batchId),u=0,a=r.ss({range:s},function(t,e,n){return u++,n.delete()});o.push(a.next(function(){qr(1===u)}));for(var c=[],h=0,f=n.mutations;h<f.length;h++){var l=f[h],p=jh.key(e,l.key.path,n.batchId);o.push(i.delete(p)),c.push(l.key)}return Ua.xn(o).next(function(){return c})}function bh(t){return df.Un(t,qh.store)}function Ih(t){return df.Un(t,jh.store)}function Eh(t){return df.Un(t,Fh.store)}var Th,_h=(Ah.prototype.Tr=function(t,e,n){return Sh(t).put(Dh(e),n)},Ah.prototype.Ir=function(t,e){var n=Sh(t),r=Dh(e);return n.delete(r)},Ah.prototype.updateMetadata=function(e,n){var r=this;return this.getMetadata(e).next(function(t){return t.byteSize+=n,r.Yo(e,t)})},Ah.prototype.Ar=function(t,e){var n=this;return Sh(t).get(Dh(e)).next(function(t){return n.Jo(t)})},Ah.prototype.Xo=function(t,e){var n=this;return Sh(t).get(Dh(e)).next(function(t){var e=n.Jo(t);return e?{Zo:e,size:xh(t)}:null})},Ah.prototype.getEntries=function(t,e){var r=this,i=po;return this.ta(t,e,function(t,e){var n=r.Jo(e);i=i.rt(t,n)}).next(function(){return i})},Ah.prototype.ea=function(t,e){var r=this,i=po,o=new io(Xr.i);return this.ta(t,e,function(t,e){var n=r.Jo(e);o=n?(i=i.rt(t,n),o.rt(t,xh(e))):(i=i.rt(t,null),o.rt(t,0))}).next(function(){return{na:i,sa:o}})},Ah.prototype.ta=function(t,e,i){if(e.m())return Ua.resolve();var n=IDBKeyRange.bound(e.first().path.A(),e.last().path.A()),o=e.lt(),s=o.Et();return Sh(t).ss({range:n},function(t,e,n){for(var r=Xr.$(t);s&&Xr.i(s,r)<0;)i(s,null),s=o.Et();s&&s.isEqual(r)&&(i(s,e),s=o.It()?o.Et():null),s?n.Jn(s.path.A()):n.done()}).next(function(){for(;s;)i(s,null),s=o.It()?o.Et():null})},Ah.prototype.Or=function(t,i,e){var n,r,o,s=this,u=go,a=i.path.length+1,c={};return e.isEqual(Vi.min())?(n=i.path.A(),c.range=IDBKeyRange.lowerBound(n)):(r=i.path.A(),o=ch(e),c.range=IDBKeyRange.lowerBound([r,o],!0),c.index=Hh.collectionReadTimeIndex),Sh(t).ss(c,function(t,e,n){var r;t.length===a&&(r=uh(s.serializer,e),i.path.T(r.key.path)?r instanceof Lu&&ea(i,r)&&(u=u.rt(r.key,r)):n.done())}).next(function(){return u})}
1,Ah.prototype.ia=function(t,e){var r=this,i=po,o=ch(e),n=Sh(t),s=IDBKeyRange.lowerBound(o,!0);return n.ss({index:Hh.readTimeIndex,range:s},function(t,e){var n=uh(r.serializer,e);i=i.rt(n.key,n),o=e.readTime}).next(function(){return{ra:i,readTime:hh(o)}})},Ah.prototype.oa=function(t){var e=Sh(t),r=Vi.min();return e.ss({index:Hh.readTimeIndex,reverse:!0},function(t,e,n){e.readTime&&(r=hh(e.readTime)),n.done()}).next(function(){return r})},Ah.prototype.aa=function(t){return new Ah.ca(this,!!t&&t.ua)},Ah.prototype.ha=function(t){return this.getMetadata(t).next(function(t){return t.byteSize})},Ah.prototype.getMetadata=function(t){return Nh(t).get(Qh.key).next(function(t){return qr(!!t),t})},Ah.prototype.Yo=function(t,e){return Nh(t).put(Qh.key,e)},Ah.prototype.Jo=function(t){if(t){var e=uh(this.serializer,t);return e instanceof Cu&&e.version.isEqual(Vi.min())?null:e}return null},Ah);function Ah(t,e){this.serializer=t,this.Sr=e}function Nh(t){return df.Un(t,Qh.store)}function Sh(t){return df.Un(t,Hh.store)}function Dh(t){return t.path.A()}function xh(t){var e;if(t.document)e=t.document;else if(t.unknownDocument)e=t.unknownDocument;else{if(!t.noDocument)throw Fr();e=t.noDocument}return JSON.stringify(e).length}function Oh(t,e){var n=this;return(n=Th.call(this)||this).la=t,n.ua=e,n._a=new Pi(function(t){return t.toString()},function(t,e){return t.isEqual(e)}),n}_h.ca=(o(Oh,Th=xc),Oh.prototype.gr=function(s){var u=this,a=[],c=0,h=new fo(function(t,e){return Ei(t.R(),e.R())});return this.dr.forEach(function(t,e){var n,r,i,o=u._a.get(t);e?(n=ah(u.la.serializer,e,u.readTime),h=h.add(t.path.h()),r=xh(n),c+=r-o,a.push(u.la.Tr(s,t,n))):(c-=o,u.ua?(i=ah(u.la.serializer,new Cu(t,Vi.min()),u.readTime),a.push(u.la.Tr(s,t,i))):a.push(u.la.Ir(s,t)))}),h.forEach(function(t){a.push(u.la.Sr.ko(s,t))}),a.push(this.la.updateMetadata(s,c)),Ua.xn(a)},Oh.prototype.Rr=function(t,e){var n=this;return this.la.Xo(t,e).next(function(t){return null===t?(n._a.set(e,0),null):(n._a.set(e,t.size),t.Zo)})},Oh.prototype.Pr=function(t,e){var n=this;return this.la.ea(t,e).next(function(t){var e=t.na;return t.sa.forEach(function(t,e){n._a.set(t,e)}),e})},Oh);var Rh=(Mh.prototype.ko=function(t,e){return this.fa.add(e),Ua.resolve()},Mh.prototype.Ur=function(t,e){return Ua.resolve(this.fa.getEntries(e))},Mh),kh=(Vh.prototype.add=function(t){var e=t._(),n=t.h(),r=this.index[e]||new fo(Kr.i),i=!r.has(n);return this.index[e]=r.add(n),i},Vh.prototype.has=function(t){var e=t._(),n=t.h(),r=this.index[e];return r&&r.has(n)},Vh.prototype.getEntries=function(t){return(this.index[t]||new fo(Kr.i)).A()},Vh),Lh=(Uh.prototype.createOrUpgrade=function(n,r,t,e){var i=this;qr(t<e&&0<=t&&e<=10);var o,s=new Qa(r);t<1&&1<=e&&(n.createObjectStore(Ph.store),(o=n).createObjectStore(Fh.store,{keyPath:Fh.keyPath}),o.createObjectStore(qh.store,{keyPath:qh.keyPath,autoIncrement:!0}).createIndex(qh.userMutationsIndex,qh.userMutationsKeyPath,{unique:!0}),o.createObjectStore(jh.store),$h(n),n.createObjectStore(Hh.store));var u,a=Ua.resolve();return t<3&&3<=e&&(0!==t&&((u=n).deleteObjectStore(Wh.store),u.deleteObjectStore(Kh.store),u.deleteObjectStore(Yh.store),$h(n)),a=a.next(function(){return t=s.store(Yh.store),e=new Yh(0,0,Vi.min().X(),0),t.put(Yh.key,e);var t,e})),t<4&&4<=e&&(0!==t&&(a=a.next(function(){return r=n,(i=s).store(qh.store).Zn().next(function(t){r.deleteObjectStore(qh.store),r.createObjectStore(qh.store,{keyPath:qh.keyPath,autoIncrement:!0}).createIndex(qh.userMutationsIndex,qh.userMutationsKeyPath,{unique:!0});var e=i.store(qh.store),n=t.map(function(t){return e.put(t)});return Ua.xn(n)});var r,i})),a=a.next(function(){n.createObjectStore(Jh.store,{keyPath:Jh.keyPath})})),t<5&&5<=e&&(a=a.next(function(){return i.removeAcknowledgedMutations(s)})),t<6&&6<=e&&(a=a.next(function(){return n.createObjectStore(Qh.store),i.addDocumentGlobal(s)})),t<7&&7<=e&&(a=a.next(function(){return i.ensureSequenceNumbers(s)})),t<8&&8<=e&&(a=a.next(function(){return i.createCollectionParentIndex(n,s)})),t<9&&9<=e&&(a=a.next(function(){var t,e;(e=n).objectStoreNames.contains("remoteDocumentChanges")&&e.deleteObjectStore("remoteDocumentChanges"),(t=r.objectStore(Hh.store)).createIndex(Hh.readTimeIndex,Hh.readTimeIndexPath,{unique:!1}),t.createIndex(Hh.collectionReadTimeIndex,Hh.collectionReadTimeIndexPath,{unique:!1})}
1)),t<10&&10<=e&&(a=a.next(function(){return i.rewriteCanonicalIds(s)})),a},Uh.prototype.addDocumentGlobal=function(e){var n=0;return e.store(Hh.store).ss(function(t,e){n+=xh(e)}).next(function(){var t=new Qh(n);return e.store(Qh.store).put(Qh.key,t)})},Uh.prototype.removeAcknowledgedMutations=function(r){var i=this,t=r.store(Fh.store),e=r.store(qh.store);return t.Zn().next(function(t){return Ua.forEach(t,function(n){var t=IDBKeyRange.bound([n.userId,-1],[n.userId,n.lastAcknowledgedBatchId]);return e.Zn(qh.userMutationsIndex,t).next(function(t){return Ua.forEach(t,function(t){qr(t.userId===n.userId);var e=ph(i.serializer,t);return wh(r,n.userId,e).next(function(){})})})})})},Uh.prototype.ensureSequenceNumbers=function(t){var s=t.store(Wh.store),e=t.store(Hh.store);return t.store(Yh.store).get(Yh.key).next(function(i){var o=[];return e.ss(function(t,e){var n=new Kr(t),r=[0,rh(n)];o.push(s.get(r).next(function(t){return t?Ua.resolve():s.put(new Wh(0,rh(n),i.highestListenSequenceNumber))}))}).next(function(){return Ua.xn(o)})})},Uh.prototype.createCollectionParentIndex=function(t,e){t.createObjectStore(Xh.store,{keyPath:Xh.keyPath});function i(t){if(o.add(t)){var e=t._(),n=t.h();return r.put({collectionId:e,parent:rh(n)})}}var r=e.store(Xh.store),o=new kh;return e.store(Hh.store).ss({ns:!0},function(t,e){var n=new Kr(t);return i(n.h())}).next(function(){return e.store(jh.store).ss({ns:!0},function(t,e){t[0];var n=t[1],r=(t[2],oh(n));return i(r.h())})})},Uh.prototype.rewriteCanonicalIds=function(t){var i=this,o=t.store(Kh.store);return o.ss(function(t,e){var n=dh(e),r=vh(i.serializer,n);return o.put(r)})},Uh),Ch=function(t,e){this.seconds=t,this.nanoseconds=e},Ph=function(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n};function Uh(t){this.serializer=t}function Vh(){this.index={}}function Mh(){this.fa=new kh}Ph.store="owner",Ph.key="owner";var Fh=function(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n};Fh.store="mutationQueues",Fh.keyPath="userId";var qh=function(t,e,n,r,i){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i};qh.store="mutations",qh.keyPath="batchId",qh.userMutationsIndex="userMutationsIndex",qh.userMutationsKeyPath=["userId","batchId"];var jh=(Gh.prefixForUser=function(t){return[t]},Gh.prefixForPath=function(t,e){return[t,rh(e)]},Gh.key=function(t,e,n){return[t,rh(e),n]},Gh);function Gh(){}jh.store="documentMutations",jh.PLACEHOLDER=new jh;var Bh=function(t,e){this.path=t,this.readTime=e},zh=function(t,e){this.path=t,this.version=e},Hh=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};Hh.store="remoteDocuments",Hh.readTimeIndex="readTimeIndex",Hh.readTimeIndexPath="readTime",Hh.collectionReadTimeIndex="collectionReadTimeIndex",Hh.collectionReadTimeIndexPath=["parentPath","readTime"];var Qh=function(t){this.byteSize=t};Qh.store="remoteDocumentGlobal",Qh.key="remoteDocumentGlobalKey";var Kh=function(t,e,n,r,i,o,s){this.targetId=t,this.canonicalId=e,this.readTime=n,this.resumeToken=r,this.lastListenSequenceNumber=i,this.lastLimboFreeSnapshotVersion=o,this.query=s};Kh.store="targets",Kh.keyPath="targetId",Kh.queryTargetsIndexName="queryTargetsIndex",Kh.queryTargetsKeyPath=["canonicalId","targetId"];var Wh=function(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n};Wh.store="targetDocuments",Wh.keyPath=["targetId","path"],Wh.documentTargetsIndex="documentTargetsIndex",Wh.documentTargetsKeyPath=["path","targetId"];var Yh=function(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r};Yh.key="targetGlobalKey",Yh.store="targetGlobal";var Xh=function(t,e){this.collectionId=t,this.parent=e};function $h(t){t.createObjectStore(Wh.store,{keyPath:Wh.keyPath}).createIndex(Wh.documentTargetsIndex,Wh.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(Kh.store,{keyPath:Kh.keyPath}).createIndex(Kh.queryTargetsIndexName,Kh.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(Yh.store)}Xh.store="collectionParents",Xh.keyPath=["collectionId","parent"];var Jh=function(t,e,n,r){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=r};Jh.store="clientMetadata",Jh.keyPath="clientId";var Zh=s(s(s([Fh.store,qh.store,jh.store,Hh.store,Kh.store,Ph.store,Yh.store,Wh.store],[Jh.store]),[Qh.store]),[Xh.store]),tf=(ef.prototype.ko=function(t,e){var n=this;if(this.da.has(e))return Ua.resolve();var r=e._(),i=e.h();t.Vr(function(){n.da.add(e)});var o={collectionId:r,parent:rh(i)};return nf(t).put(o)},ef.prototype.Ur=function(t,i){var o=[],e=IDBKeyRange.bound([i,""],[_i(i),""],!1,!0);return nf(t).Zn(e).next(function(t){for(var e=0,n=t;e<n.length;e++){var r=n[e];if(r.collectionId!==i)break;o.push(oh(r.parent))}return o}
1)},ef);function ef(){this.da=new kh}function nf(t){return df.Un(t,Xh.store)}var rf=(uf.prototype.next=function(){return this.wa+=2,this.wa},uf.ma=function(){return new uf(0)},uf.Ta=function(){return new uf(-1)},uf),of=(sf.prototype.Ea=function(n){var r=this;return this.Ia(n).next(function(t){var e=new rf(t.highestTargetId);return t.highestTargetId=e.next(),r.Aa(n,t).next(function(){return t.highestTargetId})})},sf.prototype.Ra=function(t){return this.Ia(t).next(function(t){return Vi.Y(new Ui(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))})},sf.prototype.Pa=function(t){return this.Ia(t).next(function(t){return t.highestListenSequenceNumber})},sf.prototype.ga=function(e,n,r){var i=this;return this.Ia(e).next(function(t){return t.highestListenSequenceNumber=n,r&&(t.lastRemoteSnapshotVersion=r.X()),n>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=n),i.Aa(e,t)})},sf.prototype.ya=function(e,n){var r=this;return this.Va(e,n).next(function(){return r.Ia(e).next(function(t){return t.targetCount+=1,r.pa(n,t),r.Aa(e,t)})})},sf.prototype.ba=function(t,e){return this.Va(t,e)},sf.prototype.va=function(e,t){var n=this;return this.Sa(e,t.targetId).next(function(){return af(e).delete(t.targetId)}).next(function(){return n.Ia(e)}).next(function(t){return qr(0<t.targetCount),--t.targetCount,n.Aa(e,t)})},sf.prototype.Vo=function(r,i,o){var s=this,u=0,a=[];return af(r).ss(function(t,e){var n=dh(e);n.sequenceNumber<=i&&null===o.get(n.targetId)&&(u++,a.push(s.va(r,n)))}).next(function(){return Ua.xn(a)}).next(function(){return u})},sf.prototype.De=function(t,r){return af(t).ss(function(t,e){var n=dh(e);r(n)})},sf.prototype.Ia=function(t){return cf(t).get(Yh.key).next(function(t){return qr(null!==t),t})},sf.prototype.Aa=function(t,e){return cf(t).put(Yh.key,e)},sf.prototype.Va=function(t,e){return af(t).put(vh(this.serializer,e))},sf.prototype.pa=function(t,e){var n=!1;return t.targetId>e.highestTargetId&&(e.highestTargetId=t.targetId,n=!0),t.sequenceNumber>e.highestListenSequenceNumber&&(e.highestListenSequenceNumber=t.sequenceNumber,n=!0),n},sf.prototype.Da=function(t){return this.Ia(t).next(function(t){return t.targetCount})},sf.prototype.Ca=function(t,i){var e=Wi(i),n=IDBKeyRange.bound([e,Number.NEGATIVE_INFINITY],[e,Number.POSITIVE_INFINITY]),o=null;return af(t).ss({range:n,index:Kh.queryTargetsIndexName},function(t,e,n){var r=dh(e);Yi(i,r.target)&&(o=r,n.done())}).next(function(){return o})},sf.prototype.Na=function(n,t,r){var i=this,o=[],s=hf(n);return t.forEach(function(t){var e=rh(t.path);o.push(s.put(new Wh(r,e))),o.push(i.Co.Fa(n,r,t))}),Ua.xn(o)},sf.prototype.xa=function(n,t,r){var i=this,o=hf(n);return Ua.forEach(t,function(t){var e=rh(t.path);return Ua.xn([o.delete([r,e]),i.Co.$a(n,r,t)])})},sf.prototype.Sa=function(t,e){var n=hf(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return n.delete(r)},sf.prototype.ka=function(t,e){var n=IDBKeyRange.bound([e],[e+1],!1,!0),r=hf(t),o=bo();return r.ss({range:n,ns:!0},function(t,e,n){var r=oh(t[1]),i=new Xr(r);o=o.add(i)}).next(function(){return o})},sf.prototype.zo=function(t,e){var n=rh(e.path),r=IDBKeyRange.bound([n],[_i(n)],!1,!0),i=0;return hf(t).ss({index:Wh.documentTargetsIndex,ns:!0,range:r},function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())}).next(function(){return 0<i})},sf.prototype.qe=function(t,e){return af(t).get(e).next(function(t){return t?dh(t):null})},sf);function sf(t,e){this.Co=t,this.serializer=e}function uf(t){this.wa=t}function af(t){return df.Un(t,Kh.store)}function cf(t){return df.Un(t,Yh.store)}function hf(t){return df.Un(t,Wh.store)}var ff,lf="Failed to obtain exclusive access to the persistence layer. To allow shared access, make sure to invoke `enablePersistence()` with `synchronizeTabs:true` in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",pf=(o(yf,ff=Rc),yf),df=(vf.Un=function(t,e){if(t instanceof pf)return Va.Un(t.Wo,e);throw Fr()},vf.prototype.start=function(){var e=this;return this.Ja().then(function(){if(!e.isPrimary&&!e.allowTabSynchronization)throw new Rr(Or.FAILED_PRECONDITION,lf);return e.Xa(),e.Za(),e.tc(),e.runTransaction("getHighestListenSequenceNumber","readonly",function(t){return e.Ha.Pa(t)})}
1).then(function(t){e.Ba=new vc(t,e.Oa)}).then(function(){e.qa=!0}).catch(function(t){return e.za&&e.za.close(),Promise.reject(t)})},vf.prototype.ec=function(n){var t=this;return this.Ka=function(e){return m(t,void 0,void 0,function(){return w(this,function(t){return this.Ti?[2,n(e)]:[2]})})},n(this.isPrimary)},vf.prototype.nc=function(n){var t=this;this.za.jn(function(e){return m(t,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return null===e.newVersion?[4,n()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})},vf.prototype.sc=function(t){var e=this;this.networkEnabled!==t&&(this.networkEnabled=t,this._n.ds(function(){return m(e,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return this.Ti?[4,this.Ja()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})}))},vf.prototype.Ja=function(){var n=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",function(e){return mf(e).put(new Jh(n.clientId,Date.now(),n.networkEnabled,n.inForeground)).next(function(){if(n.isPrimary)return n.ic(e).next(function(t){t||(n.isPrimary=!1,n._n.Ds(function(){return n.Ka(!1)}))})}).next(function(){return n.rc(e)}).next(function(t){return n.isPrimary&&!t?n.oc(e).next(function(){return!1}):!!t&&n.ac(e).next(function(){return!0})})}).catch(function(t){if(Ha(t))return Pr("IndexedDbPersistence","Failed to extend owner lease: ",t),n.isPrimary;if(!n.allowTabSynchronization)throw t;return Pr("IndexedDbPersistence","Releasing owner lease after error during lease refresh",t),!1}).then(function(t){n.isPrimary!==t&&n._n.Ds(function(){return n.Ka(t)}),n.isPrimary=t})},vf.prototype.ic=function(t){var e=this;return gf(t).get(Ph.key).next(function(t){return Ua.resolve(e.cc(t))})},vf.prototype.uc=function(t){return mf(t).delete(this.clientId)},vf.prototype.hc=function(){return m(this,void 0,void 0,function(){var e,n,r,i,o=this;return w(this,function(t){switch(t.label){case 0:return!this.isPrimary||this.lc(this.ja,18e5)?[3,2]:(this.ja=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",function(t){var r=vf.Un(t,Jh.store);return r.Zn().next(function(t){var e=o._c(t,18e5),n=t.filter(function(t){return-1===e.indexOf(t)});return Ua.forEach(n,function(t){return r.delete(t.clientId)}).next(function(){return n})})}).catch(function(){return[]})]);case 1:if(e=t.sent(),this.Ya)for(n=0,r=e;n<r.length;n++)i=r[n],this.Ya.removeItem(this.fc(i.clientId));t.label=2;case 2:return[2]}})})},vf.prototype.tc=function(){var t=this;this.Wa=this._n.gn("client_metadata_refresh",4e3,function(){return t.Ja().then(function(){return t.hc()}).then(function(){return t.tc()})})},vf.prototype.cc=function(t){return!!t&&t.ownerId===this.clientId},vf.prototype.rc=function(e){var i=this;return this.La?Ua.resolve(!0):gf(e).get(Ph.key).next(function(t){if(null!==t&&i.lc(t.leaseTimestampMs,5e3)&&!i.dc(t.ownerId)){if(i.cc(t)&&i.networkEnabled)return!0;if(!i.cc(t)){if(!t.allowTabSynchronization)throw new Rr(Or.FAILED_PRECONDITION,lf);return!1}}return!(!i.networkEnabled||!i.inForeground)||mf(e).Zn().next(function(t){return void 0===i._c(t,5e3).find(function(t){if(i.clientId!==t.clientId){var e=!i.networkEnabled&&t.networkEnabled,n=!i.inForeground&&t.inForeground,r=i.networkEnabled===t.networkEnabled;if(e||n&&r)return!0}return!1})})}).next(function(t){return i.isPrimary!==t&&Pr("IndexedDbPersistence","Client "+(t?"is":"is not")+" eligible for a primary lease."),t})},vf.prototype.Si=function(){return m(this,void 0,void 0,function(){var n=this;return w(this,function(t){switch(t.label){case 0:return this.qa=!1,this.wc(),this.Wa&&(this.Wa.cancel(),this.Wa=null),this.mc(),this.Tc(),[4,this.za.runTransaction("readwrite",[Ph.store,Jh.store],function(t){var e=new pf(t,vc.oi);return n.oc(e).next(function(){return n.uc(e)})})];case 1:return t.sent(),this.za.close(),this.Ec(),[2]}})})},vf.prototype._c=function(t,e){var n=this;return t.filter(function(t){return n.lc(t.updateTimeMs,e)&&!n.dc(t.clientId)})},vf.prototype.Vi=function(){var e=this;return this.runTransaction("getActiveClients","readonly",function(t){return mf(t).Zn().next(function(t){return e._c(t,18e5).map(function(t){return t.clientId})})})},Object.defineProperty(vf.prototype,"Ti",{get:function(){return this.qa}
1,enumerable:!1,configurable:!0}),vf.prototype.Ic=function(t){return yh.Fo(t,this.serializer,this.Sr,this.Co)},vf.prototype.Ac=function(){return this.Ha},vf.prototype.Rc=function(){return this.br},vf.prototype.Pc=function(){return this.Sr},vf.prototype.runTransaction=function(e,n,r){var i=this;Pr("IndexedDbPersistence","Starting transaction:",e);var o,t="readonly"===n?"readonly":"readwrite";return this.za.runTransaction(t,Zh,function(t){return o=new pf(t,i.Ba?i.Ba.next():vc.oi),"readwrite-primary"===n?i.ic(o).next(function(t){return!!t||i.rc(o)}).next(function(t){if(!t)throw Ur("Failed to obtain primary lease for action '"+e+"'."),i.isPrimary=!1,i._n.Ds(function(){return i.Ka(!1)}),new Rr(Or.FAILED_PRECONDITION,Oc);return r(o)}).next(function(t){return i.ac(o).next(function(){return t})}):i.gc(o).next(function(){return r(o)})}).then(function(t){return o.pr(),t})},vf.prototype.gc=function(t){var e=this;return gf(t).get(Ph.key).next(function(t){if(null!==t&&e.lc(t.leaseTimestampMs,5e3)&&!e.dc(t.ownerId)&&!e.cc(t)&&!(e.La||e.allowTabSynchronization&&t.allowTabSynchronization))throw new Rr(Or.FAILED_PRECONDITION,lf)})},vf.prototype.ac=function(t){var e=new Ph(this.clientId,this.allowTabSynchronization,Date.now());return gf(t).put(Ph.key,e)},vf.On=function(){return Va.On()},vf.prototype.oc=function(t){var e=this,n=gf(t);return n.get(Ph.key).next(function(t){return e.cc(t)?(Pr("IndexedDbPersistence","Releasing primary lease."),n.delete(Ph.key)):Ua.resolve()})},vf.prototype.lc=function(t,e){var n=Date.now();return!(t<n-e||n<t&&(Ur("Detected an update time that is in the future: "+t+" > "+n),1))},vf.prototype.Xa=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.Qa=function(){t._n.ds(function(){return t.inForeground="visible"===t.document.visibilityState,t.Ja()})},this.document.addEventListener("visibilitychange",this.Qa),this.inForeground="visible"===this.document.visibilityState)},vf.prototype.mc=function(){this.Qa&&(this.document.removeEventListener("visibilitychange",this.Qa),this.Qa=null)},vf.prototype.Za=function(){var t,e=this;"function"==typeof(null===(t=this.window)||void 0===t?void 0:t.addEventListener)&&(this.Ua=function(){e.wc(),e._n.ds(function(){return e.Si()})},this.window.addEventListener("unload",this.Ua))},vf.prototype.Tc=function(){this.Ua&&(this.window.removeEventListener("unload",this.Ua),this.Ua=null)},vf.prototype.dc=function(t){var e;try{var n=null!==(null===(e=this.Ya)||void 0===e?void 0:e.getItem(this.fc(t)));return Pr("IndexedDbPersistence","Client '"+t+"' "+(n?"is":"is not")+" zombied in LocalStorage"),n}catch(t){return Ur("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},vf.prototype.wc=function(){if(this.Ya)try{this.Ya.setItem(this.fc(this.clientId),String(Date.now()))}catch(t){Ur("Failed to set zombie client id.",t)}},vf.prototype.Ec=function(){if(this.Ya)try{this.Ya.removeItem(this.fc(this.clientId))}catch(t){}},vf.prototype.fc=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},vf);function vf(t,e,n,r,i,o,s,u,a,c){if(this.allowTabSynchronization=t,this.persistenceKey=e,this.clientId=n,this._n=i,this.window=o,this.document=s,this.Oa=a,this.La=c,this.Ba=null,this.qa=!1,this.isPrimary=!1,this.networkEnabled=!0,this.Ua=null,this.inForeground=!1,this.Qa=null,this.Wa=null,this.ja=Number.NEGATIVE_INFINITY,this.Ka=function(t){return Promise.resolve()},!vf.On())throw new Rr(Or.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.Co=new wf(this,r),this.Ga=e+"main",this.serializer=new sh(u),this.za=new Va(this.Ga,10,new Lh(this.serializer)),this.Ha=new of(this.Co,this.serializer),this.Sr=new tf,this.br=new _h(this.serializer,this.Sr),this.window&&this.window.localStorage?this.Ya=this.window.localStorage:(this.Ya=null,!1===c&&Ur("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}function yf(t,e){var n=this;return(n=ff.call(this)||this).Wo=t,n.Ma=e,n}function gf(t){return df.Un(t,Ph.store)}function mf(t){return df.Un(t,Jh.store)}var wf=(bf.prototype.Ro=function(t){var n=this.yc(t);return this.db.Ac().Da(t).next(function(e){return n.next(function(t){return e+t})})},bf.prototype.yc=function(t){var e=0;return this.yo(t,function(t){e++}).next(function(){return e})},bf.prototype.De=function(t,e){return this.db.Ac().De(t,e)},bf.prototype.yo=function(t,n){return this.Vc(t,function(t,e){return n(e)})},bf.prototype.Fa=function(t,e,n){return If(t,n)},bf.prototype.$a=function(t,e,n){return If(t,n)},bf.prototype.Vo=function(t,e,n){return this.db.Ac().Vo(t,e,n)},bf.prototype.Ko=If,bf.prototype.bc=function(t,e){return r=e,i=!1,Eh(n=t).rs(function(t){return mh(n,t,r).next(function(t){return t&&(i=!0),Ua.resolve(!t)})}).next(function(){return i});var n,r,i},bf.prototype.po=function(r,i){var o=this,s=this.db.Rc().aa(),u=[],a=0;return this.Vc(r,function(e,t){var n;t<=i&&(n=o.bc(r,e).next(function(t){if(!t)return a++,s.Ar(r,e).next(function(){return s.Ir(e),hf(r).delete([0,rh(e.path)])})}),u.push(n))}).next(function(){return Ua.xn(u)}).next(function(){return s.apply(r)}).next(function(){return a})},bf.prototype.removeTarget=function(t,e){var n=e.nt(t.Ma);return this.db.Ac().ba(t,n)},bf.prototype.vc=If,bf.prototype.Vc=function(t,o){var s,e=hf(t),u=vc.oi;return e.ss({index:Wh.documentTargetsIndex},function(t,e){var n=t[0],r=(t[1],e.path),i=e.sequenceNumber;0===n?(u!==vc.oi&&o(new Xr(oh(s)),u),u=i,s=r):u=vc.oi}).next(function(){u!==vc.oi&&o(new Xr(oh(s)),u)})},bf.prototype.vo=function(t){return this.db.Rc().ha(t)},bf);function bf(t,e){this.db=t,this.do=new th(this,e)}function If(t,e){return hf(t).put((n=t.Ma,new Wh(0,rh(e.path),n)));var n}function Ef(t,e){var n=t.projectId;return t.W||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}var Tf=(_f.prototype.Eo=function(e){var n=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(t){return e.bo(t,n.Dc)})},_f);function _f(t,e,n){this.persistence=t,this.Sc=e,this.Dc=new io(Ei),this.Cc=new Pi(Wi,Yi),this.Nc=Vi.min(),this.vr=t.Ic(n),this.Fc=t.Rc(),this.Ha=t.Ac(),this.xc=new kc(this.Fc,this.vr,this.persistence.Pc()),this.Sc.$c(this.xc)}function Af(t,h){var f=t;return f.persistence.runTransaction("Acknowledge batch","readwrite-primary",function(t){var e,n,i,o,s,r,u,a=h.batch.keys(),c=f.Fc.aa({ua:!0}
1);return e=f,n=t,o=c,s=(i=h).batch,r=s.keys(),u=Ua.resolve(),r.forEach(function(r){u=u.next(function(){return o.Ar(n,r)}).next(function(t){var e=t,n=i._r.get(r);qr(null!==n),(!e||e.version.L(n)<0)&&(e=s.ar(r,e,i))&&o.Tr(e,i.lr)})}),u.next(function(){return e.vr.Qo(n,s)}).next(function(){return c.apply(t)}).next(function(){return f.vr.Go(t)}).next(function(){return f.xc.$r(t,a)})})}function Nf(t){var e=t;return e.persistence.runTransaction("Get last remote snapshot version","readonly",function(t){return e.Ha.Ra(t)})}function Sf(t,s){var h=t,f=s.et,l=h.Dc;return h.persistence.runTransaction("Apply remote event","readwrite-primary",function(a){var i=h.Fc.aa({ua:!0});l=h.Dc;var c=[];s.Gt.forEach(function(t,e){var n,r,i,o,s,u=l.get(e);u&&(c.push(h.Ha.xa(a,t.ne,e).next(function(){return h.Ha.Na(a,t.te,e)})),0<(n=t.resumeToken).O()&&(r=u.st(n,f).nt(a.Ma),l=l.rt(e,r),i=u,s=t,qr(0<(o=r).resumeToken.O()),(0===i.resumeToken.O()||3e8<=o.et.J()-i.et.J()||0<s.te.size+s.ee.size+s.ne.size)&&c.push(h.Ha.ba(a,r))))});var t,o=po,n=bo();return s.Ht.forEach(function(t,e){n=n.add(t)}),c.push(i.getEntries(a,n).next(function(r){s.Ht.forEach(function(t,e){var n=r.get(t);e instanceof Cu&&e.version.isEqual(Vi.min())?(i.Ir(t,f),o=o.rt(t,e)):null==n||0<e.version.L(n.version)||0===e.version.L(n.version)&&n.hasPendingWrites?(i.Tr(e,f),o=o.rt(t,e)):Pr("LocalStore","Ignoring outdated watch update for ",t,". Current version:",n.version," Watch version:",e.version),s.Yt.has(t)&&c.push(h.persistence.Co.vc(a,t))})})),f.isEqual(Vi.min())||(t=h.Ha.Ra(a).next(function(t){return h.Ha.ga(a,a.Ma,f)}),c.push(t)),Ua.xn(c).next(function(){return i.apply(a)}).next(function(){return h.xc.kr(a,o)})}).then(function(t){return h.Dc=l,t})}function Df(t,r){var i=t;return i.persistence.runTransaction("Allocate target","readwrite",function(e){var n;return i.Ha.Ca(e,r).next(function(t){return t?(n=t,Ua.resolve(n)):i.Ha.Ea(e).next(function(t){return n=new to(r,t,0,e.Ma),i.Ha.ya(e,n).next(function(){return n})})})}).then(function(t){var e=i.Dc.get(t.targetId);return(null===e||0<t.et.L(e.et))&&(i.Dc=i.Dc.rt(t.targetId,t),i.Cc.set(r,t.targetId)),t})}function xf(o,s,u){return m(this,void 0,void 0,function(){var e,n,r,i;return w(this,function(t){switch(t.label){case 0:n=(e=o).Dc.get(s),r=u?"readwrite":"readwrite-primary",t.label=1;case 1:return t.trys.push([1,4,,5]),u?[3,3]:[4,e.persistence.runTransaction("Release target",r,function(t){return e.persistence.Co.removeTarget(t,n)})];case 2:t.sent(),t.label=3;case 3:return[3,5];case 4:if(!Ha(i=t.sent()))throw i;return Pr("LocalStore","Failed to update sequence numbers for target "+s+": "+i),[3,5];case 5:return e.Dc=e.Dc.remove(s),e.Cc.delete(n.target),[2]}})})}function Of(t,s,u){var a=t,c=Vi.min(),h=bo();return a.persistence.runTransaction("Execute query","readonly",function(e){return t=a,n=e,r=Wu(s),(void 0!==(o=(i=t).Cc.get(r))?Ua.resolve(i.Dc.get(o)):i.Ha.Ca(n,r)).next(function(t){if(t)return c=t.lastLimboFreeSnapshotVersion,a.Ha.ka(e,t.targetId).next(function(t){h=t})}).next(function(){return a.Sc.Or(e,s,u?c:Vi.min(),u?h:bo())}).next(function(t){return{documents:t,kc:h}});var t,n,r,i,o})}function Rf(t,e){var n=t,r=n.Ha,i=n.Dc.get(e);return i?Promise.resolve(i.target):n.persistence.runTransaction("Get target data","readonly",function(t){return r.qe(t,e).next(function(t){return t?t.target:null})})}function kf(e){return m(this,void 0,void 0,function(){return w(this,function(t){if(e.code!==Or.FAILED_PRECONDITION||e.message!==Oc)throw e;return Pr("LocalStore","Unexpectedly lost primary lease"),[2]})})}function Lf(t,e){this.user=e,this.type="OAuth",this.zc={},this.zc.Authorization="Bearer "+t}function Cf(t,e,n,r,i){var o=this;this.Gu=t,this.zu=e,this.os=n,this.Hu={},this.Yu=[],this.Ju=new Map,this.Xu=new Set,this.Zu=[],this.th=i,this.th.eh(function(t){n.ds(function(){return m(o,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return vl(this)?(Pr("RemoteStore","Restarting streams for network reachability change."),[4,function(n){return m(this,void 0,void 0,function(){var e;return w(this,function(t){switch(t.label){case 0:return(e=n).Xu.add(4),[4,ul(e)];case 1:return t.sent(),e.nh.set("Unknown"),e.Xu.delete(4),[4,sl(e)];case 2:return t.sent(),[2]}})})}(this)]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})}),this.nh=new Wf(n,r)}var Pf,Uf,Vf,Mf=(ol.prototype.m=function(){return this.Mc.m()},ol.prototype.Fa=function(t,e){var n=new Ff(t,e);this.Mc=this.Mc.add(n),this.Lc=this.Lc.add(n)},ol.prototype.qc=function(t,e){var n=this;t.forEach(function(t){return n.Fa(t,e)})},ol.prototype.$a=function(t,e){this.Uc(new Ff(t,e))},ol.prototype.Qc=function(t,e){var n=this;t.forEach(function(t){return n.$a(t,e)})},ol.prototype.Wc=function(t){var e=this,n=new Xr(new Kr([])),r=new Ff(n,t),i=new Ff(n,t+1),o=[];return this.Lc.Nt([r,i],function(t){e.Uc(t),o.push(t.key)}),o},ol.prototype.jc=function(){var e=this;this.Mc.forEach(function(t){return e.Uc(t)})},ol.prototype.Uc=function(t){this.Mc=this.Mc.delete(t),this.Lc=this.Lc.delete(t)},ol.prototype.Kc=function(t){var e=new Xr(new Kr([])),n=new Ff(e,t),r=new Ff(e,t+1),i=bo();return this.Lc.Nt([n,r],function(t){i=i.add(t.key)}),i},ol.prototype.zo=function(t){var e=new Ff(t,0),n=this.Mc.xt(e);return null!==n&&t.isEqual(n.key)},ol),Ff=(il.Oc=function(t,e){return Xr.i(t.key,e.key)||Ei(t.Gc,e.Gc)},il.Bc=function(t,e){return Ei(t.Gc,e.Gc)||Xr.i(t.key,e.key)},il),qf=(rl.prototype.getToken=function(){return Promise.resolve(null)},rl.prototype.Yc=function(){},rl.prototype.Jc=function(t){(this.Hc=t)(lc.UNAUTHENTICATED)},rl.prototype.Xc=function(){this.Hc=null},rl),jf=(nl.prototype.getToken=function(){var e=this,n=this.eu,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(function(t){return e.eu!==n?(Pr("FirebaseCredentialsProvider","getToken aborted due to token change."),e.getToken()):t?(qr("string"==typeof t.accessToken),new Lf(t.accessToken,e.currentUser)):null}):Promise.resolve(null)},nl.prototype.Yc=function(){this.forceRefresh=!0},nl.prototype.Jc=function(t){this.Hc=t,this.tu&&t(this.currentUser)},nl.prototype.Xc=function(){this.auth&&this.auth.removeAuthTokenListener(this.Zc),this.Zc=null,this.Hc=null},nl.prototype.nu=function(){var t=this.auth&&this.auth.getUid();return qr(null===t||"string"==typeof t),new lc(t)},nl),Gf=(Object.defineProperty(el.prototype,"zc",{get:function(){var t={"X-Goog-AuthUser":this.iu},e=this.su.auth.getAuthHeaderValueForFirstParty([]);return e&&(t.Authorization=e),t}
1,enumerable:!1,configurable:!0}),el),Bf=(tl.prototype.getToken=function(){return Promise.resolve(new Gf(this.su,this.iu))},tl.prototype.Jc=function(t){t(lc.ei)},tl.prototype.Xc=function(){},tl.prototype.Yc=function(){},tl),zf=(Zf.prototype.hu=function(){return 1===this.state||2===this.state||4===this.state},Zf.prototype.lu=function(){return 2===this.state},Zf.prototype.start=function(){3!==this.state?this.auth():this._u()},Zf.prototype.stop=function(){return m(this,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return this.hu()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},Zf.prototype.fu=function(){this.state=0,this.gs.reset()},Zf.prototype.du=function(){var t=this;this.lu()&&null===this.uu&&(this.uu=this._n.gn(this.ru,6e4,function(){return t.wu()}))},Zf.prototype.mu=function(t){this.Tu(),this.stream.send(t)},Zf.prototype.wu=function(){return m(this,void 0,void 0,function(){return w(this,function(t){return this.lu()?[2,this.close(0)]:[2]})})},Zf.prototype.Tu=function(){this.uu&&(this.uu.cancel(),this.uu=null)},Zf.prototype.close=function(e,n){return m(this,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return this.Tu(),this.gs.cancel(),this.cu++,3!==e?this.gs.reset():n&&n.code===Or.RESOURCE_EXHAUSTED?(Ur(n.toString()),Ur("Using maximum backoff delay to prevent overloading the backend."),this.gs.An()):n&&n.code===Or.UNAUTHENTICATED&&this.au.Yc(),null!==this.stream&&(this.Eu(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.Iu(n)];case 1:return t.sent(),[2]}})})},Zf.prototype.Eu=function(){},Zf.prototype.auth=function(){var n=this;this.state=1;var t=this.Au(this.cu),e=this.cu;this.au.getToken().then(function(t){n.cu===e&&n.Ru(t)},function(e){t(function(){var t=new Rr(Or.UNKNOWN,"Fetching auth token failed: "+e.message);return n.Pu(t)})})},Zf.prototype.Ru=function(t){var e=this,n=this.Au(this.cu);this.stream=this.gu(t),this.stream.yu(function(){n(function(){return e.state=2,e.listener.yu()})}),this.stream.Iu(function(t){n(function(){return e.Pu(t)})}),this.stream.onMessage(function(t){n(function(){return e.onMessage(t)})})},Zf.prototype._u=function(){var t=this;this.state=4,this.gs.Rn(function(){return m(t,void 0,void 0,function(){return w(this,function(t){return this.state=0,this.start(),[2]})})})},Zf.prototype.Pu=function(t){return Pr("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},Zf.prototype.Au=function(e){var n=this;return function(t){n._n.ds(function(){return n.cu===e?t():(Pr("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},Zf),Hf=(o(Jf,Vf=zf),Jf.prototype.gu=function(t){return this.ou.Vu("Listen",t)},Jf.prototype.onMessage=function(t){this.gs.reset();var e=function(t,e){var n,r,i,o;if("targetChange"in e){e.targetChange;var s="NO_CHANGE"===(o=e.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===o?1:"REMOVE"===o?2:"CURRENT"===o?3:"RESET"===o?4:Fr(),u=e.targetChange.targetIds||[],a=(i=e.targetChange.resumeToken,t.Ue?(qr(void 0===i||"string"==typeof i),Ai.fromBase64String(i||"")):(qr(void 0===i||i instanceof Uint8Array),Ai.fromUint8Array(i||new Uint8Array))),c=e.targetChange.cause,h=c&&(r=void 0===(n=c).code?Or.UNKNOWN:ro(n.code),new Rr(r,n.message||"")),f=new xo(s,u,a,h||null)}else if("documentChange"in e){e.documentChange;var l=e.documentChange;l.document,l.document.name,l.document.updateTime;var p=gs(t,l.document.name),d=ps(l.document.updateTime),v=new Tu({mapValue:{fields:l.document.fields}}),y=new Lu(p,d,v,{}),g=l.targetIds||[],m=l.removedTargetIds||[];f=new So(g,m,y.key,y)}else if("documentDelete"in e){e.documentDelete;var w=e.documentDelete;w.document;var b=gs(t,w.document),I=w.readTime?ps(w.readTime):Vi.min(),E=new Cu(b,I),T=w.removedTargetIds||[];f=new So([],T,E.key,E)}else if("documentRemove"in e){e.documentRemove;var _=e.documentRemove;_.document;var A=gs(t,_.document),N=_.removedTargetIds||[];f=new So([],N,A,null)}else{if(!("filter"in e))return Fr();e.filter;var S=e.filter;S.targetId;var D=S.count||0,x=new $i(D),O=S.targetId;f=new Do(O,x)}return f}(this.serializer,t),n=function(t){if(!("targetChange"in t))return Vi.min();var e=t.targetChange;return(!e.targetIds||!e.targetIds.length)&&e.readTime?ps(e.readTime):Vi.min()}(t);return this.listener.pu(e,n)},Jf.prototype.bu=function(t){var e,n,r,i,o={};o.database=bs(this.serializer),o.addTarget=(e=this.serializer,i=(n=t).target,(r=Xi(i)?{documents:As(e,i)}:{query:Ns(e,i)}).targetId=n.targetId,0<n.resumeToken.O()&&(r.resumeToken=ls(e,n.resumeToken)),r);var s,u,a=(this.serializer,s=t,null==(u=function(){switch(s.tt){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Fr()}}())?null:{"goog-listen-tags":u});a&&(o.labels=a),this.mu(o)},Jf.prototype.vu=function(t){var e={};e.database=bs(this.serializer),e.removeTarget=t,this.mu(e)},Jf),Qf=(o($f,Uf=zf),Object.defineProperty($f.prototype,"Du",{get:function(){return this.Su}
1,enumerable:!1,configurable:!0}),$f.prototype.start=function(){this.Su=!1,this.lastStreamToken=void 0,Uf.prototype.start.call(this)},$f.prototype.Eu=function(){this.Su&&this.Cu([])},$f.prototype.gu=function(t){return this.ou.Vu("Write",t)},$f.prototype.onMessage=function(t){if(qr(!!t.streamToken),this.lastStreamToken=t.streamToken,this.Su){this.gs.reset();var e=(r=t.writeResults,i=t.commitTime,r&&0<r.length?(qr(void 0!==i),r.map(function(t){return function(t,e){var n=t.updateTime?ps(t.updateTime):ps(e);n.isEqual(Vi.min())&&(n=ps(e));var r=null;return t.transformResults&&0<t.transformResults.length&&(r=t.transformResults),new Zs(n,r)}(t,i)})):[]),n=ps(t.commitTime);return this.listener.Nu(n,e)}var r,i;return qr(!t.writeResults||0===t.writeResults.length),this.Su=!0,this.listener.Fu()},$f.prototype.xu=function(){var t={};t.database=bs(this.serializer),this.mu(t)},$f.prototype.Cu=function(t){var e=this,n={streamToken:this.lastStreamToken,writes:t.map(function(t){return Ts(e.serializer,t)})};this.mu(n)},$f),Kf=(o(Xf,Pf=function(){}),Xf.prototype.ku=function(){if(this.$u)throw new Rr(Or.FAILED_PRECONDITION,"The client has already been terminated.")},Xf.prototype.Mu=function(e,n,r){var i=this;return this.ku(),this.credentials.getToken().then(function(t){return i.ou.Mu(e,n,r,t)}).catch(function(t){throw t.code===Or.UNAUTHENTICATED&&i.credentials.Yc(),t})},Xf.prototype.Ou=function(e,n,r){var i=this;return this.ku(),this.credentials.getToken().then(function(t){return i.ou.Ou(e,n,r,t)}).catch(function(t){throw t.code===Or.UNAUTHENTICATED&&i.credentials.Yc(),t})},Xf.prototype.terminate=function(){this.$u=!1},Xf),Wf=(Yf.prototype.Uu=function(){var t=this;0===this.Lu&&(this.Qu("Unknown"),this.Bu=this.os.gn("online_state_timeout",1e4,function(){return t.Bu=null,t.Wu("Backend didn't respond within 10 seconds."),t.Qu("Offline"),Promise.resolve()}))},Yf.prototype.ju=function(t){"Online"===this.state?this.Qu("Unknown"):(this.Lu++,1<=this.Lu&&(this.Ku(),this.Wu("Connection failed 1 times. Most recent error: "+t.toString()),this.Qu("Offline")))},Yf.prototype.set=function(t){this.Ku(),this.Lu=0,"Online"===t&&(this.qu=!1),this.Qu(t)},Yf.prototype.Qu=function(t){t!==this.state&&(this.state=t,this.fi(t))},Yf.prototype.Wu=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.qu?(Ur(e),this.qu=!1):Pr("OnlineStateTracker",e)},Yf.prototype.Ku=function(){null!==this.Bu&&(this.Bu.cancel(),this.Bu=null)},Yf);function Yf(t,e){this.os=t,this.fi=e,this.state="Unknown",this.Lu=0,this.Bu=null,this.qu=!0}function Xf(t,e,n){var r=this;return(r=Pf.call(this)||this).credentials=t,r.ou=e,r.serializer=n,r.$u=!1,r}function $f(t,e,n,r,i){var o=this;return(o=Uf.call(this,t,"write_stream_connection_backoff","write_stream_idle",e,n,i)||this).serializer=r,o.Su=!1,o}function Jf(t,e,n,r,i){var o=this;return(o=Vf.call(this,t,"listen_stream_connection_backoff","listen_stream_idle",e,n,i)||this).serializer=r,o}function Zf(t,e,n,r,i,o){this._n=t,this.ru=n,this.ou=r,this.au=i,this.listener=o,this.state=0,this.cu=0,this.uu=null,this.stream=null,this.gs=new Pa(t,e)}function tl(t,e){this.su=t,this.iu=e}function el(t,e){this.su=t,this.iu=e,this.type="FirstParty",this.user=lc.ei}function nl(t){var e=this;this.Zc=null,this.currentUser=lc.UNAUTHENTICATED,this.tu=!1,this.eu=0,this.Hc=null,this.forceRefresh=!1,this.Zc=function(){e.eu++,e.currentUser=e.nu(),e.tu=!0,e.Hc&&e.Hc(e.currentUser)},this.eu=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.Zc):(this.Zc(null),t.get().then(function(t){e.auth=t,e.Zc&&e.auth.addAuthTokenListener(e.Zc)},function(){}))}function rl(){this.Hc=null}function il(t,e){this.key=t,this.Gc=e}function ol(){this.Mc=new fo(Ff.Oc),this.Lc=new fo(Ff.Bc)}function sl(r){return m(this,void 0,void 0,function(){var e,n;return w(this,function(t){switch(t.label){case 0:if(!vl(r))return[3,4];e=0,n=r.Zu,t.label=1;case 1:return e<n.length?[4,(0,n[e])(!0)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})}function ul(r){return m(this,void 0,void 0,function(){var e,n;return w(this,function(t){switch(t.label){case 0:e=0,n=r.Zu,t.label=1;case 1:return e<n.length?[4,(0,n[e])(!1)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})}function al(n){return m(this,void 0,void 0,function(){var e;return w(this,function(t){switch(t.label){case 0:return e=n,Pr("RemoteStore","RemoteStore shutting down."),e.Xu.add(5),[4,ul(e)];case 1:return t.sent(),e.th.Si(),e.nh.set("Unknown"),[2]}})})}function cl(t,e){var n=t;n.Ju.has(e.targetId)||(n.Ju.set(e.targetId,e),dl(n)?pl(n):_l(n).lu()&&fl(n,e))}function hl(t,e){var n=t,r=_l(n);n.Ju.delete(e),r.lu()&&ll(n,e),0===n.Ju.size&&(r.lu()?r.du():vl(n)&&n.nh.set("Unknown"))}function fl(t,e){t.sh.Ee(e.targetId),_l(t).bu(e)}function ll(t,e){t.sh.Ee(e),_l(t).vu(e)}function pl(e){e.sh=new Ro({Be:function(t){return e.Hu.Be(t)},qe:function(t){return e.Ju.get(t)||null}}),_l(e).start(),e.nh.Uu()}function dl(t){return vl(t)&&!_l(t).hu()&&0<t.Ju.size}function vl(t){return 0===t.Xu.size}function yl(t){t.sh=void 0}function gl(u,a,c){return m(this,void 0,void 0,function(){var n,o,s;return w(this,function(t){switch(t.label){case 0:if(u.nh.set("Online"),!(a instanceof xo&&2===a.state&&a.cause))return[3,6];t.label=1;case 1:return t.trys.push([1,3,,5]),[4,function(o,s){return m(this,void 0,void 0,function(){var e,n,r,i;return w(this,function(t){switch(t.label){case 0:e=s.cause,n=0,r=s.targetIds,t.label=1;case 1:return n<r.length?(i=r[n],o.Ju.has(i)?[4,o.Hu.ih(i,e)]:[3,3]):[3,5];case 2:t.sent(),o.Ju.delete(i),o.sh.removeTarget(i),t.label=3;case 3:t.label=4;case 4:return n++,[3,1];case 5:return[2]}})})}(u,a)];case 2:return t.sent(),[3,5];case 3:return n=t.sent(),Pr("RemoteStore","Failed to remove targets %s: %s ",a.targetIds.join(","),n),[4,ml(u,n)];case 4:return t.sent(),[3,5];case 5:return[3,13];case 6:if(a instanceof So?u.sh.pe(a):a instanceof Do?u.sh.xe(a):u.sh.Se(a),c.isEqual(Vi.min()))return[3,13];t.label=7;case 7:return t.trys.push([7,11,,13]),[4,Nf(u.Gu)];case 8:return o=t.sent(),0<=c.L(o)?[4,(i=c,(e=(r=u).sh.Me(i)).Gt.forEach(function(t,e){var n;
10<t.resumeToken.O()&&((n=r.Ju.get(e))&&r.Ju.set(e,n.st(t.resumeToken,i)))}),e.zt.forEach(function(t){var e,n=r.Ju.get(t);n&&(r.Ju.set(t,n.st(Ai.B,n.et)),ll(r,t),e=new to(n.target,t,1,n.sequenceNumber),fl(r,e))}),r.Hu.rh(e))]:[3,10];case 9:t.sent(),t.label=10;case 10:return[3,13];case 11:return Pr("RemoteStore","Failed to raise snapshot:",s=t.sent()),[4,ml(u,s)];case 12:return t.sent(),[3,13];case 13:return[2]}var r,i,e})})}function ml(n,r,i){return m(this,void 0,void 0,function(){var e=this;return w(this,function(t){switch(t.label){case 0:if(!Ha(r))throw r;return n.Xu.add(1),[4,ul(n)];case 1:return t.sent(),n.nh.set("Offline"),i=i||function(){return Nf(n.Gu)},n.os.Ds(function(){return m(e,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return Pr("RemoteStore","Retrying IndexedDB access"),[4,i()];case 1:return t.sent(),n.Xu.delete(1),[4,sl(n)];case 2:return t.sent(),[2]}})})}),[2]}})})}function wl(e,n){return n().catch(function(t){return ml(e,t,n)})}function bl(c){return m(this,void 0,void 0,function(){var i,o,s,u,a;return w(this,function(t){switch(t.label){case 0:o=Al(i=c),s=0<i.Yu.length?i.Yu[i.Yu.length-1].batchId:-1,t.label=1;case 1:if(!(vl(i)&&i.Yu.length<10))return[3,7];t.label=2;case 2:return t.trys.push([2,4,,6]),[4,(e=i.Gu,n=s,(r=e).persistence.runTransaction("Get next mutation batch","readonly",function(t){return void 0===n&&(n=-1),r.vr.Lo(t,n)}))];case 3:return null===(u=t.sent())?(0===i.Yu.length&&o.du(),[3,7]):(s=u.batchId,function(t,e){t.Yu.push(e);var n=Al(t);n.lu()&&n.Du&&n.Cu(e.mutations)}(i,u),[3,6]);case 4:return a=t.sent(),[4,ml(i,a)];case 5:return t.sent(),[3,6];case 6:return[3,1];case 7:return Il(i)&&El(i),[2]}var e,n,r})})}function Il(t){return vl(t)&&!Al(t).hu()&&0<t.Yu.length}function El(t){Al(t).start()}function Tl(n,r){return m(this,void 0,void 0,function(){var e;return w(this,function(t){switch(t.label){case 0:return e=n,r?(e.Xu.delete(2),[4,sl(e)]):[3,2];case 1:return t.sent(),[3,5];case 2:return r?[3,4]:(e.Xu.add(2),[4,ul(e)]);case 3:t.sent(),e.nh.set("Unknown"),t.label=4;case 4:t.label=5;case 5:return[2]}})})}function _l(n){var t,e,r,i,o=this;return n.uh||(n.uh=(t=n.zu,e=n.os,r={yu:function(n){return m(this,void 0,void 0,function(){return w(this,function(t){return n.Ju.forEach(function(t,e){fl(n,t)}),[2]})})}.bind(null,n),Iu:function(e,n){return m(this,void 0,void 0,function(){return w(this,function(t){return yl(e),dl(e)?(e.nh.ju(n),pl(e)):e.nh.set("Unknown"),[2]})})}.bind(null,n),pu:gl.bind(null,n)},(i=t).ku(),new Hf(e,i.ou,i.credentials,i.serializer,r)),n.Zu.push(function(e){return m(o,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return e?(n.uh.fu(),dl(n)?pl(n):n.nh.set("Unknown"),[3,3]):[3,1];case 1:return[4,n.uh.stop()];case 2:t.sent(),yl(n),t.label=3;case 3:return[2]}})})})),n.uh}function Al(n){var t,e,r,i,o=this;return n.hh||(n.hh=(t=n.zu,e=n.os,r={yu:function(e){return m(this,void 0,void 0,function(){return w(this,function(t){return Al(e).xu(),[2]})})}.bind(null,n),Iu:function(e,n){return m(this,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return n&&Al(e).Du?[4,function(r,i){return m(this,void 0,void 0,function(){var e,n;return w(this,function(t){switch(t.label){case 0:return no(n=i.code)&&n!==Or.ABORTED?(e=r.Yu.shift(),Al(r).fu(),[4,wl(r,function(){return r.Hu.ah(e.batchId,i)})]):[3,3];case 1:return t.sent(),[4,bl(r)];case 2:t.sent(),t.label=3;case 3:return[2]}})})}(e,n)]:[3,2];case 1:t.sent(),t.label=2;case 2:return Il(e)&&El(e),[2]}})})}.bind(null,n),Fu:function(o){return m(this,void 0,void 0,function(){var e,n,r,i;return w(this,function(t){for(e=Al(o),n=0,r=o.Yu;n<r.length;n++)i=r[n],e.Cu(i.mutations);return[2]})})}.bind(null,n),Nu:function(r,i,o){return m(this,void 0,void 0,function(){var e,n;return w(this,function(t){switch(t.label){case 0:return e=r.Yu.shift(),n=Dc.from(e,i,o),[4,wl(r,function(){return r.Hu.oh(n)})];case 1:return t.sent(),[4,bl(r)];case 2:return t.sent(),[2]}})})}.bind(null,n)},(i=t).ku(),new Qf(e,i.ou,i.credentials,i.serializer,r)),n.Zu.push(function(e){return m(o,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return e?(n.hh.fu(),[4,bl(n)]):[3,2];case 1:return t.sent(),[3,4];case 2:return[4,n.hh.stop()];case 3:t.sent(),0<n.Yu.length&&(Pr("RemoteStore","Stopping write stream with "+n.Yu.length+" pending writes"),n.Yu=[]),t.label=4;case 4:return[2]}})})})),n.hh}var Nl=function(t){this.key=t},Sl=function(t){this.key=t},Dl=(Object.defineProperty(Ll.prototype,"mh",{get:function(){return this.lh}
1,enumerable:!1,configurable:!0}),Ll.prototype.Th=function(t,e){var u=this,a=e?e.Eh:new To,c=e?e.wh:this.wh,h=e?e.Qt:this.Qt,f=c,l=!1,p=Gu(this.query)&&c.size===this.query.limit?c.last():null,d=Bu(this.query)&&c.size===this.query.limit?c.first():null;if(t.ut(function(t,e){var n=c.get(t),r=(r=e instanceof Lu?e:null)&&(ea(u.query,r)?r:null),i=!!n&&u.Qt.has(n.key),o=!!r&&(r.Ye||u.Qt.has(r.key)&&r.hasCommittedMutations),s=!1;n&&r?n.data().isEqual(r.data())?i!==o&&(a.track({type:3,doc:r}),s=!0):u.Ih(n,r)||(a.track({type:2,doc:r}),s=!0,(p&&0<u.dh(r,p)||d&&u.dh(r,d)<0)&&(l=!0)):!n&&r?(a.track({type:0,doc:r}),s=!0):n&&!r&&(a.track({type:1,doc:n}),s=!0,(p||d)&&(l=!0)),s&&(h=r?(f=f.add(r),o?h.add(t):h.delete(t)):(f=f.delete(t),h.delete(t)))}),Gu(this.query)||Bu(this.query))for(;f.size>this.query.limit;){var n=Gu(this.query)?f.last():f.first(),f=f.delete(n.key),h=h.delete(n.key);a.track({type:1,doc:n})}return{wh:f,Eh:a,Ah:l,Qt:h}},Ll.prototype.Ih=function(t,e){return t.Ye&&e.hasCommittedMutations&&!e.Ye},Ll.prototype.gr=function(t,e,n){var o=this,r=this.wh;this.wh=t.wh,this.Qt=t.Qt;var i=t.Eh.qt();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.dh(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 Fr()}}var r,i}),this.Rh(n);var s=e?this.Ph():[],u=0===this.fh.size&&this.Zt?1:0,a=u!==this._h;return this._h=u,0!==i.length||a?{snapshot:new _o(this.query,t.wh,r,i,t.Qt,0==u,a,!1),gh:s}:{gh:s}},Ll.prototype.Us=function(t){return this.Zt&&"Offline"===t?(this.Zt=!1,this.gr({wh:this.wh,Eh:new To,Qt:this.Qt,Ah:!1},!1)):{gh:[]}},Ll.prototype.yh=function(t){return!this.lh.has(t)&&!!this.wh.has(t)&&!this.wh.get(t).Ye},Ll.prototype.Rh=function(t){var e=this;t&&(t.te.forEach(function(t){return e.lh=e.lh.add(t)}),t.ee.forEach(function(t){}),t.ne.forEach(function(t){return e.lh=e.lh.delete(t)}),this.Zt=t.Zt)},Ll.prototype.Ph=function(){var e=this;if(!this.Zt)return[];var n=this.fh;this.fh=bo(),this.wh.forEach(function(t){e.yh(t.key)&&(e.fh=e.fh.add(t.key))});var r=[];return n.forEach(function(t){e.fh.has(t)||r.push(new Sl(t))}),this.fh.forEach(function(t){n.has(t)||r.push(new Nl(t))}),r},Ll.prototype.Vh=function(t){this.lh=t.kc,this.fh=bo();var e=this.Th(t.documents);return this.gr(e,!0)},Ll.prototype.ph=function(){return _o.Kt(this.query,this.wh,this.Qt,0===this._h)},Ll),xl=function(t,e,n){this.query=t,this.targetId=e,this.view=n},Ol=function(t){this.key=t,this.bh=!1},Rl=(Object.defineProperty(kl.prototype,"Wh",{get:function(){return!0===this.Qh},enumerable:!1,configurable:!0}),kl);function kl(t,e,n,r,i,o){this.Gu=t,this.Sh=e,this.Dh=n,this.Ch=r,this.currentUser=i,this.Nh=o,this.Fh={},this.xh=new Pi(Zu,Ju),this.$h=new Map,this.kh=[],this.Mh=new io(Xr.i),this.Oh=new Map,this.Lh=new Mf,this.Bh={},this.qh=new Map,this.Uh=rf.Ta(),this.onlineState="Unknown",this.Qh=void 0}function Ll(t,e){this.query=t,this.lh=e,this._h=null,this.Zt=!1,this.fh=bo(),this.Qt=bo(),this.dh=na(t),this.wh=new Eo(this.dh)}function Cl(u,a,c,h){return m(this,void 0,void 0,function(){var e,n,r,i,o,s;return w(this,function(t){switch(t.label){case 0:return u.jh=function(t,e,n){return function(i,o,s,u){return m(this,void 0,void 0,function(){var n,e,r;return w(this,function(t){switch(t.label){case 0:return(n=o.view.Th(s)).Ah?[4,Of(i.Gu,o.query,!1).then(function(t){var e=t.documents;return o.view.Th(e,n)})]:[3,2];case 1:n=t.sent(),t.label=2;case 2:return e=u&&u.Gt.get(o.targetId),r=o.view.gr(n,i.Wh,e),[2,(Gl(i,o.targetId,r.gh),r.snapshot)]}})})}(u,t,e,n)},[4,Of(u.Gu,a,!0)];case 1:return e=t.sent(),n=new Dl(a,e.kc),r=n.Th(e.documents),i=No.Xt(c,h&&"Offline"!==u.onlineState),o=n.gr(r,u.Wh,i),Gl(u,c,o.gh),s=new xl(a,c,n),[2,(u.xh.set(a,s),u.$h.has(c)?u.$h.get(c).push(a):u.$h.set(c,[a]),o.snapshot)]}})})}function Pl(n,i){return m(this,void 0,void 0,function(){var r,e;return w(this,function(t){switch(t.label){case 0:r=n,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,Sf(r.Gu,i)];case 2:return e=t.sent(),i.Gt.forEach(function(t,e){var n=r.Oh.get(e);n&&(qr(t.te.size+t.ee.size+t.ne.size<=1),0<t.te.size?n.bh=!0:0<t.ee.size?qr(n.bh):0<t.ne.size&&(qr(n.bh),n.bh=!1))}),[4,zl(r,e,i)];case 3:return t.sent(),[3,6];case 4:return[4,kf(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})}function Ul(t,r,e){var i,n=t;
1(n.Wh&&0===e||!n.Wh&&1===e)&&(i=[],n.xh.forEach(function(t,e){var n=e.view.Us(r);n.snapshot&&i.push(n.snapshot)}),function(t,i){var e=t;e.onlineState=i;var o=!1;e.Ls.forEach(function(t,e){for(var n=0,r=e.listeners;n<r.length;n++)r[n].Us(i)&&(o=!0)}),o&&hc(e)}(n.Dh,r),i.length&&n.Fh.pu(i),n.onlineState=r,n.Wh&&n.Ch.ji(r))}function Vl(s,u,a){return m(this,void 0,void 0,function(){var n,o;return w(this,function(t){switch(t.label){case 0:n=s,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,(e=n.Gu,r=u,(i=e).persistence.runTransaction("Reject batch","readwrite-primary",function(e){var n;return i.vr.Mo(e,r).next(function(t){return qr(null!==t),n=t.keys(),i.vr.Qo(e,t)}).next(function(){return i.vr.Go(e)}).next(function(){return i.xc.$r(e,n)})}))];case 2:return o=t.sent(),Fl(n,u,a),Ml(n,u),n.Ch.$i(u,"rejected",a),[4,zl(n,o)];case 3:return t.sent(),[3,6];case 4:return[4,kf(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}var e,r,i})})}function Ml(t,e){(t.qh.get(e)||[]).forEach(function(t){t.resolve()}),t.qh.delete(e)}function Fl(t,e,n){var r,i=t,o=i.Bh[i.currentUser.Zs()];o&&((r=o.get(e))&&(n?r.reject(n):r.resolve(),o=o.remove(e)),i.Bh[i.currentUser.Zs()]=o)}function ql(e,t,n){void 0===n&&(n=null),e.Ch.Li(t);for(var r=0,i=e.$h.get(t);r<i.length;r++){var o=i[r];e.xh.delete(o),n&&e.Fh.Kh(o,n)}e.$h.delete(t),e.Wh&&e.Lh.Wc(t).forEach(function(t){e.Lh.zo(t)||jl(e,t)})}function jl(t,e){var n=t.Mh.get(e);null!==n&&(hl(t.Sh,n),t.Mh=t.Mh.remove(e),t.Oh.delete(n),Bl(t))}function Gl(t,e,n){for(var r,i,o=0,s=n;o<s.length;o++){var u=s[o];u instanceof Nl?(t.Lh.Fa(u.key,e),r=t,i=void 0,i=u.key,r.Mh.get(i)||(Pr("SyncEngine","New document in limbo: "+i),r.kh.push(i),Bl(r))):u instanceof Sl?(Pr("SyncEngine","Document no longer in limbo: "+u.key),t.Lh.$a(u.key,e),t.Lh.zo(u.key)||jl(t,u.key)):Fr()}}function Bl(t){for(;0<t.kh.length&&t.Mh.size<t.Nh;){var e=t.kh.shift(),n=t.Uh.next();t.Oh.set(n,new Ol(e)),t.Mh=t.Mh.rt(e,n),cl(t.Sh,new to(Wu(ju(e.path)),n,2,vc.oi))}}function zl(n,s,u){return m(this,void 0,void 0,function(){var r,i,o,e;return w(this,function(t){switch(t.label){case 0:return i=[],o=[],e=[],(r=n).xh.m()?[3,3]:(r.xh.forEach(function(t,n){e.push(r.jh(n,s,u).then(function(t){var e;t&&(r.Wh&&r.Ch.Ui(n.targetId,t.fromCache?"not-current":"current"),i.push(t),e=Lc.Gr(n.targetId,t),o.push(e))}))}),[4,Promise.all(e)]);case 1:return t.sent(),r.Fh.pu(i),[4,function(h,f){return m(this,void 0,void 0,function(){var r,e,n,i,o,s,u,a,c;return w(this,function(t){switch(t.label){case 0:r=h,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,r.persistence.runTransaction("notifyLocalViewChanges","readwrite",function(n){return Ua.forEach(f,function(e){return Ua.forEach(e.jr,function(t){return r.persistence.Co.Fa(n,e.targetId,t)}).next(function(){return Ua.forEach(e.Kr,function(t){return r.persistence.Co.$a(n,e.targetId,t)})})})})];case 2:return t.sent(),[3,4];case 3:if(!Ha(e=t.sent()))throw e;return Pr("LocalStore","Failed to update sequence numbers: "+e),[3,4];case 4:for(n=0,i=f;n<i.length;n++)o=i[n],s=o.targetId,o.fromCache||(u=r.Dc.get(s),a=u.et,c=u.it(a),r.Dc=r.Dc.rt(s,c));return[2]}})})}(r.Gu,o)];case 2:t.sent(),t.label=3;case 3:return[2]}})})}function Hl(i,o){return m(this,void 0,void 0,function(){var n,r;return w(this,function(t){switch(t.label){case 0:return(n=i).currentUser.isEqual(o)?[3,3]:(Pr("SyncEngine","User change. New user:",o.Zs()),[4,function(i,o){return m(this,void 0,void 0,function(){var e,n,m,r;return w(this,function(t){switch(t.label){case 0:return n=(e=i).vr,m=e.xc,[4,e.persistence.runTransaction("Handle user change","readonly",function(y){var g;return e.vr.qo(y).next(function(t){return g=t,n=e.persistence.Ic(o),m=new kc(e.Fc,n,e.persistence.Pc()),n.qo(y)}).next(function(t){for(var e=[],n=[],r=bo(),i=0,o=g;i<o.length;i++){var s=o[i];e.push(s.batchId);for(var u=0,a=s.mutations;u<a.length;u++)var c=a[u],r=r.add(c.key)}for(var h=0,f=t;h<f.length;h++){var l=f[h];n.push(l.batchId);for(var p=0,d=l.mutations;p<d.length;p++){var v=d[p];r=r.add(v.key)}}return m.$r(y,r).next(function(t){return{Gh:t,zh:e,Hh:n}})})})];case 1:return r=t.sent(),[2,(e.vr=n,e.xc=m,e.Sc.$c(e.xc),r)]}})})}(n.Gu,o)]);case 1:return r=t.sent(),n.currentUser=o,(e=n).qh.forEach(function(t){t.forEach(function(t){t.reject(new Rr(Or.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))})}),e.qh.clear(),n.Ch.Wi(o,r.zh,r.Hh),[4,zl(n,r.Gh)];case 2:t.sent(),t.label=3;case 3:return[2]}var e})})}function Ql(u,a,c,h){return m(this,void 0,void 0,function(){var o,s;return w(this,function(t){switch(t.label){case 0:return[4,(e=(o=u).Gu,n=a,i=(r=e).vr,r.persistence.runTransaction("Lookup mutation documents","readonly",function(e){return i.Oo(e,n).next(function(t){return t?r.xc.$r(e,t):Ua.resolve(null)})}
1))];case 1:return null===(s=t.sent())?[3,6]:"pending"!==c?[3,3]:[4,bl(o.Sh)];case 2:return t.sent(),[3,4];case 3:"acknowledged"===c||"rejected"===c?(Fl(o,a,h||null),Ml(o,a),o.Gu.vr.jo(a)):Fr(),t.label=4;case 4:return[4,zl(o,s)];case 5:return t.sent(),[3,7];case 6:Pr("SyncEngine","Cannot apply mutation batch with id: "+a),t.label=7;case 7:return[2]}var e,n,r,i})})}function Kl(h,f){return m(this,void 0,void 0,function(){var r,e,i,o,s,u,a,c;return w(this,function(t){switch(t.label){case 0:return $l(r=h),Jl(r),!0!==f||!0===r.Qh?[3,3]:(e=r.Ch.Di(),[4,Wl(r,e.A())]);case 1:return i=t.sent(),r.Qh=!0,[4,Tl(r.Sh,!0)];case 2:for(t.sent(),o=0,s=i;o<s.length;o++)u=s[o],cl(r.Sh,u);return[3,7];case 3:return!1!==f||!1===r.Qh?[3,7]:(a=[],c=Promise.resolve(),r.$h.forEach(function(t,e){r.Ch.Bi(e)?a.push(e):c=c.then(function(){return ql(r,e),xf(r.Gu,e,!0)}),hl(r.Sh,e)}),[4,c]);case 4:return t.sent(),[4,Wl(r,a)];case 5:return t.sent(),(n=r).Oh.forEach(function(t,e){hl(n.Sh,e)}),n.Lh.jc(),n.Oh=new Map,n.Mh=new io(Xr.i),r.Qh=!1,[4,Tl(r.Sh,!1)];case 6:t.sent(),t.label=7;case 7:return[2]}var n})})}function Wl(v,y){return m(this,void 0,void 0,function(){var e,n,r,i,o,s,u,a,c,h,f,l,p,d;return w(this,function(t){switch(t.label){case 0:e=v,n=[],r=[],i=0,o=y,t.label=1;case 1:return i<o.length?(s=o[i],u=void 0,(a=e.$h.get(s))&&0!==a.length?[4,Df(e.Gu,Wu(a[0]))]:[3,7]):[3,13];case 2:u=t.sent(),c=0,h=a,t.label=3;case 3:return c<h.length?(f=h[c],l=e.xh.get(f),[4,function(i,o){return m(this,void 0,void 0,function(){var e,n,r;return w(this,function(t){switch(t.label){case 0:return[4,Of((e=i).Gu,o.query,!0)];case 1:return n=t.sent(),r=o.view.Vh(n),[2,(e.Wh&&Gl(e,o.targetId,r.gh),r)]}})})}(e,l)]):[3,6];case 4:(p=t.sent()).snapshot&&r.push(p.snapshot),t.label=5;case 5:return c++,[3,3];case 6:return[3,11];case 7:return[4,Rf(e.Gu,s)];case 8:return d=t.sent(),[4,Df(e.Gu,d)];case 9:return u=t.sent(),[4,Cl(e,Yl(d),s,!1)];case 10:t.sent(),t.label=11;case 11:n.push(u),t.label=12;case 12:return i++,[3,1];case 13:return[2,(e.Fh.pu(r),n)]}})})}function Yl(t){return qu(t.path,t.collectionGroup,t.orderBy,t.filters,t.limit,"F",t.startAt,t.endAt)}function Xl(s,u,a,c){return m(this,void 0,void 0,function(){var n,i,o;return w(this,function(t){switch(t.label){case 0:return(n=s).Qh?(Pr("SyncEngine","Ignoring unexpected query state notification."),[3,8]):[3,1];case 1:if(!n.$h.has(u))return[3,8];switch(a){case"current":case"not-current":return[3,2];case"rejected":return[3,5]}return[3,7];case 2:return[4,(r=n.Gu,e=r.Fc,r.persistence.runTransaction("Get new document changes","readonly",function(t){return e.ia(t,r.Nc)}).then(function(t){var e=t.ra,n=t.readTime;return r.Nc=n,e}))];case 3:return i=t.sent(),o=Ao.Jt(u,"current"===a),[4,zl(n,i,o)];case 4:return t.sent(),[3,8];case 5:return[4,xf(n.Gu,u,!0)];case 6:return t.sent(),ql(n,u,c),[3,8];case 7:Fr(),t.label=8;case 8:return[2]}var r,e})})}function $l(t){var e=t;return e.Sh.Hu.rh=Pl.bind(null,e),e.Sh.Hu.Be=function(t,e){var n=t,r=n.Oh.get(e);if(r&&r.bh)return bo().add(r.key);var i=bo(),o=n.$h.get(e);if(!o)return i;for(var s=0,u=o;s<u.length;s++)var a=u[s],c=n.xh.get(a),i=i.$t(c.view.mh);return i}.bind(null,e),e.Sh.Hu.ih=function(u,a,c){return m(this,void 0,void 0,function(){var e,n,r,i,o,s;return w(this,function(t){switch(t.label){case 0:return(e=u).Ch.Ui(a,"rejected",c),n=e.Oh.get(a),(r=n&&n.key)?(i=(i=new io(Xr.i)).rt(r,new Cu(r,Vi.min())),o=bo().add(r),s=new Ao(Vi.min(),new Map,new fo(Ei),i,o),[4,Pl(e,s)]):[3,2];case 1:return t.sent(),e.Mh=e.Mh.remove(r),e.Oh.delete(a),Bl(e),[3,4];case 2:return[4,xf(e.Gu,a,!1).then(function(){return ql(e,a,c)}).catch(kf)];case 3:t.sent(),t.label=4;case 4:return[2]}})})}.bind(null,e),e.Fh.pu=function(t,e){for(var n=t,r=!1,i=0,o=e;i<o.length;i++){var s=o[i],u=s.query,a=n.Ls.get(u);if(a){for(var c=0,h=a.listeners;c<h.length;c++)h[c].Qs(s)&&(r=!0);a.Os=s}}r&&hc(n)}.bind(null,e.Dh),e.Fh.Kh=function(t,e,n){var r=t,i=r.Ls.get(e);if(i)for(var o=0,s=i.listeners;o<s.length;o++)s[o].onError(n);r.Ls.delete(e)}.bind(null,e.Dh),e}function Jl(t){var e=t;return e.Sh.Hu.oh=function(i,o){return m(this,void 0,void 0,function(){var e,n,r;return w(this,function(t){switch(t.label){case 0:e=i,n=o.batch.batchId,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,Af(e.Gu,o)];case 2:return r=t.sent(),Fl(e,n,null),Ml(e,n),e.Ch.$i(n,"acknowledged"),[4,zl(e,r)];case 3:return t.sent(),[3,6];case 4:return[4,kf(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})}.bind(null,e),e.Sh.Hu.ah=Vl.bind(null,e),e}var Zl,tp=(op.prototype.$c=function(t){this.Yh=t},op.prototype.Or=function(e,r,i,o){var s=this;return 0===r.filters.length&&null===r.limit&&null==r.startAt&&null==r.endAt&&(0===r.rn.length||1===r.rn.length&&r.rn[0].field.p())||i.isEqual(Vi.min())?this.Jh(e,r):this.Yh.$r(e,o).next(function(t){var n=s.Xh(r,t);return(Gu(r)||Bu(r))&&s.Ah(r.on,n,o,i)?s.Jh(e,r):(Cr()<=l.DEBUG&&Pr("IndexFreeQueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),ta(r)),s.Yh.Or(e,r,i).next(function(e){return n.forEac
1h(function(t){e=e.rt(t.key,t)}),e}))})},op.prototype.Xh=function(n,t){var r=new fo(na(n));return t.forEach(function(t,e){e instanceof Lu&&ea(n,e)&&(r=r.add(e))}),r},op.prototype.Ah=function(t,e,n,r){if(n.size!==e.size)return!0;var i="F"===t?e.last():e.first();return!!i&&(i.hasPendingWrites||0<i.version.L(r))},op.prototype.Jh=function(t,e){return Cr()<=l.DEBUG&&Pr("IndexFreeQueryEngine","Using full collection scan to execute query:",ta(e)),this.Yh.Or(t,e,Vi.min())},op),ep=(ip.prototype.xo=function(t){return Ua.resolve(0===this.vr.length)},ip.prototype.$o=function(t,e,n,r){var i=this.Zh;this.Zh++,0<this.vr.length&&this.vr[this.vr.length-1];var o=new Sc(i,e,n,r);this.vr.push(o);for(var s=0,u=r;s<u.length;s++){var a=u[s];this.tl=this.tl.add(new Ff(a.key,i)),this.Sr.ko(t,a.key.path.h())}return Ua.resolve(o)},ip.prototype.Mo=function(t,e){return Ua.resolve(this.el(e))},ip.prototype.Lo=function(t,e){var n=e+1,r=this.nl(n),i=r<0?0:r;return Ua.resolve(this.vr.length>i?this.vr[i]:null)},ip.prototype.Bo=function(){return Ua.resolve(0===this.vr.length?-1:this.Zh-1)},ip.prototype.qo=function(t){return Ua.resolve(this.vr.slice())},ip.prototype.Cr=function(t,e){var n=this,r=new Ff(e,0),i=new Ff(e,Number.POSITIVE_INFINITY),o=[];return this.tl.Nt([r,i],function(t){var e=n.el(t.Gc);o.push(e)}),Ua.resolve(o)},ip.prototype.Mr=function(t,e){var r=this,i=new fo(Ei);return e.forEach(function(t){var e=new Ff(t,0),n=new Ff(t,Number.POSITIVE_INFINITY);r.tl.Nt([e,n],function(t){i=i.add(t.Gc)})}),Ua.resolve(this.sl(i))},ip.prototype.Qr=function(t,e){var n=e.path,r=n.length+1,i=n;Xr.F(i)||(i=i.child(""));var o=new Ff(new Xr(i),0),s=new fo(Ei);return this.tl.Ft(function(t){var e=t.key.path;return!!n.T(e)&&(e.length===r&&(s=s.add(t.Gc)),!0)},o),Ua.resolve(this.sl(s))},ip.prototype.sl=function(t){var n=this,r=[];return t.forEach(function(t){var e=n.el(t);null!==e&&r.push(e)}),r},ip.prototype.Qo=function(n,r){var i=this;qr(0===this.il(r.batchId,"removed")),this.vr.shift();var o=this.tl;return Ua.forEach(r.mutations,function(t){var e=new Ff(t.key,r.batchId);return o=o.delete(e),i.Co.Ko(n,t.key)}).next(function(){i.tl=o})},ip.prototype.jo=function(t){},ip.prototype.zo=function(t,e){var n=new Ff(e,0),r=this.tl.xt(n);return Ua.resolve(e.isEqual(r&&r.key))},ip.prototype.Go=function(t){return this.vr.length,Ua.resolve()},ip.prototype.il=function(t,e){return this.nl(t)},ip.prototype.nl=function(t){return 0===this.vr.length?0:t-this.vr[0].batchId},ip.prototype.el=function(t){var e=this.nl(t);return e<0||e>=this.vr.length?null:this.vr[e]},ip),np=(rp.prototype.Tr=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,s=this.rl(e);return this.docs=this.docs.rt(r,{Zo:e,size:s,readTime:n}),this.size+=s-o,this.Sr.ko(t,r.path.h())},rp.prototype.Ir=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},rp.prototype.Ar=function(t,e){var n=this.docs.get(e);return Ua.resolve(n?n.Zo:null)},rp.prototype.getEntries=function(t,e){var n=this,r=po;return e.forEach(function(t){var e=n.docs.get(t);r=r.rt(t,e?e.Zo:null)}),Ua.resolve(r)},rp.prototype.Or=function(t,e,n){for(var r=go,i=new Xr(e.path.child("")),o=this.docs._t(i);o.It();){var s=o.Et(),u=s.key,a=s.value,c=a.Zo,h=a.readTime;if(!e.path.T(u.path))break;h.L(n)<=0||c instanceof Lu&&ea(e,c)&&(r=r.rt(c.key,c))}return Ua.resolve(r)},rp.prototype.ol=function(t,e){return Ua.forEach(this.docs,function(t){return e(t)})},rp.prototype.aa=function(t){return new rp.ca(this)},rp.prototype.ha=function(t){return Ua.resolve(this.size)},rp);function rp(t,e){this.Sr=t,this.rl=e,this.docs=new io(Xr.i),this.size=0}function ip(t,e){this.Sr=t,this.Co=e,this.vr=[],this.Zh=1,this.tl=new fo(Ff.Oc)}function op(){}function sp(t){var e=this;return(e=Zl.call(this)||this).la=t,e}np.ca=(o(sp,Zl=xc),sp.prototype.gr=function(n){var r=this,i=[];return this.dr.forEach(function(t,e){e?i.push(r.la.Tr(n,e,r.readTime)):r.la.Ir(t)}),Ua.xn(i)},sp.prototype.Rr=function(t,e){return this.la.Ar(t,e)},sp.prototype.Pr=function(t,e){return this.la.getEntries(t,e)},sp);var up,ap,cp=(Np.prototype.De=function(t,n){return this.al.forEach(function(t,e){return n(e)}),Ua.resolve()},Np.prototype.Ra=function(t){return Ua.resolve(this.lastRemoteSnapshotVersion)},Np.prototype.Pa=function(t){return Ua.resolve(this.cl)},Np.prototype.Ea=function(t){return this.highestTargetId=this.hl.next(),Ua.resolve(this.highestTargetId)},Np.prototype.ga=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.cl&&(this.cl=e),Ua.resolve()},Np.prototype.Va=function(t){this.al.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.hl=new rf(e),this.highestTargetId=e),t.sequenceNumber>this.cl&&(this.cl=t.sequenceNumber)},Np.prototype.ya=function(t,e){return this.Va(e),this.targetCount+=1,Ua.resolve()},Np.prototype.ba=function(t,e){return this.Va(e),Ua.resolve()},Np.prototype.va=function(t,e){return this.al.delete(e.target),this.ul.Wc(e.targetId),--this.targetCount,Ua.resolve()},Np.prototype.Vo=function(n,r,i){var o=this,s=0,u=[];return this.al.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.al.delete(t),u.push(o.Sa(n,e.targetId)),s++)}),Ua.xn(u).next(function(){return s})},Np.prototype.Da=function(t){return Ua.resolve(this.targetCount)},Np.prototype.Ca=function(t,e){var n=this.al.get(e)||null;return Ua.resolve(n)},Np.prototype.Na=function(t,e,n){return this.ul.qc(e,n),Ua.resolve()},Np.prototype.xa=function(e,t,n){this.ul.Qc(t,n);var r=this.persistence.Co,i=[];return r&&t.forEach(function(t){i.push(r.Ko(e,t))}),Ua.xn(i)},Np.prototype.Sa=function(t,e){return this.ul.Wc(e),Ua.resolve()},Np.prototype.ka=function(t,e){var n=this.ul.Kc(e);return Ua.resolve(n)},Np.prototype.zo=function(t,e){return Ua.resolve(this.ul.zo(e))},Np),hp=(Ap.prototype.start=function(){return Promise.resolve()},Ap.prototype.Si=function(){return this.qa=!1,Promise.resolve()},Object.defineProperty(Ap.prototype,"Ti",{get:function(){return this.qa}
1,enumerable:!1,configurable:!0}),Ap.prototype.nc=function(){},Ap.prototype.sc=function(){},Ap.prototype.Pc=function(){return this.Sr},Ap.prototype.Ic=function(t){var e=this.ll[t.Zs()];return e||(e=new ep(this.Sr,this.Co),this.ll[t.Zs()]=e),e},Ap.prototype.Ac=function(){return this.Ha},Ap.prototype.Rc=function(){return this.br},Ap.prototype.runTransaction=function(t,e,n){var r=this;Pr("MemoryPersistence","Starting transaction:",t);var i=new fp(this.Ba.next());return this.Co.fl(),n(i).next(function(t){return r.Co.dl(i).next(function(){return t})}).Nn().then(function(t){return i.pr(),t})},Ap.prototype.wl=function(e,n){return Ua.$n(Object.values(this.ll).map(function(t){return function(){return t.zo(e,n)}}))},Ap),fp=(o(_p,ap=Rc),_p),lp=(Tp.El=function(t){return new Tp(t)},Object.defineProperty(Tp.prototype,"Il",{get:function(){if(this.Tl)return this.Tl;throw Fr()},enumerable:!1,configurable:!0}),Tp.prototype.Fa=function(t,e,n){return this.ml.Fa(n,e),this.Il.delete(n.toString()),Ua.resolve()},Tp.prototype.$a=function(t,e,n){return this.ml.$a(n,e),this.Il.add(n.toString()),Ua.resolve()},Tp.prototype.Ko=function(t,e){return this.Il.add(e.toString()),Ua.resolve()},Tp.prototype.removeTarget=function(t,e){var n=this;this.ml.Wc(e.targetId).forEach(function(t){return n.Il.add(t.toString())});var r=this.persistence.Ac();return r.ka(t,e.targetId).next(function(t){t.forEach(function(t){return n.Il.add(t.toString())})}).next(function(){return r.va(t,e)})},Tp.prototype.fl=function(){this.Tl=new Set},Tp.prototype.dl=function(n){var r=this,i=this.persistence.Rc().aa();return Ua.forEach(this.Il,function(t){var e=Xr.D(t);return r.Al(n,e).next(function(t){t||i.Ir(e)})}).next(function(){return r.Tl=null,i.apply(n)})},Tp.prototype.vc=function(t,e){var n=this;return this.Al(t,e).next(function(t){t?n.Il.delete(e.toString()):n.Il.add(e.toString())})},Tp.prototype._l=function(t){return 0},Tp.prototype.Al=function(t,e){var n=this;return Ua.$n([function(){return Ua.resolve(n.ml.zo(e))},function(){return n.persistence.Ac().zo(t,e)},function(){return n.persistence.wl(t,e)}])},Tp),pp=(Ep.prototype.yu=function(t){this.gl=t},Ep.prototype.Iu=function(t){this.yl=t},Ep.prototype.onMessage=function(t){this.Vl=t},Ep.prototype.close=function(){this.Pl()},Ep.prototype.send=function(t){this.Rl(t)},Ep.prototype.pl=function(){this.gl()},Ep.prototype.bl=function(t){this.yl(t)},Ep.prototype.vl=function(t){this.Vl(t)},Ep),dp={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery"},vp=(Ip.prototype.Mu=function(e,t,n,r){var i=this.Nl(e,t);Pr("RestConnection","Sending: ",i,n);var o={};return this.Fl(o,r),this.xl(e,i,o,n).then(function(t){return Pr("RestConnection","Received: ",t),t},function(t){throw Vr("RestConnection",e+" failed with error: ",t,"url: ",i,"request:",n),t})},Ip.prototype.Ou=function(t,e,n,r){return this.Mu(t,e,n,r)},Ip.prototype.Fl=function(t,e){if(t["X-Goog-Api-Client"]="gl-js/ fire/7.21.1",t["Content-Type"]="text/plain",e)for(var n in e.zc)e.zc.hasOwnProperty(n)&&(t[n]=e.zc[n])},Ip.prototype.Nl=function(t,e){var n=dp[t];return this.Dl+"/v1/"+e+":"+n},o(bp,up=Ip),bp.prototype.xl=function(a,e,n,r){return new Promise(function(o,s){var u=new Nr;u.listenOnce(_r.COMPLETE,function(){try{switch(u.getLastErrorCode()){case Tr.NO_ERROR:var t=u.getResponseJson();Pr("Connection","XHR received:",JSON.stringify(t)),o(t);break;case Tr.TIMEOUT:Pr("Connection",'RPC "'+a+'" timed out'),s(new Rr(Or.DEADLINE_EXCEEDED,"Request time out"));break;case Tr.HTTP_ERROR:var e,n,r=u.getStatus();Pr("Connection",'RPC "'+a+'" failed with status:',r,"response text:",u.getResponseText()),0<r?(e=u.getResponseJson().error)&&e.status&&e.message?(i=e.status.toLowerCase().replace("_","-"),n=0<=Object.values(Or).indexOf(i)?i:Or.UNKNOWN,s(new Rr(n,e.message))):s(new Rr(Or.UNKNOWN,"Server responded with status "+u.getStatus())):s(new Rr(Or.UNAVAILABLE,"Connection failed."));break;default:Fr()}}finally{Pr("Connection",'RPC "'+a+'" completed.')}var i});var t=JSON.stringify(r);u.send(e,"POST",t,n,15)})},bp.prototype.Vu=function(t,e){var n,r,i=[this.Dl,"/","google.firestore.v1.Firestore","/",t,"/channel"],o=Er(),s={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.U.projectId+"/databases/"+this.U.database}
1,sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling};this.Fl(s.initMessageHeaders,e),"undefined"!=typeof window&&(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(v())||"object"==typeof navigator&&"ReactNative"===navigator.product||0<=v().indexOf("Electron/")||(0<=(r=v()).indexOf("MSIE ")||0<=r.indexOf("Trident/"))||0<=v().indexOf("MSAppHost/")||"object"==typeof(n="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0)&&void 0!==n.id||(s.httpHeadersOverwriteParam="$httpHeaders");var u=i.join("");Pr("Connection","Creating WebChannel: "+u,s);function a(t,e){c.listen(t,function(t){try{e(t)}catch(t){setTimeout(function(){throw t},0)}})}var c=o.createWebChannel(u,s),h=!1,f=!1,l=new pp({Rl:function(t){f?Pr("Connection","Not sending because WebChannel is closed:",t):(h||(Pr("Connection","Opening WebChannel transport."),c.open(),h=!0),Pr("Connection","WebChannel sending:",t),c.send(t))},Pl:function(){return c.close()}});return a(Ar.EventType.OPEN,function(){f||Pr("Connection","WebChannel transport opened.")}),a(Ar.EventType.CLOSE,function(){f||(f=!0,Pr("Connection","WebChannel transport closed"),l.bl())}),a(Ar.EventType.ERROR,function(t){f||(f=!0,Vr("Connection","WebChannel transport errored:",t),l.bl(new Rr(Or.UNAVAILABLE,"The operation could not be completed")))}),a(Ar.EventType.MESSAGE,function(t){var e,n,r,i,o,s;f||(qr(!!(n=t.data[0])),(r=n.error||(null===(e=n[0])||void 0===e?void 0:e.error))?(Pr("Connection","WebChannel received error:",r),i=r.status,o=function(){var t=Ji[i];if(void 0!==t)return ro(t)}(),s=r.message,void 0===o&&(o=Or.INTERNAL,s="Unknown error status: "+i+" with message "+r.message),f=!0,l.bl(new Rr(o,s)),c.close()):(Pr("Connection","WebChannel received:",n),l.vl(n)))}),setTimeout(function(){l.pl()},0),l},bp),yp=(wp.prototype.eh=function(t){this.Ll.push(t)},wp.prototype.Si=function(){window.removeEventListener("online",this.$l),window.removeEventListener("offline",this.Ml)},wp.prototype.Bl=function(){window.addEventListener("online",this.$l),window.addEventListener("offline",this.Ml)},wp.prototype.kl=function(){Pr("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.Ll;t<e.length;t++)(0,e[t])(0)},wp.prototype.Ol=function(){Pr("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(var t=0,e=this.Ll;t<e.length;t++)(0,e[t])(1)},wp.On=function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener},wp),gp=(mp.prototype.eh=function(t){},mp.prototype.Si=function(){},mp);function mp(){}function wp(){var t=this;this.$l=function(){return t.kl()},this.Ml=function(){return t.Ol()},this.Ll=[],this.Bl()}function bp(t){var e=this;return(e=up.call(this,t)||this).forceLongPolling=t.forceLongPolling,e}function Ip(t){this.Sl=t,this.U=t.U;var e=t.ssl?"https":"http";this.Dl=e+"://"+t.host,this.Cl="projects/"+this.U.projectId+"/databases/"+this.U.database+"/documents"}function Ep(t){this.Rl=t.Rl,this.Pl=t.Pl}function Tp(t){this.persistence=t,this.ml=new Mf,this.Tl=null}function _p(t){var e=this;return(e=ap.call(this)||this).Ma=t,e}function Ap(t){var e=this;this.ll={},this.Ba=new vc(0),this.qa=!1,this.qa=!0,this.Co=t(this),this.Ha=new cp(this),this.Sr=new Rh,this.br=new np(this.Sr,function(t){return e.Co._l(t)})}function Np(t){this.persistence=t,this.al=new Pi(Wi,Yi),this.lastRemoteSnapshotVersion=Vi.min(),this.highestTargetId=0,this.cl=0,this.ul=new Mf,this.targetCount=0,this.hl=rf.ma()}function Sp(t){return new us(t,!0)}var Dp,xp,Op,Rp,kp="You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.",Lp=(Wp.prototype.initialize=function(e){return m(this,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return this.Ch=this.ql(e),this.persistence=this.Ul(e),[4,this.persistence.start()];case 1:return t.sent(),this.Ql=this.Wl(e),this.Gu=this.jl(e),[2]}})})},Wp.prototype.Wl=function(t){return null},Wp.prototype.jl=function(t){return e=this.persistence,n=new tp,r=t.Kl,new Tf(e,n,r);var e,n,r},Wp.prototype.Ul=function(t){if(t.persistenceSettings.Gl)throw new Rr(Or.FAILED_PRECONDITION,kp);return new hp(lp.El)},Wp.prototype.ql=function(t){return new Nc},Wp.prototype.terminate=function(){return m(this,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return this.Ql&&this.Ql.stop(),[4,this.Ch.Si()];case 1:return t.sent(),[4,this.persistence.Si()];case 2:return t.sent(),[2]}})})},Wp.prototype.clearPersistence=function(t,e){throw new Rr(Or.FAILED_PRECONDITION,kp)},Wp),Cp=(o(Kp,Rp=Lp),Kp.prototype.initialize=function(e){return m(this,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return[4,Rp.prototype.initialize.call(this,e)];case 1:return t.sent(),[4,function(r){return m(this,void 0,void 0,function(){var e,n;return w(this,function(t){return n=(e=r).Fc,[2,e.persistence.runTransaction("Synchronize last document change read time","readonly",function(t){return n.oa(t)}).then(function(t){e.Nc=t})]})})}(this.Gu)];case 2:return t.sent(),[4,this.zl.initialize(this,e)];case 3:return t.sent(),[4,Jl(this.zl._i)];case 4:return t.sent(),[4,bl(this.zl.Sh)];case 5:return t.sent(),[2]}})})},Kp.prototype.Wl=function(t){var e=this.persistence.Co.do;return new Zc(e,t.os)},Kp.prototype.Ul=function(t){var e=Ef(t.Sl.U,t.Sl.persistenceKey),n=Sp(t.Sl.U);return new df(t.persistenceSettings.synchronizeTabs,e,t.clientId,Xc.oo(t.persistenceSettings.cacheSizeBytes),t.os,Za(),tc(),n,this.Ch,t.persistenceSettings.La)},Kp.prototype.ql=function(t){return new Nc},Kp.prototype.clearPersistence=function(t,e){return function(n){return m(this,void 0,void 0,function(){var e;return w(this,function(t){switch(t.label){case 0:return Va.On()?(e=n+"main",[4,Va.delete(e)]):[2,Promise.resolve()];case 1:return t.sent(),[2]}})})}(Ef(t,e))},o(Qp,Op=Kp),Qp.prototype.initialize=function(r){return m(this,void 0,void 0,function(){var e,n=this;return w(this,function(t){switch(t.label){case 0:return[4,Op.prototype.initialize.call(this,r)];case 1:return t.sent(),e=this.zl._i,this.Ch instanceof Ac?(this.Ch._i={tr:Ql.bind(null,e),er:Xl.bind(null,e),nr:function(f,l,p){return m(this,void 0,void 0,function(){var n,e,r,i,o,s,u,a,c,h;return w(this,function(t){switch(t.label){case 0:if(!(n=$l(f)).Qh)return[3,10];e=0,r=l,t.label=1;case 1:return e<r.length?(i=r[e],n.$h.has(i)?(Pr("SyncEngine","Adding an already active target "+i),[3,5]):[4,Rf(n.Gu,i)]):[3,6];case 2:return o=t.sent(),[4,Df(n.Gu,o)];case 3:return s=t.sent(),[4,Cl(n,Yl(o),s.targetId,!1)];case 4:t.sent(),cl(n.Sh,s),t.label=5;case 5:return e++,[3,1];case 6:u=function(e){return w(this,function(t){switch(t.label){case 0:return n.$h.has(e)?[4,xf(n.Gu,e,!1).then(function(){hl(n.Sh,e),ql(n,e)}
1).catch(kf)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})},a=0,c=p,t.label=7;case 7:return a<c.length?(h=c[a],[5,u(h)]):[3,10];case 8:t.sent(),t.label=9;case 9:return a++,[3,7];case 10:return[2]}})})}.bind(null,e),Vi:function(t){return t.Gu.persistence.Vi()}.bind(null,e)},[4,this.Ch.start()]):[3,3];case 2:t.sent(),t.label=3;case 3:return[4,this.persistence.ec(function(e){return m(n,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return[4,Kl(this.zl._i,e)];case 1:return t.sent(),this.Ql&&(e&&!this.Ql.Ti?this.Ql.start(this.Gu):e||this.Ql.stop()),[2]}})})})];case 4:return t.sent(),[2]}})})},Qp.prototype.ql=function(t){if(t.persistenceSettings.Gl&&t.persistenceSettings.synchronizeTabs){var e=Za();if(!Ac.On(e))throw new Rr(Or.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var n=Ef(t.Sl.U,t.Sl.persistenceKey);return new Ac(e,t.os,n,t.clientId,t.Kl)}return new Nc},Qp),Pp=(Hp.prototype.initialize=function(n,r){return m(this,void 0,void 0,function(){var e=this;return w(this,function(t){switch(t.label){case 0:return this.Gu?[3,2]:(this.Gu=n.Gu,this.Ch=n.Ch,this.zu=this.Hl(r),this.Sh=this.Yl(r),this.Dh=this.Jl(r),this._i=this.Xl(r),this.Ch.fi=function(t){return Ul(e._i,t,1)},this.Sh.Hu.Zl=Hl.bind(null,this._i),[4,Tl(this.Sh,this._i.Wh)]);case 1:t.sent(),t.label=2;case 2:return[2]}})})},Hp.prototype.Jl=function(t){return new uc},Hp.prototype.Hl=function(t){var e,n,r=Sp(t.Sl.U),i=(e=t.Sl,new vp(e));return n=t.credentials,new Kf(n,i,r)},Hp.prototype.Yl=function(t){var e=this,n=this.Gu,r=this.zu,i=t.os,o=function(t){return Ul(e._i,t,0)},s=new(yp.On()?yp:gp);return new Cf(n,r,i,o,s)},Hp.prototype.Xl=function(t){return e=this.Gu,n=this.Sh,r=this.Dh,i=this.Ch,o=t.Kl,s=t.Nh,u=!t.persistenceSettings.Gl||!t.persistenceSettings.synchronizeTabs,a=new Rl(e,n,r,i,o,s),u&&(a.Qh=!0),a;var e,n,r,i,o,s,u,a},Hp.prototype.terminate=function(){return al(this.Sh)},Hp),Up=(zp.prototype.next=function(t){this.observer.next&&this.t_(this.observer.next,t)},zp.prototype.error=function(t){this.observer.error?this.t_(this.observer.error,t):console.error("Uncaught Error in snapshot listener:",t)},zp.prototype.e_=function(){this.muted=!0},zp.prototype.t_=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},zp),Vp=function(t){!function(){if(!(t instanceof Array)||t.length<1)throw new Rr(Or.INVALID_ARGUMENT,"Function FieldPath() requires its fieldNames argument to be an array with at least 1 element.")}();for(var e=0;e<t.length;++e)if(oi("FieldPath","string",e,t[e]),0===t[e].length)throw new Rr(Or.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this.n_=new Yr(t)},Mp=(o(Bp,xp=Vp),Bp.documentId=function(){return new Bp(Yr.v().R())},Bp.prototype.isEqual=function(t){if(!(t instanceof Bp))throw yi("isEqual","FieldPath",1,t);return this.n_.isEqual(t.n_)},Bp),Fp=new RegExp("[~\\*/\\[\\]]"),qp=function(){this.s_=this},jp=(o(Gp,Dp=qp),Gp.prototype.r_=function(t){if(2!==t.o_)throw 1===t.o_?t.a_(this.i_+"() can only appear at the top level of your update data"):t.a_(this.i_+"() cannot be used with set() unless you pass {merge:true}");return t.Qe.push(t.path),null},Gp.prototype.isEqual=function(t){return t instanceof Gp},Gp);function Gp(t){var e=this;return(e=Dp.call(this)||this).i_=t,e}function Bp(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return xp.call(this,t)||this}function zp(t){this.observer=t,this.muted=!1}function Hp(){}function Qp(){return null!==Op&&Op.apply(this,arguments)||this}function Kp(t){var e=this;return(e=Rp.call(this)||this).zl=t,e}function Wp(){}function Yp(t,e,n){return new Td({o_:3,c_:e.settings.c_,methodName:t.i_,u_:n},e.U,e.serializer,e.ignoreUndefinedProperties)}var Xp,$p,Jp,Zp,td,ed,nd=(o(Id,ed=qp),Id.prototype.r_=function(t){return new $s(t.path,new Us)},Id.prototype.isEqual=function(t){return t instanceof Id},Id),rd=(o(bd,td=qp),bd.prototype.r_=function(t){var e=Yp(this,t,!0),n=this.h_.map(function(t){return Rd(t,e)}),r=new Vs(n);return new $s(t.path,r)},bd.prototype.isEqual=function(t){return this===t},bd),id=(o(wd,Zp=qp),wd.prototype.r_=function(t){var e=Yp(this,t,!0),n=this.h_.map(function(t){return Rd(t,e)}),r=new Gs(n);return new $s(t.path,r)},wd.prototype.isEqual=function(t){return this===t},wd),od=(o(md,Jp=qp),md.prototype.r_=function(t){var e=new Qs(t.serializer,hs(t.serializer,this.l_));return new $s(t.path,e)},md.prototype.isEqual=function(t){return this===t},md),sd=(o(gd,$p=qp),gd.delete=function(){return ei("FieldValue.delete",arguments),new ud(new jp("FieldValue.delete"))},gd.serverTimestamp=function(){return ei("FieldValue.serverTimestamp",arguments),new ud(new nd("FieldValue.serverTimestamp"))},gd.arrayUnion=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];
1return ri("FieldValue.arrayUnion",arguments,1),new ud(new rd("FieldValue.arrayUnion",t))},gd.arrayRemove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return ri("FieldValue.arrayRemove",arguments,1),new ud(new id("FieldValue.arrayRemove",t))},gd.increment=function(t){return oi("FieldValue.increment","number",1,t),ni("FieldValue.increment",arguments,1),new ud(new od("FieldValue.increment",t))},gd),ud=(o(yd,Xp=sd),yd.prototype.r_=function(t){return this.s_.r_(t)},yd.prototype.isEqual=function(t){return t instanceof yd&&this.s_.isEqual(t.s_)},yd),ad=(Object.defineProperty(vd.prototype,"latitude",{get:function(){return this.__},enumerable:!1,configurable:!0}),Object.defineProperty(vd.prototype,"longitude",{get:function(){return this.f_},enumerable:!1,configurable:!0}),vd.prototype.isEqual=function(t){return this.__===t.__&&this.f_===t.f_},vd.prototype.toJSON=function(){return{latitude:this.__,longitude:this.f_}},vd.prototype.H=function(t){return Ei(this.__,t.__)||Ei(this.f_,t.f_)},vd),cd=/^__.*__$/,hd=function(t,e,n){this.d_=t,this.w_=e,this.m_=n},fd=(dd.prototype.T_=function(t,e){var n=[];return null!==this.Qe?n.push(new fu(t,this.data,this.Qe,e)):n.push(new hu(t,this.data,e)),0<this.fieldTransforms.length&&n.push(new yu(t,this.fieldTransforms)),n},dd),ld=(pd.prototype.T_=function(t,e){var n=[new fu(t,this.data,this.Qe,e)];return 0<this.fieldTransforms.length&&n.push(new yu(t,this.fieldTransforms)),n},pd);function pd(t,e,n){this.data=t,this.Qe=e,this.fieldTransforms=n}function dd(t,e,n){this.data=t,this.Qe=e,this.fieldTransforms=n}function vd(t,e){if(ni("GeoPoint",arguments,2),oi("GeoPoint","number",1,t),oi("GeoPoint","number",2,e),!isFinite(t)||t<-90||90<t)throw new Rr(Or.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||180<e)throw new Rr(Or.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this.__=t,this.f_=e}function yd(t){var e=this;return(e=Xp.call(this)||this).s_=t,e.i_=t.i_,e}function gd(){return $p.call(this)||this}function md(t,e){var n=this;return(n=Jp.call(this)||this).i_=t,n.l_=e,n}function wd(t,e){var n=this;return(n=Zp.call(this)||this).i_=t,n.h_=e,n}function bd(t,e){var n=this;return(n=td.call(this)||this).i_=t,n.h_=e,n}function Id(t){var e=this;return(e=ed.call(this)||this).i_=t,e}function Ed(t){switch(t){case 0:case 2:case 1:return 1;case 3:case 4:return;default:throw Fr()}}var Td=(Object.defineProperty(Nd.prototype,"path",{get:function(){return this.settings.path},enumerable:!1,configurable:!0}),Object.defineProperty(Nd.prototype,"o_",{get:function(){return this.settings.o_},enumerable:!1,configurable:!0}),Nd.prototype.I_=function(t){return new Nd(Object.assign(Object.assign({},this.settings),t),this.U,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.Qe)},Nd.prototype.A_=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.I_({path:n,u_:!1});return r.R_(t),r},Nd.prototype.P_=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.I_({path:n,u_:!1});return r.E_(),r},Nd.prototype.g_=function(t){return this.I_({path:void 0,u_:!0})},Nd.prototype.a_=function(t){return Vd(t,this.settings.methodName,this.settings.y_||!1,this.path,this.settings.c_)},Nd.prototype.contains=function(e){return void 0!==this.Qe.find(function(t){return e.T(t)})||void 0!==this.fieldTransforms.find(function(t){return e.T(t.field)})},Nd.prototype.E_=function(){if(this.path)for(var t=0;t<this.path.length;t++)this.R_(this.path.get(t))},Nd.prototype.R_=function(t){if(0===t.length)throw this.a_("Document fields must not be empty");if(Ed(this.o_)&&cd.test(t))throw this.a_('Document fields cannot begin and end with "__"')},Nd),_d=(Ad.prototype.V_=function(t,e,n,r){return void 0===r&&(r=!1),new Td({o_:t,methodName:e,c_:n,path:Yr.g(),u_:!1,y_:r},this.U,this.serializer,this.ignoreUndefinedProperties)},Ad);function Ad(t,e,n){this.U=t,this.ignoreUndefinedProperties=e,this.serializer=n||Sp(t)}function Nd(t,e,n,r,i,o){this.settings=t,this.U=e,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===i&&this.E_(),this.fieldTransforms=i||[],this.Qe=o||[]}function Sd(t,e,n,r,i,o){void 0===o&&(o={});var s=t.V_(o.merge||o.mergeFields?2:0,e,n,i);Cd("Data must be an object, but it was:",s,r);var u,a,c=kd(r,s);if(o.merge)u=new Xs(s.Qe),a=s.fieldTransforms;else if(o.mergeFields){for(var h=[],f=0,l=o.mergeFields;f<l.length;f++){var p=l[f],d=void 0;if(p instanceof Vp)d=p.n_;else{if("string"!=typeof p)throw Fr();d=Ud(e,p,n)}
1if(!s.contains(d))throw new Rr(Or.INVALID_ARGUMENT,"Field '"+d+"' is specified in your field mask but missing from your input data.");Md(h,d)||h.push(d)}u=new Xs(h),a=s.fieldTransforms.filter(function(t){return u.He(t.field)})}else u=null,a=s.fieldTransforms;return new fd(new Tu(c),u,a)}function Dd(t,o,s,e){var u=t.V_(1,o,s);Cd("Data must be an object, but it was:",u,e);var a=[],c=new _u;Gr(e,function(t,e){var n,r=Ud(o,t,s),i=u.P_(r);e instanceof qp&&e.s_ instanceof jp?a.push(r):null!=(n=Rd(e,i))&&(a.push(r),c.set(r,n))});var n=new Xs(a);return new ld(c.Je(),n,u.fieldTransforms)}function xd(t,e,n,r,i,o){var s=t.V_(1,e,n),u=[Pd(e,r,n)],a=[i];if(o.length%2!=0)throw new Rr(Or.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)u.push(Pd(e,o[c])),a.push(o[c+1]);for(var h,f,l,p,d=[],v=new _u,y=u.length-1;0<=y;--y){Md(d,u[y])||(h=u[y],f=a[y],l=s.P_(h),f instanceof qp&&f.s_ instanceof jp?d.push(h):null!=(p=Rd(f,l))&&(d.push(h),v.set(h,p)))}var g=new Xs(d);return new ld(v.Je(),g,s.fieldTransforms)}function Od(t,e,n,r){return void 0===r&&(r=!1),Rd(n,t.V_(r?4:3,e))}function Rd(s,t){if(Ld(s))return Cd("Unsupported field value:",t,s),kd(s,t);if(s instanceof qp)return function(t,e){if(!Ed(e.o_))throw e.a_(t.i_+"() can only be used with update() and set()");if(!e.path)throw e.a_(t.i_+"() is not currently supported inside arrays");var n=t.r_(e);n&&e.fieldTransforms.push(n)}(s,t),null;if(t.path&&t.Qe.push(t.path),s instanceof Array){if(t.settings.u_&&4!==t.o_)throw t.a_("Nested arrays are not supported");return function(t){for(var e=[],n=0,r=0,i=s;r<i.length;r++){var o=Rd(i[r],t.g_(n));null==o&&(o={nullValue:"NULL_VALUE"}),e.push(o),n++}return{arrayValue:{values:e}}}(t)}return function(t,e){if(null===t)return{nullValue:"NULL_VALUE"};if("number"==typeof t)return hs(e.serializer,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){var n=Ui.fromDate(t);return{timestampValue:fs(e.serializer,n)}}if(t instanceof Ui){var r=new Ui(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:fs(e.serializer,r)}}if(t instanceof ad)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Si)return{bytesValue:ls(e.serializer,t.q)};if(t instanceof hd){var i=e.U,o=t.d_;if(!o.isEqual(i))throw e.a_("Document reference is for database "+o.projectId+"/"+o.database+" but should be for database "+i.projectId+"/"+i.database);return{referenceValue:ds(t.d_||e.U,t.w_.path)}}if(void 0===t&&e.ignoreUndefinedProperties)return null;throw e.a_("Unsupported field value: "+pi(t))}(s,t)}function kd(t,r){var i={};return Br(t)?r.path&&0<r.path.length&&r.Qe.push(r.path):Gr(t,function(t,e){var n=Rd(e,r.A_(t));null!=n&&(i[t]=n)}),{mapValue:{fields:i}}}function Ld(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Ui||t instanceof ad||t instanceof Si||t instanceof hd||t instanceof qp)}function Cd(t,e,n){if(!Ld(n)||!li(n)){var r=pi(n);throw"an object"===r?e.a_(t+" a custom object"):e.a_(t+" "+r)}}function Pd(t,e,n){if(e instanceof Vp)return e.n_;if("string"==typeof e)return Ud(t,e);throw Vd("Field path arguments must be of type string or FieldPath.",t,!1,void 0,n)}function Ud(t,e,n){try{return function(e){if(0<=e.search(Fp))throw new Rr(Or.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not contain '~', '*', '/', '[', or ']'");try{return new(Mp.bind.apply(Mp,s([void 0],e.split("."))))}catch(t){throw new Rr(Or.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not be empty, begin with '.', end with '.', or contain '..'")}}(e).n_}catch(e){throw Vd(e instanceof Error?e.message:e.toString(),t,!1,void 0,n)}}function Vd(t,e,n,r,i){var o=r&&!r.m(),s=void 0!==i,u="Function "+e+"() called with invalid data";n&&(u+=" (via `toFirestore()`)");var a="";return(o||s)&&(a+=" (found",o&&(a+=" in field "+r),s&&(a+=" in document "+i),a+=")"),new Rr(Or.INVALID_ARGUMENT,(u+=". ")+t+a)}function Md(t,e){return t.some(function(t){return t.isEqual(e)})}var Fd=(zd.prototype.D_=function(r){return m(this,void 0,void 0,function(){var e,n=this;return w(this,function(t){switch(t.label){case 0:if(this.C_(),0<this.mutations.length)throw new Rr(Or.INVA
1LID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(u,a){return m(this,void 0,void 0,function(){var i,e,n,r,o,s;return w(this,function(t){switch(t.label){case 0:return e=bs((i=u).serializer)+"/documents",n={documents:a.map(function(t){return ys(i.serializer,t)})},[4,i.Ou("BatchGetDocuments",e,n)];case 1:return r=t.sent(),o=new Map,r.forEach(function(t){var e,n,r=(e=i.serializer,"found"in(n=t)?function(t,e){qr(!!e.found),e.found.name,e.found.updateTime;var n=gs(t,e.found.name),r=ps(e.found.updateTime),i=new Tu({mapValue:{fields:e.found.fields}});return new Lu(n,r,i,{})}(e,n):"missing"in n?function(t,e){qr(!!e.missing),qr(!!e.readTime);var n=gs(t,e.missing),r=ps(e.readTime);return new Cu(n,r)}(e,n):Fr());o.set(r.key.toString(),r)}),s=[],[2,(a.forEach(function(t){var e=o.get(t.toString());qr(!!e),s.push(e)}),s)]}})})}(this.zu,r)];case 1:return[2,((e=t.sent()).forEach(function(t){t instanceof Cu||t instanceof Lu?n.N_(t):Fr()}),e)]}})})},zd.prototype.set=function(t,e){this.write(e.T_(t,this.Ke(t))),this.S_.add(t.toString())},zd.prototype.update=function(t,e){try{this.write(e.T_(t,this.F_(t)))}catch(t){this.v_=t}this.S_.add(t.toString())},zd.prototype.delete=function(t){this.write([new Iu(t,this.Ke(t))]),this.S_.add(t.toString())},zd.prototype.commit=function(){return m(this,void 0,void 0,function(){var e,r=this;return w(this,function(t){switch(t.label){case 0:if(this.C_(),this.v_)throw this.v_;return e=this.p_,this.mutations.forEach(function(t){e.delete(t.key.toString())}),e.forEach(function(t,e){var n=Xr.D(e);r.mutations.push(new Eu(n,r.Ke(n)))}),[4,function(i,o){return m(this,void 0,void 0,function(){var e,n,r;return w(this,function(t){switch(t.label){case 0:return n=bs((e=i).serializer)+"/documents",r={writes:o.map(function(t){return Ts(e.serializer,t)})},[4,e.Mu("Commit",n,r)];case 1:return t.sent(),[2]}})})}(this.zu,this.mutations)];case 1:return t.sent(),this.b_=!0,[2]}})})},zd.prototype.N_=function(t){var e;if(t instanceof Lu)e=t.version;else{if(!(t instanceof Cu))throw Fr();e=Vi.min()}var n=this.p_.get(t.key.toString());if(n){if(!e.isEqual(n))throw new Rr(Or.ABORTED,"Document version changed between two reads.")}else this.p_.set(t.key.toString(),e)},zd.prototype.Ke=function(t){var e=this.p_.get(t.toString());return!this.S_.has(t.toString())&&e?tu.updateTime(e):tu.Ge()},zd.prototype.F_=function(t){var e=this.p_.get(t.toString());if(this.S_.has(t.toString())||!e)return tu.exists(!0);if(e.isEqual(Vi.min()))throw new Rr(Or.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return tu.updateTime(e)},zd.prototype.write=function(t){this.C_(),this.mutations=this.mutations.concat(t)},zd.prototype.C_=function(){},zd),qd=(Bd.prototype.run=function(){this.k_()},Bd.prototype.k_=function(){var t=this;this.gs.Rn(function(){return m(t,void 0,void 0,function(){var e,n,r=this;return w(this,function(t){return e=new Fd(this.zu),(n=this.M_(e))&&n.then(function(t){r.os.ds(function(){return e.commit().then(function(){r.hs.resolve(t)}).catch(function(t){r.O_(t)})})}).catch(function(t){r.O_(t)}),[2]})})})},Bd.prototype.M_=function(t){try{var e=this.updateFunction(t);return!Bi(e)&&e.catch&&e.then?e:(this.hs.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.hs.reject(t),null}},Bd.prototype.O_=function(t){var e=this;0<this.x_&&this.L_(t)?(--this.x_,this.os.ds(function(){return e.k_(),Promise.resolve()})):this.hs.reject(t)},Bd.prototype.L_=function(t){if("FirebaseError"!==t.name)return!1;var e=t.code;return"aborted"===e||"failed-precondition"===e||!no(e)},Bd),jd=(Gd.prototype.start=function(t,e,n,r){var i=this;this.q_(),this.Sl=t;var o=new La,s=!1;return this.credentials.Jc(function(t){return s?void i.os.Ds(function(){return function(r,i){return m(this,void 0,void 0,function(){var e,n;return w(this,function(t){switch(t.label){case 0:return(e=r).os.Fs(),Pr("RemoteStore","RemoteStore received new credentials"),n=vl(e),e.Xu.add(3),[4,ul(e)];case 1:return t.sent(),n&&e.nh.set("Unknown"),[4,e.Hu.Zl(i)];case 2:return t.sent(),e.Xu.delete(3),[4,sl(e)];case 3:return t.sent(),[2]}})})}(i.Sh,t)}):(s=!0,Pr("FirestoreClient","Initializing. user=",t.uid),i.U_(e,n,r,t,o).then(i.B_.resolve,i.B_.reject))}),this.os.ds(function(){return i.B_.promise}),o.promise},Gd.prototype.enableNetwork=function(){var e=this;return this.q_(),this.os.enqueue(function(){return e.persistence.sc(!0),(t=e.Sh).Xu.delete(0),sl(t);var t})},Gd.prototype.U_=function(i,o,s,u,a){return m(this,void 0,void 0,function(){var e,n,r=this;return w(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),e={os:this.os,Sl:this.Sl,clientId:this.clientId,credentials:this.credentials,Kl:u,Nh:100,persistenceSettings:s},[4,i.initialize(e)];case 1:return t.sent(),[4,o.initialize(i,e)];case 2:return t.sent(),this.persistence=i.persistence,this.Ch=i.Ch,this.Gu=i.Gu,this.Ql=i.Ql,this.zu=o.zu,this.Sh=o.Sh,this._i=o._i,this.Q_=o.Dh,this.Q_.qs=function(u,a){return m(this,void 0,void 0,function(){var e,n,r,i,o,s;return w(this,function(t){switch(t.label){case 0:return e=$l(u),(i=e.xh.get(a))?(n=i.targetId,e.Ch.Mi(n),r=i.view.ph(),[3,4]):[3,1];case 1:return[4,Df(e.Gu,Wu(a))];case 2:return o=t.sent(),s=e.Ch.Mi(o.targetId),n=o.targetId,[4,Cl(e,a,n,"current"===s)];case 3:r=t.sent(),e.Wh&&cl(e.Sh,o),t.label=4;case 4:return[2,r]}})})}.bind(null,this._i),this.Q_.Ws=function(i,o){return m(this,void 0,void 0,function(){var e,n,r;return w(this,function(t){switch(t.label){case 0:return n=(e=i).xh.get(o),1<(r=e.$h.get(n.targetId)).length?[2,(e.$h.set(n.targetId,r.filter(function(t){return!Ju(t,o)})),void e.xh.delete(o))]:e.Wh?(e.Ch.Li(n.targetId),e.Ch.Ni(n.targetId)?[3,2]:[4,xf(e.Gu,n.targetId,!1).then(function(){e.Ch.qi(n.targetId),hl(e.Sh,n.targetId),ql(e,n.targetId)}).catch(kf)]):[3,3];case 1:t.sent(),t.label=2;case 2:return[3,5];case 3:return ql(e,n.targetId),[4,xf(e.Gu,n.targetId,!0)];case 4:t.sent(),t.label=5;case 5:return[2]}})})}.bind(null,this._i),this.persistence.nc(function(){return m(r,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return[4,this.terminate()];case 1:return t.sent(),[2]}})})}),a.resolve(),[3,4];case 3:if(n=t.sent(),a.reject(n),!this.W_(n))throw n;return[2,(console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+n),this.U_(new Lp,new Pp,{Gl:!1},u,a))];case 4:return[2]}})})},Gd.prototype.W_=function(t){return"FirebaseError"===t.name?t.code===Or.FAILED_PRECONDITION||t.code===Or.UNIMPLEMENT
1ED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code},Gd.prototype.q_=function(){if(this.os.Vs)throw new Rr(Or.FAILED_PRECONDITION,"The client has already been terminated.")},Gd.prototype.disableNetwork=function(){var t=this;return this.q_(),this.os.enqueue(function(){return t.persistence.sc(!1),function(n){return m(this,void 0,void 0,function(){var e;return w(this,function(t){switch(t.label){case 0:return(e=n).Xu.add(0),[4,ul(e)];case 1:return t.sent(),e.nh.set("Offline"),[2]}})})}(t.Sh)})},Gd.prototype.terminate=function(){var t=this;this.os.Ss();var r=new La;return this.os.ps(function(){return m(t,void 0,void 0,function(){var e,n;return w(this,function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),this.Ql&&this.Ql.stop(),[4,al(this.Sh)];case 1:return t.sent(),[4,this.Ch.Si()];case 2:return t.sent(),[4,this.persistence.Si()];case 3:return t.sent(),this.credentials.Xc(),r.resolve(),[3,5];case 4:return e=t.sent(),n=oc(e,"Failed to shutdown persistence"),r.reject(n),[3,5];case 5:return[2]}})})}),r.promise},Gd.prototype.waitForPendingWrites=function(){var t=this;this.q_();var e=new La;return this.os.ds(function(){return function(u,a){return m(this,void 0,void 0,function(){var n,r,i,o,s;return w(this,function(t){switch(t.label){case 0:vl((n=u).Sh)||Pr("SyncEngine","The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled."),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,(e=n.Gu).persistence.runTransaction("Get highest unacknowledged batch id","readonly",function(t){return e.vr.Bo(t)})];case 2:return-1===(r=t.sent())?[2,void a.resolve()]:((i=n.qh.get(r)||[]).push(a),n.qh.set(r,i),[3,4]);case 3:return o=t.sent(),s=oc(o,"Initialization of waitForPendingWrites() operation failed"),a.reject(s),[3,4];case 4:return[2]}var e})})}(t._i,e)}),e.promise},Gd.prototype.listen=function(t,e,n){var r=this;this.q_();var i=new Up(n),o=new fc(t,i,e);return this.os.ds(function(){return ac(r.Q_,o)}),function(){i.e_(),r.os.ds(function(){return cc(r.Q_,o)})}},Gd.prototype.j_=function(r){return m(this,void 0,void 0,function(){var e,n=this;return w(this,function(t){switch(t.label){case 0:return this.q_(),[4,this.B_.promise];case 1:return t.sent(),e=new La,[2,(this.os.ds(function(){return function(s,u,a){return m(this,void 0,void 0,function(){var r,i,o;return w(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(e=u,(n=s).persistence.runTransaction("read document","readonly",function(t){return n.xc.Dr(t,e)}))];case 1:return(r=t.sent())instanceof Lu?a.resolve(r):r instanceof Cu?a.resolve(null):a.reject(new Rr(Or.UNAVAILABLE,"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)")),[3,3];case 2:return i=t.sent(),o=oc(i,"Failed to get document '"+u+" from cache"),a.reject(o),[3,3];case 3:return[2]}var e,n})})}(n.Gu,r,e)}),e.promise)]}})})},Gd.prototype.K_=function(c,h){return void 0===h&&(h={}),m(this,void 0,void 0,function(){var e,a=this;return w(this,function(t){switch(t.label){case 0:return this.q_(),[4,this.B_.promise];case 1:return t.sent(),e=new La,[2,(this.os.ds(function(){return n=a.Q_,r=a.os,i=c,o=h,s=e,t=new Up({next:function(t){r.ds(function(){return cc(n,u)});var e=t.docs.has(i);!e&&t.fromCache?s.reject(new Rr(Or.UNAVAILABLE,"Failed to get document because the client is offline.")):e&&t.fromCache&&o&&"server"===o.source?s.reject(new Rr(Or.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.)')):s.resolve(t)},error:function(t){return s.reject(t)}}),u=new fc(ju(i.path),t,{includeMetadataChanges:!0,Js:!0}),ac(n,u);var n,r,i,o,s,t,u}),e.promise)]}})})},Gd.prototype.G_=function(r){return m(this,void 0,void 0,function(){var e,n=this;return w(this,function(t){switch(t.label){case 0:return this.q_(),[4,this.B_.promise];case 1:return t.sent(),e=new La,[2,(this.os.ds(function(){return function(u,a,c){return m(this,void 0,void 0,function(){var e,n,r,i,o,s;return w(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,Of(u,a,!0)];case 1:return e=t.sent(),n=new Dl(a,e.kc),r=n.Th(e.documents),i=n.gr(r,!1),c.resolve(i.snapshot),[3,3];case 2:return o=t.sent(),s=oc(o,"Failed to execute query '"+a+" against cache"),c.reject(s),[3,3];case 3:return[2]}})})}(n.Gu,r,e)}),e.promise)]}})})},Gd.prototype.z_=function(c,h){return void 0===h&&(h={}),m(this,void 0,void 0,function(){var u,a=this;return w(this,function(t){switch(t.label){case 0:return this.q_(),[4,this.B_.promise];case 1:return t.sent(),u=new La,[2,(this.os.ds(function(){return e=a.Q_,n=a.os,t=c,r=h,i=u,o=new Up({next:function(t){n.ds(function(){return cc(e,s)}),t.fromCache&&"server"===r.source?i.reject(new Rr(Or.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(t)},error:function(t){return i.reject(t)}}),s=new fc(t,o,{includeMetadataChanges:!0,Js:!0}),ac(e,s);var e,n,t,r,i,o,s}),u.promise)]}})})},Gd.prototype.write=function(t){var e=this;this.q_();var n=new La;return this.os.ds(function(){return function(v,y,g){return m(this,void 0,void 0,function(){var u,a,p,d;return w(this,function(t){switch(t.label){case 0:u=Jl(v),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,(o=u.Gu,c=y,f=o,l=Ui.now(),s=c.reduce(function(t,e){return t.add(e.key)},bo()),f.persistence.runTransaction("Locally write mutations","readwrite",function(a){return f.xc.$r(a,s).next(function(t){h=t;for(var u,e,n=[],r=0,i=c;r<i.length;r++){var o=i[r],s=(u=o,e=h.get(o.key),u instanceof yu?function(t){for(var e=null,n=0,r=u.fieldTransforms;n<r.length;n++){var i=r[n],o=t instanceof Lu?t.field(i.field):void 0,s=Ls(i.transform,o||null);null!=s&&(e=null==e?(new _u).set(i.field,s):e.set(i.field,s))}return e?e.Je():null}(e):null);null!=s&&n.push(new fu(o.key,s,function u(t){var a=[];return Gr(t.fields||{},function(t,e){var n=new Yr([t]);if(is(e)){var r=u(e.mapValue).fields;if(0===r.length)a.push(n);else for(var i=0,o=r;i<o.length;i++){var s=o[i];a.push(n.child(s))}}else a.push(n)}),new Xs(a)}(s.proto.mapValue),tu.exists(!0)))}return f.vr.$o(a,l,n,c)})}).then(function(t){var e=t.hr(h);return{batchId:t.batchId,dr:e}}))];case 2:return a=t.sent(),u.Ch.Fi(a.batchId),e=u,n=a.batchId,r=g,i=(i=(i=e.Bh[e.currentUser.Zs()])||new io(Ei)).rt(n,r),e.Bh[e.currentUser.Zs()]=i,[4,zl(u,a.dr)];case 3:return t.sent(),[4,bl(u.Sh)];case 4:return t.sent(),[3,6];case 5:return p=t.sent(),d=oc(p,"Failed to persist write"),g.reject(d),[3,6];case 6:return[2]}var e,n,r,i,o,c,h,f,l,s})})}(e._i,t,n)}),n.promise},Gd.prototype.U=function(){return this.Sl.U},Gd.prototype.H_=function(t){var e=this;this.q_();
1var r=new Up(t);return this.os.ds(function(){return m(e,void 0,void 0,function(){return w(this,function(t){return[2,(e=this.Q_,n=r,e.Bs.add(n),void n.next())];var e,n})})}),function(){r.e_(),e.os.ds(function(){return m(e,void 0,void 0,function(){return w(this,function(t){return[2,void this.Q_.Bs.delete(r)]})})})}},Object.defineProperty(Gd.prototype,"Y_",{get:function(){return this.os.Vs},enumerable:!1,configurable:!0}),Gd.prototype.transaction=function(t){var e=this;this.q_();var n=new La;return this.os.ds(function(){return new qd(e.os,e.zu,t,n).run(),Promise.resolve()}),n.promise},Gd);function Gd(t,e){this.credentials=t,this.os=e,this.clientId=bi.k(),this.B_=new La}function Bd(t,e,n,r){this.os=t,this.zu=e,this.updateFunction=n,this.hs=r,this.x_=5,this.gs=new Pa(this.os,"transaction_retry")}function zd(t){this.zu=t,this.p_=new Map,this.mutations=[],this.b_=!1,this.v_=null,this.S_=new Set}function Hd(i){return function(){if("object"==typeof i&&null!==i)for(var t=i,e=0,n=["next","error","complete"];e<n.length;e++){var r=n[e];if(r in t&&"function"==typeof t[r])return 1}}()}var Qd,Kd,Wd=(lv.prototype.tf=function(t){switch(zo(t)){case 0:return null;case 1:return t.booleanValue;case 2:return $o(t.integerValue||t.doubleValue);case 3:return this.ef(t.timestampValue);case 4:return this.nf(t);case 5:return t.stringValue;case 6:return this.Z_(Jo(t.bytesValue));case 7:return this.sf(t.referenceValue);case 8:return this.if(t.geoPointValue);case 9:return this.rf(t.arrayValue);case 10:return this.af(t.mapValue);default:throw Fr()}},lv.prototype.af=function(t){var n=this,r={};return Gr(t.fields||{},function(t,e){r[t]=n.tf(e)}),r},lv.prototype.if=function(t){return new ad($o(t.latitude),$o(t.longitude))},lv.prototype.rf=function(t){var e=this;return(t.values||[]).map(function(t){return e.tf(t)})},lv.prototype.nf=function(t){switch(this.J_){case"previous":var e=function t(e){var n=e.mapValue.fields.__previous_value__;return jo(n)?t(n):n}(t);return null==e?null:this.tf(e);case"estimate":return this.ef(Go(t));default:return null}},lv.prototype.ef=function(t){var e=Xo(t),n=new Ui(e.seconds,e.nanos);return this.timestampsInSnapshots?n:n.toDate()},lv.prototype.sf=function(t){var e=Kr.P(t);qr(Rs(e));var n=new Ci(e.get(1),e.get(3)),r=new Xr(e.u(5));return n.isEqual(this.U)||Ur("Document "+r+" contains a document reference within a different database ("+n.projectId+"/"+n.database+") which is not supported. It will be treated as a reference in the current database ("+this.U.projectId+"/"+this.U.database+") instead."),this.X_(r)},lv),Yd=Xc.uo,Xd=(fv.prototype.isEqual=function(t){return this.host===t.host&&this.ssl===t.ssl&&this.timestampsInSnapshots===t.timestampsInSnapshots&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties},fv),$d=(Object.defineProperty(hv.prototype,"Ef",{get:function(){return this.If||(this.If=new _d(this.d_,this.Tf.ignoreUndefinedProperties)),this.If},enumerable:!1,configurable:!0}),hv.prototype.settings=function(t){ni("Firestore.settings",arguments,1),oi("Firestore.settings","object",1,t),t.merge&&delete(t=Object.assign(Object.assign({},this.Tf),t)).merge;var e=new Xd(t);if(this.ff&&!this.Tf.isEqual(e))throw new Rr(Or.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only call settings() before calling any other methods on a Firestore object.");void 0!==(this.Tf=e).credentials&&(this.mf=function(t){if(!t)return new qf;switch(t.type){case"gapi":var e=t.client;return qr(!("object"!=typeof e||null===e||!e.auth||!e.auth.getAuthHeaderValueForFirstParty)),new Bf(e,t.sessionIndex||"0");case"provider":return t.client;default:throw new Rr(Or.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(e.credentials))},hv.prototype.enableNetwork=function(){return this._f(),this.ff.enableNetwork()},hv.prototype.disableNetwork=function(){return this._f(),this.ff.disableNetwork()},hv.prototype.enablePersistence=function(t){var e,n;if(this.ff)throw new Rr(Or.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only call enablePersistence() before calling any other methods on a Firestore object.");var r=!1,i=!1;if(t&&(void 0!==t.experimentalTabSynchronization&&Ur("The 'experimentalTabSynchronization' setting will be removed. Use 'synchronizeTabs' instead."),r=null!==(n=null!==(e=t.synchronizeTabs)&&void 0!==e?e:t.experimentalTabSynchronization)&&void 0!==n&&n,i=!!t.experimentalForceOwningTab&&t.experimentalForceOwningTab,r&&i))throw new Rr(Or.INVA
1LID_ARGUMENT,"The 'experimentalForceOwningTab' setting cannot be used with 'synchronizeTabs'.");return this.Af(this.cf,this.uf,{Gl:!0,cacheSizeBytes:this.Tf.cacheSizeBytes,synchronizeTabs:r,La:i})},hv.prototype.clearPersistence=function(){return m(this,void 0,void 0,function(){var n,e=this;return w(this,function(t){if(void 0!==this.ff&&!this.ff.Y_)throw new Rr(Or.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");return n=new La,[2,(this.lf.ps(function(){return m(e,void 0,void 0,function(){var e;return w(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.cf.clearPersistence(this.d_,this.wf)];case 1:return t.sent(),n.resolve(),[3,3];case 2:return e=t.sent(),n.reject(e),[3,3];case 3:return[2]}})})}),n.promise)]})})},hv.prototype.terminate=function(){return this.app._removeServiceInstance("firestore"),this.INTERNAL.delete()},Object.defineProperty(hv.prototype,"Rf",{get:function(){return this._f(),this.ff.Y_},enumerable:!1,configurable:!0}),hv.prototype.waitForPendingWrites=function(){return this._f(),this.ff.waitForPendingWrites()},hv.prototype.onSnapshotsInSync=function(t){if(this._f(),Hd(t))return this.ff.H_(t);oi("Firestore.onSnapshotsInSync","function",1,t);var e={next:t};return this.ff.H_(e)},hv.prototype._f=function(){return this.ff||this.Af(new Lp,new Pp,{Gl:!1}),this.ff},hv.prototype.Pf=function(){return new Ri(this.d_,this.wf,this.Tf.host,this.Tf.ssl,this.Tf.experimentalForceLongPolling)},hv.prototype.Af=function(t,e,n){var r=this.Pf();return this.ff=new jd(this.mf,this.lf),this.ff.start(r,t,e,n)},hv.df=function(t){if(e=t.options,!Object.prototype.hasOwnProperty.call(e,"projectId"))throw new Rr(Or.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');var e,n=t.options.projectId;if(!n||"string"!=typeof n)throw new Rr(Or.INVALID_ARGUMENT,"projectId must be a string in FirebaseApp.options");return new Ci(n)},Object.defineProperty(hv.prototype,"app",{get:function(){if(!this.hf)throw new Rr(Or.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.hf},enumerable:!1,configurable:!0}),hv.prototype.collection=function(t){return ni("Firestore.collection",arguments,1),oi("Firestore.collection","non-empty string",1,t),this._f(),new bv(Kr.P(t),this,null)},hv.prototype.doc=function(t){return ni("Firestore.doc",arguments,1),oi("Firestore.doc","non-empty string",1,t),this._f(),tv.gf(Kr.P(t),this,null)},hv.prototype.collectionGroup=function(t){if(ni("Firestore.collectionGroup",arguments,1),oi("Firestore.collectionGroup","non-empty string",1,t),0<=t.indexOf("/"))throw new Rr(Or.INVALID_ARGUMENT,"Invalid collection ID '"+t+"' passed to function Firestore.collectionGroup(). Collection IDs must not contain '/'.");return this._f(),new mv((e=t,new Uu(Kr.g(),e)),this,null);var e},hv.prototype.runTransaction=function(e){var n=this;return ni("Firestore.runTransaction",arguments,1),oi("Firestore.runTransaction","function",1,e),this._f().transaction(function(t){return e(new Jd(n,t))})},hv.prototype.batch=function(){return this._f(),new Zd(this)},Object.defineProperty(hv,"logLevel",{get:function(){switch(Cr()){case l.DEBUG:return"debug";case l.ERROR:return"error";case l.SILENT:return"silent";case l.WARN:return"warn";case l.INFO:return"info";case l.VERBOSE:return"verbose";default:return"error"}},enumerable:!1,configurable:!0}),hv.setLogLevel=function(t){ni("Firestore.setLogLevel",arguments,1),hi("setLogLevel",["debug","error","silent","warn","info","verbose"],1,t),kr.setLogLevel(t)},hv.prototype.yf=function(){return this.Tf.timestampsInSnapshots},hv.prototype.Vf=function(){return this.Tf},hv),Jd=(cv.prototype.get=function(t){var n=this;ni("Transaction.get",arguments,1);var r=Sv("Transaction.get",t,this.pf);return this.bf.D_([r.w_]).then(function(t){if(!t||1!==t.length)return Fr();var e=t[0];if(e instanceof Cu)return new nv(n.pf,r.w_,null,!1,!1,r.m_);if(e instanceof Lu)return new nv(n.pf,r.w_,e,!1,!1,r.m_);throw Fr()})},cv.prototype.set=function(t,e,n){ii("Transaction.set",arguments,2,3);var r=Sv("Transaction.set",t,this.pf);n=_v("Transaction.set",n);var i=Dv(r.m_,e,n),o=Sd(this.pf.Ef,"Transaction.set",r.w_,i,null!==r.m_,n);return this.bf.set(r.w_,o),this},cv.prototype.update=function(t,e,n){for(var r,i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return i="string"==typeof e||e instanceof Mp?(ri("Transaction.update",arguments,3),r=Sv("Transaction.update",t,this.pf),xd(this.pf.Ef,"Transaction.update",r.w_,e,n,o)):(ni("Transaction.update",arguments,2),r=Sv("Transaction.update",t,this.pf),Dd(this.pf.Ef,"Transaction.update",r.w_,e)),this.bf.update(r.w_,i),this},cv.prototype.delete=function(t){ni("Transaction.delete",arguments,1
1);var e=Sv("Transaction.delete",t,this.pf);return this.bf.delete(e.w_),this},cv),Zd=(av.prototype.set=function(t,e,n){ii("WriteBatch.set",arguments,2,3),this.Df();var r=Sv("WriteBatch.set",t,this.pf);n=_v("WriteBatch.set",n);var i=Dv(r.m_,e,n),o=Sd(this.pf.Ef,"WriteBatch.set",r.w_,i,null!==r.m_,n);return this.vf=this.vf.concat(o.T_(r.w_,tu.Ge())),this},av.prototype.update=function(t,e,n){for(var r,i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return this.Df(),i="string"==typeof e||e instanceof Mp?(ri("WriteBatch.update",arguments,3),r=Sv("WriteBatch.update",t,this.pf),xd(this.pf.Ef,"WriteBatch.update",r.w_,e,n,o)):(ni("WriteBatch.update",arguments,2),r=Sv("WriteBatch.update",t,this.pf),Dd(this.pf.Ef,"WriteBatch.update",r.w_,e)),this.vf=this.vf.concat(i.T_(r.w_,tu.exists(!0))),this},av.prototype.delete=function(t){ni("WriteBatch.delete",arguments,1),this.Df();var e=Sv("WriteBatch.delete",t,this.pf);return this.vf=this.vf.concat(new Iu(e.w_,tu.Ge())),this},av.prototype.commit=function(){return this.Df(),this.Sf=!0,0<this.vf.length?this.pf._f().write(this.vf):Promise.resolve()},av.prototype.Df=function(){if(this.Sf)throw new Rr(Or.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},av),tv=(o(uv,Kd=hd),uv.gf=function(t,e,n){if(t.length%2!=0)throw new Rr(Or.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.R()+" has "+t.length);return new uv(new Xr(t),e,n)},Object.defineProperty(uv.prototype,"id",{get:function(){return this.w_.path._()},enumerable:!1,configurable:!0}),Object.defineProperty(uv.prototype,"parent",{get:function(){return new bv(this.w_.path.h(),this.firestore,this.m_)},enumerable:!1,configurable:!0}),Object.defineProperty(uv.prototype,"path",{get:function(){return this.w_.path.R()},enumerable:!1,configurable:!0}),uv.prototype.collection=function(t){if(ni("DocumentReference.collection",arguments,1),oi("DocumentReference.collection","non-empty string",1,t),!t)throw new Rr(Or.INVALID_ARGUMENT,"Must provide a non-empty collection name to collection()");var e=Kr.P(t);return new bv(this.w_.path.child(e),this.firestore,null)},uv.prototype.isEqual=function(t){if(!(t instanceof uv))throw yi("isEqual","DocumentReference",1,t);return this.firestore===t.firestore&&this.w_.isEqual(t.w_)&&this.m_===t.m_},uv.prototype.set=function(t,e){ii("DocumentReference.set",arguments,1,2),e=_v("DocumentReference.set",e);var n=Dv(this.m_,t,e),r=Sd(this.firestore.Ef,"DocumentReference.set",this.w_,n,null!==this.m_,e);return this.ff.write(r.T_(this.w_,tu.Ge()))},uv.prototype.update=function(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return n="string"==typeof t||t instanceof Mp?(ri("DocumentReference.update",arguments,2),xd(this.firestore.Ef,"DocumentReference.update",this.w_,t,e,r)):(ni("DocumentReference.update",arguments,1),Dd(this.firestore.Ef,"DocumentReference.update",this.w_,t)),this.ff.write(n.T_(this.w_,tu.exists(!0)))},uv.prototype.delete=function(){return ni("DocumentReference.delete",arguments,0),this.ff.write([new Iu(this.w_,tu.Ge())])},uv.prototype.onSnapshot=function(){for(var t,e,n,r=this,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];ii("DocumentReference.onSnapshot",arguments,1,4);var s={includeMetadataChanges:!1},u=0;"object"!=typeof i[u]||Hd(i[u])||(vi("DocumentReference.onSnapshot",s=i[u],["includeMetadataChanges"]),ai("DocumentReference.onSnapshot","boolean","includeMetadataChanges",s.includeMetadataChanges),u++);var a,c={includeMetadataChanges:s.includeMetadataChanges};Hd(i[u])?(a=i[u],i[u]=null===(t=a.next)||void 0===t?void 0:t.bind(a),i[u+1]=null===(e=a.error)||void 0===e?void 0:e.bind(a),i[u+2]=null===(n=a.complete)||void 0===n?void 0:n.bind(a)):(oi("DocumentReference.onSnapshot","function",u,i[u]),si("DocumentReference.onSnapshot","function",u+1,i[u+1]),si("DocumentReference.onSnapshot","function",u+2,i[u+2]));var h={next:function(t){i[u]&&i[u](r.Cf(t))},error:i[u+1],complete:i[u+2]};return this.ff.listen(ju(this.w_.path),c,h)},uv.prototype.get=function(t){var e=this;ii("DocumentReference.get",arguments,0,1),Nv("DocumentReference.get",t);var n=this.firestore._f();return t&&"cache"===t.source?n.j_(this.w_).then(function(t){return new nv(e.firestore,e.w_,t,!0,t instanceof Lu&&t.Ye,e.m_)}):n.K_(this.w_,t).then(function(t){return e.Cf(t)})},uv.prototype.withConverter=function(t){return new uv(this.w_,this.firestore,t)},uv.prototype.Cf=function(t){var e=t.docs.get(this.w_);return new nv(this.firestore,this.w_,e,t.fromCache,t.hasPendingWrites,this.m_)},uv),ev=(sv.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},sv),nv=(ov.prototype.data=function(t){var e=this;if(ii("DocumentSnapshot.data",arguments,0,1),t=Av("DocumentSnapshot.data",t),this.Nf){if(this.m_){var n=new rv(this.pf,this.w_,this.Nf,this.Ff,this.xf,null);return this.m_.fromFirestore(n,t)}return new Wd(this.pf.d_,this.pf.yf(),t.serverTimestamps||"none",function(t){return new tv(t,e.pf,null)},function(t){return new Li(t)}).tf(this.Nf.sn())}},ov.prototype.get=function(t,e){var n=this;if(ii("DocumentSnapshot.get",arguments,1,2),e=Av("DocumentSnapshot.get",e),this.Nf){var r=this.Nf.data().field(Pd("DocumentSnapshot.get",t,this.w_));if(null!==r)return new Wd(this.pf.d_,this.pf.yf(),e.serverTimestamps||"none",function(t){return new tv(t,n.pf,n.m_)},function(t){return new Li(t)}).tf(r)}},Object.defineProperty(ov.prototype,"id",{get:function(){return this.w_.path._()}
1,enumerable:!1,configurable:!0}),Object.defineProperty(ov.prototype,"ref",{get:function(){return new tv(this.w_,this.pf,this.m_)},enumerable:!1,configurable:!0}),Object.defineProperty(ov.prototype,"exists",{get:function(){return null!==this.Nf},enumerable:!1,configurable:!0}),Object.defineProperty(ov.prototype,"metadata",{get:function(){return new ev(this.xf,this.Ff)},enumerable:!1,configurable:!0}),ov.prototype.isEqual=function(t){if(!(t instanceof ov))throw yi("isEqual","DocumentSnapshot",1,t);return this.pf===t.pf&&this.Ff===t.Ff&&this.w_.isEqual(t.w_)&&(null===this.Nf?null===t.Nf:this.Nf.isEqual(t.Nf))&&this.m_===t.m_},ov),rv=(o(iv,Qd=nv),iv.prototype.data=function(t){return Qd.prototype.data.call(this,t)},iv);function iv(){return null!==Qd&&Qd.apply(this,arguments)||this}function ov(t,e,n,r,i,o){this.pf=t,this.w_=e,this.Nf=n,this.Ff=r,this.xf=i,this.m_=o}function sv(t,e){this.hasPendingWrites=t,this.fromCache=e}function uv(t,e,n){var r=this;return(r=Kd.call(this,e.d_,t,n)||this).w_=t,r.firestore=e,r.m_=n,r.ff=r.firestore._f(),r}function av(t){this.pf=t,this.vf=[],this.Sf=!1}function cv(t,e){this.pf=t,this.bf=e}function hv(t,e,n,r){var i=this;if(void 0===n&&(n=new Lp),void 0===r&&(r=new Pp),this.cf=n,this.uf=r,this.hf=null,this.lf=new nc,this.INTERNAL={delete:function(){return m(i,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return this._f(),[4,this.ff.terminate()];case 1:return t.sent(),[2]}})})}},"object"==typeof t.options){var o=t;this.hf=o,this.d_=hv.df(o),this.wf=o.name,this.mf=new jf(e)}else{var s=t;if(!s.projectId)throw new Rr(Or.INVALID_ARGUMENT,"Must provide projectId");this.d_=new Ci(s.projectId,s.database),this.wf="[DEFAULT]",this.mf=new qf}this.Tf=new Xd({})}function fv(t){var e,n,r,i;if(void 0===t.host){if(void 0!==t.ssl)throw new Rr(Or.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else ui("settings","non-empty string","host",t.host),this.host=t.host,ai("settings","boolean","ssl",t.ssl),this.ssl=null===(e=t.ssl)||void 0===e||e;if(vi("settings",t,["host","ssl","credentials","timestampsInSnapshots","cacheSizeBytes","experimentalForceLongPolling","ignoreUndefinedProperties"]),ai("settings","object","credentials",t.credentials),this.credentials=t.credentials,ai("settings","boolean","timestampsInSnapshots",t.timestampsInSnapshots),ai("settings","boolean","ignoreUndefinedProperties",t.ignoreUndefinedProperties),!0===t.timestampsInSnapshots?Ur("The setting 'timestampsInSnapshots: true' is no longer required and should be removed."):!1===t.timestampsInSnapshots&&Ur("Support for 'timestampsInSnapshots: false' will be removed soon. You must update your code to handle Timestamp objects."),this.timestampsInSnapshots=null===(n=t.timestampsInSnapshots)||void 0===n||n,this.ignoreUndefinedProperties=null!==(r=t.ignoreUndefinedProperties)&&void 0!==r&&r,ai("settings","number","cacheSizeBytes",t.cacheSizeBytes),void 0===t.cacheSizeBytes)this.cacheSizeBytes=Xc.lo;else{if(t.cacheSizeBytes!==Yd&&t.cacheSizeBytes<Xc.ho)throw new Rr(Or.INVALID_ARGUMENT,"cacheSizeBytes must be at least "+Xc.ho);this.cacheSizeBytes=t.cacheSizeBytes}ai("settings","boolean","experimentalForceLongPolling",t.experimentalForceLongPolling),this.experimentalForceLongPolling=null!==(i=t.experimentalForceLongPolling)&&void 0!==i&&i}function lv(t,e,n,r,i){this.U=t,this.timestampsInSnapshots=e,this.J_=n,this.X_=r,this.Z_=i}function pv(t,e,n){if("string"==typeof n){if(""===n)throw new Rr(Or.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!Qu(e)&&-1!==n.indexOf("/"))throw new Rr(Or.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(Kr.P(n));if(!Xr.F(r))throw new Rr(Or.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 Zo(t,new Xr(r))}if(n instanceof hd)return Zo(t,n.w_);
1throw new Rr(Or.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+pi(n)+".")}function dv(t,e){if(!Array.isArray(t)||0===t.length)throw new Rr(Or.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+e.toString()+"' filters.");if(10<t.length)throw new Rr(Or.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters support a maximum of 10 elements in the value array.");if("in"===e||"array-contains-any"===e){if(0<=t.indexOf(null))throw new Rr(Or.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters cannot contain 'null' in the value array.");if(0<t.filter(function(t){return Number.isNaN(t)}).length)throw new Rr(Or.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters cannot contain 'NaN' in the value array.")}}function vv(t,e,n){if(!n.isEqual(e))throw new Rr(Or.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+e.toString()+"' and so you must also use '"+e.toString()+"' as your first orderBy(), but your first orderBy() is on field '"+n.toString()+"' instead.")}function yv(t){if(Bu(t)&&0===t.rn.length)throw new Rr(Or.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var gv,mv=(Tv.prototype.where=function(t,e,n){ni("Query.where",arguments,3),di("Query.where",3,n);var r,i,o=hi("Query.where",["<","<=","==","!=",">=",">","array-contains","in","array-contains-any","not-in"],2,e),s=Pd("Query.where",t),u=function(t,e,n,r,i,o,s){var u;if(i.p()){if("array-contains"===o||"array-contains-any"===o)throw new Rr(Or.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+o+"' queries on FieldPath.documentId().");if("in"===o||"not-in"===o){dv(s,o);for(var a=[],c=0,h=s;c<h.length;c++){var f=h[c];a.push(pv(r,t,f))}u={arrayValue:{values:a}}}else u=pv(r,t,s)}else"in"!==o&&"not-in"!==o&&"array-contains-any"!==o||dv(s,o),u=Od(n,e,s,"in"===o||"not-in"===o);var l=ia.create(i,o,u);return function(t,e){if(e.un()){var n=Hu(t);if(null!==n&&!n.isEqual(e.field))throw new Rr(Or.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=zu(t);null!==r&&vv(0,e.field,r)}var i=function(t,e){for(var n=0,r=t.filters;n<r.length;n++){var i=r[n];if(0<=e.indexOf(i.op))return i.op}return null}(t,function(){switch(e.op){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}());if(null!==i)throw i===e.op?new Rr(Or.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+e.op.toString()+"' filter."):new Rr(Or.INVALID_ARGUMENT,"Invalid query. You cannot use '"+e.op.toString()+"' filters with '"+i.toString()+"' filters.")}(t,l),l}(this.$f,"Query.where",this.firestore.Ef,this.firestore.d_,s,o,n);return new Tv((r=this.$f,i=r.filters.concat([u]),new Uu(r.path,r.collectionGroup,r.rn.slice(),i,r.limit,r.on,r.startAt,r.endAt)),this.firestore,this.m_)},Tv.prototype.orderBy=function(t,e){var n;if(ii("Query.orderBy",arguments,1,2),si("Query.orderBy","non-empty string",2,e),void 0===e||"asc"===e)n="asc";else{if("desc"!==e)throw new Rr(Or.INVALID_ARGUMENT,"Function Query.orderBy() has unknown direction '"+e+"', expected 'asc' or 'desc'.");n="desc"}var r,i,o=Pd("Query.orderBy",t),s=function(t,e,n){if(null!==t.startAt)throw new Rr(Or.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==t.endAt)throw new Rr(Or.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");var r,i,o,s=new ka(e,n);return i=s,null!==zu(r=t)||null!==(o=Hu(r))&&vv(0,o,i.field),s}(this.$f,o,n);return new Tv((r=this.$f,i=r.rn.concat([s]),new Uu(r.path,r.collectionGroup,i,r.filters.slice(),r.limit,r.on,r.startAt,r.endAt)),this.firestore,this.m_)},Tv.prototype.limit=function(t){return ni("Query.limit",arguments,1
1),oi("Query.limit","number",1,t),gi("Query.limit",1,t),new Tv(Yu(this.$f,t,"F"),this.firestore,this.m_)},Tv.prototype.limitToLast=function(t){return ni("Query.limitToLast",arguments,1),oi("Query.limitToLast","number",1,t),gi("Query.limitToLast",1,t),new Tv(Yu(this.$f,t,"L"),this.firestore,this.m_)},Tv.prototype.startAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];ri("Query.startAt",arguments,1);var r=this.kf("Query.startAt",t,e,!0);return new Tv(Xu(this.$f,r),this.firestore,this.m_)},Tv.prototype.startAfter=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];ri("Query.startAfter",arguments,1);var r=this.kf("Query.startAfter",t,e,!1);return new Tv(Xu(this.$f,r),this.firestore,this.m_)},Tv.prototype.endBefore=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];ri("Query.endBefore",arguments,1);var r=this.kf("Query.endBefore",t,e,!0);return new Tv($u(this.$f,r),this.firestore,this.m_)},Tv.prototype.endAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];ri("Query.endAt",arguments,1);var r=this.kf("Query.endAt",t,e,!1);return new Tv($u(this.$f,r),this.firestore,this.m_)},Tv.prototype.isEqual=function(t){if(!(t instanceof Tv))throw yi("isEqual","Query",1,t);return this.firestore===t.firestore&&Ju(this.$f,t.$f)&&this.m_===t.m_},Tv.prototype.withConverter=function(t){return new Tv(this.$f,this.firestore,t)},Tv.prototype.kf=function(h,t,e,n){if(di(h,1,t),t instanceof nv)return ni(h,s([t],e),1),function(t,e,n,r){if(!n)throw new Rr(Or.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+h+"().");for(var i=[],o=0,s=Ku(t);o<s.length;o++){var u=s[o];if(u.field.p())i.push(Zo(e,n.key));else{var a=n.field(u.field);if(jo(a))throw new Rr(Or.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+u.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===a){var c=u.field.R();throw new Rr(Or.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '"+c+"' (used as the orderBy) does not exist.")}i.push(a)}}return new _a(i,r)}(this.$f,this.firestore.d_,t.Nf,n);var r=[t].concat(e);return function(t,e,n,r,i,o){var s=t.rn;if(i.length>s.length)throw new Rr(Or.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 u=[],a=0;a<i.length;a++){var c=i[a];if(s[a].field.p()){if("string"!=typeof c)throw new Rr(Or.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+r+"(), but got a "+typeof c);if(!Qu(t)&&-1!==c.indexOf("/"))throw new Rr(Or.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 h=t.path.child(Kr.P(c));if(!Xr.F(h))throw new Rr(Or.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 '"+h+"' is not because it contains an odd number of segments.");var f=new Xr(h);u.push(Zo(e,f))}else{var l=Od(n,r,c);u.push(l)}}return new _a(u,o)}(this.$f,this.firestore.d_,this.firestore.Ef,h,r,n)},Tv.prototype.onSnapshot=function(){for(var t,e,n,r=this,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];ii("Query.onSnapshot",arguments,1,4);var s,u={},a=0;"object"!=typeof i[a]||Hd(i[a])||(vi("Query.onSnapshot",u=i[a],["includeMetadataChanges"]),ai("Query.onSnapshot","boolean","includeMetadataChanges",u.includeMetadataChanges),a++),Hd(i[a])?(s=i[a],i[a]=null===(t=s.next)||void 0===t?void 0:t.bind(s),i[a+1]=null===(e=s.error)||void 0===e?void 0:e.bind(s),i[a+2]=null===(n=s.complete)||void 0===n?void 0:n.bind(s)):(oi("Query.onSnapshot","function",a,i[a]),si("Query.onSnapshot","function",a+1,i[a+1]),si("Query.onSnapshot","function",a+2,i[a+2]));var c={next:function(t){i[a]&&i[a](new wv(r.firestore,r.$f,t,r.m_))},error:i[a+1],complete:i[a+2]};return yv(this.$f),this.firestore._f().listen(this.$f,u,c)},Tv.prototype.get=function(t){var e=this;ii("Query.get",arguments,0,1),Nv("Query.get",t),yv(this.$f);var n=this.firestore._f();return(t&&"cache"===t.source?n.G_(this.$f):n.z_(this.$f,t)).then(function(t){return new wv(e.firestore,e.$f,t,e.m_)})},Tv),wv=(Object.defineProperty(Ev.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e}
1,enumerable:!1,configurable:!0}),Object.defineProperty(Ev.prototype,"empty",{get:function(){return this.Of.docs.m()},enumerable:!1,configurable:!0}),Object.defineProperty(Ev.prototype,"size",{get:function(){return this.Of.docs.size},enumerable:!1,configurable:!0}),Ev.prototype.forEach=function(e,n){var r=this;ii("QuerySnapshot.forEach",arguments,1,2),oi("QuerySnapshot.forEach","function",1,e),this.Of.docs.forEach(function(t){e.call(n,r.qf(t,r.metadata.fromCache,r.Of.Qt.has(t.key)))})},Object.defineProperty(Ev.prototype,"query",{get:function(){return new mv(this.Mf,this.pf,this.m_)},enumerable:!1,configurable:!0}),Ev.prototype.docChanges=function(t){t&&(vi("QuerySnapshot.docChanges",t,["includeMetadataChanges"]),ai("QuerySnapshot.docChanges","boolean","includeMetadataChanges",t.includeMetadataChanges));var e=!(!t||!t.includeMetadataChanges);if(e&&this.Of.jt)throw new Rr(Or.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this.Lf&&this.Bf===e||(this.Lf=function(i,e,o){if(i.Ut.m()){var n=0;return i.docChanges.map(function(t){var e=o(t.doc,i.fromCache,i.Qt.has(t.doc.key));return t.doc,{type:"added",doc:e,oldIndex:-1,newIndex:n++}})}var s=i.Ut;return i.docChanges.filter(function(t){return e||3!==t.type}).map(function(t){var e=o(t.doc,i.fromCache,i.Qt.has(t.doc.key)),n=-1,r=-1;return 0!==t.type&&(n=s.indexOf(t.doc.key),s=s.delete(t.doc.key)),1!==t.type&&(r=(s=s.add(t.doc)).indexOf(t.doc.key)),{type:function(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Fr()}}(t.type),doc:e,oldIndex:n,newIndex:r}})}(this.Of,e,this.qf.bind(this)),this.Bf=e),this.Lf},Ev.prototype.isEqual=function(t){if(!(t instanceof Ev))throw yi("isEqual","QuerySnapshot",1,t);return this.pf===t.pf&&Ju(this.Mf,t.Mf)&&this.Of.isEqual(t.Of)&&this.m_===t.m_},Ev.prototype.qf=function(t,e,n){return new rv(this.pf,t.key,t,e,n,this.m_)},Ev),bv=(o(Iv,gv=mv),Object.defineProperty(Iv.prototype,"id",{get:function(){return this.$f.path._()},enumerable:!1,configurable:!0}),Object.defineProperty(Iv.prototype,"parent",{get:function(){var t=this.$f.path.h();return t.m()?null:new tv(new Xr(t),this.firestore,null)},enumerable:!1,configurable:!0}),Object.defineProperty(Iv.prototype,"path",{get:function(){return this.$f.path.R()},enumerable:!1,configurable:!0}),Iv.prototype.doc=function(t){ii("CollectionReference.doc",arguments,0,1),0===arguments.length&&(t=bi.k()),oi("CollectionReference.doc","non-empty string",1,t);var e=Kr.P(t);return tv.gf(this.$f.path.child(e),this.firestore,this.m_)},Iv.prototype.add=function(t){ni("CollectionReference.add",arguments,1);var e=this.m_?this.m_.toFirestore(t):t;oi("CollectionReference.add","object",1,e);var n=this.doc();return new tv(n.w_,this.firestore,null).set(e).then(function(){return n})},Iv.prototype.withConverter=function(t){return new Iv(this.Uf,this.firestore,t)},Iv);function Iv(t,e,n){var r=this;if(((r=gv.call(this,ju(t),e,n)||this).Uf=t).length%2!=1)throw new Rr(Or.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t.R()+" has "+t.length);return r}function Ev(t,e,n,r){this.pf=t,this.Mf=e,this.Of=n,this.m_=r,this.Lf=null,this.Bf=null,this.metadata=new ev(n.hasPendingWrites,n.fromCache)}function Tv(t,e,n){this.$f=t,this.firestore=e,this.m_=n}function _v(t,e){if(void 0===e)return{merge:!1};if(vi(t,e,["merge","mergeFields"]),ai(t,"boolean","merge",e.merge),void 0!==(n=e.mergeFields)&&function(t,e,n,r){if(!(n instanceof Array))throw new Rr(Or.INVALID_ARGUMENT,"Function "+t+"() requires its "+e+" option to be an array, but it was: "+pi(n));for(var i=0;i<n.length;++i)if(!r(n[i]))throw new Rr(Or.INVALID_ARGUMENT,"Function "+t+"() requires all "+e+" elements to be a string or a FieldPath, but the value at index "+i+" was: "+pi(n[i]))}(t,"mergeFields",n,function(t){return"string"==typeof t||t instanceof Mp}),void 0!==e.mergeFields&&void 0!==e.merge)throw new Rr(Or.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');var n;return e}function Av(t,e){return void 0===e?{}:(vi(t,e,["serverTimestamps"]),ci(t,0,"serverTimestamps",e.serverTimestamps,["estimate","previous","none"]),e)}function Nv(t,e){si(t,"object",1,e),e&&(vi(t,e,["source"]),ci(t,0,"s
1ource",e.source,["default","server","cache"]))}function Sv(t,e,n){if(e instanceof hd){if(e.firestore!==n)throw new Rr(Or.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}throw yi(t,"DocumentReference",1,e)}function Dv(t,e,n){return t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e}var xv,Ov={Firestore:$d,GeoPoint:ad,Timestamp:Ui,Blob:Li,Transaction:Jd,WriteBatch:Zd,DocumentReference:tv,DocumentSnapshot:nv,Query:mv,QueryDocumentSnapshot:rv,QuerySnapshot:wv,CollectionReference:bv,FieldPath:Mp,FieldValue:sd,setLogLevel:$d.setLogLevel,CACHE_SIZE_UNLIMITED:Yd};(xv=r.default).INTERNAL.registerComponent(new Sr("firestore",function(t){return e=t.getProvider("app").getImmediate(),n=t.getProvider("auth-internal"),r=new Pp,i=new Cp(r),new $d(e,n,i,r);var e,n,r,i},"PUBLIC").setServiceProps(Object.assign({},Ov))),xv.registerVersion("@firebase/firestore","1.17.1")}).apply(this,arguments)}catch(t){throw console.error(t),new Error("Cannot instantiate firebase-firestore.js - be sure to load firebase-app.js first.")}}); 2//# sourceMappingURL=firebase-firestore.js.map
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.