vendor: 4,491 bytes, line 1
1import{a as ph,b as dh,c as vh,d as yh,e as gh}from"./chunk-XCGJA4ND.js";import{d as ii,e as fh,f as vs,g as lh,h as oi}from"./chunk-VA6FUXHB.js";var gs={};vs(gs,{__assign:()=>ui,__asyncDelegator:()=>Lh,__asyncGenerator:()=>Dh,__asyncValues:()=>kh,__await:()=>cn,__awaiter:()=>Ih,__classPrivateFieldGet:()=>Ch,__classPrivateFieldSet:()=>Uh,__createBinding:()=>Ah,__decorate:()=>_h,__exportStar:()=>Nh,__extends:()=>mh,__generator:()=>Th,__importDefault:()=>Ph,__importStar:()=>Rh,__makeTemplateObject:()=>Oh,__metadata:()=>Eh,__param:()=>bh,__read:()=>ys,__rest:()=>wh,__spread:()=>Sh,__spreadArrays:()=>xh,__values:()=>ai});function mh(e,t){si(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function wh(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function _h(e,t,n,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(s=e[u])&&(o=(i<3?s(o):i>3?s(t,n,o):s(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o}function bh(e,t){return function(n,r){t(n,r,e)}}function Eh(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function Ih(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function u(h){try{c(r.next(h))}catch(f){s(f)}}function a(h){try{c(r.throw(h))}catch(f){s(f)}}function c(h){h.done?o(h.value):i(h.value).then(u,a)}c((r=r.apply(e,t||[])).next())})}function Th(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(c){return function(h){return a([c,h])}}function a(c){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){n.label=c[1];break}if(c[0]===6&&n.label<o[1]){n.label=o[1],o=c;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(c);break}o[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(h){c=[6,h],i=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Ah(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}function Nh(e,t){for(var n in e)n!=="default"&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function ai(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ys(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function Sh(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ys(arguments[t]));return e}function xh(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var o=arguments[t],s=0,u=o.length;s<u;s++,i++)r[i]=o[s];return r}function cn(e){return this instanceof cn?(this.v=e,this):new cn(e)}function Dh(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(l){r[l]&&(i[l]=function(d){return new Promise(function(v,g){o.push([l,d,v,g])>1||u(l,d)})})}function u(l,d){try{a(r[l](d))}catch(v){f(o[0][3],v)}}function a(l){l.value instanceof cn?Promise.resolve(l.value.v).then(c,h):f(o[0][2],l)}function c(l){u("next",l)}
1function h(l){u("throw",l)}function f(l,d){l(d),o.shift(),o.length&&u(o[0][0],o[0][1])}}function Lh(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,o){t[i]=e[i]?function(s){return(n=!n)?{value:cn(e[i](s)),done:i==="return"}:o?o(s):s}:o}}function kh(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof ai=="function"?ai(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(u,a){s=e[o](s),i(u,a,s.done,s.value)})}}function i(o,s,u,a){Promise.resolve(a).then(function(c){o({value:c,done:u})},s)}}function Oh(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Rh(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Ph(e){return e&&e.__esModule?e:{default:e}}function Ch(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function Uh(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}var si,ui,ms=ii(()=>{si=function(e,t){return si=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)r.hasOwnProperty(i)&&(n[i]=r[i])},si(e,t)};ui=function(){return ui=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},ui.apply(this,arguments)}});var Fu={};vs(Fu,{ErrorCode:()=>Cu,EventType:()=>Uu,WebChannel:()=>Vu,XhrIo:()=>Mu,createWebChannelTransport:()=>Pu,default:()=>Mf});function Vh(e,t){gi(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function Ls(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function tr(){}function cr(e){var t=typeof e;return t!="object"?t:e?Array.isArray(e)?"array":t:"null"}function mi(e){var t=cr(e);return t=="array"||t=="object"&&typeof e.length=="number"}function gn(e){var t=typeof e;return t=="object"&&e!=null||t=="function"}function Fh(e){return Object.prototype.hasOwnProperty.call(e,ci)&&e[ci]||(e[ci]=++jh)}function qh(e,t,n){return e.call.apply(e.bind,arguments)}function Gh(e,t,n){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var i=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(i,r),e.apply(t,i)}}return function(){return e.apply(t,arguments)}}function tt(e,t,n){return Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?tt=qh:tt=Gh,tt.apply(null,arguments)}function Qn(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var r=n.slice();return r.push.apply(r,arguments),e.apply(this,r)}}function at(e,t){function n(){}n.prototype=t.prototype,e.S=t.prototype,e.prototype=new n,e.prototype.constructor=e}function Qt(){this.j=this.j,this.i=this.i}function zh(e){t:{for(var t=Pf,n=e.length,r=typeof e=="string"?e.split(""):e,i=0;i<n;i++)if(i in r&&t.call(void 0,r[i],i,e)){t=i;break t}t=-1}return 0>t?null:typeof e=="string"?e.charAt(t):e[t]}function ws(e){return Array.prototype.concat.apply([],arguments)}function Li(e){var t=e.length;if(0<t){for(var n=Array(t),r=0;r<t;r++)n[r]=e[r];return n}return[]}function er(e){return/^[\s\xa0]*$/.test(e)}function st(e,t){return e.indexOf(t)!=-1}function hi(e,t){return e<t?-1:e>t?1:0}function ki(e,t,n){for(var r in e)t.call(n,e[r],r,e)}function Rs(e){var t={};for(var n in e)t[n]=e[n];return t}function Ps(e,t){for(var n,r,i=1;i<arguments.length;i++){r=arguments[i];for(n in r)e[n]=r[n];for(var o=0;o<bs.length;
1o++)n=bs[o],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function Oi(e){return Oi[" "](e),e}function Kh(e,t){var n=Qh;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}function Vs(){var e=L.document;return e?e.documentMode:void 0}function Ms(e){return Kh(e,function(){for(var t=0,n=_s(String(nr)).split("."),r=_s(String(e)).split("."),i=Math.max(n.length,r.length),o=0;t==0&&o<i;o++){var s=n[o]||"",u=r[o]||"";do{if(s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],u=/(\d*)(\D*)(.*)/.exec(u)||["","","",""],s[0].length==0&&u[0].length==0)break;t=hi(s[1].length==0?0:parseInt(s[1],10),u[1].length==0?0:parseInt(u[1],10))||hi(s[2].length==0,u[2].length==0)||hi(s[2],u[2]),s=s[3],u=u[3]}while(t==0)}return 0<=t})}function et(e,t){this.type=e,this.a=this.target=t,this.defaultPrevented=!1}function pn(e,t){if(et.call(this,e?e.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,e){var n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.a=t,t=e.relatedTarget){if(Us){t:{try{Oi(t.nodeName);var i=!0;break t}catch{}i=!1}i||(t=null)}}else n=="mouseover"?t=e.fromElement:n=="mouseout"&&(t=e.toElement);this.relatedTarget=t,r?(this.clientX=r.clientX!==void 0?r.clientX:r.pageX,this.clientY=r.clientY!==void 0?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=e.clientX!==void 0?e.clientX:e.pageX,this.clientY=e.clientY!==void 0?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType=typeof e.pointerType=="string"?e.pointerType:Jh[e.pointerType]||"",this.c=e,e.defaultPrevented&&this.b()}}function Zh(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ca=i,this.key=++$h,this.Y=this.Z=!1}function hr(e){e.Y=!0,e.listener=null,e.proxy=null,e.src=null,e.ca=null}function fr(e){this.src=e,this.a={},this.b=0}function bi(e,t){var n=t.type;if(n in e.a){var r=e.a[n],i=ks(r,t),o;(o=0<=i)&&Array.prototype.splice.call(r,i,1),o&&(hr(t),e.a[n].length==0&&(delete e.a[n],e.b--))}}function Ei(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i];if(!o.Y&&o.listener==t&&o.capture==!!n&&o.ca==r)return i}return-1}function Ci(e,t,n,r,i){if(r&&r.once)return qs(e,t,n,r,i);if(Array.isArray(t)){for(var o=0;o<t.length;o++)Ci(e,t[o],n,r,i);return null}return n=Mi(n),e&&e[mn]?e.va(t,n,gn(r)?!!r.capture:!!r,i):js(e,t,n,!1,r,i)}function js(e,t,n,r,i,o){if(!t)throw Error("Invalid event type");var s=gn(i)?!!i.capture:!!i;if(s&&!Ri)return null;var u=Vi(e);if(u||(e[Pi]=u=new fr(e)),n=u.add(t,n,r,s,o),n.proxy)return n;if(r=tf(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)Yh||(i=s),i===void 0&&(i=!1),e.addEventListener(t.toString(),r,i);else if(e.attachEvent)e.attachEvent(Bs(t.toString()),r);else if(e.addListener&&e.removeListener)e.addListener(r);else throw Error("addEventListener and attachEvent are unavailable.");return n}function tf(){var e=ef,t=Ri?function(n){return e.call(t.src,t.listener,n)}:function(n){if(n=e.call(t.src,t.listener,n),!n)return n};return t}function qs(e,t,n,r,i){if(Array.isArray(t)){for(var o=0;o<t.length;o++)qs(e,t[o],n,r,i);return null}return n=Mi(n),e&&e[mn]?e.wa(t,n,gn(r)?!!r.capture:!!r,i):js(e,t,n,!0,r,i)}function Gs(e,t,n,r,i){if(Array.isArray(t))for(var o=0;o<t.length;o++)Gs(e,t[o],n,r,i);else r=gn(r)?!!r.capture:!!r,n=Mi(n),e&&e[mn]?(e=e.c,t=String(t).toString(),t in e.a&&(o=e.a[t],n=Ei(o,n,r,i),-1<n&&(hr(o[n]),Array.prototype.splice.call(o,n,1),o.length==0&&(delete e.a[t],e.b--)))):e&&(e=Vi(e))&&(t=e.a[t.toString()],e=-1,t&&(e=Ei(t,n,r,i)),(n=-1<e?t[e]:null)&&Ui(n))}function Ui(e){if(typeof e!="number"&&e&&!e.Y){var t=e.src;if(t&&t[mn])bi(t.c,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(Bs(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=Vi(t))?(bi(n,e),n.b==0&&(n.src=null,t[Pi]=null)):hr(e)}}}function Bs(e){return e in di?di[e]:di[e]="on"+e}function Es(e,t){var n=e.listener,r=e.ca||e.src;return e.Z&&Ui(e),n.call(r,t)}function ef(e,t){if(e.Y)return!0;
1if(!Ri){if(!t)t:{t=["window","event"];for(var n=L,r=0;r<t.length;r++)if(n=n[t[r]],n==null){t=null;break t}t=n}return t=new pn(t,this),Es(e,t)}return Es(e,new pn(t,this))}function Vi(e){return e=e[Pi],e instanceof fr?e:null}function Mi(e){return cr(e)=="function"?e:(e[vi]||(e[vi]=function(t){return e.handleEvent(t)}),e[vi])}function lt(){Qt.call(this),this.c=new fr(this),this.J=this,this.C=null}function $n(e,t,n,r){if(t=e.c.a[String(t)],!t)return!0;t=t.concat();for(var i=!0,o=0;o<t.length;++o){var s=t[o];if(s&&!s.Y&&s.capture==n){var u=s.listener,a=s.ca||s.src;s.Z&&bi(e.c,s),i=u.call(a,r)!==!1&&i}}return i&&!r.defaultPrevented}function zs(){this.b=this.a=null}function nf(){var e=Hs,t=null;return e.a&&(t=e.a,e.a=e.a.next,e.a||(e.b=null),t.next=null),t}function ji(){this.next=this.b=this.a=null}function rf(e){L.setTimeout(function(){throw e},0)}function Ws(e,t){Ii||of(),Ti||(Ii(),Ti=!0),Hs.add(e,t)}function of(){var e=L.Promise.resolve(void 0);Ii=function(){e.then(sf)}}function sf(){for(var e;e=nf();){try{e.a.call(e.b)}catch(n){rf(n)}var t=Ks;t.g(e),t.b<t.f&&(t.b++,e.next=t.a,t.a=e)}Ti=!1}function lr(e,t){lt.call(this),this.b=e||1,this.a=t||L,this.f=tt(this.Ya,this),this.g=kt()}function qi(e){e.aa=!1,e.M&&(e.a.clearTimeout(e.M),e.M=null)}function Gi(e,t,n){if(cr(e)=="function")n&&(e=tt(e,n));else if(e&&typeof e.handleEvent=="function")e=tt(e.handleEvent,e);else throw Error("Invalid listener argument");return 2147483647<Number(t)?-1:L.setTimeout(e,t||0)}function Qs(e){e.a=Gi(function(){e.a=null,e.c&&(e.c=!1,Qs(e))},e.h);var t=e.b;e.b=null,e.g.apply(null,t)}function dn(e){Qt.call(this),this.b=e,this.a={}}function Xs(e,t,n,r){Array.isArray(n)||(n&&(Is[0]=n.toString()),n=Is);for(var i=0;i<n.length;i++){var o=Ci(t,n[i],r||e.handleEvent,!1,e.b||e);if(!o)break;e.a[o.key]=o}}function Ys(e){ki(e.a,function(t,n){this.a.hasOwnProperty(n)&&Ui(t)},e),e.a={}}function Bi(){this.a=!0}function af(e,t,n,r,i,o){e.info(function(){if(e.a)if(o)for(var s="",u=o.split("&"),a=0;a<u.length;a++){var c=u[a].split("=");if(1<c.length){var h=c[0];c=c[1];var f=h.split("_");s=2<=f.length&&f[1]=="type"?s+(h+"="+c+"&"):s+(h+"=redacted&")}}else s=null;else s=o;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+t+` 2`+n+` 3`+s})}function cf(e,t,n,r,i,o,s){e.info(function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+t+` 4`+n+` 5`+o+" "+s})}function Le(e,t,n,r){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+ff(e,n)+(r?" "+r:"")})}function hf(e,t){e.info(function(){return"TIMEOUT: "+t})}function ff(e,t){if(!e.a)return t;if(!t)return null;try{var n=JSON.parse(t);if(n){for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var r=n[e];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var o=i[0];if(o!="noop"&&o!="stop"&&o!="close")for(var s=1;s<i.length;s++)i[s]=""}}}}return Fi(n)}catch{return t}}function zi(){return Ts=Ts||new lt}function Js(e){et.call(this,"serverreachability",e)}function vn(e){var t=zi();t.dispatchEvent(new Js(t,e))}function $s(e){et.call(this,"statevent",e)}function ft(e){var t=zi();t.dispatchEvent(new $s(t,e))}function Zs(e){et.call(this,"timingevent",e)}function wn(e,t){if(cr(e)!="function")throw Error("Fn must not be null and must be a function");return L.setTimeout(function(){e()},t)}function eu(){}function As(e){var t;return(t=e.a)||(t=e.a={}),t}function nu(){}function Ki(){et.call(this,"d")}function Wi(){et.call(this,"c")}function iu(){}function bn(e,t,n,r){this.g=e,this.c=t,this.f=n,this.T=r||1,this.J=new dn(this),this.P=lf,e=wi?125:void 0,this.R=new lr(e),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}function Ni(e,t,n){e.H=1,e.i=vr(Ft(t)),e.j=n,e.I=!0,su(e,null)}function su(e,t){e.u=kt(),En(e),e.l=Ft(e.i);var n=e.l,r=e.T;Array.isArray(r)||(r=[String(r)]),lu(n.b,"t",r),e.D=0,e.a=Lu(e.g,e.g.C?t:null),0<e.O&&(e.F=new uf(tt(e.Ca,e,e.a),e.O)),Xs(e.J,e.a,"readystatechange",e.Wa),t=e.B?Rs(e.B):{},e.j?(e.m||(e.m="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.a.ba(e.l,e.m,e.j,t)):(e.m="GET",e.a.ba(e.l,e.m,null,t)),vn(1),af(e.c,e.m,e.l,e.f,e.T,e.j)}function uu(e,t,n){for(var r=!0;!e.A&&e.D<n.length;){var i=pf(e,n);if(i==Ai){t==4&&(e.h=4,ft(14),r=!1),Le(e.c,e.f,null,"[Incomplete Response]");break}else if(i==ou){e.h=4,ft(15),Le(e.c,e.f,n,"[Invalid Chunk]"),r=!1;break}else Le(e.c,e.f,i,null),Si(e,i)}t==4&&n.length==0&&(e.h=1,ft(16),r=!1),e.b=e.b&&r,r?0<n.length&&!e.W&&(e.W=!0,t=e.g,t.a==e&&t.V&&!t.F&&(t.c.info("Great, no buffering proxy detected. Bytes received: "+n.length),to(t),t.F=!0)):(Le(e.c,e.f,n,"[Invalid Chunked Response]"),ke(e),rr(e))}function pf(e,t){var n=e.D,r=t.indexOf(` 6`,n);return r==-1?Ai:(n=Number(t.substring(n,r)),isNaN(n)?ou:(r+=1,r+n>t.length?Ai:(t=t.substr(r,n),e.D=r+n,t)))}function En(e){e.U=kt()+e.P,au(e,e.P)}function au(e,t){if(e.o!=null)throw Error("WatchDog timer not null");e.o=wn(tt(e.Ua,e),t)}function dr(e){e.o&&(L.clearTimeout(e.o),e.o=null)}function rr(e){e.g.v==0||e.A||Nu(e.g,e)}function ke(e){dr(e);var t=e.F;t&&typeof t.ja=="function"&&t.ja(),e.F=null,qi(e.R),Ys(e.J),e.a&&(t=e.a,e.a=null,t.abort(),t.ja())}function Si(e,t){try{var n=e.g;
6if(n.v!=0&&(n.a==e||xi(n.b,e))){if(n.I=e.N,!e.C&&xi(n.b,e)&&n.v==3){try{var r=n.ka.a.parse(t)}catch{r=null}if(Array.isArray(r)&&r.length==3){var i=r;if(i[0]==0){t:if(!n.j){if(n.a)if(n.a.u+3e3<e.u)ur(n),gr(n);else break t;Zi(n),ft(18)}}else n.oa=i[1],0<n.oa-n.P&&37500>i[2]&&n.H&&n.o==0&&!n.m&&(n.m=wn(tt(n.Ra,n),6e3));if(1>=vu(n.b)&&n.ea){try{n.ea()}catch{}n.ea=void 0}}else ae(n,11)}else if((e.C||n.a==e)&&ur(n),!er(t))for(t=r=n.ka.a.parse(t),r=0;r<t.length;r++)if(i=t[r],n.P=i[0],i=i[1],n.v==2)if(i[0]=="c"){n.J=i[1],n.ga=i[2];var o=i[3];o!=null&&(n.ha=o,n.c.info("VER="+n.ha));var s=i[4];s!=null&&(n.pa=s,n.c.info("SVER="+n.pa));var u=i[5];if(u!=null&&typeof u=="number"&&0<u){var a=1.5*u;n.D=a,n.c.info("backChannelRequestTimeoutMs_="+a)}a=n;var c=e.a;if(c){var h=c.a?c.a.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var f=a.b;!f.a&&(st(h,"spdy")||st(h,"quic")||st(h,"h2"))&&(f.f=f.g,f.a=new Set,f.b&&(Xi(f,f.b),f.b=null))}if(a.A){var l=c.a?c.a.getResponseHeader("X-HTTP-Session-Id"):null;l&&(a.na=l,G(a.B,a.A,l))}}n.v=3,n.f&&n.f.ta(),n.V&&(n.N=kt()-e.u,n.c.info("Handshake RTT: "+n.N+"ms")),a=n;var d=e;if(a.la=Du(a,a.C?a.ga:null,a.fa),d.C){yu(a.b,d);var v=d,g=a.D;g&&v.setTimeout(g),v.o&&(dr(v),En(v)),a.a=d}else Tu(a);0<n.g.length&&mr(n)}else i[0]!="stop"&&i[0]!="close"||ae(n,7);else n.v==3&&(i[0]=="stop"||i[0]=="close"?i[0]=="stop"?ae(n,7):$i(n):i[0]!="noop"&&n.f&&n.f.sa(i),n.o=0)}vn(4)}catch{}}function df(e){if(e.K&&typeof e.K=="function")return e.K();if(typeof e=="string")return e.split("");if(mi(e)){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t}t=[],n=0;for(r in e)t[n++]=e[r];return e=t}function Hi(e,t){if(e.forEach&&typeof e.forEach=="function")e.forEach(t,void 0);else if(mi(e)||typeof e=="string")Os(e,t,void 0);else{if(e.L&&typeof e.L=="function")var n=e.L();else if(e.K&&typeof e.K=="function")n=void 0;else if(mi(e)||typeof e=="string"){n=[];for(var r=e.length,i=0;i<r;i++)n.push(i)}else for(i in n=[],r=0,e)n[r++]=i;
6r=df(e),i=r.length;for(var o=0;o<i;o++)t.call(void 0,r[o],n&&n[o],e)}}function Oe(e,t){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(e)if(e instanceof Oe)for(n=e.L(),r=0;r<n.length;r++)this.set(n[r],e.get(n[r]));else for(r in e)this.set(r,e[r])}function Qi(e){if(e.c!=e.a.length){for(var t=0,n=0;t<e.a.length;){var r=e.a[t];ce(e.b,r)&&(e.a[n++]=r),t++}e.a.length=n}if(e.c!=e.a.length){var i={};for(n=t=0;t<e.a.length;)r=e.a[t],ce(i,r)||(e.a[n++]=r,i[r]=1),t++;e.a.length=n}}function ce(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function vf(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var r=e[n].indexOf("="),i=null;if(0<=r){var o=e[n].substring(0,r);i=e[n].substring(r+1)}else o=e[n];t(o,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}function he(e,t){if(this.c=this.j=this.f="",this.h=null,this.i=this.g="",this.a=!1,e instanceof he){this.a=t!==void 0?t:e.a,ir(this,e.f),this.j=e.j,or(this,e.c),sr(this,e.h),this.g=e.g,t=e.b;var n=new yn;n.c=t.c,t.a&&(n.a=new Oe(t.a),n.b=t.b),Ns(this,n),this.i=e.i}else e&&(n=String(e).match(cu))?(this.a=!!t,ir(this,n[1]||"",!0),this.j=ln(n[2]||""),or(this,n[3]||"",!0),sr(this,n[4]),this.g=ln(n[5]||"",!0),Ns(this,n[6]||"",!0),this.i=ln(n[7]||"")):(this.a=!!t,this.b=new yn(null,this.a))}function Ft(e){return new he(e)}function ir(e,t,n){e.f=n?ln(t,!0):t,e.f&&(e.f=e.f.replace(/:$/,""))}function or(e,t,n){e.c=n?ln(t,!0):t}function sr(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.h=t}else e.h=null}function Ns(e,t,n){t instanceof yn?(e.b=t,If(e.b,e.a)):(n||(t=fn(t,bf)),e.b=new yn(t,e.a))}function G(e,t,n){e.b.set(t,n)}function vr(e){return G(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^kt()).toString(36)),e}function yf(e){return e instanceof he?Ft(e):new he(e,void 0)}function gf(e,t,n,r){var i=new he(null,void 0);return e&&ir(i,e),t&&or(i,t),n&&sr(i,n),r&&(i.g=r),i}function ln(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function fn(e,t,n){return typeof e=="string"?(e=encodeURI(e).replace(t,mf),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function mf(e){return e=e.charCodeAt(0),"%"+(e>>4&15).toString(16)+(e&15).toString(16)}function yn(e,t){this.b=this.a=null,this.c=e||null,this.f=!!t}function Xt(e){e.a||(e.a=new Oe,e.b=0,e.c&&vf(e.c,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function hu(e,t){Xt(e),t=Re(e,t),ce(e.a.b,t)&&(e.c=null,e.b-=e.a.get(t).length,e=e.a,ce(e.b,t)&&(delete e.b[t],e.c--,e.a.length>2*e.c&&Qi(e)))}function fu(e,t){return Xt(e),t=Re(e,t),ce(e.a.b,t)}function lu(e,t,n){hu(e,t),0<n.length&&(e.c=null,e.a.set(Re(e,t),Li(n)),e.b+=n.length)}function Re(e,t){return t=String(t),e.f&&(t=t.toLowerCase()),t}function If(e,t){t&&!e.f&&(Xt(e),e.c=null,e.a.forEach(function(n,r){var i=r.toLowerCase();r!=i&&(hu(this,r),lu(this,i,n))},e)),e.f=t}function Tf(e,t){this.b=e,this.a=t}function pu(e){this.g=e||Af,L.PerformanceNavigationTiming?(e=L.performance.getEntriesByType("navigation"),e=0<e.length&&(e[0].nextHopProtocol=="hq"||e[0].nextHopProtocol=="h2")):e=!!(L.ia&&L.ia.ya&&L.ia.ya()&&L.ia.ya().qb),this.f=e?this.g:1,this.a=null,1<this.f&&(this.a=new Set),this.b=null,this.c=[]}function du(e){return e.b?!0:e.a?e.a.size>=e.f:!1}function vu(e){return e.b?1:e.a?e.a.size:0}function xi(e,t){return e.b?e.b==t:e.a?e.a.has(t):!1}function Xi(e,t){e.a?e.a.add(t):e.b=t}function yu(e,t){e.b&&e.b==t?e.b=null:e.a&&e.a.has(t)&&e.a.delete(t)}function gu(e){var t,n;if(e.b!=null)return e.c.concat(e.b.s);if(e.a!=null&&e.a.size!==0){var r=e.c;try{for(var i=Ls(e.a.values()),o=i.next();!o.done;o=i.next()){var s=o.value;r=r.concat(s.s)}}catch(u){t={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}return Li(e.c)}function Yi(){}function Nf(){this.a=new Yi}function Sf(e,t,n){var r=n||"";try{Hi(e,function(i,o){var s=i;gn(i)&&(s=Fi(i)),t.push(r+o+"="+encodeURIComponent(s))})}catch(i){throw t.push(r+"type="+encodeURIComponent("_badmap")),i}}function xf(e,t){var n=new Bi;if(L.Image){var r=new Image;r.onload=Qn(Zn,n,r,"TestLoadImage: loaded",!0,t),r.onerror=Qn(Zn,n,r,"TestLoadImage: error",!1,t),r.onabort=Qn(Zn,n,r,"TestLoadImage: abort",!1,t),r.ontimeout=Qn(Zn,n,r,"TestLoadImage: timeout",!1,t),L.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}function Zn(e,t,n,r,i){try{t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,i(r)}catch{}}function X(e){lt.call(this),this.headers=new Oe,this.H=e||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=Lf,this.D=this.F=!1}function Rf(e){return Ht&&Ms(9)&&typeof e.timeout=="number"&&e.ontimeout!==void 0}function Pf(e){return e.toLowerCase()=="content-type"}function xs(e,t){e.b=!1,e.a&&(e.g=!0,e.a.abort(),e.g=!1),e.f=t,e.h=5,mu(e),yr(e)}function mu(e){e.u||(e.u=!0,e.dispatchEvent("complete"),e.dispatchEvent("error"))}function wu(e){if(e.b&&typeof Di<"u"&&(!e.s[1]||Wt(e)!=4||e.X()!=2)){if(e.l&&Wt(e)==4)Gi(e.za,0,e);else if(e.dispatchEvent("readystatechange"),Wt(e)==4){e.b=!1;try{var t=e.X();
6t:switch(t){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var n=!0;break t;default:n=!1}var r;if(!(r=n)){var i;if(i=t===0){var o=String(e.B).match(cu)[1]||null;if(!o&&L.self&&L.self.location){var s=L.self.location.protocol;o=s.substr(0,s.length-1)}i=!kf.test(o?o.toLowerCase():"")}r=i}if(r)e.dispatchEvent("complete"),e.dispatchEvent("success");else{e.h=6;try{var u=2<Wt(e)?e.a.statusText:""}catch{u=""}e.f=u+" ["+e.X()+"]",mu(e)}}finally{yr(e)}}}}function yr(e,t){if(e.a){_u(e);var n=e.a,r=e.s[0]?tr:null;e.a=null,e.s=null,t||e.dispatchEvent("ready");try{n.onreadystatechange=r}catch{}}}function _u(e){e.a&&e.D&&(e.a.ontimeout=null),e.m&&(L.clearTimeout(e.m),e.m=null)}function Wt(e){return e.a?e.a.readyState:0}function Cf(e){var t="";return ki(e,function(n,r){t+=r,t+=":",t+=n,t+=`\r 7`}),t}function Ji(e,t,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Cf(n),typeof e=="string"?n!=null&&encodeURIComponent(String(n)):G(e,t,n))}function hn(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function bu(e){this.pa=0,this.g=[],this.c=new Bi,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=hn("failFast",!1,e),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=hn("baseRetryDelayMs",5e3,e),this.Ma=hn("retryDelaySeedMs",1e4,e),this.Ja=hn("forwardChannelMaxRetries",2,e),this.ma=hn("forwardChannelRequestTimeoutMs",2e4,e),this.Ka=e&&e.g||void 0,this.D=void 0,this.C=e&&e.supportsCrossDomainXhr||!1,this.J="",this.b=new pu(e&&e.concurrentRequestLimit),this.ka=new Nf,this.da=e&&e.fastHandshake||!1,this.Ga=e&&e.b||!1,e&&e.f&&(this.c.a=!1),e&&e.forceLongPolling&&(this.T=!1),this.V=!this.da&&this.T&&e&&e.c||!1,this.ea=void 0,this.N=0,this.F=!1,this.s=null}function $i(e){if(Eu(e),e.v==3){var t=e.R++,n=Ft(e.B);G(n,"SID",e.J),G(n,"RID",t),G(n,"TYPE","terminate"),In(e,n),t=new bn(e,e.c,t,void 0),t.H=2,t.i=vr(Ft(n)),n=!1,L.navigator&&L.navigator.sendBeacon&&(n=L.navigator.sendBeacon(t.i.toString(),"")),!n&&L.Image&&(new Image().src=t.i,n=!0),n||(t.a=Lu(t.g,null),t.a.ba(t.i)),t.u=kt(),En(t)}xu(e)}function gr(e){e.a&&(to(e),e.a.cancel(),e.a=null)}function Eu(e){gr(e),e.j&&(L.clearTimeout(e.j),e.j=null),ur(e),e.b.cancel(),e.h&&(typeof e.h=="number"&&L.clearTimeout(e.h),e.h=null)}function yi(e,t){e.g.push(new Tf(e.La++,t)),e.v==3&&mr(e)}function mr(e){du(e.b)||e.h||(e.h=!0,Ws(e.Ba,e),e.u=0)}function Uf(e,t){return vu(e.b)>=e.b.f-(e.h?1:0)?!1:e.h?(e.g=t.s.concat(e.g),!0):e.v==1||e.v==2||e.u>=(e.Ia?0:e.Ja)?!1:(e.h=wn(tt(e.Ba,e,t),Su(e,e.u)),e.u++,!0)}function Ds(e,t){var n;t?n=t.f:n=e.R++;var r=Ft(e.B);G(r,"SID",e.J),G(r,"RID",n),G(r,"AID",e.P),In(e,r),e.i&&e.l&&Ji(r,e.i,e.l),n=new bn(e,e.c,n,e.u+1),e.i===null&&(n.B=e.l),t&&(e.g=t.s.concat(e.g)),t=Iu(e,n,1e3),n.setTimeout(Math.round(.5*e.ma)+Math.round(.5*e.ma*Math.random())),Xi(e.b,n),Ni(n,r,t)}function In(e,t){e.f&&Hi({},function(n,r){G(t,r,n)})}function Iu(e,t,n){n=Math.min(e.g.length,n);var r=e.f?tt(e.f.Ha,e.f,e):null;t:for(var i=e.g,o=-1;;){var s=["count="+n];o==-1?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>c)o=Math.max(0,i[a].b-100),u=!1;else try{Sf(h,s,"req"+c+"_")}catch{r&&r(h)}}if(u){r=s.join("&");break t}}return e=e.g.splice(0,n),t.s=e,r}function Tu(e){e.a||e.j||(e.U=1,Ws(e.Aa,e),e.o=0)}function Zi(e){return e.a||e.j||3<=e.o?!1:(e.U++,e.j=wn(tt(e.Aa,e),Su(e,e.o)),e.o++,!0)}function to(e){e.s!=null&&(L.clearTimeout(e.s),e.s=null)}function Au(e){e.a=new bn(e,e.c,"rpc",e.U),e.i===null&&(e.a.B=e.l),e.a.O=0;var t=Ft(e.la);G(t,"RID","rpc"),G(t,"SID",e.J),G(t,"CI",e.H?"0":"1"),G(t,"AID",e.P),In(e,t),G(t,"TYPE","xmlhttp"),e.i&&e.l&&Ji(t,e.i,e.l),e.D&&e.a.setTimeout(e.D);var n=e.a;e=e.ga,n.H=1,n.i=vr(Ft(t)),n.j=null,n.I=!0,su(n,e)}function ur(e){e.m!=null&&(L.clearTimeout(e.m),e.m=null)}function Nu(e,t){var n=null;if(e.a==t){ur(e),to(e),e.a=null;var r=2}else if(xi(e.b,t))n=t.s,yu(e.b,t),r=1;else return;if(e.I=t.N,e.v!=0){if(t.b)if(r==1){n=t.j?t.j.length:0,t=kt()-t.u;var i=e.u;r=zi(),r.dispatchEvent(new Zs(r,n,t,i)),mr(e)}else Tu(e);else if(i=t.h,i==3||i==0&&0<e.I||!(r==1&&Uf(e,t)||r==2&&Zi(e)))switch(n&&0<n.length&&(t=e.b,t.c=t.c.concat(n)),i){case 1:ae(e,5);break;case 4:ae(e,10);break;case 3:ae(e,6);break;default:ae(e,2)}}}function Su(e,t){var n=e.Fa+Math.floor(Math.random()*e.Ma);return e.f||(n*=2),n*t}function ae(e,t){if(e.c.info("Error code "+t),t==2){var n=null;e.f&&(n=null);var r=tt(e.Xa,e);n||(n=new he("//www.google.com/images/cleardot.gif"),L.location&&L.location.protocol=="http"||ir(n,"https"),vr(n)),xf(n.toString(),r)}else ft(2);e.v=0,e.f&&e.f.ra(t),xu(e),Eu(e)}function xu(e){e.v=0,e.I=-1,e.f&&((gu(e.b).length!=0||e.g.length!=0)&&(e.b.c.length=0,Li(e.g),e.g.length=0),e.f.qa())}function Du(e,t,n){var r=yf(n);if(r.c!="")t&&or(r,t+"."+r.c),sr(r,r.h);else{var i=L.location;r=gf(i.protocol,t?t+"."+i.hostname:i.hostname,+i.port,n)}return e.W&&ki(e.W,function(o,s){G(r,s,o)}),t=e.A,n=e.na,t&&n&&G(r,t,n),G(r,"VER",e.ha),In(e,r),r}function Lu(e,t){if(t&&!e.C)throw Error("Can't create secondary domain capable XhrIo object.");return t=new X(e.Ka),t.F=e.C,t}function ku(){}function ar(){if(Ht&&!(10<=Number(Fs)))throw Error("Environmental error: no available transport.")}function wt(e,t){lt.call(this),this.a=new bu(t),this.l=e,this.b=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.a.l=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.a&&(e?e["X-WebChannel-Client-Profile"]=t.a:e={"X-WebChannel-Client-Profile":t.a}),this.a.O=e,(e=t&&t.httpHeadersOverwriteParam)&&!er(e)&&(this.a.i=e),this.h=t&&t.supportsCrossDomainXhr||!1,this.g=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!er(t)&&(this.a.A=t,e=this.b,e!==null&&t in e&&(e=this.b,t in e&&delete e[t])),this.f=new Pe(this)}function Ou(e){Ki.call(this);var t=e.__sm__;if(t){t:{for(var n in t){e=n;break t}e=void 0}(this.c=e)?(e=this.c,this.data=t!==null&&e in t?t[e]:void 0):this.data=t}else this.data=e}
7function Ru(){Wi.call(this),this.status=1}function Pe(e){this.a=e}var gi,Mh,T,Di,L,ci,jh,kt,Bh,ks,Os,_s,ut,fi,li,bs,Wh,Ht,Cs,wi,Us,Hh,nr,Xn,Yn,Jn,Qh,_i,pi,Fs,Ri,Xh,Yh,Jh,mn,$h,Pi,di,vi,Fi,Ks,Ii,Ti,Hs,uf,Is,Ts,pr,tu,_n,ru,lf,ou,Ai,cu,Ss,wf,_f,bf,Ef,Af,Df,Lf,kf,Of,Pu,Cu,Uu,Vu,Mu,Vf,Mf,ju=ii(()=>{gi=function(e,t){return gi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},gi(e,t)};Mh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Di=Di||{},L=Mh||self;ci="closure_uid_"+(1e9*Math.random()>>>0),jh=0;kt=Date.now;Bh=0;Qt.prototype.j=!1;Qt.prototype.ja=function(){if(!this.j&&(this.j=!0,this.G(),Bh!=0))var e=Fh(this)};Qt.prototype.G=function(){if(this.i)for(;this.i.length;)this.i.shift()()};ks=Array.prototype.indexOf?function(e,t){return Array.prototype.indexOf.call(e,t,void 0)}:function(e,t){if(typeof e=="string")return typeof t!="string"||t.length!=1?-1:e.indexOf(t,0);for(var n=0;n<e.length;n++)if(n in e&&e[n]===t)return n;return-1},Os=Array.prototype.forEach?function(e,t,n){Array.prototype.forEach.call(e,t,n)}:function(e,t,n){for(var r=e.length,i=typeof e=="string"?e.split(""):e,o=0;o<r;o++)o in i&&t.call(n,i[o],o,e)};_s=String.prototype.trim?function(e){return e.trim()}:function(e){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(e)[1]};t:{if(fi=L.navigator,fi&&(li=fi.userAgent,li)){ut=li;break t}ut=""}bs="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");Oi[" "]=tr;Wh=st(ut,"Opera"),Ht=st(ut,"Trident")||st(ut,"MSIE"),Cs=st(ut,"Edge"),wi=Cs||Ht,Us=st(ut,"Gecko")&&!(st(ut.toLowerCase(),"webkit")&&!st(ut,"Edge"))&&!(st(ut,"Trident")||st(ut,"MSIE"))&&!st(ut,"Edge"),Hh=st(ut.toLowerCase(),"webkit")&&!st(ut,"Edge");t:{if(Xn="",Yn=function(){var e=ut;if(Us)return/rv:([^\);]+)(\)|;)/.exec(e);if(Cs)return/Edge\/([\d\.]+)/.exec(e);if(Ht)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e);if(Hh)return/WebKit\/(\S+)/.exec(e);if(Wh)return/(?:Version)[ \/]?(\S+)/.exec(e)}(),Yn&&(Xn=Yn?Yn[1]:""),Ht&&(Jn=Vs(),Jn!=null&&Jn>parseFloat(Xn))){nr=String(Jn);break t}nr=Xn}Qh={};L.document&&Ht?(pi=Vs(),_i=pi||parseInt(nr,10)||void 0):_i=void 0;Fs=_i,Ri=!Ht||9<=Number(Fs),Xh=Ht&&!Ms("9"),Yh=function(){if(!L.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{L.addEventListener("test",tr,t),L.removeEventListener("test",tr,t)}catch{}return e}();et.prototype.b=function(){this.defaultPrevented=!0};at(pn,et);Jh={2:"touch",3:"pen",4:"mouse"};pn.prototype.b=function(){pn.S.b.call(this);var e=this.c;if(e.preventDefault)e.preventDefault();else if(e.returnValue=!1,Xh)try{(e.ctrlKey||112<=e.keyCode&&123>=e.keyCode)&&(e.keyCode=-1)}catch{}};mn="closure_listenable_"+(1e6*Math.random()|0),$h=0;fr.prototype.add=function(e,t,n,r,i){var o=e.toString();e=this.a[o],e||(e=this.a[o]=[],this.b++);var s=Ei(e,t,r,i);return-1<s?(t=e[s],n||(t.Z=!1)):(t=new Zh(t,this.src,o,!!r,i),t.Z=n,e.push(t)),t};Pi="closure_lm_"+(1e6*Math.random()|0),di={};vi="__closure_events_fn_"+(1e9*Math.random()>>>0);at(lt,Qt);lt.prototype[mn]=!0;T=lt.prototype;T.addEventListener=function(e,t,n,r){Ci(this,e,t,n,r)};
7T.removeEventListener=function(e,t,n,r){Gs(this,e,t,n,r)};T.dispatchEvent=function(e){var t,n=this.C;if(n)for(t=[];n;n=n.C)t.push(n);n=this.J;var r=e.type||e;if(typeof e=="string")e=new et(e,n);else if(e instanceof et)e.target=e.target||n;else{var i=e;e=new et(r,n),Ps(e,i)}if(i=!0,t)for(var o=t.length-1;0<=o;o--){var s=e.a=t[o];i=$n(s,r,!0,e)&&i}if(s=e.a=n,i=$n(s,r,!0,e)&&i,i=$n(s,r,!1,e)&&i,t)for(o=0;o<t.length;o++)s=e.a=t[o],i=$n(s,r,!1,e)&&i;return i};T.G=function(){if(lt.S.G.call(this),this.c){var e=this.c,t;for(t in e.a){for(var n=e.a[t],r=0;r<n.length;r++)hr(n[r]);delete e.a[t],e.b--}}this.C=null};T.va=function(e,t,n,r){return this.c.add(String(e),t,!1,n,r)};T.wa=function(e,t,n,r){return this.c.add(String(e),t,!0,n,r)};Fi=L.JSON.stringify;Ks=new(function(){function e(t,n,r){this.f=r,this.c=t,this.g=n,this.b=0,this.a=null}return e.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},e}())(function(){return new ji},function(e){e.reset()},100);zs.prototype.add=function(e,t){var n=Ks.get();n.set(e,t),this.b?this.b.next=n:this.a=n,this.b=n};ji.prototype.set=function(e,t){this.a=e,this.b=t,this.next=null};ji.prototype.reset=function(){this.next=this.b=this.a=null};Ti=!1,Hs=new zs;at(lr,lt);T=lr.prototype;T.aa=!1;T.M=null;T.Ya=function(){if(this.aa){var e=kt()-this.g;0<e&&e<.8*this.b?this.M=this.a.setTimeout(this.f,this.b-e):(this.M&&(this.a.clearTimeout(this.M),this.M=null),this.dispatchEvent("tick"),this.aa&&(qi(this),this.start()))}};T.start=function(){this.aa=!0,this.M||(this.M=this.a.setTimeout(this.f,this.b),this.g=kt())};T.G=function(){lr.S.G.call(this),qi(this),delete this.a};uf=function(e){Vh(t,e);function t(n,r,i){var o=e.call(this)||this;return o.g=i!=null?n.bind(i):n,o.h=r,o.b=null,o.c=!1,o.a=null,o}return t.prototype.f=function(n){this.b=arguments,this.a?this.c=!0:Qs(this)},t.prototype.G=function(){e.prototype.G.call(this),this.a&&(L.clearTimeout(this.a),this.a=null,this.c=!1,this.b=null)},t}(Qt);at(dn,Qt);Is=[];dn.prototype.G=function(){dn.S.G.call(this),Ys(this)};dn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};Bi.prototype.info=function(){};Ts=null;at(Js,et);at($s,et);at(Zs,et);pr={NO_ERROR:0,Za:1,gb:2,fb:3,bb:4,eb:5,hb:6,Da:7,TIMEOUT:8,kb:9},tu={ab:"complete",ob:"success",Ea:"error",Da:"abort",mb:"ready",nb:"readystatechange",TIMEOUT:"timeout",ib:"incrementaldata",lb:"progress",cb:"downloadprogress",pb:"uploadprogress"};eu.prototype.a=null;_n={OPEN:"a",$a:"b",Ea:"c",jb:"d"};at(Ki,et);at(Wi,et);at(iu,eu);ru=new iu;lf=45e3,ou={},Ai={};T=bn.prototype;T.setTimeout=function(e){this.P=e};T.Wa=function(e){e=e.target;var t=this.F;t&&Wt(e)==3?t.f():this.Ca(e)};T.Ca=function(e){try{if(e==this.a)t:{var t=Wt(this.a),n=this.a.ua(),r=this.a.X();if(!(3>t||t==3&&!wi&&!this.a.$())){this.A||t!=4||n==7||(n==8||0>=r?vn(3):vn(2)),dr(this);var i=this.a.X();this.N=i;var o=this.a.$();if(this.b=i==200,cf(this.c,this.m,this.l,this.f,this.T,t,i),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)&&!er(s)){var a=s;break e}}a=null}if(a)Le(this.c,this.f,a,"Initial handshake response via X-HTTP-Initial-Response"),this.C=!0,Si(this,a);else{this.b=!1,this.h=3,ft(12),ke(this),rr(this);break t}}this.I?(uu(this,t,o),wi&&this.b&&t==3&&(Xs(this.J,this.R,"tick",this.Va),this.R.start())):(Le(this.c,this.f,o,null),Si(this,o)),t==4&&ke(this),this.b&&!this.A&&(t==4?Nu(this.g,this):(this.b=!1,En(this)))}else i==400&&0<o.indexOf("Unknown SID")?(this.h=3,ft(12)):(this.h=0,ft(13)),ke(this),rr(this)}}}catch{}finally{}};T.Va=function(){if(this.a){var e=Wt(this.a),t=this.a.$();this.D<t.length&&(dr(this),uu(this,e,t),this.b&&e!=4&&En(this))}};T.cancel=function(){this.A=!0,ke(this)};T.Ua=function(){this.o=null;var e=kt();0<=e-this.U?(hf(this.c,this.l),this.H!=2&&(vn(3),ft(17)),ke(this),this.h=2,rr(this)):au(this,this.U-e)};T=Oe.prototype;T.K=function(){Qi(this);for(var e=[],t=0;t<this.a.length;t++)e.push(this.b[this.a[t]]);return e};T.L=function(){return Qi(this),this.a.concat()};T.get=function(e,t){return ce(this.b,e)?this.b[e]:t};T.set=function(e,t){ce(this.b,e)||(this.c++,this.a.push(e)),this.b[e]=t};T.forEach=function(e,t){for(var n=this.L(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);e.call(t,o,i,this)}};cu=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;he.prototype.toString=function(){var e=[],t=this.f;t&&e.push(fn(t,Ss,!0),":");var n=this.c;return(n||t=="file")&&(e.push("//"),(t=this.j)&&e.push(fn(t,Ss,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),n=this.h,n!=null&&e.push(":",String(n))),(n=this.g)&&(this.c&&n.charAt(0)!="/"&&e.push("/"),e.push(fn(n,n.charAt(0)=="/"?_f:wf,!0))),(n=this.b.toString())&&e.push("?",n),(n=this.i)&&e.push("#",fn(n,Ef)),e.join("")};Ss=/[#\/\?@]/g,wf=/[#\?:]/g,_f=/[#\?]/g,bf=/[#\?@]/g,Ef=/#/g;T=yn.prototype;T.add=function(e,t){Xt(this),this.c=null,e=Re(this,e);var n=this.a.get(e);return n||this.a.set(e,n=[]),n.push(t),this.b+=1,this};T.forEach=function(e,t){Xt(this),this.a.forEach(function(n,r){Os(n,function(i){e.call(t,i,r,this)},this)},this)};T.L=function(){Xt(this);for(var e=this.a.K(),t=this.a.L(),n=[],r=0;r<t.length;r++)for(var i=e[r],o=0;o<i.length;o++)n.push(t[r]);return n};T.K=function(e){Xt(this);var t=[];if(typeof e=="string")fu(this,e)&&(t=ws(t,this.a.get(Re(this,e))));else{e=this.a.K();for(var n=0;n<e.length;n++)t=ws(t,e[n])}return t};T.set=function(e,t){return Xt(this),this.c=null,e=Re(this,e),fu(this,e)&&(this.b-=this.a.get(e).length),this.a.set(e,[t]),this.b+=1,this};T.get=function(e,t){return e?(e=this.K(e),0<e.length?String(e[0]):t):t};T.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var e=[],t=this.a.L(),n=0;n<t.length;n++){var r=t[n],i=encodeURIComponent(String(r));r=this.K(r);for(var o=0;o<r.length;o++){var s=i;r[o]!==""&&(s+="="+encodeURIComponent(String(r[o]))),e.push(s)}}return this.c=e.join("&")};Af=10;pu.prototype.cancel=function(){var e,t;if(this.c=gu(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&this.a.size!==0){try{for(var n=Ls(this.a.values()),r=n.next();!r.done;r=n.next()){var i=r.value;i.cancel()}}catch(o){e={error:o}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.a.clear()}};Yi.prototype.stringify=function(e){return L.JSON.stringify(e,void 0)};Yi.prototype.parse=function(e){return L.JSON.parse(e,void 0)};Df=L.JSON.parse;at(X,lt);Lf="",kf=/^https?$/i,Of=["POST","PUT"];T=X.prototype;T.ba=function(e,t,n,r){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.B+"; newUri="+e);t=t?t.toUpperCase():"GET",this.B=e,this.f="",this.h=0,this.u=!1,this.b=!0,this.a=new XMLHttpRequest,this.s=this.H?As(this.H):As(ru),this.a.onreadystatechange=tt(this.za,this);try{this.A=!0,this.a.open(t,String(e),!0),this.A=!1}catch(o){xs(this,o);return}e=n||"";var i=new Oe(this.headers);r&&Hi(r,function(o,s){i.set(s,o)}),r=zh(i.L()),n=L.FormData&&e instanceof L.FormData,!(0<=ks(Of,t))||r||n||i.set("Content-Type","application/x-www-form-urlencoded;
7charset=utf-8"),i.forEach(function(o,s){this.a.setRequestHeader(s,o)},this),this.I&&(this.a.responseType=this.I),"withCredentials"in this.a&&this.a.withCredentials!==this.F&&(this.a.withCredentials=this.F);try{_u(this),0<this.o&&((this.D=Rf(this.a))?(this.a.timeout=this.o,this.a.ontimeout=tt(this.xa,this)):this.m=Gi(this.xa,this.o,this)),this.l=!0,this.a.send(e),this.l=!1}catch(o){xs(this,o)}};T.xa=function(){typeof Di<"u"&&this.a&&(this.f="Timed out after "+this.o+"ms, aborting",this.h=8,this.dispatchEvent("timeout"),this.abort(8))};T.abort=function(e){this.a&&this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1,this.h=e||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),yr(this))};T.G=function(){this.a&&(this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1),yr(this,!0)),X.S.G.call(this)};T.za=function(){this.j||(this.A||this.l||this.g?wu(this):this.Ta())};T.Ta=function(){wu(this)};T.X=function(){try{return 2<Wt(this)?this.a.status:-1}catch{return-1}};T.$=function(){try{return this.a?this.a.responseText:""}catch{return""}};T.Na=function(e){if(this.a){var t=this.a.responseText;return e&&t.indexOf(e)==0&&(t=t.substring(e.length)),Df(t)}};T.ua=function(){return this.h};T.Qa=function(){return typeof this.f=="string"?this.f:String(this.f)};T=bu.prototype;T.ha=8;T.v=1;T.Ba=function(e){if(this.h)if(this.h=null,this.v==1){if(!e){this.R=Math.floor(1e5*Math.random()),e=this.R++;var t=new bn(this,this.c,e,void 0),n=this.l;this.O&&(n?(n=Rs(n),Ps(n,this.O)):n=this.O),this.i===null&&(t.B=n);var r;if(this.da)t:{for(var i=r=0;i<this.g.length;i++){e:{var o=this.g[i];if("__data__"in o.a&&(o=o.a.__data__,typeof o=="string")){o=o.length;break e}o=void 0}if(o===void 0)break;if(r+=o,4096<r){r=i;break t}if(r===4096||i===this.g.length-1){r=i+1;break t}}r=1e3}else r=1e3;r=Iu(this,t,r),i=Ft(this.B),G(i,"RID",e),G(i,"CVER",22),this.A&&G(i,"X-HTTP-Session-Id",this.A),In(this,i),this.i&&n&&Ji(i,this.i,n),Xi(this.b,t),this.Ga&&G(i,"TYPE","init"),this.da?(G(i,"$req",r),G(i,"SID","null"),t.V=!0,Ni(t,i,null)):Ni(t,i,r),this.v=2}}else this.v==3&&(e?Ds(this,e):this.g.length==0||du(this.b)||Ds(this))};T.Aa=function(){if(this.j=null,Au(this),this.V&&!(this.F||this.a==null||0>=this.N)){var e=2*this.N;this.c.info("BP detection timer enabled: "+e),this.s=wn(tt(this.Sa,this),e)}};T.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,gr(this),Au(this))};T.Ra=function(){this.m!=null&&(this.m=null,gr(this),Zi(this),ft(19))};T.Xa=function(e){e?(this.c.info("Successfully pinged google.com"),ft(2)):(this.c.info("Failed to ping google.com"),ft(1))};T=ku.prototype;T.ta=function(){};T.sa=function(){};T.ra=function(){};T.qa=function(){};T.Ha=function(){};ar.prototype.a=function(e,t){return new wt(e,t)};at(wt,lt);T=wt.prototype;T.addEventListener=function(e,t,n,r){wt.S.addEventListener.call(this,e,t,n,r)};T.removeEventListener=function(e,t,n,r){wt.S.removeEventListener.call(this,e,t,n,r)};T.Oa=function(){this.a.f=this.f,this.h&&(this.a.C=!0);var e=this.a,t=this.l,n=this.b||void 0;ft(0),e.fa=t,e.W=n||{},e.H=e.T,e.B=Du(e,null,e.fa),mr(e)};T.close=function(){$i(this.a)};T.Pa=function(e){if(typeof e=="string"){var t={};t.__data__=e,yi(this.a,t)}else this.g?(t={},t.__data__=Fi(e),yi(this.a,t)):yi(this.a,e)};T.G=function(){this.a.f=null,delete this.f,$i(this.a),delete this.a,wt.S.G.call(this)};at(Ou,Ki);at(Ru,Wi);at(Pe,ku);Pe.prototype.ta=function(){this.a.dispatchEvent("a")};Pe.prototype.sa=function(e){this.a.dispatchEvent(new Ou(e))};Pe.prototype.ra=function(e){this.a.dispatchEvent(new Ru(e))};Pe.prototype.qa=function(){this.a.dispatchEvent("b")};ar.prototype.createWebChannel=ar.prototype.a;wt.prototype.send=wt.prototype.Pa;wt.prototype.open=wt.prototype.Oa;wt.prototype.close=wt.prototype.close;pr.NO_ERROR=0;pr.TIMEOUT=8;pr.HTTP_ERROR=6;tu.COMPLETE="complete";nu.EventType=_n;_n.OPEN="a";_n.CLOSE="b";_n.ERROR="c";_n.MESSAGE="d";lt.prototype.listen=lt.prototype.va;X.prototype.listenOnce=X.prototype.wa;X.prototype.getLastError=X.prototype.Qa;X.prototype.getLastErrorCode=X.prototype.ua;X.prototype.getStatus=X.prototype.X;X.prototype.getResponseJson=X.prototype.Na;X.prototype.getResponseText=X.prototype.$;X.prototype.send=X.prototype.ba;Pu=function(){return new ar},Cu=pr,Uu=tu,Vu=nu,Mu=X,Vf={createWebChannelTransport:Pu,ErrorCode:Cu,EventType:Uu,WebChannel:Vu,XhrIo:Mu},Mf=Vf});var ch=fh(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});var p=(ms(),oi(gs)),Ff=gh(),vt=(yh(),oi(vh)),jt=ph(),Ot=(ju(),oi(Fu)),jf=dh();function qf(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var Gf=qf(Ff),y={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",UNIMPLEMENT
7ED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},m=function(e){function t(n,r){var i=this;return(i=e.call(this,r)||this).code=n,i.message=r,i.name="FirebaseError",i.toString=function(){return i.name+": [code="+i.code+"]: "+i.message},i}return p.__extends(t,e),t}(Error),St=new vt.Logger("@firebase/firestore");function Sr(){return St.logLevel}function _(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(St.logLevel<=vt.LogLevel.DEBUG){var r=t.map(So);St.debug.apply(St,p.__spreadArrays(["Firestore (7.24.0): "+e],r))}}function B(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(St.logLevel<=vt.LogLevel.ERROR){var r=t.map(So);St.error.apply(St,p.__spreadArrays(["Firestore (7.24.0): "+e],r))}}function qu(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(St.logLevel<=vt.LogLevel.WARN){var r=t.map(So);St.warn.apply(St,p.__spreadArrays(["Firestore (7.24.0): "+e],r))}}function So(e){if(typeof e=="string")return e;try{return t=e,JSON.stringify(t)}catch{return e}var t}function A(e){e===void 0&&(e="Unexpected state");var t="FIRESTORE (7.24.0) INTERNAL ASSERTION FAILED: "+e;throw B(t),new Error(t)}function S(e,t){e||A()}function I(e,t){return e}function Gu(e){var t=0;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function nn(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function Fa(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}var ja=function(){function e(t,n,r){n===void 0?n=0:n>t.length&&A(),r===void 0?r=t.length-n:r>t.length-n&&A(),this.segments=t,this.offset=n,this.t=r}return Object.defineProperty(e.prototype,"length",{get:function(){return this.t},enumerable:!1,configurable:!0}),e.prototype.isEqual=function(t){return e.i(this,t)===0},e.prototype.child=function(t){var n=this.segments.slice(this.offset,this.limit());return t instanceof e?t.forEach(function(r){n.push(r)}):n.push(t),this.o(n)},e.prototype.limit=function(){return this.offset+this.length},e.prototype.u=function(t){return t=t===void 0?1:t,this.o(this.segments,this.offset+t,this.length-t)},e.prototype.h=function(){return this.o(this.segments,this.offset,this.length-1)},e.prototype.l=function(){return this.segments[this.offset]},e.prototype._=function(){return this.get(this.length-1)},e.prototype.get=function(t){return this.segments[this.offset+t]},e.prototype.m=function(){return this.length===0},e.prototype.T=function(t){if(t.length<this.length)return!1;for(var n=0;n<this.length;n++)if(this.get(n)!==t.get(n))return!1;return!0},e.prototype.I=function(t){if(this.length+1!==t.length)return!1;for(var n=0;n<this.length;n++)if(this.get(n)!==t.get(n))return!1;return!0},e.prototype.forEach=function(t){for(var n=this.offset,r=this.limit();n<r;n++)t(this.segments[n])},e.prototype.A=function(){return this.segments.slice(this.offset,this.limit())},e.i=function(t,n){for(var r=Math.min(t.length,n.length),i=0;i<r;i++){var o=t.get(i),s=n.get(i);if(o<s)return-1;if(o>s)return 1}return t.length<n.length?-1:t.length>n.length?1:0},e}(),q=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return p.__extends(t,e),t.prototype.o=function(n,r,i){return new t(n,r,i)},t.prototype.R=function(){return this.A().join("/")},t.prototype.toString=function(){return this.R()},t.g=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i=[],o=0,s=n;o<s.length;o++){var u=s[o];if(u.indexOf("//")>=0)throw new m(y.INVALID_ARGUMENT,"Invalid segment ("+u+"). Paths must not contain // in them.");i.push.apply(i,u.split("/").filter(function(a){return a.length>0}))}return new t(i)},t.P=function(){return new t([])},t}(ja),Bf=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Dt=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return p.__extends(t,e),t.prototype.o=function(n,r,i){return new t(n,r,i)},t.V=function(n){return Bf.test(n)},t.prototype.R=function(){return this.A().map(function(n){return n=n.replace("\\","\\\\").replace("`","\\`"),t.V(n)||(n="`"+n+"`"),n}).join(".")},t.prototype.toString=function(){return this.R()},t.prototype.p=function(){return this.length===1&&this.get(0)==="__name__"},t.v=function(){return new t(["__name__"])},t.S=function(n){for(var r=[],i="",o=0,s=function(){if(i.length===0)throw new m
7(y.INVALID_ARGUMENT,"Invalid field path ("+n+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");r.push(i),i=""},u=!1;o<n.length;){var a=n[o];if(a==="\\"){if(o+1===n.length)throw new m(y.INVALID_ARGUMENT,"Path has trailing escape character: "+n);var c=n[o+1];if(c!=="\\"&&c!=="."&&c!=="`")throw new m(y.INVALID_ARGUMENT,"Path has invalid escape sequence: "+n);i+=c,o+=2}else a==="`"?(u=!u,o++):a!=="."||u?(i+=a,o++):(s(),o++)}if(s(),u)throw new m(y.INVALID_ARGUMENT,"Unterminated ` in path: "+n);return new t(r)},t.P=function(){return new t([])},t}(ja),x=function(){function e(t){this.path=t}return e.D=function(t){return new e(q.g(t))},e.C=function(t){return new e(q.g(t).u(5))},e.prototype.N=function(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t},e.prototype.isEqual=function(t){return t!==null&&q.i(this.path,t.path)===0},e.prototype.toString=function(){return this.path.toString()},e.i=function(t,n){return q.i(t.path,n.path)},e.F=function(t){return t.length%2==0},e.$=function(t){return new e(new q(t.slice()))},e}();function Bu(e,t){if(t.length!==0)throw new m(y.INVALID_ARGUMENT,"Function "+e+"() does not support arguments, but was called with "+pe(t.length,"argument")+".")}function j(e,t,n){if(t.length!==n)throw new m(y.INVALID_ARGUMENT,"Function "+e+"() requires "+pe(n,"argument")+", but was called with "+pe(t.length,"argument")+".")}function At(e,t,n){if(t.length<n)throw new m(y.INVALID_ARGUMENT,"Function "+e+"() requires at least "+pe(n,"argument")+", but was called with "+pe(t.length,"argument")+".")}function bt(e,t,n,r){if(t.length<n||t.length>r)throw new m(y.INVALID_ARGUMENT,"Function "+e+"() requires between "+n+" and "+r+" arguments, but was called with "+pe(t.length,"argument")+".")}function Q(e,t,n,r){za(e,t,Vn(n)+" argument",r)}function Ge(e,t,n,r){r!==void 0&&Q(e,t,n,r)}function qa(e,t,n,r){za(e,t,n+" option",r)}function Tt(e,t,n,r){r!==void 0&&qa(e,t,n,r)}function Ga(e,t,n,r,i){r!==void 0&&function(o,s,u,a,c){for(var h=[],f=0,l=c;f<l.length;f++){var d=l[f];if(d===a)return;h.push(Ct(d))}var v=Ct(a);throw new m(y.INVALID_ARGUMENT,"Invalid value "+v+" provided to function "+o+'() for option "'+u+'". Acceptable values: '+h.join(", "))}(e,0,n,r,i)}function Ba(e,t,n,r){if(!t.some(function(i){return i===r}))throw new m(y.INVALID_ARGUMENT,"Invalid value "+Ct(r)+" provided to function "+e+"() for its "+Vn(n)+" argument. Acceptable values: "+t.join(", "));return r}function za(e,t,n,r){if(!(t==="object"?Ka(r):t==="non-empty string"?typeof r=="string"&&r!=="":typeof r===t)){var i=Ct(r);throw new m(y.INVALID_ARGUMENT,"Function "+e+"() requires its "+n+" to be of type "+t+", but it was: "+i)}}function Ka(e){return typeof e=="object"&&e!==null&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function Ct(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="string")return e.length>20&&(e=e.substring(0,20)+"..."),JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return""+e;if(typeof e=="object"){if(e instanceof Array)return"an array";var t=function(n){if(n.constructor){var r=/function\s+([^\s(]+)\s*\(/.exec(n.constructor.toString());if(r&&r.length>1)return r[1]}return null}(e);return t?"a custom "+t+" object":"an object"}return typeof e=="function"?"a function":A()}function zu(e,t,n){if(n===void 0)throw new m(y.INVALID_ARGUMENT,"Function "+e+"() requires a valid "+Vn(t)+" argument, but it was undefined.")}function we(e,t,n){nn(t,function(r,i){if(n.indexOf(r)<0)throw new m(y.INVALID_ARGUMENT,"Unknown option '"+r+"' passed to function "+e+"(). Available options: "+n.join(", "))})}function _e(e,t,n,r){var i=Ct(r);return new m(y.INVALID_ARGUMENT,"Function "+e+"() requires its "+Vn(n)+" argument to be a "+t+", but it was: "+i)}function Ku(e,t,n){if(n<=0)throw new m(y.INVALID_ARGUMENT,"Function "+e+"() requires its "+Vn(t)+" argument to be a positive number, but it was: "+n+".")}function Vn(e){switch(e){case 1:return"first";
7case 2:return"second";case 3:return"third";default:return e+"th"}}function pe(e,t){return e+" "+t+(e===1?"":"s")}function zf(e){var t=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&typeof t.getRandomValues=="function")t.getRandomValues(n);else for(var r=0;r<e;r++)n[r]=Math.floor(256*Math.random());return n}var Wa=function(){function e(){}return e.k=function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=Math.floor(256/t.length)*t.length,r="";r.length<20;)for(var i=zf(40),o=0;o<i.length;++o)r.length<20&&i[o]<n&&(r+=t.charAt(i[o]%t.length));return r},e}();function k(e,t){return e<t?-1:e>t?1:0}function We(e,t,n){return e.length===t.length&&e.every(function(r,i){return n(r,t[i])})}function Ha(e){return e+"\0"}var it=function(){function e(t){this.M=t}return e.fromBase64String=function(t){return new e(atob(t))},e.fromUint8Array=function(t){return new e(function(n){for(var r="",i=0;i<n.length;++i)r+=String.fromCharCode(n[i]);return r}(t))},e.prototype.toBase64=function(){return t=this.M,btoa(t);var t},e.prototype.toUint8Array=function(){return function(t){for(var n=new Uint8Array(t.length),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}(this.M)},e.prototype.O=function(){return 2*this.M.length},e.prototype.L=function(t){return k(this.M,t.M)},e.prototype.isEqual=function(t){return this.M===t.M},e}();it.B=new it("");var xo=function(){function e(t){this.q=t}return e.fromBase64String=function(t){try{return new e(it.fromBase64String(t))}catch(n){throw new m(y.INVALID_ARGUMENT,"Failed to construct Bytes from Base64 string: "+n)}},e.fromUint8Array=function(t){return new e(it.fromUint8Array(t))},e.prototype.toBase64=function(){return this.q.toBase64()},e.prototype.toUint8Array=function(){return this.q.toUint8Array()},e.prototype.toString=function(){return"Bytes(base64: "+this.toBase64()+")"},e.prototype.isEqual=function(t){return this.q.isEqual(t.q)},e}();function Wu(){if(typeof Uint8Array>"u")throw new m(y.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function Hu(){if(typeof atob>"u")throw new m(y.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var ho=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return p.__extends(t,e),t.fromBase64String=function(n){j("Blob.fromBase64String",arguments,1),Q("Blob.fromBase64String","string",1,n),Hu();try{return new t(it.fromBase64String(n))}catch(r){throw new m(y.INVALID_ARGUMENT,"Failed to construct Blob from Base64 string: "+r)}},t.fromUint8Array=function(n){if(j("Blob.fromUint8Array",arguments,1),Wu(),!(n instanceof Uint8Array))throw _e("Blob.fromUint8Array","Uint8Array",1,n);return new t(it.fromUint8Array(n))},t.prototype.toBase64=function(){return j("Blob.toBase64",arguments,0),Hu(),e.prototype.toBase64.call(this)},t.prototype.toUint8Array=function(){return j("Blob.toUint8Array",arguments,0),Wu(),e.prototype.toUint8Array.call(this)},t.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},t}(xo),Kf=function(e,t,n,r,i,o){this.U=e,this.persistenceKey=t,this.host=n,this.ssl=r,this.forceLongPolling=i,this.W=o},fo=function(){function e(t,n){this.projectId=t,this.database=n||"(default)"}return Object.defineProperty(e.prototype,"j",{get:function(){return this.database==="(default)"},enumerable:!1,configurable:!0}),e.prototype.isEqual=function(t){return t instanceof e&&t.projectId===this.projectId&&t.database===this.database},e.prototype.L=function(t){return k(this.projectId,t.projectId)||k(this.database,t.database)},e}(),rn=function(){function e(t,n){this.K=t,this.G=n,this.H={}}return e.prototype.get=function(t){var n=this.K(t),r=this.H[n];if(r!==void 0)for(var i=0,o=r;i<o.length;i++){var s=o[i],u=s[0],a=s[1];if(this.G(u,t))return a}},e.prototype.has=function(t){return this.get(t)!==void 0},e.prototype.set=function(t,n){var r=this.K(t),i=this.H[r];if(i!==void 0){for(var o=0;o<i.length;o++)if(this.G(i[o][0],t))return void(i[o]=[t,n]);i.push([t,n])}else this.H[r]=[[t,n]]},e.prototype.delete=function(t){var n=this.K(t),r=this.H[n];if(r===void 0)return!1;for(var i=0;i<r.length;i++)if(this.G(r[i][0],t))return r.length===1?delete this.H[n]:r.splice(i,1),!0;return!1},e.prototype.forEach=function(t){nn(this.H,function(n,r){for(var i=0,o=r;i<o.length;i++){var s=o[i],u=s[0],a=s[1];t(u,a)}})},e.prototype.m=function(){return Fa(this.H)},e}(),ht=function(){function e(t,n){if(this.seconds=t,this.nanoseconds=n,n<0)throw new m
7(y.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new m(y.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(t<-62135596800)throw new m(y.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new m(y.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}return e.now=function(){return e.fromMillis(Date.now())},e.fromDate=function(t){return e.fromMillis(t.getTime())},e.fromMillis=function(t){var n=Math.floor(t/1e3);return new e(n,1e6*(t-1e3*n))},e.prototype.toDate=function(){return new Date(this.toMillis())},e.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},e.prototype.Y=function(t){return this.seconds===t.seconds?k(this.nanoseconds,t.nanoseconds):k(this.seconds,t.seconds)},e.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},e.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},e.prototype.toJSON=function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}},e.prototype.valueOf=function(){var t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")},e}(),R=function(){function e(t){this.timestamp=t}return e.J=function(t){return new e(t)},e.min=function(){return new e(new ht(0,0))},e.prototype.L=function(t){return this.timestamp.Y(t.timestamp)},e.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},e.prototype.X=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},e.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},e.prototype.Z=function(){return this.timestamp},e}();function be(e){return e==null}function xr(e){return e===0&&1/e==-1/0}function Qa(e){return typeof e=="number"&&Number.isInteger(e)&&!xr(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}var Wf=function(e,t,n,r,i,o,s){t===void 0&&(t=null),n===void 0&&(n=[]),r===void 0&&(r=[]),i===void 0&&(i=null),o===void 0&&(o=null),s===void 0&&(s=null),this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=o,this.endAt=s,this.tt=null};function Qu(e,t,n,r,i,o,s){return t===void 0&&(t=null),n===void 0&&(n=[]),r===void 0&&(r=[]),i===void 0&&(i=null),o===void 0&&(o=null),s===void 0&&(s=null),new Wf(e,t,n,r,i,o,s)}function Mn(e){var t=I(e);if(t.tt===null){var n=t.path.R();t.collectionGroup!==null&&(n+="|cg:"+t.collectionGroup),n+="|f:",n+=t.filters.map(function(r){return function(i){return i.field.R()+i.op.toString()+Oo(i.value)}(r)}).join(","),n+="|ob:",n+=t.orderBy.map(function(r){return(i=r).field.R()+i.dir;var i}).join(","),be(t.limit)||(n+="|l:",n+=t.limit),t.startAt&&(n+="|lb:",n+=Vr(t.startAt)),t.endAt&&(n+="|ub:",n+=Vr(t.endAt)),t.tt=n}return t.tt}function Qr(e,t){if(e.limit!==t.limit||e.orderBy.length!==t.orderBy.length)return!1;for(var n=0;n<e.orderBy.length;n++)if(!Tl(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(var r=0;r<e.filters.length;r++)if(i=e.filters[r],o=t.filters[r],i.op!==o.op||!i.field.isEqual(o.field)||!Ut(i.value,o.value))return!1;var i,o;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!la(e.startAt,t.startAt)&&la(e.endAt,t.endAt)}function Dr(e){return x.F(e.path)&&e.collectionGroup===null&&e.filters.length===0}var K,P,Xr=function(){function e(t,n,r,i,o,s,u){o===void 0&&(o=R.min()),s===void 0&&(s=R.min()),u===void 0&&(u=it.B),this.target=t,this.targetId=n,this.et=r,this.sequenceNumber=i,this.nt=o,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=u}return e.prototype.st=function(t){return new e(this.target,this.targetId,this.et,t,this.nt,this.lastLimboFreeSnapshotVersion,this.resumeToken)},e.prototype.it=function(t,n){return new e(this.target,this.targetId,this.et,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,t)},e.prototype.rt=function(t){return new e(this.target,this.targetId,this.et,this.sequenceNumber,this.nt,t,this.resumeToken)},e}(),Hf=function(e){this.count=e};function Xa(e){switch(e){case y.OK:return A();case y.CANCELLED:case y.UNKNOWN:case y.DEADLINE_EXCEEDED:case y.RESOURCE_EXHAUSTED:case y.INTERNAL:case y.UNAVAILABLE:case y.UNAUTHENTICATED:return!1;case y.INVALID_ARGUMENT:case y.NOT_FOUND:case y.ALREADY_EXISTS:case y.PERMISSION_DENIED:case y.FAILED_PRECONDITION:case y.ABORTED:case y.OUT_OF_RANGE:case y.UNIMPLEMENT
7ED:case y.DATA_LOSS:return!0;default:return A()}}function Ya(e){if(e===void 0)return B("GRPC error has no .code"),y.UNKNOWN;switch(e){case K.OK:return y.OK;case K.CANCELLED:return y.CANCELLED;case K.UNKNOWN:return y.UNKNOWN;case K.DEADLINE_EXCEEDED:return y.DEADLINE_EXCEEDED;case K.RESOURCE_EXHAUSTED:return y.RESOURCE_EXHAUSTED;case K.INTERNAL:return y.INTERNAL;case K.UNAVAILABLE:return y.UNAVAILABLE;case K.UNAUTHENTICATED:return y.UNAUTHENTICATED;case K.INVALID_ARGUMENT:return y.INVALID_ARGUMENT;case K.NOT_FOUND:return y.NOT_FOUND;case K.ALREADY_EXISTS:return y.ALREADY_EXISTS;case K.PERMISSION_DENIED:return y.PERMISSION_DENIED;case K.FAILED_PRECONDITION:return y.FAILED_PRECONDITION;case K.ABORTED:return y.ABORTED;case K.OUT_OF_RANGE:return y.OUT_OF_RANGE;case K.UNIMPLEMENTED:return y.UNIMPLEMENTED;case K.DATA_LOSS:return y.DATA_LOSS;default:return A()}}(P=K||(K={}))[P.OK=0]="OK",P[P.CANCELLED=1]="CANCELLED",P[P.UNKNOWN=2]="UNKNOWN",P[P.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",P[P.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",P[P.NOT_FOUND=5]="NOT_FOUND",P[P.ALREADY_EXISTS=6]="ALREADY_EXISTS",P[P.PERMISSION_DENIED=7]="PERMISSION_DENIED",P[P.UNAUTHENTICATED=16]="UNAUTHENTICATED",P[P.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",P[P.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",P[P.ABORTED=10]="ABORTED",P[P.OUT_OF_RANGE=11]="OUT_OF_RANGE",P[P.UNIMPLEMENTED=12]="UNIMPLEMENTED",P[P.INTERNAL=13]="INTERNAL",P[P.UNAVAILABLE=14]="UNAVAILABLE",P[P.DATA_LOSS=15]="DATA_LOSS";var ot=function(){function e(t,n){this.i=t,this.root=n||$t.EMPTY}return e.prototype.ot=function(t,n){return new e(this.i,this.root.ot(t,n,this.i).copy(null,null,$t.at,null,null))},e.prototype.remove=function(t){return new e(this.i,this.root.remove(t,this.i).copy(null,null,$t.at,null,null))},e.prototype.get=function(t){for(var n=this.root;!n.m();){var r=this.i(t,n.key);if(r===0)return n.value;r<0?n=n.left:r>0&&(n=n.right)}return null},e.prototype.indexOf=function(t){for(var n=0,r=this.root;!r.m();){var i=this.i(t,r.key);if(i===0)return n+r.left.size;i<0?r=r.left:(n+=r.left.size+1,r=r.right)}return-1},e.prototype.m=function(){return this.root.m()},Object.defineProperty(e.prototype,"size",{get:function(){return this.root.size},enumerable:!1,configurable:!0}),e.prototype.ct=function(){return this.root.ct()},e.prototype.ut=function(){return this.root.ut()},e.prototype.ht=function(t){return this.root.ht(t)},e.prototype.forEach=function(t){this.ht(function(n,r){return t(n,r),!1})},e.prototype.toString=function(){var t=[];return this.ht(function(n,r){return t.push(n+":"+r),!1}),"{"+t.join(", ")+"}"},e.prototype.lt=function(t){return this.root.lt(t)},e.prototype._t=function(){return new wr(this.root,null,this.i,!1)},e.prototype.ft=function(t){return new wr(this.root,t,this.i,!1)},e.prototype.dt=function(){return new wr(this.root,null,this.i,!0)},e.prototype.wt=function(t){return new wr(this.root,t,this.i,!0)},e}(),wr=function(){function e(t,n,r,i){this.Tt=i,this.Et=[];for(var o=1;!t.m();)if(o=n?r(t.key,n):1,i&&(o*=-1),o<0)t=this.Tt?t.left:t.right;else{if(o===0){this.Et.push(t);break}this.Et.push(t),t=this.Tt?t.right:t.left}}return e.prototype.It=function(){var t=this.Et.pop(),n={key:t.key,value:t.value};if(this.Tt)for(t=t.left;!t.m();)this.Et.push(t),t=t.right;else for(t=t.right;!t.m();)this.Et.push(t),t=t.left;return n},e.prototype.At=function(){return this.Et.length>0},e.prototype.Rt=function(){if(this.Et.length===0)return null;var t=this.Et[this.Et.length-1];return{key:t.key,value:t.value}},e}(),$t=function(){function e(t,n,r,i,o){this.key=t,this.value=n,this.color=r??e.RED,this.left=i??e.EMPTY,this.right=o??e.EMPTY,this.size=this.left.size+1+this.right.size}return e.prototype.copy=function(t,n,r,i,o){return new e(t??this.key,n??this.value,r??this.color,i??this.left,o??this.right)},e.prototype.m=function(){return!1},e.prototype.ht=function(t){return this.left.ht(t)||t(this.key,this.value)||this.right.ht(t)},e.prototype.lt=function(t){return this.right.lt(t)||t(this.key,this.value)||this.left.lt(t)},e.prototype.min=function(){return this.left.m()?this:this.left.min()},e.prototype.ct=function(){return this.min().key},e.prototype.ut=function(){return this.right.m()?this.key:this.right.ut()},e.prototype.ot=function(t,n,r){var i=this,o=r(t,i.key);return(i=o<0?i.copy(null,null,null,i.left.ot(t,n,r),null):o===0?i.copy(null,n,null,null,null):i.copy(null,null,null,null,i.right.ot(t,n,r))).gt()},e.prototype.Pt=function(){if(this.left.m())return e.EMPTY;var t=this;return t.left.yt()||t.left.left.yt()||(t=t.Vt()),(t=t.copy(null,null,null,t.left.Pt(),null)).gt()},e.prototype.remove=function(t,n){var r,i=this;if(n(t,i.key)<0)i.left.m()||i.left.yt()||i.left.left.yt()||(i=i.Vt()),i=i.copy(null,null,null,i.left.remove(t,n),null);
7else{if(i.left.yt()&&(i=i.bt()),i.right.m()||i.right.yt()||i.right.left.yt()||(i=i.vt()),n(t,i.key)===0){if(i.right.m())return e.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.Pt())}i=i.copy(null,null,null,null,i.right.remove(t,n))}return i.gt()},e.prototype.yt=function(){return this.color},e.prototype.gt=function(){var t=this;return t.right.yt()&&!t.left.yt()&&(t=t.St()),t.left.yt()&&t.left.left.yt()&&(t=t.bt()),t.left.yt()&&t.right.yt()&&(t=t.Dt()),t},e.prototype.Vt=function(){var t=this.Dt();return t.right.left.yt()&&(t=(t=(t=t.copy(null,null,null,null,t.right.bt())).St()).Dt()),t},e.prototype.vt=function(){var t=this.Dt();return t.left.left.yt()&&(t=(t=t.bt()).Dt()),t},e.prototype.St=function(){var t=this.copy(null,null,e.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},e.prototype.bt=function(){var t=this.copy(null,null,e.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},e.prototype.Dt=function(){var t=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,n)},e.prototype.Ct=function(){var t=this.Nt();return Math.pow(2,t)<=this.size+1},e.prototype.Nt=function(){if(this.yt()&&this.left.yt()||this.right.yt())throw A();var t=this.left.Nt();if(t!==this.right.Nt())throw A();return t+(this.yt()?0:1)},e}();$t.EMPTY=null,$t.RED=!0,$t.at=!1,$t.EMPTY=new(function(){function e(){this.size=0}return Object.defineProperty(e.prototype,"key",{get:function(){throw A()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){throw A()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){throw A()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"left",{get:function(){throw A()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"right",{get:function(){throw A()},enumerable:!1,configurable:!0}),e.prototype.copy=function(t,n,r,i,o){return this},e.prototype.ot=function(t,n,r){return new $t(t,n)},e.prototype.remove=function(t,n){return this},e.prototype.m=function(){return!0},e.prototype.ht=function(t){return!1},e.prototype.lt=function(t){return!1},e.prototype.ct=function(){return null},e.prototype.ut=function(){return null},e.prototype.yt=function(){return!1},e.prototype.Ct=function(){return!0},e.prototype.Nt=function(){return 0},e}());var Y=function(){function e(t){this.i=t,this.data=new ot(this.i)}return e.prototype.has=function(t){return this.data.get(t)!==null},e.prototype.first=function(){return this.data.ct()},e.prototype.last=function(){return this.data.ut()},Object.defineProperty(e.prototype,"size",{get:function(){return this.data.size},enumerable:!1,configurable:!0}),e.prototype.indexOf=function(t){return this.data.indexOf(t)},e.prototype.forEach=function(t){this.data.ht(function(n,r){return t(n),!1})},e.prototype.Ft=function(t,n){for(var r=this.data.ft(t[0]);r.At();){var i=r.It();if(this.i(i.key,t[1])>=0)return;n(i.key)}},e.prototype.xt=function(t,n){var r;for(r=n!==void 0?this.data.ft(n):this.data._t();r.At();)if(!t(r.It().key))return},e.prototype.$t=function(t){var n=this.data.ft(t);return n.At()?n.It().key:null},e.prototype._t=function(){return new Xu(this.data._t())},e.prototype.ft=function(t){return new Xu(this.data.ft(t))},e.prototype.add=function(t){return this.copy(this.data.remove(t).ot(t,!0))},e.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},e.prototype.m=function(){return this.data.m()},e.prototype.kt=function(t){var n=this;return n.size<t.size&&(n=t,t=this),t.forEach(function(r){n=n.add(r)}),n},e.prototype.isEqual=function(t){if(!(t instanceof e)||this.size!==t.size)return!1;for(var n=this.data._t(),r=t.data._t();n.At();){var i=n.It().key,o=r.It().key;if(this.i(i,o)!==0)return!1}return!0},e.prototype.A=function(){var t=[];return this.forEach(function(n){t.push(n)}),t},e.prototype.toString=function(){var t=[];return this.forEach(function(n){return t.push(n)}),"SortedSet("+t.toString()+")"},e.prototype.copy=function(t){var n=new e(this.i);return n.data=t,n},e}(),Xu=function(){function e(t){this.Mt=t}return e.prototype.It=function(){return this.Mt.It().key},e.prototype.At=function(){return this.Mt.At()},e}(),Qf=new ot(x.i);function de(){return Qf}function Lr(){return de()}var Xf=new ot(x.i);function Sn(){return Xf}var Yf=new ot(x.i),Jf=new Y(x.i);function V(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=Jf,r=0,i=e;r<i.length;r++){var o=i[r];n=n.add(o)}return n}var $f=new Y(k);function Yr(){return $f}var Ja=function(){function e(t){this.i=t?function(n,r){return t(n,r)||x.i(n.key,r.key)}:function(n,r){return x.i(n.key,r.key)}
7,this.Ot=Sn(),this.Lt=new ot(this.i)}return e.Bt=function(t){return new e(t.i)},e.prototype.has=function(t){return this.Ot.get(t)!=null},e.prototype.get=function(t){return this.Ot.get(t)},e.prototype.first=function(){return this.Lt.ct()},e.prototype.last=function(){return this.Lt.ut()},e.prototype.m=function(){return this.Lt.m()},e.prototype.indexOf=function(t){var n=this.Ot.get(t);return n?this.Lt.indexOf(n):-1},Object.defineProperty(e.prototype,"size",{get:function(){return this.Lt.size},enumerable:!1,configurable:!0}),e.prototype.forEach=function(t){this.Lt.ht(function(n,r){return t(n),!1})},e.prototype.add=function(t){var n=this.delete(t.key);return n.copy(n.Ot.ot(t.key,t),n.Lt.ot(t,null))},e.prototype.delete=function(t){var n=this.get(t);return n?this.copy(this.Ot.remove(t),this.Lt.remove(n)):this},e.prototype.isEqual=function(t){if(!(t instanceof e)||this.size!==t.size)return!1;for(var n=this.Lt._t(),r=t.Lt._t();n.At();){var i=n.It().key,o=r.It().key;if(!i.isEqual(o))return!1}return!0},e.prototype.toString=function(){var t=[];return this.forEach(function(n){t.push(n.toString())}),t.length===0?"DocumentSet ()":`DocumentSet ( 8 `+t.join(` 9`)+` 10)`},e.prototype.copy=function(t,n){var r=new e;return r.i=this.i,r.Ot=t,r.Lt=n,r},e}(),Yu=function(){function e(){this.qt=new ot(x.i)}return e.prototype.track=function(t){var n=t.doc.key,r=this.qt.get(n);r?t.type!==0&&r.type===3?this.qt=this.qt.ot(n,t):t.type===3&&r.type!==1?this.qt=this.qt.ot(n,{type:r.type,doc:t.doc}):t.type===2&&r.type===2?this.qt=this.qt.ot(n,{type:2,doc:t.doc}):t.type===2&&r.type===0?this.qt=this.qt.ot(n,{type:0,doc:t.doc}):t.type===1&&r.type===0?this.qt=this.qt.remove(n):t.type===1&&r.type===2?this.qt=this.qt.ot(n,{type:1,doc:r.doc}):t.type===0&&r.type===1?this.qt=this.qt.ot(n,{type:2,doc:t.doc}):A():this.qt=this.qt.ot(n,t)},e.prototype.Ut=function(){var t=[];return this.qt.ht(function(n,r){t.push(r)}),t},e}(),kr=function(){function e(t,n,r,i,o,s,u,a){this.query=t,this.docs=n,this.Qt=r,this.docChanges=i,this.Wt=o,this.fromCache=s,this.jt=u,this.Kt=a}return e.Gt=function(t,n,r,i){var o=[];return n.forEach(function(s){o.push({type:0,doc:s})}),new e(t,n,Ja.Bt(n),o,r,i,!0,!1)},Object.defineProperty(e.prototype,"hasPendingWrites",{get:function(){return!this.Wt.m()},enumerable:!1,configurable:!0}),e.prototype.isEqual=function(t){if(!(this.fromCache===t.fromCache&&this.jt===t.jt&&this.Wt.isEqual(t.Wt)&&on(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.Qt.isEqual(t.Qt)))return!1;var n=this.docChanges,r=t.docChanges;if(n.length!==r.length)return!1;for(var i=0;i<n.length;i++)if(n[i].type!==r[i].type||!n[i].doc.isEqual(r[i].doc))return!1;return!0},e}(),Do=function(){function e(t,n,r,i,o){this.nt=t,this.zt=n,this.Ht=r,this.Yt=i,this.Jt=o}return e.Xt=function(t,n){var r=new Map;return r.set(t,Lo.Zt(t,n)),new e(R.min(),r,Yr(),de(),V())},e}(),Lo=function(){function e(t,n,r,i,o){this.resumeToken=t,this.te=n,this.ee=r,this.ne=i,this.se=o}return e.Zt=function(t,n){return new e(it.B,n,V(),V(),V())},e}(),Tr=function(e,t,n,r){this.ie=e,this.removedTargetIds=t,this.key=n,this.re=r},$a=function(e,t){this.targetId=e,this.oe=t},Za=function(e,t,n,r){n===void 0&&(n=it.B),r===void 0&&(r=null),this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=r},Ju=function(){function e(){this.ae=0,this.ce=Zu(),this.ue=it.B,this.he=!1,this.le=!0}return Object.defineProperty(e.prototype,"te",{get:function(){return this.he},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resumeToken",{get:function(){return this.ue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_e",{get:function(){return this.ae!==0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fe",{get:function(){return this.le},enumerable:!1,configurable:!0}),e.prototype.de=function(t){t.O()>0&&(this.le=!0,this.ue=t)},e.prototype.we=function(){var t=V(),n=V(),r=V();return this.ce.forEach(function(i,o){switch(o){case 0:t=t.add(i);break;case 2:n=n.add(i);break;case 1:r=r.add(i);break;default:A()}}),new Lo(this.ue,this.he,t,n,r)},e.prototype.me=function(){this.le=!1,this.ce=Zu()},e.prototype.Te=function(t,n){this.le=!0,this.ce=this.ce.ot(t,n)},e.prototype.Ee=function(t){this.le=!0,this.ce=this.ce.remove(t)},e.prototype.Ie=function(){this.ae+=1},e.prototype.Ae=function(){this.ae-=1},e.prototype.Re=function(){this.le=!0,this.he=!0},e}(),Zf=function(){function e(t){this.ge=t,this.Pe=new Map,this.ye=de(),this.Ve=$u(),this.pe=new Y(k)}return e.prototype.be=function(t){for(var n=0,r=t.ie;n<r.length;n++){var i=r[n];t.re instanceof C?this.ve(i,t.re):t.re instanceof $&&this.Se(i,t.key,t.re)}for(var o=0,s=t.removedTargetIds;o<s.length;o++){var u=s[o];
10this.Se(u,t.key,t.re)}},e.prototype.De=function(t){var n=this;this.Ce(t,function(r){var i=n.Ne(r);switch(t.state){case 0:n.Fe(r)&&i.de(t.resumeToken);break;case 1:i.Ae(),i._e||i.me(),i.de(t.resumeToken);break;case 2:i.Ae(),i._e||n.removeTarget(r);break;case 3:n.Fe(r)&&(i.Re(),i.de(t.resumeToken));break;case 4:n.Fe(r)&&(n.xe(r),i.de(t.resumeToken));break;default:A()}})},e.prototype.Ce=function(t,n){var r=this;t.targetIds.length>0?t.targetIds.forEach(n):this.Pe.forEach(function(i,o){r.Fe(o)&&n(o)})},e.prototype.$e=function(t){var n=t.targetId,r=t.oe.count,i=this.ke(n);if(i){var o=i.target;if(Dr(o))if(r===0){var s=new x(o.path);this.Se(n,s,new $(s,R.min()))}else S(r===1);else this.Me(n)!==r&&(this.xe(n),this.pe=this.pe.add(n))}},e.prototype.Oe=function(t){var n=this,r=new Map;this.Pe.forEach(function(s,u){var a=n.ke(u);if(a){if(s.te&&Dr(a.target)){var c=new x(a.target.path);n.ye.get(c)!==null||n.Le(u,c)||n.Se(u,c,new $(c,t))}s.fe&&(r.set(u,s.we()),s.me())}});var i=V();this.Ve.forEach(function(s,u){var a=!0;u.xt(function(c){var h=n.ke(c);return!h||h.et===2||(a=!1,!1)}),a&&(i=i.add(s))});var o=new Do(t,r,this.pe,this.ye,i);return this.ye=de(),this.Ve=$u(),this.pe=new Y(k),o},e.prototype.ve=function(t,n){if(this.Fe(t)){var r=this.Le(t,n.key)?2:0;this.Ne(t).Te(n.key,r),this.ye=this.ye.ot(n.key,n),this.Ve=this.Ve.ot(n.key,this.Be(n.key).add(t))}},e.prototype.Se=function(t,n,r){if(this.Fe(t)){var i=this.Ne(t);this.Le(t,n)?i.Te(n,1):i.Ee(n),this.Ve=this.Ve.ot(n,this.Be(n).delete(t)),r&&(this.ye=this.ye.ot(n,r))}},e.prototype.removeTarget=function(t){this.Pe.delete(t)},e.prototype.Me=function(t){var n=this.Ne(t).we();return this.ge.qe(t).size+n.ee.size-n.se.size},e.prototype.Ie=function(t){this.Ne(t).Ie()},e.prototype.Ne=function(t){var n=this.Pe.get(t);return n||(n=new Ju,this.Pe.set(t,n)),n},e.prototype.Be=function(t){var n=this.Ve.get(t);return n||(n=new Y(k),this.Ve=this.Ve.ot(t,n)),n},e.prototype.Fe=function(t){var n=this.ke(t)!==null;return n||_("WatchChangeAggregator","Detected inactive target",t),n},e.prototype.ke=function(t){var n=this.Pe.get(t);return n&&n._e?null:this.ge.Ue(t)},e.prototype.xe=function(t){var n=this;this.Pe.set(t,new Ju),this.ge.qe(t).forEach(function(r){n.Se(t,r,null)})},e.prototype.Le=function(t,n){return this.ge.qe(t).has(n)},e}();function $u(){return new ot(x.i)}function Zu(){return new ot(x.i)}function ko(e){var t,n;return((n=(((t=e?.mapValue)===null||t===void 0?void 0:t.fields)||{}).__type__)===null||n===void 0?void 0:n.stringValue)==="server_timestamp"}function tc(e){var t=e.mapValue.fields.__previous_value__;return ko(t)?tc(t):t}function xn(e){var t=re(e.mapValue.fields.__local_write_time__.timestampValue);return new ht(t.seconds,t.nanos)}var tl=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function ne(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?ko(e)?4:10:A()}function Ut(e,t){var n=ne(e);if(n!==ne(t))return!1;switch(n){case 0:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return xn(e).isEqual(xn(t));case 3:return function(r,i){if(typeof r.timestampValue=="string"&&typeof i.timestampValue=="string"&&r.timestampValue.length===i.timestampValue.length)return r.timestampValue===i.timestampValue;var o=re(r.timestampValue),s=re(i.timestampValue);return o.seconds===s.seconds&&o.nanos===s.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(r,i){return Qe(r.bytesValue).isEqual(Qe(i.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(r,i){return H(r.geoPointValue.latitude)===H(i.geoPointValue.latitude)&&H(r.geoPointValue.longitude)===H(i.geoPointValue.longitude)}(e,t);case 2:return function(r,i){if("integerValue"in r&&"integerValue"in i)return H(r.integerValue)===H(i.integerValue);if("doubleValue"in r&&"doubleValue"in i){var o=H(r.doubleValue),s=H(i.doubleValue);return o===s?xr(o)===xr(s):isNaN(o)&&isNaN(s)}return!1}(e,t);case 9:return We(e.arrayValue.values||[],t.arrayValue.values||[],Ut);case 10:return function(r,i){var o=r.mapValue.fields||{},s=i.mapValue.fields||{};if(Gu(o)!==Gu(s))return!1;for(var u in o)if(o.hasOwnProperty(u)&&(s[u]===void 0||!Ut(o[u],s[u])))return!1;return!0}(e,t);default:return A()}}function Dn(e,t){return(e.values||[]).find(function(n){return Ut(n,t)})!==void 0}function He(e,t){var n=ne(e),r=ne(t);if(n!==r)return k(n,r);switch(n){case 0:return 0;case 1:return k(e.booleanValue,t.booleanValue);case 2:return function(i,o){var s=H(i.integerValue||i.doubleValue),u=H(o.integerValue||o.doubleValue);return s<u?-1:s>u?1:s===u?0:isNaN(s)?isNaN(u)?0:-1:1}(e,t);case 3:return ta(e.timestampValue,t.timestampValue);case 4:return ta(xn(e),xn(t));case 5:return k(e.stringValue,t.stringValue);case 6:return function(i,o){var s=Qe(i),u=Qe(o);return s.L(u)}(e.bytesValue,t.bytesValue);case 7:return function(i,o){for(var s=i.split("/"),u=o.split("/"),a=0;a<s.length&&a<u.length;a++){var c=k(s[a],u[a]);if(c!==0)return c}return k(s.length,u.length)}(e.referenceValue,t.referenceValue);case 8:return function(i,o){var s=k(H(i.latitude),H(o.latitude));return s!==0?s:k(H(i.longitude),H(o.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return function(i,o){for(var s=i.values||[],u=o.values||[],a=0;a<s.length&&a<u.length;++a){var c=He(s[a],u[a]);if(c)return c}return k(s.length,u.length)}(e.arrayValue,t.arrayValue);case 10:return function(i,o){var s=i.fields||{},u=Object.keys(s),a=o.fields||{},c=Object.keys(a);u.sort(),c.sort();for(var h=0;h<u.length&&h<c.length;++h){var f=k(u[h],c[h]);if(f!==0)return f;var l=He(s[u[h]],a[c[h]]);if(l!==0)return l}return k(u.length,c.length)}(e.mapValue,t.mapValue);default:throw A()}}function ta(e,t){if(typeof e=="string"&&typeof t=="string"&&e.length===t.length)return k(e,t);var n=re(e),r=re(t),i=k(n.seconds,r.seconds);return i!==0?i:k(n.nanos,r.nanos)}function Oo(e){return lo(e)}function lo(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(r){var i=re(r);return"time("+i.seconds+","+i.nanos+")"}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?Qe(e.bytesValue).toBase64():"referenceValue"in e?(n=e.referenceValue,x.C(n).toString()):"geoPointValue"in e?"geo("+(t=e.geoPointValue).latitude+","+t.longitude+")":"arrayValue"in e?function(r){for(var i="[",o=!0,s=0,u=r.values||[];s<u.length;s++)o?o=!1:i+=",",i+=lo(u[s]);return i+"]"}(e.arrayValue):"mapValue"in e?function(r){for(var i="{",o=!0,s=0,u=Object.keys(r.fields||{}).sort();s<u.length;s++){var a=u[s];o?o=!1:i+=",",i+=a+":"+lo(r.fields[a])}return i+"}"}(e.mapValue):A();var t,n}function re(e){if(S(!!e),typeof e=="string"){var t=0,n=tl.exec(e);if(S(!!n),n[1]){var r=n[1];r=(r+"000000000").substr(0,9),t=Number(r)}var i=new Date(e);return{seconds:Math.floor(i.getTime()/1e3),nanos:t}}return{seconds:H(e.seconds),nanos:H(e.nanos)}}function H(e){return typeof e=="number"?e:typeof e=="string"?Number(e):0}function Qe(e){return typeof e=="string"?it.fromBase64String(e):it.fromUint8Array(e)}function Or(e,t){return{referenceValue:"projects/"+e.projectId+"/databases/"+e.database+"/documents/"+t.path.R()}}function po(e){return!!e&&"integerValue"in e}function Ro(e){return!!e&&"arrayValue"in e}function vo(e){return!!e&&"nullValue"in e}function yo(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function Po(e){return!!e&&"mapValue"in e}var el={asc:"ASCENDING",desc:"DESCENDING"},nl={"<":"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"},rl=function(e,t){this.U=e,this.Qe=t};function ec(e){return{integerValue:""+e}}function nc(e,t){if(e.Qe){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:xr(t)?"-0":t}}function rc(e,t){return Qa(t)?ec(t):nc(e,t)}function Rr(e,t){return e.Qe?new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+t.nanoseconds).slice(-9)+"Z":{seconds:""+t.seconds,nanos:t.nanoseconds}}function ic(e,t){return e.Qe?t.toBase64():t.toUint8Array()}function il(e,t){return Rr(e,t.Z())}function Nt(e){return S(!!e),R.J(function(t){var n=re(t);return new ht(n.seconds,n.nanos)}(e))}function Co(e,t){return function(n){return new q(["projects",n.projectId,"databases",n.database])}(e).child("documents").child(t).R()}function oc(e){var t=q.g(e);return S(fc(t)),t}function Be(e,t){return Co(e.U,t.path)}function Rt(e,t){var n=oc(t);return S(n.get(1)===e.U.projectId),S(!n.get(3)&&!e.U.database||n.get(3)===e.U.database),new x(uc(n))}function go(e,t){return Co(e.U,t)}function sc(e){var t=oc(e);return t.length===4?q.P():uc(t)}function Ln(e){return new q(["projects",e.U.projectId,"databases",e.U.database]).R()}function uc(e){return S(e.length>4&&e.get(4)==="documents"),e.u(5)}function ea(e,t,n){return{name:Be(e,t),fields:n.proto.mapValue.fields}}function Pr(e,t){var n;if(t instanceof qn)n={update:ea(e,t.key,t.value)};else if(t instanceof Gn)n={delete:Be(e,t.key)};else if(t instanceof ue)n={update:ea(e,t.key,t.data),updateMask:hl(t.We)};else if(t instanceof Ee)n={transform:{document:Be(e,t.key),fieldTransforms:t.fieldTransforms.map(function(r){return function(i,o){var s=o.transform;if(s instanceof Xe)return{fieldPath:o.field.R(),setToServerValue:"REQUEST_TIME"};if(s instanceof ve)return{fieldPath:o.field.R(),appendMissingElements:{values:s.elements}};if(s instanceof ye)return{fieldPath:o.field.R(),removeAllFromArray:{values:s.elements}};if(s instanceof Ye)return{fieldPath:o.field.R(),increment:s.je};throw A()}(0,r)})}};else{if(!(t instanceof Uo))return A();n={verify:Be(e,t.key)}}return t.Ge.Ke||(n.currentDocument=function(r,i){return i.updateTime!==void 0?{updateTime:il(r,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:A()}(e,t.Ge)),n}function na(e,t){var n=t.currentDocument?function(h){return h.updateTime!==void 0?rt.updateTime(Nt(h.updateTime)):h.exists!==void 0?rt.exists(h.exists):rt.ze()}(t.currentDocument):rt.ze();if(t.update){t.update.name;var r=Rt(e,t.update.name),i=new ie({mapValue:{fields:t.update.fields}});if(t.updateMask){var o=function(h){var f=h.fieldPaths||[];return new Je(f.map(function(l){return Dt.S(l)}))}(t.updateMask);return new ue(r,i,o,n)}return new qn(r,i,n)}if(t.delete){var s=Rt(e,t.delete);return new Gn(s,n)}if(t.transform){var u=Rt(e,t.transform.document),a=t.transform.fieldTransforms.map(function(h){return function(f,l){var d=null;if("setToServerValue"in l)S(l.setToServerValue==="REQUEST_TIME"),d=new Xe;else if("appendMissingElements"in l){var v=l.appendMissingElements.values||[];d=new ve(v)}else if("removeAllFromArray"in l){var g=l.removeAllFromArray.values||[];d=new ye(g)}else"increment"in l?d=new Ye(f,l.increment):A();var E=Dt.S(l.fieldPath);return new Fn(E,d)}(e,h)});return S(n.exists===!0),new Ee(u,a)}if(t.verify){var c=Rt(e,t.verify);return new Uo(c,n)}return A()}function ac(e,t){return{documents:[go(e,t.path)]}}function cc(e,t){var n={structuredQuery:{}},r=t.path;t.collectionGroup!==null?(n.parent=go(e,r),n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(n.parent=go(e,r.h()),n.structuredQuery.from=[{collectionId:r._()}]);var i=function(u){if(u.length!==0){var a=u.map(function(c){return function(h){if(h.op==="=="){if(yo(h.value))return{unaryFilter:{field:Ce(h.field),op:"IS_NAN"}};if(vo(h.value))return{unaryFilter:{field:Ce(h.field),op:"IS_NULL"}}}else if(h.op==="!="){if(yo(h.value))return{unaryFilter:{field:Ce(h.field),op:"IS_NOT_NA
10N"}};if(vo(h.value))return{unaryFilter:{field:Ce(h.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Ce(h.field),op:ul(h.op),value:h.value}}}(c)});return a.length===1?a[0]:{compositeFilter:{op:"AND",filters:a}}}}(t.filters);i&&(n.structuredQuery.where=i);var o=function(u){if(u.length!==0)return u.map(function(a){return function(c){return{field:Ce(c.field),direction:sl(c.dir)}}(a)})}(t.orderBy);o&&(n.structuredQuery.orderBy=o);var s=function(u,a){return u.Qe||be(a)?a:{value:a}}(e,t.limit);return s!==null&&(n.structuredQuery.limit=s),t.startAt&&(n.structuredQuery.startAt=ra(t.startAt)),t.endAt&&(n.structuredQuery.endAt=ra(t.endAt)),n}function ol(e){var t=sc(e.parent),n=e.structuredQuery,r=n.from?n.from.length:0,i=null;if(r>0){S(r===1);var o=n.from[0];o.allDescendants?i=o.collectionId:t=t.child(o.collectionId)}var s=[];n.where&&(s=hc(n.where));var u=[];n.orderBy&&(u=n.orderBy.map(function(f){return function(l){return new ze(je(l.field),function(d){switch(d){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(l.direction))}(f)}));var a=null;n.limit&&(a=function(f){var l;return be(l=typeof f=="object"?f.value:f)?null:l}(n.limit));var c=null;n.startAt&&(c=ia(n.startAt));var h=null;return n.endAt&&(h=ia(n.endAt)),Vt(_c(t,i,u,s,a,"F",c,h))}function hc(e){return e?e.unaryFilter!==void 0?[cl(e)]:e.fieldFilter!==void 0?[al(e)]:e.compositeFilter!==void 0?e.compositeFilter.filters.map(function(t){return hc(t)}).reduce(function(t,n){return t.concat(n)}):A():[]}function ra(e){return{before:e.before,values:e.position}}function ia(e){var t=!!e.before,n=e.values||[];return new kn(n,t)}function sl(e){return el[e]}function ul(e){return nl[e]}function Ce(e){return{fieldPath:e.R()}}function je(e){return Dt.S(e.fieldPath)}function al(e){return gt.create(je(e.fieldFilter.field),function(t){switch(t){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return A()}}(e.fieldFilter.op),e.fieldFilter.value)}function cl(e){switch(e.unaryFilter.op){case"IS_NAN":var t=je(e.unaryFilter.field);return gt.create(t,"==",{doubleValue:NaN});case"IS_NULL":var n=je(e.unaryFilter.field);return gt.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var r=je(e.unaryFilter.field);return gt.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":var i=je(e.unaryFilter.field);return gt.create(i,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return A()}}function hl(e){var t=[];return e.fields.forEach(function(n){return t.push(n.R())}),{fieldPaths:t}}function fc(e){return e.length>=4&&e.get(0)==="projects"&&e.get(2)==="databases"}var Jr=function(){this.He=void 0};function fl(e,t,n){return e instanceof Xe?function(r,i){var o={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:r.seconds,nanos:r.nanoseconds}}}};return i&&(o.fields.__previous_value__=i),{mapValue:o}}(n,t):e instanceof ve?pc(e,t):e instanceof ye?dc(e,t):function(r,i){var o=lc(r,i),s=oa(o)+oa(r.je);return po(o)&&po(r.je)?ec(s):nc(r.serializer,s)}(e,t)}function ll(e,t,n){return e instanceof ve?pc(e,t):e instanceof ye?dc(e,t):n}function lc(e,t){return e instanceof Ye?po(n=t)||function(r){return!!r&&"doubleValue"in r}(n)?t:{integerValue:0}:null;var n}var Xe=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return p.__extends(t,e),t}(Jr),ve=function(e){function t(n){var r=this;return(r=e.call(this)||this).elements=n,r}return p.__extends(t,e),t}(Jr);function pc(e,t){for(var n=vc(t),r=function(s){n.some(function(u){return Ut(u,s)})||n.push(s)},i=0,o=e.elements;i<o.length;i++)r(o[i]);return{arrayValue:{values:n}}}var ye=function(e){function t(n){var r=this;return(r=e.call(this)||this).elements=n,r}return p.__extends(t,e),t}(Jr);function dc(e,t){for(var n=vc(t),r=function(s){n=n.filter(function(u){return!Ut(u,s)})},i=0,o=e.elements;i<o.length;i++)r(o[i]);return{arrayValue:{values:n}}}var Ye=function(e){function t(n,r){var i=this;
10return(i=e.call(this)||this).serializer=n,i.je=r,i}return p.__extends(t,e),t}(Jr);function oa(e){return H(e.integerValue||e.doubleValue)}function vc(e){return Ro(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}var Je=function(){function e(t){this.fields=t,t.sort(Dt.i)}return e.prototype.Ye=function(t){for(var n=0,r=this.fields;n<r.length;n++)if(r[n].T(t))return!0;return!1},e.prototype.isEqual=function(t){return We(this.fields,t.fields,function(n,r){return n.isEqual(r)})},e}(),Fn=function(e,t){this.field=e,this.transform=t},pl=function(e,t){this.version=e,this.transformResults=t},rt=function(){function e(t,n){this.updateTime=t,this.exists=n}return e.ze=function(){return new e},e.exists=function(t){return new e(void 0,t)},e.updateTime=function(t){return new e(t)},Object.defineProperty(e.prototype,"Ke",{get:function(){return this.updateTime===void 0&&this.exists===void 0},enumerable:!1,configurable:!0}),e.prototype.isEqual=function(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)},e}();function qe(e,t){return e.updateTime!==void 0?t instanceof C&&t.version.isEqual(e.updateTime):e.exists===void 0||e.exists===t instanceof C}var jn=function(){};function dl(e,t,n){return e instanceof qn?function(r,i,o){return new C(r.key,o.version,r.value,{hasCommittedMutations:!0})}(e,0,n):e instanceof ue?function(r,i,o){if(!qe(r.Ge,i))return new Cr(r.key,o.version);var s=yc(r,i);return new C(r.key,o.version,s,{hasCommittedMutations:!0})}(e,t,n):e instanceof Ee?function(r,i,o){if(S(o.transformResults!=null),!qe(r.Ge,i))return new Cr(r.key,o.version);var s=gc(r,i),u=function(h,f,l){var d=[];S(h.length===l.length);for(var v=0;v<l.length;v++){var g=h[v],E=g.transform,b=null;f instanceof C&&(b=f.field(g.field)),d.push(ll(E,b,l[v]))}return d}(r.fieldTransforms,i,o.transformResults),a=o.version,c=mc(r,s.data(),u);return new C(r.key,a,c,{hasCommittedMutations:!0})}(e,t,n):function(r,i,o){return new $(r.key,o.version,{hasCommittedMutations:!0})}(e,0,n)}function mo(e,t,n,r){return e instanceof qn?function(i,o){if(!qe(i.Ge,o))return o;var s=ua(o);return new C(i.key,s,i.value,{Je:!0})}(e,t):e instanceof ue?function(i,o){if(!qe(i.Ge,o))return o;var s=ua(o),u=yc(i,o);return new C(i.key,s,u,{Je:!0})}(e,t):e instanceof Ee?function(i,o,s,u){if(!qe(i.Ge,o))return o;var a=gc(i,o),c=function(f,l,d,v){for(var g=[],E=0,b=f;E<b.length;E++){var N=b[E],D=N.transform,O=null;d instanceof C&&(O=d.field(N.field)),O===null&&v instanceof C&&(O=v.field(N.field)),g.push(fl(D,O,l))}return g}(i.fieldTransforms,s,o,u),h=mc(i,a.data(),c);return new C(i.key,a.version,h,{Je:!0})}(e,t,r,n):function(i,o){return qe(i.Ge,o)?new $(i.key,R.min()):o}(e,t)}function vl(e,t){return e instanceof Ee?function(n,r){for(var i=null,o=0,s=n.fieldTransforms;o<s.length;o++){var u=s[o],a=r instanceof C?r.field(u.field):void 0,c=lc(u.transform,a||null);c!=null&&(i=i==null?new Bn().set(u.field,c):i.set(u.field,c))}return i?i.Xe():null}(e,t):null}function sa(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.Ge.isEqual(t.Ge)&&(e.type===0?e.value.isEqual(t.value):e.type===1?e.data.isEqual(t.data)&&e.We.isEqual(t.We):e.type!==2||We(e.fieldTransforms,e.fieldTransforms,function(n,r){return function(i,o){return i.field.isEqual(o.field)&&function(s,u){return s instanceof ve&&u instanceof ve||s instanceof ye&&u instanceof ye?We(s.elements,u.elements,Ut):s instanceof Ye&&u instanceof Ye?Ut(s.je,u.je):s instanceof Xe&&u instanceof Xe}(i.transform,o.transform)}(n,r)}))}function ua(e){return e instanceof C?e.version:R.min()}var qn=function(e){function t(n,r,i){var o=this;return(o=e.call(this)||this).key=n,o.value=r,o.Ge=i,o.type=0,o}return p.__extends(t,e),t}(jn),ue=function(e){function t(n,r,i,o){var s=this;return(s=e.call(this)||this).key=n,s.data=r,s.We=i,s.Ge=o,s.type=1,s}return p.__extends(t,e),t}(jn);function yc(e,t){return function(n,r){var i=new Bn(r);return n.We.fields.forEach(function(o){if(!o.m()){var s=n.data.field(o);s!==null?i.set(o,s):i.delete(o)}}),i.Xe()}(e,t instanceof C?t.data():ie.empty())}var Ee=function(e){function t(n,r){var i=this;return(i=e.call(this)||this).key=n,i.fieldTransforms=r,i.type=2,i.Ge=rt.exists(!0),i}return p.__extends(t,e),t}(jn);function gc(e,t){return t}function mc(e,t,n){for(var r=new Bn(t),i=0;i<e.fieldTransforms.length;i++){var o=e.fieldTransforms[i];r.set(o.field,n[i])}return r.Xe()}var Gn=function(e){function t(n,r){var i=this;return(i=e.call(this)||this).key=n,i.Ge=r,i.type=3,i}return p.__extends(t,e),t}(jn),Uo=function(e){function t(n,r){var i=this;return(i=e.call(this)||this).key=n,i.Ge=r,i.type=4,i}return p.__extends(t,e),t}(jn),ie=function(){function e(t){this.proto=t}return e.empty=function(){return new e({mapValue:{}})},e.prototype.field=function(t){if(t.m())return this.proto;for(var n=this.proto,r=0;r<t.length-1;++r)if(!n.mapValue.fields||!Po(n=n.mapValue.fields[t.get(r)]))return null;return(n=(n.mapValue.fields||{})[t._()])||null},e.prototype.isEqual=function(t){return Ut(this.proto,t.proto)},e}(),Bn=function(){function e(t){t===void 0&&(t=ie.empty()),this.Ze=t,this.tn=new Map}
10return e.prototype.set=function(t,n){return this.en(t,n),this},e.prototype.delete=function(t){return this.en(t,null),this},e.prototype.en=function(t,n){for(var r=this.tn,i=0;i<t.length-1;++i){var o=t.get(i),s=r.get(o);s instanceof Map?r=s:s&&ne(s)===10?(s=new Map(Object.entries(s.mapValue.fields||{})),r.set(o,s),r=s):(s=new Map,r.set(o,s),r=s)}r.set(t._(),n)},e.prototype.Xe=function(){var t=this.nn(Dt.P(),this.tn);return t!=null?new ie(t):this.Ze},e.prototype.nn=function(t,n){var r=this,i=!1,o=this.Ze.field(t),s=Po(o)?Object.assign({},o.mapValue.fields):{};return n.forEach(function(u,a){if(u instanceof Map){var c=r.nn(t.child(a),u);c!=null&&(s[a]=c,i=!0)}else u!==null?(s[a]=u,i=!0):s.hasOwnProperty(a)&&(delete s[a],i=!0)}),i?{mapValue:{fields:s}}:null},e}();function wc(e){var t=[];return nn(e.fields||{},function(n,r){var i=new Dt([n]);if(Po(r)){var o=wc(r.mapValue).fields;if(o.length===0)t.push(i);else for(var s=0,u=o;s<u.length;s++){var a=u[s];t.push(i.child(a))}}else t.push(i)}),new Je(t)}var Vo=function(e,t){this.key=e,this.version=t},C=function(e){function t(n,r,i,o){var s=this;return(s=e.call(this,n,r)||this).sn=i,s.Je=!!o.Je,s.hasCommittedMutations=!!o.hasCommittedMutations,s}return p.__extends(t,e),t.prototype.field=function(n){return this.sn.field(n)},t.prototype.data=function(){return this.sn},t.prototype.rn=function(){return this.sn.proto},t.prototype.isEqual=function(n){return n instanceof t&&this.key.isEqual(n.key)&&this.version.isEqual(n.version)&&this.Je===n.Je&&this.hasCommittedMutations===n.hasCommittedMutations&&this.sn.isEqual(n.sn)},t.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+this.sn.toString()+", {hasLocalMutations: "+this.Je+"}), {hasCommittedMutations: "+this.hasCommittedMutations+"})"},Object.defineProperty(t.prototype,"hasPendingWrites",{get:function(){return this.Je||this.hasCommittedMutations},enumerable:!1,configurable:!0}),t}(Vo),$=function(e){function t(n,r,i){var o=this;return(o=e.call(this,n,r)||this).hasCommittedMutations=!(!i||!i.hasCommittedMutations),o}return p.__extends(t,e),t.prototype.toString=function(){return"NoDocument("+this.key+", "+this.version+")"},Object.defineProperty(t.prototype,"hasPendingWrites",{get:function(){return this.hasCommittedMutations},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(n){return n instanceof t&&n.hasCommittedMutations===this.hasCommittedMutations&&n.version.isEqual(this.version)&&n.key.isEqual(this.key)},t}(Vo),Cr=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return p.__extends(t,e),t.prototype.toString=function(){return"UnknownDocument("+this.key+", "+this.version+")"},Object.defineProperty(t.prototype,"hasPendingWrites",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(n){return n instanceof t&&n.version.isEqual(this.version)&&n.key.isEqual(this.key)},t}(Vo),zt=function(e,t,n,r,i,o,s,u){t===void 0&&(t=null),n===void 0&&(n=[]),r===void 0&&(r=[]),i===void 0&&(i=null),o===void 0&&(o="F"),s===void 0&&(s=null),u===void 0&&(u=null),this.path=e,this.collectionGroup=t,this.on=n,this.filters=r,this.limit=i,this.an=o,this.startAt=s,this.endAt=u,this.cn=null,this.un=null,this.startAt,this.endAt};function _c(e,t,n,r,i,o,s,u){return new zt(e,t,n,r,i,o,s,u)}function zn(e){return new zt(e)}function Ar(e){return!be(e.limit)&&e.an==="F"}function Ur(e){return!be(e.limit)&&e.an==="L"}function Mo(e){return e.on.length>0?e.on[0].field:null}function Fo(e){for(var t=0,n=e.filters;t<n.length;t++){var r=n[t];if(r.hn())return r.field}return null}function jo(e){return e.collectionGroup!==null}function $e(e){var t=I(e);if(t.cn===null){t.cn=[];var n=Fo(t),r=Mo(t);if(n!==null&&r===null)n.p()||t.cn.push(new ze(n)),t.cn.push(new ze(Dt.v(),"asc"));else{for(var i=!1,o=0,s=t.on;o<s.length;o++){var u=s[o];t.cn.push(u),u.field.p()&&(i=!0)}if(!i){var a=t.on.length>0?t.on[t.on.length-1].dir:"asc";t.cn.push(new ze(Dt.v(),a))}}}return t.cn}function Vt(e){var t=I(e);if(!t.un)if(t.an==="F")t.un=Qu(t.path,t.collectionGroup,$e(t),t.filters,t.limit,t.startAt,t.endAt);else{for(var n=[],r=0,i=$e(t);r<i.length;r++){var o=i[r],s=o.dir==="desc"?"asc":"desc";n.push(new ze(o.field,s))}var u=t.endAt?new kn(t.endAt.position,!t.endAt.before):null,a=t.startAt?new kn(t.startAt.position,!t.startAt.before):null;t.un=Qu(t.path,t.collectionGroup,n,t.filters,t.limit,u,a)}return t.un}
10function aa(e,t,n){return new zt(e.path,e.collectionGroup,e.on.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function ca(e,t){return new zt(e.path,e.collectionGroup,e.on.slice(),e.filters.slice(),e.limit,e.an,t,e.endAt)}function ha(e,t){return new zt(e.path,e.collectionGroup,e.on.slice(),e.filters.slice(),e.limit,e.an,e.startAt,t)}function on(e,t){return Qr(Vt(e),Vt(t))&&e.an===t.an}function bc(e){return Mn(Vt(e))+"|lt:"+e.an}function wo(e){return"Query(target="+function(t){var n=t.path.R();return t.collectionGroup!==null&&(n+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(n+=", filters: ["+t.filters.map(function(r){return(i=r).field.R()+" "+i.op+" "+Oo(i.value);var i}).join(", ")+"]"),be(t.limit)||(n+=", limit: "+t.limit),t.orderBy.length>0&&(n+=", orderBy: ["+t.orderBy.map(function(r){return(i=r).field.R()+" ("+i.dir+")";var i}).join(", ")+"]"),t.startAt&&(n+=", startAt: "+Vr(t.startAt)),t.endAt&&(n+=", endAt: "+Vr(t.endAt)),"Target("+n+")"}(Vt(e))+"; limitType="+e.an+")"}function Kn(e,t){return function(n,r){var i=r.key.path;return n.collectionGroup!==null?r.key.N(n.collectionGroup)&&n.path.T(i):x.F(n.path)?n.path.isEqual(i):n.path.I(i)}(e,t)&&function(n,r){for(var i=0,o=n.on;i<o.length;i++){var s=o[i];if(!s.field.p()&&r.field(s.field)===null)return!1}return!0}(e,t)&&function(n,r){for(var i=0,o=n.filters;i<o.length;i++)if(!o[i].matches(r))return!1;return!0}(e,t)&&function(n,r){return!(n.startAt&&!fa(n.startAt,$e(n),r))&&(!n.endAt||!fa(n.endAt,$e(n),r))}(e,t)}function Ec(e){return function(t,n){for(var r=!1,i=0,o=$e(e);i<o.length;i++){var s=o[i],u=Il(s,t,n);if(u!==0)return u;r=r||s.field.p()}return 0}}var gt=function(e){function t(n,r,i){var o=this;return(o=e.call(this)||this).field=n,o.op=r,o.value=i,o}return p.__extends(t,e),t.create=function(n,r,i){if(n.p())return r==="in"||r==="not-in"?this.ln(n,r,i):new yl(n,r,i);if(vo(i)){if(r!=="=="&&r!=="!=")throw new m(y.INVALID_ARGUMENT,"Invalid query. Null only supports '==' and '!=' comparisons.");return new t(n,r,i)}if(yo(i)){if(r!=="=="&&r!=="!=")throw new m(y.INVALID_ARGUMENT,"Invalid query. NaN only supports '==' and '!=' comparisons.");return new t(n,r,i)}return r==="array-contains"?new wl(n,i):r==="in"?new _l(n,i):r==="not-in"?new bl(n,i):r==="array-contains-any"?new El(n,i):new t(n,r,i)},t.ln=function(n,r,i){return r==="in"?new gl(n,i):new ml(n,i)},t.prototype.matches=function(n){var r=n.field(this.field);return this.op==="!="?r!==null&&this._n(He(r,this.value)):r!==null&&ne(this.value)===ne(r)&&this._n(He(r,this.value))},t.prototype._n=function(n){switch(this.op){case"<":return n<0;case"<=":return n<=0;case"==":return n===0;case"!=":return n!==0;case">":return n>0;case">=":return n>=0;default:return A()}},t.prototype.hn=function(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0},t}(function(){}),yl=function(e){function t(n,r,i){var o=this;return(o=e.call(this,n,r,i)||this).key=x.C(i.referenceValue),o}return p.__extends(t,e),t.prototype.matches=function(n){var r=x.i(n.key,this.key);return this._n(r)},t}(gt),gl=function(e){function t(n,r){var i=this;return(i=e.call(this,n,"in",r)||this).keys=Ic("in",r),i}return p.__extends(t,e),t.prototype.matches=function(n){return this.keys.some(function(r){return r.isEqual(n.key)})},t}(gt),ml=function(e){function t(n,r){var i=this;return(i=e.call(this,n,"not-in",r)||this).keys=Ic("not-in",r),i}return p.__extends(t,e),t.prototype.matches=function(n){return!this.keys.some(function(r){return r.isEqual(n.key)})},t}(gt);function Ic(e,t){var n;return(((n=t.arrayValue)===null||n===void 0?void 0:n.values)||[]).map(function(r){return x.C(r.referenceValue)})}var wl=function(e){function t(n,r){return e.call(this,n,"array-contains",r)||this}return p.__extends(t,e),t.prototype.matches=function(n){var r=n.field(this.field);return Ro(r)&&Dn(r.arrayValue,this.value)},t}(gt),_l=function(e){function t(n,r){return e.call(this,n,"in",r)||this}return p.__extends(t,e),t.prototype.matches=function(n){var r=n.field(this.field);return r!==null&&Dn(this.value.arrayValue,r)},t}
10(gt),bl=function(e){function t(n,r){return e.call(this,n,"not-in",r)||this}return p.__extends(t,e),t.prototype.matches=function(n){if(Dn(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;var r=n.field(this.field);return r!==null&&!Dn(this.value.arrayValue,r)},t}(gt),El=function(e){function t(n,r){return e.call(this,n,"array-contains-any",r)||this}return p.__extends(t,e),t.prototype.matches=function(n){var r=this,i=n.field(this.field);return!(!Ro(i)||!i.arrayValue.values)&&i.arrayValue.values.some(function(o){return Dn(r.value.arrayValue,o)})},t}(gt),kn=function(e,t){this.position=e,this.before=t};function Vr(e){return(e.before?"b":"a")+":"+e.position.map(function(t){return Oo(t)}).join(",")}function fa(e,t,n){for(var r=0,i=0;i<e.position.length;i++){var o=t[i],s=e.position[i];if(r=o.field.p()?x.i(x.C(s.referenceValue),n.key):He(s,n.field(o.field)),o.dir==="desc"&&(r*=-1),r!==0)break}return e.before?r<=0:r<0}function la(e,t){if(e===null)return t===null;if(t===null||e.before!==t.before||e.position.length!==t.position.length)return!1;for(var n=0;n<e.position.length;n++)if(!Ut(e.position[n],t.position[n]))return!1;return!0}var ze=function(e,t){t===void 0&&(t="asc"),this.field=e,this.dir=t};function Il(e,t,n){var r=e.field.p()?x.i(t.key,n.key):function(i,o,s){var u=o.field(i),a=s.field(i);return u!==null&&a!==null?He(u,a):A()}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return-1*r;default:return A()}}function Tl(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}var pt=function(){var e=this;this.promise=new Promise(function(t,n){e.resolve=t,e.reject=n})},qo=function(){function e(t,n,r,i,o){r===void 0&&(r=1e3),i===void 0&&(i=1.5),o===void 0&&(o=6e4),this.fn=t,this.dn=n,this.wn=r,this.mn=i,this.Tn=o,this.En=0,this.In=null,this.An=Date.now(),this.reset()}return e.prototype.reset=function(){this.En=0},e.prototype.Rn=function(){this.En=this.Tn},e.prototype.gn=function(t){var n=this;this.cancel();var r=Math.floor(this.En+this.Pn()),i=Math.max(0,Date.now()-this.An),o=Math.max(0,r-i);o>0&&_("ExponentialBackoff","Backing off for "+o+" ms (base delay: "+this.En+" ms, delay with jitter: "+r+" ms, last attempt: "+i+" ms ago)"),this.In=this.fn.yn(this.dn,o,function(){return n.An=Date.now(),t()}),this.En*=this.mn,this.En<this.wn&&(this.En=this.wn),this.En>this.Tn&&(this.En=this.Tn)},e.prototype.Vn=function(){this.In!==null&&(this.In.pn(),this.In=null)},e.prototype.cancel=function(){this.In!==null&&(this.In.cancel(),this.In=null)},e.prototype.Pn=function(){return(Math.random()-.5)*this.En},e}(),w=function(){function e(t){var n=this;this.bn=null,this.vn=null,this.result=void 0,this.error=void 0,this.Sn=!1,this.Dn=!1,t(function(r){n.Sn=!0,n.result=r,n.bn&&n.bn(r)},function(r){n.Sn=!0,n.error=r,n.vn&&n.vn(r)})}return e.prototype.catch=function(t){return this.next(void 0,t)},e.prototype.next=function(t,n){var r=this;return this.Dn&&A(),this.Dn=!0,this.Sn?this.error?this.Cn(n,this.error):this.Nn(t,this.result):new e(function(i,o){r.bn=function(s){r.Nn(t,s).next(i,o)},r.vn=function(s){r.Cn(n,s).next(i,o)}})},e.prototype.Fn=function(){var t=this;return new Promise(function(n,r){t.next(n,r)})},e.prototype.xn=function(t){try{var n=t();return n instanceof e?n:e.resolve(n)}catch(r){return e.reject(r)}},e.prototype.Nn=function(t,n){return t?this.xn(function(){return t(n)}):e.resolve(n)},e.prototype.Cn=function(t,n){return t?this.xn(function(){return t(n)}):e.reject(n)},e.resolve=function(t){return new e(function(n,r){n(t)})},e.reject=function(t){return new e(function(n,r){r(t)})},e.$n=function(t){return new e(function(n,r){var i=0,o=0,s=!1;t.forEach(function(u){++i,u.next(function(){++o,s&&o===i&&n()},function(a){return r(a)})}),s=!0,o===i&&n()})},e.kn=function(t){for(var n=e.resolve(!1),r=function(s){n=n.next(function(u){return u?e.resolve(u):s()})},i=0,o=t;i<o.length;i++)r(o[i]);return n},e.forEach=function(t,n){var r=this,i=[];return t.forEach(function(o,s){i.push(n.call(r,o,s))}),this.$n(i)},e}(),Ke=function(){function e(t,n,r){this.name=t,this.version=n,this.Mn=r,e.On(jt.getUA())===12.2&&B("Firestore persistence suffers from a bug in
10iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}return e.delete=function(t){return _("SimpleDb","Removing database:",t),fe(window.indexedDB.deleteDatabase(t)).Fn()},e.Ln=function(){if(typeof indexedDB>"u")return!1;if(e.Bn())return!0;var t=jt.getUA(),n=e.On(t),r=0<n&&n<10,i=e.qn(t),o=0<i&&i<4.5;return!(t.indexOf("MSIE ")>0||t.indexOf("Trident/")>0||t.indexOf("Edge/")>0||r||o)},e.Bn=function(){var t;return typeof process<"u"&&((t=process.env)===null||t===void 0?void 0:t.Un)==="YES"},e.Qn=function(t,n){return t.store(n)},e.On=function(t){var n=t.match(/i(?:phone|pad|pod) os ([\d_]+)/i),r=n?n[1].split("_").slice(0,2).join("."):"-1";return Number(r)},e.qn=function(t){var n=t.match(/Android ([\d.]+)/i),r=n?n[1].split(".").slice(0,2).join("."):"-1";return Number(r)},e.prototype.Wn=function(t){return p.__awaiter(this,void 0,void 0,function(){var n,r=this;return p.__generator(this,function(i){switch(i.label){case 0:return this.db?[3,2]:(_("SimpleDb","Opening database:",this.name),n=this,[4,new Promise(function(o,s){var u=indexedDB.open(r.name,r.version);u.onsuccess=function(a){var c=a.target.result;o(c)},u.onblocked=function(){s(new Nn(t,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},u.onerror=function(a){var c=a.target.error;c.name==="VersionError"?s(new m(y.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.")):s(new Nn(t,c))},u.onupgradeneeded=function(a){_("SimpleDb",'Database "'+r.name+'" requires upgrade from version:',a.oldVersion);var c=a.target.result;r.Mn.createOrUpgrade(c,u.transaction,a.oldVersion,r.version).next(function(){_("SimpleDb","Database upgrade to version "+r.version+" complete")})}})]);case 1:n.db=i.sent(),i.label=2;case 2:return[2,(this.jn&&(this.db.onversionchange=function(o){return r.jn(o)}),this.db)]}})})},e.prototype.Kn=function(t){this.jn=t,this.db&&(this.db.onversionchange=function(n){return t(n)})},e.prototype.runTransaction=function(t,n,r,i){return p.__awaiter(this,void 0,void 0,function(){var o,s,u,a,c;return p.__generator(this,function(h){switch(h.label){case 0:o=n==="readonly",s=0,u=function(){var f,l,d,v,g;return p.__generator(this,function(E){switch(E.label){case 0:++s,E.label=1;case 1:return E.trys.push([1,4,,5]),[4,a.Wn(t)];case 2:return a.db=E.sent(),f=Tc.open(a.db,t,o?"readonly":"readwrite",r),l=i(f).catch(function(b){return f.abort(b),w.reject(b)}).Fn(),d={},l.catch(function(){}),[4,f.Gn];case 3:return[2,(d.value=(E.sent(),l),d)];case 4:return v=E.sent(),g=v.name!=="FirebaseError"&&s<3,_("SimpleDb","Transaction failed with error:",v.message,"Retrying:",g),a.close(),g?[3,5]:[2,{value:Promise.reject(v)}];case 5:return[2]}})},a=this,h.label=1;case 1:return[5,u()];case 2:if(typeof(c=h.sent())=="object")return[2,c.value];h.label=3;case 3:return[3,1];case 4:return[2]}})})},e.prototype.close=function(){this.db&&this.db.close(),this.db=void 0},e}(),Al=function(){function e(t){this.zn=t,this.Hn=!1,this.Yn=null}return Object.defineProperty(e.prototype,"Sn",{get:function(){return this.Hn},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"Jn",{get:function(){return this.Yn},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cursor",{set:function(t){this.zn=t},enumerable:!1,configurable:!0}),e.prototype.done=function(){this.Hn=!0},e.prototype.Xn=function(t){this.Yn=t},e.prototype.delete=function(){return fe(this.zn.delete())},e}(),Nn=function(e){function t(n,r){var i=this;return(i=e.call(this,y.UNAVAILABLE,"IndexedDB transaction '"+n+"' failed: "+r)||this).name="IndexedDbTransactionError",i}return p.__extends(t,e),t}(m);function Ie(e){return e.name==="IndexedDbTransactionError"}var Tc=function(){function e(t,n){var r=this;this.action=t,this.transaction=n,this.aborted=!1,this.Zn=new pt,this.transaction.oncomplete=function(){r.Zn.resolve()},this.transaction.onabort=function(){n.error?r.Zn.reject(new Nn(t,n.error)):r.Zn.resolve()},this.transaction.onerror=function(i){var o=Go(i.target.error);r.Zn.reject(new Nn(t,o))}}return e.open=function(t,n,r,i){try{return new e(n,t.transaction(i,r))}catch(o){throw new Nn(n,o)}},Object.defineProperty(e.prototype,"Gn",{get:function(){return this.Zn.promise}
10,enumerable:!1,configurable:!0}),e.prototype.abort=function(t){t&&this.Zn.reject(t),this.aborted||(_("SimpleDb","Aborting transaction:",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())},e.prototype.store=function(t){var n=this.transaction.objectStore(t);return new Nl(n)},e}(),Nl=function(){function e(t){this.store=t}return e.prototype.put=function(t,n){var r;return n!==void 0?(_("SimpleDb","PUT",this.store.name,t,n),r=this.store.put(n,t)):(_("SimpleDb","PUT",this.store.name,"<auto-key>",t),r=this.store.put(t)),fe(r)},e.prototype.add=function(t){return _("SimpleDb","ADD",this.store.name,t,t),fe(this.store.add(t))},e.prototype.get=function(t){var n=this;return fe(this.store.get(t)).next(function(r){return r===void 0&&(r=null),_("SimpleDb","GET",n.store.name,t,r),r})},e.prototype.delete=function(t){return _("SimpleDb","DELETE",this.store.name,t),fe(this.store.delete(t))},e.prototype.count=function(){return _("SimpleDb","COUNT",this.store.name),fe(this.store.count())},e.prototype.ts=function(t,n){var r=this.cursor(this.options(t,n)),i=[];return this.es(r,function(o,s){i.push(s)}).next(function(){return i})},e.prototype.ns=function(t,n){_("SimpleDb","DELETE ALL",this.store.name);var r=this.options(t,n);r.ss=!1;var i=this.cursor(r);return this.es(i,function(o,s,u){return u.delete()})},e.prototype.rs=function(t,n){var r;n?r=t:(r={},n=t);var i=this.cursor(r);return this.es(i,n)},e.prototype.os=function(t){var n=this.cursor({});return new w(function(r,i){n.onerror=function(o){var s=Go(o.target.error);i(s)},n.onsuccess=function(o){var s=o.target.result;s?t(s.primaryKey,s.value).next(function(u){u?s.continue():r()}):r()}})},e.prototype.es=function(t,n){var r=[];return new w(function(i,o){t.onerror=function(s){o(s.target.error)},t.onsuccess=function(s){var u=s.target.result;if(u){var a=new Al(u),c=n(u.primaryKey,u.value,a);if(c instanceof w){var h=c.catch(function(f){return a.done(),w.reject(f)});r.push(h)}a.Sn?i():a.Jn===null?u.continue():u.continue(a.Jn)}else i()}}).next(function(){return w.$n(r)})},e.prototype.options=function(t,n){var r=void 0;return t!==void 0&&(typeof t=="string"?r=t:n=t),{index:r,range:n}},e.prototype.cursor=function(t){var n="next";if(t.reverse&&(n="prev"),t.index){var r=this.store.index(t.index);return t.ss?r.openKeyCursor(t.range,n):r.openCursor(t.range,n)}return this.store.openCursor(t.range,n)},e}();function fe(e){return new w(function(t,n){e.onsuccess=function(r){var i=r.target.result;t(i)},e.onerror=function(r){var i=Go(r.target.error);n(i)}})}var pa=!1;function Go(e){var t=Ke.On(jt.getUA());if(t>=12.2&&t<13){var n="An internal error was encountered in the Indexed Database server";if(e.message.indexOf(n)>=0){var r=new m("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 pa||(pa=!0,setTimeout(function(){throw r},0)),r}}return e}function da(){return typeof window<"u"?window:null}function Nr(){return typeof document<"u"?document:null}var Sl=function(){function e(t,n,r,i,o){this.cs=t,this.dn=n,this.us=r,this.op=i,this.hs=o,this.ls=new pt,this.then=this.ls.promise.then.bind(this.ls.promise),this.ls.promise.catch(function(s){})}return e._s=function(t,n,r,i,o){var s=new e(t,n,Date.now()+r,i,o);return s.start(r),s},e.prototype.start=function(t){var n=this;this.fs=setTimeout(function(){return n.ds()},t)},e.prototype.pn=function(){return this.ds()},e.prototype.cancel=function(t){this.fs!==null&&(this.clearTimeout(),this.ls.reject(new m(y.CANCELLED,"Operation cancelled"+(t?": "+t:"")))
10)},e.prototype.ds=function(){var t=this;this.cs.ws(function(){return t.fs!==null?(t.clearTimeout(),t.op().then(function(n){return t.ls.resolve(n)})):Promise.resolve()})},e.prototype.clearTimeout=function(){this.fs!==null&&(this.hs(this),clearTimeout(this.fs),this.fs=null)},e}(),xl=function(){function e(){var t=this;this.Ts=Promise.resolve(),this.Es=[],this.Is=!1,this.As=[],this.Rs=null,this.gs=!1,this.Ps=[],this.ys=new qo(this,"async_queue_retry"),this.Vs=function(){var r=Nr();r&&_("AsyncQueue","Visibility state changed to ",r.visibilityState),t.ys.Vn()};var n=Nr();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this.Vs)}return Object.defineProperty(e.prototype,"ps",{get:function(){return this.Is},enumerable:!1,configurable:!0}),e.prototype.ws=function(t){this.enqueue(t)},e.prototype.bs=function(t){this.vs(),this.Ss(t)},e.prototype.Ds=function(){if(!this.Is){this.Is=!0;var t=Nr();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.Vs)}},e.prototype.enqueue=function(t){return this.vs(),this.Is?new Promise(function(n){}):this.Ss(t)},e.prototype.Cs=function(t){var n=this;this.ws(function(){return n.Es.push(t),n.Ns()})},e.prototype.Ns=function(){return p.__awaiter(this,void 0,void 0,function(){var t,n=this;return p.__generator(this,function(r){switch(r.label){case 0:if(this.Es.length===0)return[3,5];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.Es[0]()];case 2:return r.sent(),this.Es.shift(),this.ys.reset(),[3,4];case 3:if(!Ie(t=r.sent()))throw t;return _("AsyncQueue","Operation failed with retryable error: "+t),[3,4];case 4:this.Es.length>0&&this.ys.gn(function(){return n.Ns()}),r.label=5;case 5:return[2]}})})},e.prototype.Ss=function(t){var n=this,r=this.Ts.then(function(){return n.gs=!0,t().catch(function(i){throw n.Rs=i,n.gs=!1,B("INTERNAL UNHANDLED ERROR: ",function(o){var s=o.message||"";return o.stack&&(s=o.stack.includes(o.message)?o.stack:o.message+` 11`+o.stack),s}(i)),i}).then(function(i){return n.gs=!1,i})});return this.Ts=r,r},e.prototype.yn=function(t,n,r){var i=this;this.vs(),this.Ps.indexOf(t)>-1&&(n=0);var o=Sl._s(this,t,n,r,function(s){return i.Fs(s)});return this.As.push(o),o},e.prototype.vs=function(){this.Rs&&A()},e.prototype.xs=function(){},e.prototype.$s=function(){return p.__awaiter(this,void 0,void 0,function(){var t;return p.__generator(this,function(n){switch(n.label){case 0:return[4,t=this.Ts];case 1:n.sent(),n.label=2;case 2:if(t!==this.Ts)return[3,0];n.label=3;case 3:return[2]}})})},e.prototype.ks=function(t){for(var n=0,r=this.As;n<r.length;n++)if(r[n].dn===t)return!0;return!1},e.prototype.Ms=function(t){var n=this;return this.$s().then(function(){n.As.sort(function(s,u){return s.us-u.us});for(var r=0,i=n.As;r<i.length;r++){var o=i[r];if(o.pn(),t!=="all"&&o.dn===t)break}return n.$s()})},e.prototype.Os=function(t){this.Ps.push(t)},e.prototype.Fs=function(t){var n=this.As.indexOf(t);this.As.splice(n,1)},e}();function Ve(e,t){if(B("AsyncQueue",t+": "+e),Ie(e))return new m(y.UNAVAILABLE,t+": "+e);throw e}var Dl=function(){this.Ls=void 0,this.listeners=[]},Ll=function(){this.Bs=new rn(function(e){return bc(e)},on),this.onlineState="Unknown",this.qs=new Set};function eo(e,t){return p.__awaiter(this,void 0,void 0,function(){var n,r,i,o,s,u,a;return p.__generator(this,function(c){switch(c.label){case 0:if(n=I(e),r=t.query,i=!1,(o=n.Bs.get(r))||(i=!0,o=new Dl),!i)return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),s=o,[4,n.Us(r)];case 2:return s.Ls=c.sent(),[3,4];case 3:return u=c.sent(),a=Ve(u,"Initialization of query '"+wo(t.query)+"' failed"),[2,void t.onError(a)];case 4:return n.Bs.set(r,o),o.listeners.push(t),t.Qs(n.onlineState),o.Ls&&t.Ws(o.Ls)&&Bo(n),[2]}})})}function no(e,t){return p.__awaiter(this,void 0,void 0,function(){var n,r,i,o,s;return p.__generator(this,function(u){return n=I(e),r=t.query,i=!1,(o=n.Bs.get(r))&&(s=o.listeners.indexOf(t))>=0&&(o.listeners.splice(s,1),i=o.listeners.length===0),i?[2,(n.Bs.delete(r),n.js(r))]:[2]})})}function kl(e,t){for(var n=I(e),r=!1,i=0,o=t;i<o.length;i++){var s=o[i],u=s.query,a=n.Bs.get(u);if(a){for(var c=0,h=a.listeners;c<h.length;c++)h[c].Ws(s)&&(r=!0);a.Ls=s}}r&&Bo(n)}function Ol(e,t,n){var r=I(e),i=r.Bs.get(t);if(i)for(var o=0,s=i.listeners;o<s.length;o++)s[o].onError(n);r.Bs.delete(t)}
11function Bo(e){e.qs.forEach(function(t){t.next()})}var ro=function(){function e(t,n,r){this.query=t,this.Ks=n,this.Gs=!1,this.zs=null,this.onlineState="Unknown",this.options=r||{}}return e.prototype.Ws=function(t){if(!this.options.includeMetadataChanges){for(var n=[],r=0,i=t.docChanges;r<i.length;r++){var o=i[r];o.type!==3&&n.push(o)}t=new kr(t.query,t.docs,t.Qt,n,t.Wt,t.fromCache,t.jt,!0)}var s=!1;return this.Gs?this.Hs(t)&&(this.Ks.next(t),s=!0):this.Ys(t,this.onlineState)&&(this.Js(t),s=!0),this.zs=t,s},e.prototype.onError=function(t){this.Ks.error(t)},e.prototype.Qs=function(t){this.onlineState=t;var n=!1;return this.zs&&!this.Gs&&this.Ys(this.zs,t)&&(this.Js(this.zs),n=!0),n},e.prototype.Ys=function(t,n){if(!t.fromCache)return!0;var r=n!=="Offline";return!(this.options.Xs&&r||t.docs.m()&&n!=="Offline")},e.prototype.Hs=function(t){if(t.docChanges.length>0)return!0;var n=this.zs&&this.zs.hasPendingWrites!==t.hasPendingWrites;return!(!t.jt&&!n)&&this.options.includeMetadataChanges===!0},e.prototype.Js=function(t){t=kr.Gt(t.query,t.docs,t.Wt,t.fromCache),this.Gs=!0,this.Ks.next(t)},e}(),_t=function(){function e(t){this.uid=t}return e.prototype.Zs=function(){return this.uid!=null},e.prototype.ti=function(){return this.Zs()?"uid:"+this.uid:"anonymous-user"},e.prototype.isEqual=function(t){return t.uid===this.uid},e}();_t.UNAUTHENTICATED=new _t(null),_t.ei=new _t("google-credentials-uid"),_t.ni=new _t("first-party-uid");var mt=function(){function e(t,n){var r=this;this.previousValue=t,n&&(n.si=function(i){return r.ii(i)},this.ri=function(i){return n.oi(i)})}return e.prototype.ii=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},e.prototype.next=function(){var t=++this.previousValue;return this.ri&&this.ri(t),t},e}();function va(e,t){return"firestore_clients_"+e+"_"+t}function ya(e,t,n){var r="firestore_mutations_"+e+"_"+n;return t.Zs()&&(r+="_"+t.uid),r}function io(e,t){return"firestore_targets_"+e+"_"+t}mt.ai=-1;var ga=function(){function e(t,n,r,i){this.user=t,this.batchId=n,this.state=r,this.error=i}return e.ci=function(t,n,r){var i=JSON.parse(r),o=typeof i=="object"&&["pending","acknowledged","rejected"].indexOf(i.state)!==-1&&(i.error===void 0||typeof i.error=="object"),s=void 0;return o&&i.error&&(o=typeof i.error.message=="string"&&typeof i.error.code=="string")&&(s=new m(i.error.code,i.error.message)),o?new e(t,n,i.state,s):(B("SharedClientState","Failed to parse mutation state for ID '"+n+"': "+r),null)},e.prototype.ui=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},e}(),oo=function(){function e(t,n,r){this.targetId=t,this.state=n,this.error=r}return e.ci=function(t,n){var r=JSON.parse(n),i=typeof r=="object"&&["not-current","current","rejected"].indexOf(r.state)!==-1&&(r.error===void 0||typeof r.error=="object"),o=void 0;return i&&r.error&&(i=typeof r.error.message=="string"&&typeof r.error.code=="string")&&(o=new m(r.error.code,r.error.message)),i?new e(t,r.state,o):(B("SharedClientState","Failed to parse target state for ID '"+t+"': "+n),null)},e.prototype.ui=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},e}(),ma=function(){function e(t,n){this.clientId=t,this.activeTargetIds=n}return e.ci=function(t,n){for(var r=JSON.parse(n),i=typeof r=="object"&&r.activeTargetIds instanceof Array,o=Yr(),s=0;i&&s<r.activeTargetIds.length;++s)i=Qa(r.activeTargetIds[s]),o=o.add(r.activeTargetIds[s]);return i?new e(t,o):(B("SharedClientState","Failed to parse client data for instance '"+t+"': "+n),null)},e}(),Rl=function(){function e(t,n){this.clientId=t,this.onlineState=n}return e.ci=function(t){var n=JSON.parse(t);return typeof n=="object"&&["Unknown","Online","Offline"].indexOf(n.onlineState)!==-1&&typeof n.clientId=="string"?new e(n.clientId,n.onlineState):(B("SharedClientState","Failed to parse online state: "+t),null)},e}(),_o=function(){function e(){this.activeTargetIds=Yr()}return e.prototype.hi=function(t){this.activeTargetIds=this.activeTargetIds.add(t)},e.prototype.li=function(t){this.activeTargetIds=this.activeTargetIds.delete(t)},e.prototype.ui=function(){var t={activeTargetIds:this.activeTargetIds.A(),updateTimeMs:Date.now()};return JSON.stringify(t)},e}(),so=function(){function e(t,n,r,i,o){this.window=t,this.fn=n,this.persistenceKey=r,this._i=i,this.fi=null,this.di=null,this.si=null,this.wi=this.mi.bind(this),this.Ti=new ot(k),this.Ei=!1,this.Ii=[];var s=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=o,this.Ai=va(this.persistenceKey,this._i),this.Ri=function(u){return"firestore_sequence_number_"+u}(this.persistenceKey),this.Ti=this.Ti.ot(this._i,new _o),this.gi=new RegExp("^firestore_clients_"+s+"_([^_]*)$"),this.Pi=new RegExp("^firestore_mutations_"+s+"_(\\d+)(?:_(.*))?$"),this.yi=new RegExp("^firestore_targets_"+s+"_(\\d+)$"),this.Vi=function(u){return"firestore_online_state_"+u}(this.persistenceKey),this.window.addEventListener("storage",this.wi)}return e.Ln=function(t){return!(!t||!t.localStorage)},e.prototype.start=function(){return p.__awaiter(this,void 0,void 0,function(){var t,n,r,i,o,s,u,a,c,h,f,l=this;return p.__generator(this,function(d){switch(d.label){case 0:return[4,this.fi.pi()];case 1:for(t=d.sent(),n=0,r=t;n<r.length;n++)(i=r[n])!==this._i&&(o=this.getItem(va(this.persistenceKey,i)))&&
11(s=ma.ci(i,o))&&(this.Ti=this.Ti.ot(s.clientId,s));for(this.bi(),(u=this.storage.getItem(this.Vi))&&(a=this.vi(u))&&this.Si(a),c=0,h=this.Ii;c<h.length;c++)f=h[c],this.mi(f);return this.Ii=[],this.window.addEventListener("unload",function(){return l.Di()}),this.Ei=!0,[2]}})})},e.prototype.oi=function(t){this.setItem(this.Ri,JSON.stringify(t))},e.prototype.Ci=function(){return this.Ni(this.Ti)},e.prototype.Fi=function(t){var n=!1;return this.Ti.forEach(function(r,i){i.activeTargetIds.has(t)&&(n=!0)}),n},e.prototype.xi=function(t){this.$i(t,"pending")},e.prototype.ki=function(t,n,r){this.$i(t,n,r),this.Mi(t)},e.prototype.Oi=function(t){var n="not-current";if(this.Fi(t)){var r=this.storage.getItem(io(this.persistenceKey,t));if(r){var i=oo.ci(t,r);i&&(n=i.state)}}return this.Li.hi(t),this.bi(),n},e.prototype.Bi=function(t){this.Li.li(t),this.bi()},e.prototype.qi=function(t){return this.Li.activeTargetIds.has(t)},e.prototype.Ui=function(t){this.removeItem(io(this.persistenceKey,t))},e.prototype.Qi=function(t,n,r){this.Wi(t,n,r)},e.prototype.ji=function(t,n,r){var i=this;n.forEach(function(o){i.Mi(o)}),this.currentUser=t,r.forEach(function(o){i.xi(o)})},e.prototype.Ki=function(t){this.Gi(t)},e.prototype.Di=function(){this.Ei&&(this.window.removeEventListener("storage",this.wi),this.removeItem(this.Ai),this.Ei=!1)},e.prototype.getItem=function(t){var n=this.storage.getItem(t);return _("SharedClientState","READ",t,n),n},e.prototype.setItem=function(t,n){_("SharedClientState","SET",t,n),this.storage.setItem(t,n)},e.prototype.removeItem=function(t){_("SharedClientState","REMOVE",t),this.storage.removeItem(t)},e.prototype.mi=function(t){var n=this,r=t;if(r.storageArea===this.storage){if(_("SharedClientState","EVENT",r.key,r.newValue),r.key===this.Ai)return void B("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.fn.Cs(function(){return p.__awaiter(n,void 0,void 0,function(){var i,o,s,u,a,c;return p.__generator(this,function(h){if(this.Ei){if(r.key!==null)if(this.gi.test(r.key)){if(r.newValue==null)return i=this.zi(r.key),[2,this.Hi(i,null)];if(o=this.Yi(r.key,r.newValue))return[2,this.Hi(o.clientId,o)]}else if(this.Pi.test(r.key)){if(r.newValue!==null&&(s=this.Ji(r.key,r.newValue)))return[2,this.Xi(s)]}else if(this.yi.test(r.key)){if(r.newValue!==null&&(u=this.Zi(r.key,r.newValue)))return[2,this.tr(u)]}else if(r.key===this.Vi){if(r.newValue!==null&&(a=this.vi(r.newValue)))return[2,this.Si(a)]}else r.key===this.Ri&&(c=function(f){var l=mt.ai;if(f!=null)try{var d=JSON.parse(f);S(typeof d=="number"),l=d}catch(v){B("SharedClientState","Failed to read sequence number from WebStorage",v)}return l}(r.newValue))!==mt.ai&&this.si(c)}else this.Ii.push(r);return[2]})})})}},Object.defineProperty(e.prototype,"Li",{get:function(){return this.Ti.get(this._i)},enumerable:!1,configurable:!0}),e.prototype.bi=function(){this.setItem(this.Ai,this.Li.ui())},e.prototype.$i=function(t,n,r){var i=new ga(this.currentUser,t,n,r),o=ya(this.persistenceKey,this.currentUser,t);this.setItem(o,i.ui())},e.prototype.Mi=function(t){var n=ya(this.persistenceKey,this.currentUser,t);this.removeItem(n)},e.prototype.Gi=function(t){var n={clientId:this._i,onlineState:t};this.storage.setItem(this.Vi,JSON.stringify(n))},e.prototype.Wi=function(t,n,r){var i=io(this.persistenceKey,t),o=new oo(t,n,r);this.setItem(i,o.ui())},e.prototype.zi=function(t){var n=this.gi.exec(t);return n?n[1]:null},e.prototype.Yi=function(t,n){var r=this.zi(t);return ma.ci(r,n)},e.prototype.Ji=function(t,n){var r=this.Pi.exec(t),i=Number(r[1]),o=r[2]!==void 0?r[2]:null;return ga.ci(new _t(o),i,n)},e.prototype.Zi=function(t,n){var r=this.yi.exec(t),i=Number(r[1]);return oo.ci(i,n)},e.prototype.vi=function(t){return Rl.ci(t)},e.prototype.Xi=function(t){return p.__awaiter(this,void 0,void 0,function(){return p.__generator(this,function(n){return t.user.uid===this.currentUser.uid?[2,this.fi.er(t.batchId,t.state,t.error)]:(_("SharedClientState","Ignoring mutation for non-active user "+t.user.uid),[2])})})},e.prototype.tr=function(t){return this.fi.nr(t.targetId,t.state,t.error)},e.prototype.Hi=function(t,n){var r=this,i=n?this.Ti.ot(t,n):this.Ti.remove(t),o=this.Ni(this.Ti),s=this.Ni(i),u=[],a=[];
11return s.forEach(function(c){o.has(c)||u.push(c)}),o.forEach(function(c){s.has(c)||a.push(c)}),this.fi.sr(u,a).then(function(){r.Ti=i})},e.prototype.Si=function(t){this.Ti.get(t.clientId)&&this.di(t.onlineState)},e.prototype.Ni=function(t){var n=Yr();return t.forEach(function(r,i){n=n.kt(i.activeTargetIds)}),n},e}(),bo=function(){function e(){this.ir=new _o,this.rr={},this.di=null,this.si=null}return e.prototype.xi=function(t){},e.prototype.ki=function(t,n,r){},e.prototype.Oi=function(t){return this.ir.hi(t),this.rr[t]||"not-current"},e.prototype.Qi=function(t,n,r){this.rr[t]=n},e.prototype.Bi=function(t){this.ir.li(t)},e.prototype.qi=function(t){return this.ir.activeTargetIds.has(t)},e.prototype.Ui=function(t){delete this.rr[t]},e.prototype.Ci=function(){return this.ir.activeTargetIds},e.prototype.Fi=function(t){return this.ir.activeTargetIds.has(t)},e.prototype.start=function(){return this.ir=new _o,Promise.resolve()},e.prototype.ji=function(t,n,r){},e.prototype.Ki=function(t){},e.prototype.Di=function(){},e.prototype.oi=function(t){},e}(),zo=function(){function e(t,n,r,i){this.batchId=t,this.ar=n,this.baseMutations=r,this.mutations=i}return e.prototype.cr=function(t,n,r){for(var i=r.ur,o=0;o<this.mutations.length;o++){var s=this.mutations[o];s.key.isEqual(t)&&(n=dl(s,n,i[o]))}return n},e.prototype.hr=function(t,n){for(var r=0,i=this.baseMutations;r<i.length;r++){var o=i[r];o.key.isEqual(t)&&(n=mo(o,n,n,this.ar))}for(var s=n,u=0,a=this.mutations;u<a.length;u++){var c=a[u];c.key.isEqual(t)&&(n=mo(c,n,s,this.ar))}return n},e.prototype.lr=function(t){var n=this,r=t;return this.mutations.forEach(function(i){var o=n.hr(i.key,t.get(i.key));o&&(r=r.ot(i.key,o))}),r},e.prototype.keys=function(){return this.mutations.reduce(function(t,n){return t.add(n.key)},V())},e.prototype.isEqual=function(t){return this.batchId===t.batchId&&We(this.mutations,t.mutations,function(n,r){return sa(n,r)})&&We(this.baseMutations,t.baseMutations,function(n,r){return sa(n,r)})},e}(),Pl=function(){function e(t,n,r,i){this.batch=t,this._r=n,this.ur=r,this.dr=i}return e.from=function(t,n,r){S(t.mutations.length===r.length);for(var i=Yf,o=t.mutations,s=0;s<o.length;s++)i=i.ot(o[s].key,r[s].version);return new e(t,n,r,i)},e}(),Ac=function(){function e(){this.wr=new rn(function(t){return t.toString()},function(t,n){return t.isEqual(n)}),this.mr=!1}return Object.defineProperty(e.prototype,"readTime",{get:function(){return this.Tr},set:function(t){this.Tr=t},enumerable:!1,configurable:!0}),e.prototype.Er=function(t,n){this.Ir(),this.readTime=n,this.wr.set(t.key,t)},e.prototype.Ar=function(t,n){this.Ir(),n&&(this.readTime=n),this.wr.set(t,null)},e.prototype.Rr=function(t,n){this.Ir();var r=this.wr.get(n);return r!==void 0?w.resolve(r):this.gr(t,n)},e.prototype.getEntries=function(t,n){return this.Pr(t,n)},e.prototype.apply=function(t){return this.Ir(),this.mr=!0,this.yr(t)},e.prototype.Ir=function(){},e}(),Nc="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",Sc=function(){function e(){this.Vr=[]}return e.prototype.pr=function(t){this.Vr.push(t)},e.prototype.br=function(){this.Vr.forEach(function(t){return t()})},e}(),xc=function(){function e(t,n,r){this.vr=t,this.Sr=n,this.Dr=r}return e.prototype.Cr=function(t,n){var r=this;return this.Sr.Nr(t,n).next(function(i){return r.Fr(t,n,i)})},e.prototype.Fr=function(t,n,r){return this.vr.Rr(t,n).next(function(i){for(var o=0,s=r;o<s.length;o++)i=s[o].hr(n,i);return i})},e.prototype.$r=function(t,n,r){var i=Lr();return n.forEach(function(o,s){for(var u=0,a=r;u<a.length;u++)s=a[u].hr(o,s);i=i.ot(o,s)}),i},e.prototype.kr=function(t,n){var r=this;return this.vr.getEntries(t,n).next(function(i){return r.Mr(t,i)})},e.prototype.Mr=function(t,n){var r=this;return this.Sr.Or(t,n).next(function(i){var o=r.$r(t,n,i),s=de();return o.forEach(function(u,a){a||(a=new $(u,R.min())),s=s.ot(u,a)}),s})},e.prototype.Lr=function(t,n,r){return function(i){return x.F(i.path)&&i.collectionGroup===null&&i.filters.length===0}(n)?this.Br(t,n.path):jo(n)?this.qr(t,n,r):this.Ur(t,n,r)},e.prototype.Br=function(t,n){return this.Cr(t,new x(n)).next(function(r){var i=Sn();return r instanceof C&&(i=i.ot(r.key,r)),i})},e.prototype.qr=function(t,n,r){var i=this,o=n.collectionGroup,s=Sn();
11return this.Dr.Qr(t,o).next(function(u){return w.forEach(u,function(a){var c=function(h,f){return new zt(f,null,h.on.slice(),h.filters.slice(),h.limit,h.an,h.startAt,h.endAt)}(n,a.child(o));return i.Ur(t,c,r).next(function(h){h.forEach(function(f,l){s=s.ot(f,l)})})}).next(function(){return s})})},e.prototype.Ur=function(t,n,r){var i,o,s=this;return this.vr.Lr(t,n,r).next(function(u){return i=u,s.Sr.Wr(t,n)}).next(function(u){return o=u,s.jr(t,o,i).next(function(a){i=a;for(var c=0,h=o;c<h.length;c++)for(var f=h[c],l=0,d=f.mutations;l<d.length;l++){var v=d[l],g=v.key,E=i.get(g),b=mo(v,E,E,f.ar);i=b instanceof C?i.ot(g,b):i.remove(g)}})}).next(function(){return i.forEach(function(u,a){Kn(n,a)||(i=i.remove(u))}),i})},e.prototype.jr=function(t,n,r){for(var i=V(),o=0,s=n;o<s.length;o++)for(var u=0,a=s[o].mutations;u<a.length;u++){var c=a[u];c instanceof ue&&r.get(c.key)===null&&(i=i.add(c.key))}var h=r;return this.vr.getEntries(t,i).next(function(f){return f.forEach(function(l,d){d!==null&&d instanceof C&&(h=h.ot(l,d))}),h})},e}(),Cl=function(){function e(t,n,r,i){this.targetId=t,this.fromCache=n,this.Kr=r,this.Gr=i}return e.zr=function(t,n){for(var r=V(),i=V(),o=0,s=n.docChanges;o<s.length;o++){var u=s[o];switch(u.type){case 0:r=r.add(u.doc.key);break;case 1:i=i.add(u.doc.key)}}return new e(t,n.fromCache,r,i)},e}();function wa(e,t){var n=e[0],r=e[1],i=t[0],o=t[1],s=k(n,i);return s===0?k(r,o):s}var Ul=function(){function e(t){this.Hr=t,this.buffer=new Y(wa),this.Yr=0}return e.prototype.Jr=function(){return++this.Yr},e.prototype.Xr=function(t){var n=[t,this.Jr()];if(this.buffer.size<this.Hr)this.buffer=this.buffer.add(n);else{var r=this.buffer.last();wa(n,r)<0&&(this.buffer=this.buffer.delete(r).add(n))}},Object.defineProperty(e.prototype,"maxValue",{get:function(){return this.buffer.last()[0]},enumerable:!1,configurable:!0}),e}(),_a={Zr:!1,eo:0,no:0,so:0},W=function(){function e(t,n,r){this.io=t,this.ro=n,this.oo=r}return e.ao=function(t){return new e(t,e.co,e.uo)},e}();W.ho=-1,W.lo=1048576,W._o=41943040,W.co=10,W.uo=1e3,W.fo=new W(W._o,W.co,W.uo),W.do=new W(W.ho,0,0);var Vl=function(){function e(t,n){this.wo=t,this.cs=n,this.mo=!1,this.To=null}return e.prototype.start=function(t){this.wo.params.io!==W.ho&&this.Eo(t)},e.prototype.stop=function(){this.To&&(this.To.cancel(),this.To=null)},Object.defineProperty(e.prototype,"Ei",{get:function(){return this.To!==null},enumerable:!1,configurable:!0}),e.prototype.Eo=function(t){var n=this,r=this.mo?3e5:6e4;_("LruGarbageCollector","Garbage collection scheduled in "+r+"ms"),this.To=this.cs.yn("lru_garbage_collection",r,function(){return p.__awaiter(n,void 0,void 0,function(){var i;return p.__generator(this,function(o){switch(o.label){case 0:this.To=null,this.mo=!0,o.label=1;case 1:return o.trys.push([1,3,,7]),[4,t.Io(this.wo)];case 2:return o.sent(),[3,7];case 3:return Ie(i=o.sent())?(_("LruGarbageCollector","Ignoring IndexedDB error during garbage collection: ",i),[3,6]):[3,4];case 4:return[4,Te(i)];case 5:o.sent(),o.label=6;case 6:return[3,7];case 7:return[4,this.Eo(t)];case 8:return o.sent(),[2]}})})})},e}(),Ml=function(){function e(t,n){this.Ao=t,this.params=n}return e.prototype.Ro=function(t,n){return this.Ao.Po(t).next(function(r){return Math.floor(n/100*r)})},e.prototype.yo=function(t,n){var r=this;if(n===0)return w.resolve(mt.ai);var i=new Ul(n);return this.Ao.Ce(t,function(o){return i.Xr(o.sequenceNumber)}).next(function(){return r.Ao.Vo(t,function(o){return i.Xr(o)})}).next(function(){return i.maxValue})},e.prototype.po=function(t,n,r){return this.Ao.po(t,n,r)},e.prototype.bo=function(t,n){return this.Ao.bo(t,n)},e.prototype.vo=function(t,n){var r=this;return this.params.io===W.ho?(_("LruGarbageCollector","Garbage collection skipped; disabled"),w.resolve(_a)):this.So(t).next(function(i){return i<r.params.io?(_("LruGarbageCollector","Garbage collection skipped; Cache size "+i+" is lower than threshold "+r.params.io),_a):r.Do(t,n)})},e.prototype.So=function(t){return this.Ao.So(t)},e.prototype.Do=function(t,n){var r,i,o,s,u,a,c,h=this,f=Date.now();return this.Ro(t,this.params.ro).next(function(l){return l>h.params.oo?(_("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+h.params.oo+" from "+l),i=h.params.oo):i=l,s=Date.now(),h.yo(t,i)}).next(function(l){return r=l,u=Date.now(),h.po(t,r,n)}).next(function(l){return o=l,a=Date.now(),h.bo(t,r)}).next(function(l){return c=Date.now(),Sr()<=vt.LogLevel.DEBUG&&_("LruGarbageCollector",`LRU Garbage Collection 12 Counted targets in `+(s-f)+`ms 13 Determined least recently used `+i+" in "+(u-s)+`ms 14 Removed `+o+" targets in "+(a-u)+`ms 15 Removed `+l+" documents in "+(c-a)+`ms 16Total Duration: `+(c-f)+"ms"),w.resolve({Zr:!0,eo:i,no:o,so:l})})},e}();function xt(e){for(var t="",n=0;n<e.length;n++)t.length>0&&(t=ba(t)),t=Fl(e.get(n),t);return ba(t)}function Fl(e,t){for(var n=t,r=e.length,i=0;i<r;i++){var o=e.charAt(i);switch(o){case"\0":n+="��";break;case"�":n+="��";break;default:n+=o}}return n}function ba(e){return e+"��"}function Gt(e){var t=e.length;if(S(t>=2),t===2)return S(e.charAt(0)==="�"&&e.charAt(1)==="�"),q.P();for(var n=t-2,r=[],i="",o=0;o<t;){var s=e.indexOf("�",o);switch((s<0||s>n)&&A(),e.charAt(s+1)){case"�":var u=e.substring(o,s),a=void 0;i.length===0?a=u:(a=i+=u,i=""),r.push(a);break;case"�":i+=e.substring(o,s),i+="\0";break;case"�":i+=e.substring(o,s+1);break;default:A()}o=s+2}return new q(r)}var jl=function(e){this.Co=e};function Eo(e,t){if(t.document)return function(s,u,a){var c=Rt(s,u.name),h=Nt(u.updateTime),f=new ie({mapValue:{fields:u.fields}});return new C(c,h,f,{hasCommittedMutations:!!a})}(e.Co,t.document,!!t.hasCommittedMutations);if(t.noDocument){var n=x.$(t.noDocument.path),r=Fr(t.noDocument.readTime);return new $(n,r,{hasCommittedMutations:!!t.hasCommittedMutations})}if(t.unknownDocument){var i=x.$(t.unknownDocument.path),o=Fr(t.unknownDocument.version);return new Cr(i,o)}return A()}function Ea(e,t,n){var r=Ko(n),i=t.key.path.h().A();if(t instanceof C){var o=function(l,d){return{name:Be(l,d.key),fields:d.rn().mapValue.fields,updateTime:Rr(l,d.version.Z())}}(e.Co,t),s=t.hasCommittedMutations;return new z(null,null,o,s,r,i)}if(t instanceof $){var u=t.key.path.A(),a=Mr(t.version),c=t.hasCommittedMutations;return new z(null,new Hl(u,a),null,c,r,i)}if(t instanceof Cr){var h=t.key.path.A(),f=Mr(t.version);return new z(new Ql(h,f),null,null,!0,r,i)}return A()}function Ko(e){var t=e.Z();return[t.seconds,t.nanoseconds]}function Dc(e){var t=new ht(e[0],e[1]);return R.J(t)}function Mr(e){var t=e.Z();return new Wl(t.seconds,t.nanoseconds)}function Fr(e){var t=new ht(e.seconds,e.nanoseconds);return R.J(t)}function Me(e,t){var n=(t.baseMutations||[]).map(function(o){return na(e.Co,o)}),r=t.mutations.map(function(o){return na(e.Co,o)}),i=ht.fromMillis(t.localWriteTimeMs);return new zo(t.batchId,i,n,r)}function An(e){var t,n,r=Fr(e.readTime),i=e.lastLimboFreeSnapshotVersion!==void 0?Fr(e.lastLimboFreeSnapshotVersion):R.min();return e.query.documents!==void 0?(S((n=e.query).documents.length===1),t=Vt(zn(sc(n.documents[0])))):t=ol(e.query),new Xr(t,e.targetId,0,e.lastListenSequenceNumber,r,i,it.fromBase64String(e.resumeToken))}function Lc(e,t){var n,r=Mr(t.nt),i=Mr(t.lastLimboFreeSnapshotVersion);n=Dr(t.target)?ac(e.Co,t.target):cc(e.Co,t.target);var o=t.resumeToken.toBase64();return new ct(t.targetId,Mn(t.target),r,o,t.sequenceNumber,i,n)}var ql=function(){function e(t,n,r,i){this.userId=t,this.serializer
16=n,this.Dr=r,this.No=i,this.Fo={}}return e.xo=function(t,n,r,i){return S(t.uid!==""),new e(t.Zs()?t.uid:"",n,r,i)},e.prototype.$o=function(t){var n=!0,r=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return Yt(t).rs({index:F.userMutationsIndex,range:r},function(i,o,s){n=!1,s.done()}).next(function(){return n})},e.prototype.ko=function(t,n,r,i){var o=this,s=Fe(t),u=Yt(t);return u.add({}).next(function(a){S(typeof a=="number");for(var c=new zo(a,n,r,i),h=function(b,N,D){var O=D.baseMutations.map(function(M){return Pr(b.Co,M)}),U=D.mutations.map(function(M){return Pr(b.Co,M)});return new F(N,D.batchId,D.ar.toMillis(),O,U)}(o.serializer,o.userId,c),f=[],l=new Y(function(b,N){return k(b.R(),N.R())}),d=0,v=i;d<v.length;d++){var g=v[d],E=nt.key(o.userId,g.key.path,a);l=l.add(g.key.path.h()),f.push(u.put(h)),f.push(s.put(E,nt.PLACEHOLDER))}return l.forEach(function(b){f.push(o.Dr.Mo(t,b))}),t.pr(function(){o.Fo[a]=c.keys()}),w.$n(f).next(function(){return c})})},e.prototype.Oo=function(t,n){var r=this;return Yt(t).get(n).next(function(i){return i?(S(i.userId===r.userId),Me(r.serializer,i)):null})},e.prototype.Lo=function(t,n){var r=this;return this.Fo[n]?w.resolve(this.Fo[n]):this.Oo(t,n).next(function(i){if(i){var o=i.keys();return r.Fo[n]=o,o}return null})},e.prototype.Bo=function(t,n){var r=this,i=n+1,o=IDBKeyRange.lowerBound([this.userId,i]),s=null;return Yt(t).rs({index:F.userMutationsIndex,range:o},function(u,a,c){a.userId===r.userId&&(S(a.batchId>=i),s=Me(r.serializer,a)),c.done()}).next(function(){return s})},e.prototype.qo=function(t){var n=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),r=-1;return Yt(t).rs({index:F.userMutationsIndex,range:n,reverse:!0},function(i,o,s){r=o.batchId,s.done()}).next(function(){return r})},e.prototype.Uo=function(t){var n=this,r=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return Yt(t).ts(F.userMutationsIndex,r).next(function(i){return i.map(function(o){return Me(n.serializer,o)})})},e.prototype.Nr=function(t,n){var r=this,i=nt.prefixForPath(this.userId,n.path),o=IDBKeyRange.lowerBound(i),s=[];return Fe(t).rs({range:o},function(u,a,c){var h=u[0],f=u[1],l=u[2],d=Gt(f);if(h===r.userId&&n.path.isEqual(d))return Yt(t).get(l).next(function(v){if(!v)throw A();S(v.userId===r.userId),s.push(Me(r.serializer,v))});c.done()}).next(function(){return s})},e.prototype.Or=function(t,n){var r=this,i=new Y(k),o=[];return n.forEach(function(s){var u=nt.prefixForPath(r.userId,s.path),a=IDBKeyRange.lowerBound(u),c=Fe(t).rs({range:a},function(h,f,l){var d=h[0],v=h[1],g=h[2],E=Gt(v);d===r.userId&&s.path.isEqual(E)?i=i.add(g):l.done()});o.push(c)}),w.$n(o).next(function(){return r.Qo(t,i)})},e.prototype.Wr=function(t,n){var r=this,i=n.path,o=i.length+1,s=nt.prefixForPath(this.userId,i),u=IDBKeyRange.lowerBound(s),a=new Y(k);return Fe(t).rs({range:u},function(c,h,f){var l=c[0],d=c[1],v=c[2],g=Gt(d);l===r.userId&&i.T(g)?g.length===o&&(a=a.add(v)):f.done()}).next(function(){return r.Qo(t,a)})},e.prototype.Qo=function(t,n){var r=this,i=[],o=[];return n.forEach(function(s){o.push(Yt(t).get(s).next(function(u){if(u===null)throw A();S(u.userId===r.userId),i.push(Me(r.serializer,u))}))}),w.$n(o).next(function(){return i})},e.prototype.Wo=function(t,n){var r=this;return Oc(t.jo,this.userId,n).next(function(i){return t.pr(function(){r.Ko(n.batchId)}
16),w.forEach(i,function(o){return r.No.Go(t,o)})})},e.prototype.Ko=function(t){delete this.Fo[t]},e.prototype.zo=function(t){var n=this;return this.$o(t).next(function(r){if(!r)return w.resolve();var i=IDBKeyRange.lowerBound(nt.prefixForUser(n.userId)),o=[];return Fe(t).rs({range:i},function(s,u,a){if(s[0]===n.userId){var c=Gt(s[1]);o.push(c)}else a.done()}).next(function(){S(o.length===0)})})},e.prototype.Ho=function(t,n){return kc(t,this.userId,n)},e.prototype.Yo=function(t){var n=this;return Rc(t).get(this.userId).next(function(r){return r||new te(n.userId,-1,"")})},e}();function kc(e,t,n){var r=nt.prefixForPath(t,n.path),i=r[1],o=IDBKeyRange.lowerBound(r),s=!1;return Fe(e).rs({range:o,ss:!0},function(u,a,c){var h=u[0],f=u[1];u[2],h===t&&f===i&&(s=!0),c.done()}).next(function(){return s})}function Oc(e,t,n){var r=e.store(F.store),i=e.store(nt.store),o=[],s=IDBKeyRange.only(n.batchId),u=0,a=r.rs({range:s},function(v,g,E){return u++,E.delete()});o.push(a.next(function(){S(u===1)}));for(var c=[],h=0,f=n.mutations;h<f.length;h++){var l=f[h],d=nt.key(t,l.key.path,n.batchId);o.push(i.delete(d)),c.push(l.key)}return w.$n(o).next(function(){return c})}function Yt(e){return Et.Qn(e,F.store)}function Fe(e){return Et.Qn(e,nt.store)}function Rc(e){return Et.Qn(e,te.store)}var Gl=function(){function e(t,n){this.serializer=t,this.Dr=n}return e.prototype.Er=function(t,n,r){return Jt(t).put(_r(n),r)},e.prototype.Ar=function(t,n){var r=Jt(t),i=_r(n);return r.delete(i)},e.prototype.updateMetadata=function(t,n){var r=this;return this.getMetadata(t).next(function(i){return i.byteSize+=n,r.Jo(t,i)})},e.prototype.Rr=function(t,n){var r=this;return Jt(t).get(_r(n)).next(function(i){return r.Xo(i)})},e.prototype.Zo=function(t,n){var r=this;return Jt(t).get(_r(n)).next(function(i){var o=r.Xo(i);return o?{ta:o,size:jr(i)}:null})},e.prototype.getEntries=function(t,n){var r=this,i=Lr();return this.ea(t,n,function(o,s){var u=r.Xo(s);i=i.ot(o,u)}).next(function(){return i})},e.prototype.na=function(t,n){var r=this,i=Lr(),o=new ot(x.i);return this.ea(t,n,function(s,u){var a=r.Xo(u);a?(i=i.ot(s,a),o=o.ot(s,jr(u))):(i=i.ot(s,null),o=o.ot(s,0))}).next(function(){return{sa:i,ia:o}})},e.prototype.ea=function(t,n,r){if(n.m())return w.resolve();var i=IDBKeyRange.bound(n.first().path.A(),n.last().path.A()),o=n._t(),s=o.It();return Jt(t).rs({range:i},function(u,a,c){for(var h=x.$(u);s&&x.i(s,h)<0;)r(s,null),s=o.It();s&&s.isEqual(h)&&(r(s,a),s=o.At()?o.It():null),s?c.Xn(s.path.A()):c.done()}).next(function(){for(;s;)r(s,null),s=o.At()?o.It():null})},e.prototype.Lr=function(t,n,r){var i=this,o=Sn(),s=n.path.length+1,u={};if(r.isEqual(R.min())){var a=n.path.A();u.range=IDBKeyRange.lowerBound(a)}else{var c=n.path.A(),h=Ko(r);u.range=IDBKeyRange.lowerBound([c,h],!0),u.index=z.collectionReadTimeIndex}return Jt(t).rs(u,function(f,l,d){if(f.length===s){var v=Eo(i.serializer,l);n.path.T(v.key.path)?v instanceof C&&Kn(n,v)&&(o=o.ot(v.key,v)):d.done()}}).next(function(){return o})},e.prototype.ra=function(t){return new Bl(this,!!t&&t.oa)},e.prototype.aa=function(t){return this.getMetadata(t).next(function(n){return n.byteSize})},e.prototype.getMetadata=function(t){return Ia(t).get(Pt.key).next(function(n){return S(!!n),n})},e.prototype.Jo=function(t,n){return Ia(t).put(Pt.key,n)},e.prototype.Xo=function(t){if(t){var n=Eo(this.serializer,t);return n instanceof $&&n.version.isEqual(R.min())?null:n}return null},e}(),Bl=function(e){function t(n,r){var i=this;return(i=e.call(this)||this).ca=n,i.oa=r,i.ua=new rn(function(o){return o.toString()},function(o,s){return o.isEqual(s)}),i}return p.__extends(t,e),t.prototype.yr=function(n){var r=this,i=[],o=0,s=new Y(function(u,a){return k(u.R(),a.R())});return this.wr.forEach(function(u,a){var c=r.ua.get(u);if(a){var h=Ea(r.ca.serializer,a,r.readTime);s=s.add(u.path.h());var f=jr(h);o+=f-c,i.push(r.ca.Er(n,u,h))}else if(o-=c,r.oa){var l=Ea(r.ca.serializer,new $(u,R.min()),r.readTime);i.push(r.ca.Er(n,u,l))}else i.push(r.ca.Ar(n,u))}),s.forEach(function(u){i.push(r.ca.Dr.Mo(n,u))}),i.push(this.ca.updateMetadata(n,o)),w.$n(i)},t.prototype.gr=function(n,r){var i=this;return this.ca.Zo(n,r).next(function(o){return o===null?(i.ua.set(r,0),null):(i.ua.set(r,o.size),o.ta)})},t.prototype.Pr=function(n,r){var i=this;return this.ca.na(n,r).next(function(o){var s=o.sa;
16return o.ia.forEach(function(u,a){i.ua.set(u,a)}),s})},t}(Ac);function Ia(e){return Et.Qn(e,Pt.store)}function Jt(e){return Et.Qn(e,z.store)}function _r(e){return e.path.A()}function jr(e){var t;if(e.document)t=e.document;else if(e.unknownDocument)t=e.unknownDocument;else{if(!e.noDocument)throw A();t=e.noDocument}return JSON.stringify(t).length}var zl=function(){function e(){this.ha=new Wo}return e.prototype.Mo=function(t,n){return this.ha.add(n),w.resolve()},e.prototype.Qr=function(t,n){return w.resolve(this.ha.getEntries(n))},e}(),Wo=function(){function e(){this.index={}}return e.prototype.add=function(t){var n=t._(),r=t.h(),i=this.index[n]||new Y(q.i),o=!i.has(r);return this.index[n]=i.add(r),o},e.prototype.has=function(t){var n=t._(),r=t.h(),i=this.index[n];return i&&i.has(r)},e.prototype.getEntries=function(t){return(this.index[t]||new Y(q.i)).A()},e}(),Kl=function(){function e(t){this.serializer=t}return e.prototype.createOrUpgrade=function(t,n,r,i){var o=this;S(r<i&&r>=0&&i<=10);var s=new Tc("createOrUpgrade",n);r<1&&i>=1&&(function(a){a.createObjectStore(dt.store)}(t),function(a){a.createObjectStore(te.store,{keyPath:te.keyPath}),a.createObjectStore(F.store,{keyPath:F.keyPath,autoIncrement:!0}).createIndex(F.userMutationsIndex,F.userMutationsKeyPath,{unique:!0}),a.createObjectStore(nt.store)}(t),Ta(t),function(a){a.createObjectStore(z.store)}(t));var u=w.resolve();return r<3&&i>=3&&(r!==0&&(function(a){a.deleteObjectStore(Z.store),a.deleteObjectStore(ct.store),a.deleteObjectStore(yt.store)}(t),Ta(t)),u=u.next(function(){return function(a){var c=a.store(yt.store),h=new yt(0,0,R.min().Z(),0);return c.put(yt.key,h)}(s)})),r<4&&i>=4&&(r!==0&&(u=u.next(function(){return function(a,c){return c.store(F.store).ts().next(function(h){a.deleteObjectStore(F.store),a.createObjectStore(F.store,{keyPath:F.keyPath,autoIncrement:!0}).createIndex(F.userMutationsIndex,F.userMutationsKeyPath,{unique:!0});var f=c.store(F.store),l=h.map(function(d){return f.put(d)});return w.$n(l)})}(t,s)})),u=u.next(function(){(function(a){a.createObjectStore(Bt.store,{keyPath:Bt.keyPath})})(t)})),r<5&&i>=5&&(u=u.next(function(){return o.removeAcknowledgedMutations(s)})),r<6&&i>=6&&(u=u.next(function(){return function(a){a.createObjectStore(Pt.store)}(t),o.addDocumentGlobal(s)})),r<7&&i>=7&&(u=u.next(function(){return o.ensureSequenceNumbers(s)})),r<8&&i>=8&&(u=u.next(function(){return o.createCollectionParentIndex(t,s)})),r<9&&i>=9&&(u=u.next(function(){(function(a){a.objectStoreNames.contains("remoteDocumentChanges")&&a.deleteObjectStore("remoteDocumentChanges")})(t),function(a){var c=a.objectStore(z.store);c.createIndex(z.readTimeIndex,z.readTimeIndexPath,{unique:!1}),c.createIndex(z.collectionReadTimeIndex,z.collectionReadTimeIndexPath,{unique:!1})}(n)})),r<10&&i>=10&&(u=u.next(function(){return o.rewriteCanonicalIds(s)})),u},e.prototype.addDocumentGlobal=function(t){var n=0;return t.store(z.store).rs(function(r,i){n+=jr(i)}).next(function(){var r=new Pt(n);return t.store(Pt.store).put(Pt.key,r)})},e.prototype.removeAcknowledgedMutations=function(t){var n=this,r=t.store(te.store),i=t.store(F.store);return r.ts().next(function(o){return w.forEach(o,function(s){var u=IDBKeyRange.bound([s.userId,-1],[s.userId,s.lastAcknowledgedBatchId]);return i.ts(F.userMutationsIndex,u).next(function(a){return w.forEach(a,function(c){S(c.userId===s.userId);var h=Me(n.serializer,c);return Oc(t,s.userId,h).next(function(){})})})})})},e.prototype.ensureSequenceNumbers=function(t){var n=t.store(Z.store),r=t.store(z.store);return t.store(yt.store).get(yt.key).next(function(i){var o=[];return r.rs(function(s,u){var a=new q(s),c=function(h){return[0,xt(h)]}(a);o.push(n.get(c).next(function(h){return h?w.resolve():function(f){return n.put(new Z(0,xt(f),i.highestListenSequenceNumber))}(a)}))}).next(function(){return w.$n(o)})})},e.prototype.createCollectionParentIndex=function(t,n){t.createObjectStore(le.store,{keyPath:le.keyPath});var r=n.store(le.store),i=new Wo,o=function(s){if(i.add(s)){var u=s._(),a=s.h();return r.put({collectionId:u,parent:xt(a)})}};
16return n.store(z.store).rs({ss:!0},function(s,u){var a=new q(s);return o(a.h())}).next(function(){return n.store(nt.store).rs({ss:!0},function(s,u){s[0];var a=s[1],c=(s[2],Gt(a));return o(c.h())})})},e.prototype.rewriteCanonicalIds=function(t){var n=this,r=t.store(ct.store);return r.rs(function(i,o){var s=An(o),u=Lc(n.serializer,s);return r.put(u)})},e}(),Wl=function(e,t){this.seconds=e,this.nanoseconds=t},dt=function(e,t,n){this.ownerId=e,this.allowTabSynchronization=t,this.leaseTimestampMs=n};dt.store="owner",dt.key="owner";var te=function(e,t,n){this.userId=e,this.lastAcknowledgedBatchId=t,this.lastStreamToken=n};te.store="mutationQueues",te.keyPath="userId";var F=function(e,t,n,r,i){this.userId=e,this.batchId=t,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i};F.store="mutations",F.keyPath="batchId",F.userMutationsIndex="userMutationsIndex",F.userMutationsKeyPath=["userId","batchId"];var nt=function(){function e(){}return e.prefixForUser=function(t){return[t]},e.prefixForPath=function(t,n){return[t,xt(n)]},e.key=function(t,n,r){return[t,xt(n),r]},e}();nt.store="documentMutations",nt.PLACEHOLDER=new nt;var Hl=function(e,t){this.path=e,this.readTime=t},Ql=function(e,t){this.path=e,this.version=t},z=function(e,t,n,r,i,o){this.unknownDocument=e,this.noDocument=t,this.document=n,this.hasCommittedMutations=r,this.readTime=i,this.parentPath=o};z.store="remoteDocuments",z.readTimeIndex="readTimeIndex",z.readTimeIndexPath="readTime",z.collectionReadTimeIndex="collectionReadTimeIndex",z.collectionReadTimeIndexPath=["parentPath","readTime"];var Pt=function(e){this.byteSize=e};Pt.store="remoteDocumentGlobal",Pt.key="remoteDocumentGlobalKey";var ct=function(e,t,n,r,i,o,s){this.targetId=e,this.canonicalId=t,this.readTime=n,this.resumeToken=r,this.lastListenSequenceNumber=i,this.lastLimboFreeSnapshotVersion=o,this.query=s};ct.store="targets",ct.keyPath="targetId",ct.queryTargetsIndexName="queryTargetsIndex",ct.queryTargetsKeyPath=["canonicalId","targetId"];var Z=function(e,t,n){this.targetId=e,this.path=t,this.sequenceNumber=n};Z.store="targetDocuments",Z.keyPath=["targetId","path"],Z.documentTargetsIndex="documentTargetsIndex",Z.documentTargetsKeyPath=["path","targetId"];var yt=function(e,t,n,r){this.highestTargetId=e,this.highestListenSequenceNumber=t,this.lastRemoteSnapshotVersion=n,this.targetCount=r};yt.key="targetGlobalKey",yt.store="targetGlobal";var le=function(e,t){this.collectionId=e,this.parent=t};function Ta(e){e.createObjectStore(Z.store,{keyPath:Z.keyPath}).createIndex(Z.documentTargetsIndex,Z.documentTargetsKeyPath,{unique:!0}),e.createObjectStore(ct.store,{keyPath:ct.keyPath}).createIndex(ct.queryTargetsIndexName,ct.queryTargetsKeyPath,{unique:!0}),e.createObjectStore(yt.store)}le.store="collectionParents",le.keyPath=["collectionId","parent"];var Bt=function(e,t,n,r){this.clientId=e,this.updateTimeMs=t,this.networkEnabled=n,this.inForeground=r};Bt.store="clientMetadata",Bt.keyPath="clientId";var Xl=p.__spreadArrays(p.__spreadArrays(p.__spreadArrays([te.store,F.store,nt.store,z.store,ct.store,dt.store,yt.store,Z.store],[Bt.store]),[Pt.store]),[le.store]),Yl=function(){function e(){this.la=new Wo}return e.prototype.Mo=function(t,n){var r=this;if(!this.la.has(n)){var i=n._(),o=n.h();t.pr(function(){r.la.add(n)});var s={collectionId:i,parent:xt(o)};return Aa(t).put(s)}return w.resolve()},e.prototype.Qr=function(t,n){var r=[],i=IDBKeyRange.bound([n,""],[Ha(n),""],!1,!0);return Aa(t).ts(i).next(function(o){for(var s=0,u=o;s<u.length;s++){var a=u[s];if(a.collectionId!==n)break;r.push(Gt(a.parent))}return r})},e}();function Aa(e){return Et.Qn(e,le.store)}var qr=function(){function e(t){this._a=t}return e.prototype.next=function(){return this._a+=2,this._a},e.fa=function(){return new e(0)},e.da=function(){return new e(-1)},e}(),Jl=function(){function e(t,n){this.No=t,this.serializer=n}return e.prototype.wa=function(t){var n=this;return this.ma(t).next(function(r){var i=new qr(r.highestTargetId);return r.highestTargetId=i.next(),n.Ta(t,r).next(function(){return r.highestTargetId})})},e.prototype.Ea=function(t){return this.ma(t).next(function(n){return R.J(new ht(n.lastRemoteSnapshotVersion.seconds,n.lastRemoteSnapshotVersion.nanoseconds))})},e.prototype.Ia=function(t){return this.ma(t).next(function(n){return n.highe
16stListenSequenceNumber})},e.prototype.Aa=function(t,n,r){var i=this;return this.ma(t).next(function(o){return o.highestListenSequenceNumber=n,r&&(o.lastRemoteSnapshotVersion=r.Z()),n>o.highestListenSequenceNumber&&(o.highestListenSequenceNumber=n),i.Ta(t,o)})},e.prototype.Ra=function(t,n){var r=this;return this.ga(t,n).next(function(){return r.ma(t).next(function(i){return i.targetCount+=1,r.Pa(n,i),r.Ta(t,i)})})},e.prototype.ya=function(t,n){return this.ga(t,n)},e.prototype.Va=function(t,n){var r=this;return this.pa(t,n.targetId).next(function(){return Ue(t).delete(n.targetId)}).next(function(){return r.ma(t)}).next(function(i){return S(i.targetCount>0),i.targetCount-=1,r.Ta(t,i)})},e.prototype.po=function(t,n,r){var i=this,o=0,s=[];return Ue(t).rs(function(u,a){var c=An(a);c.sequenceNumber<=n&&r.get(c.targetId)===null&&(o++,s.push(i.Va(t,c)))}).next(function(){return w.$n(s)}).next(function(){return o})},e.prototype.Ce=function(t,n){return Ue(t).rs(function(r,i){var o=An(i);n(o)})},e.prototype.ma=function(t){return Na(t).get(yt.key).next(function(n){return S(n!==null),n})},e.prototype.Ta=function(t,n){return Na(t).put(yt.key,n)},e.prototype.ga=function(t,n){return Ue(t).put(Lc(this.serializer,n))},e.prototype.Pa=function(t,n){var r=!1;return t.targetId>n.highestTargetId&&(n.highestTargetId=t.targetId,r=!0),t.sequenceNumber>n.highestListenSequenceNumber&&(n.highestListenSequenceNumber=t.sequenceNumber,r=!0),r},e.prototype.ba=function(t){return this.ma(t).next(function(n){return n.targetCount})},e.prototype.va=function(t,n){var r=Mn(n),i=IDBKeyRange.bound([r,Number.NEGATIVE_INFINITY],[r,Number.POSITIVE_INFINITY]),o=null;return Ue(t).rs({range:i,index:ct.queryTargetsIndexName},function(s,u,a){var c=An(u);Qr(n,c.target)&&(o=c,a.done())}).next(function(){return o})},e.prototype.Sa=function(t,n,r){var i=this,o=[],s=Zt(t);return n.forEach(function(u){var a=xt(u.path);o.push(s.put(new Z(r,a))),o.push(i.No.Da(t,r,u))}),w.$n(o)},e.prototype.Ca=function(t,n,r){var i=this,o=Zt(t);return w.forEach(n,function(s){var u=xt(s.path);return w.$n([o.delete([r,u]),i.No.Na(t,r,s)])})},e.prototype.pa=function(t,n){var r=Zt(t),i=IDBKeyRange.bound([n],[n+1],!1,!0);return r.delete(i)},e.prototype.Fa=function(t,n){var r=IDBKeyRange.bound([n],[n+1],!1,!0),i=Zt(t),o=V();return i.rs({range:r,ss:!0},function(s,u,a){var c=Gt(s[1]),h=new x(c);o=o.add(h)}).next(function(){return o})},e.prototype.Ho=function(t,n){var r=xt(n.path),i=IDBKeyRange.bound([r],[Ha(r)],!1,!0),o=0;return Zt(t).rs({index:Z.documentTargetsIndex,ss:!0,range:i},function(s,u,a){var c=s[0];s[1],c!==0&&(o++,a.done())}).next(function(){return o>0})},e.prototype.Ue=function(t,n){return Ue(t).get(n).next(function(r){return r?An(r):null})},e}();function Ue(e){return Et.Qn(e,ct.store)}function Na(e){return Et.Qn(e,yt.store)}function Zt(e){return Et.Qn(e,Z.store)}var uo="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.",ao=function(e){function t(n,r){var i=this;return(i=e.call(this)||this).jo=n,i.xa=r,i}return p.__extends(t,e),t}(Sc),Et=function(){function e(t,n,r,i,o,s,u,a,c,h){if(this.allowTabSynchronization=t,this.persistenceKey=n,this.clientId=r,this.fn=o,this.window=s,this.document=u,this.$a=c,this.ka=h,this.Ma=null,this.Oa=!1,this.isPrimary=!1,this.networkEnabled=!0,this.La=null,this.inForeground=!1,this.Ba=null,this.qa=null,this.Ua=Number.NEGATIVE_INFINITY,this.Qa=function(f){return Promise.resolve()},!e.Ln())throw new m(y.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.No=new $l(this,i),this.Wa=n+"main",this.serializer=new jl(a),this.ja=new Ke(this.Wa,10,new Kl(this.serializer)),this.Ka=new Jl(this.No,this.serializer),this.Dr=new Yl,this.vr=function(f,l){return new Gl(f,l)}(this.serializer,this.Dr),this.window&&this.window.localStorage?this.Ga=this.window.localStorage:(this.Ga=null,h===!1&&B("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}return e.Qn=function(t,n){if(t instanceof ao)return Ke.Qn(t.jo,n);throw A()},e.prototype.start=function(){var t=this;return this.za().then(function(){if(!t.isPrimary&&!t.allowTabSynchronization)throw new m
16(y.FAILED_PRECONDITION,uo);return t.Ha(),t.Ya(),t.Ja(),t.runTransaction("getHighestListenSequenceNumber","readonly",function(n){return t.Ka.Ia(n)})}).then(function(n){t.Ma=new mt(n,t.$a)}).then(function(){t.Oa=!0}).catch(function(n){return t.ja&&t.ja.close(),Promise.reject(n)})},e.prototype.Xa=function(t){var n=this;return this.Qa=function(r){return p.__awaiter(n,void 0,void 0,function(){return p.__generator(this,function(i){return this.Ei?[2,t(r)]:[2]})})},t(this.isPrimary)},e.prototype.Za=function(t){var n=this;this.ja.Kn(function(r){return p.__awaiter(n,void 0,void 0,function(){return p.__generator(this,function(i){switch(i.label){case 0:return r.newVersion===null?[4,t()]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})})},e.prototype.tc=function(t){var n=this;this.networkEnabled!==t&&(this.networkEnabled=t,this.fn.ws(function(){return p.__awaiter(n,void 0,void 0,function(){return p.__generator(this,function(r){switch(r.label){case 0:return this.Ei?[4,this.za()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})}))},e.prototype.za=function(){var t=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",function(n){return br(n).put(new Bt(t.clientId,Date.now(),t.networkEnabled,t.inForeground)).next(function(){if(t.isPrimary)return t.ec(n).next(function(r){r||(t.isPrimary=!1,t.fn.Cs(function(){return t.Qa(!1)}))})}).next(function(){return t.nc(n)}).next(function(r){return t.isPrimary&&!r?t.sc(n).next(function(){return!1}):!!r&&t.ic(n).next(function(){return!0})})}).catch(function(n){if(Ie(n))return _("IndexedDbPersistence","Failed to extend owner lease: ",n),t.isPrimary;if(!t.allowTabSynchronization)throw n;return _("IndexedDbPersistence","Releasing owner lease after error during lease refresh",n),!1}).then(function(n){t.isPrimary!==n&&t.fn.Cs(function(){return t.Qa(n)}),t.isPrimary=n})},e.prototype.ec=function(t){var n=this;return Tn(t).get(dt.key).next(function(r){return w.resolve(n.rc(r))})},e.prototype.oc=function(t){return br(t).delete(this.clientId)},e.prototype.ac=function(){return p.__awaiter(this,void 0,void 0,function(){var t,n,r,i,o=this;return p.__generator(this,function(s){switch(s.label){case 0:return!this.isPrimary||this.cc(this.Ua,18e5)?[3,2]:(this.Ua=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",function(u){var a=e.Qn(u,Bt.store);return a.ts().next(function(c){var h=o.uc(c,18e5),f=c.filter(function(l){return h.indexOf(l)===-1});return w.forEach(f,function(l){return a.delete(l.clientId)}).next(function(){return f})})}).catch(function(){return[]})]);case 1:if(t=s.sent(),this.Ga)for(n=0,r=t;n<r.length;n++)i=r[n],this.Ga.removeItem(this.hc(i.clientId));s.label=2;case 2:return[2]}})})},e.prototype.Ja=function(){var t=this;this.qa=this.fn.yn("client_metadata_refresh",4e3,function(){return t.za().then(function(){return t.ac()}).then(function(){return t.Ja()})})},e.prototype.rc=function(t){return!!t&&t.ownerId===this.clientId},e.prototype.nc=function(t){var n=this;return this.ka?w.resolve(!0):Tn(t).get(dt.key).next(function(r){if(r!==null&&n.cc(r.leaseTimestampMs,5e3)&&!n.lc(r.ownerId)){if(n.rc(r)&&n.networkEnabled)return!0;if(!n.rc(r)){if(!r.allowTabSynchronization)throw new m(y.FAILED_PRECONDITION,uo);return!1}}return!(!n.networkEnabled||!n.inForeground)||br(t).ts().next(function(i){return n.uc(i,5e3).find(function(o){if(n.clientId!==o.clientId){var s=!n.networkEnabled&&o.networkEnabled,u=!n.inForeground&&o.inForeground,a=n.networkEnabled===o.networkEnabled;if(s||u&&a)return!0}return!1})===void 0})}).next(function(r){return n.isPrimary!==r&&_("IndexedDbPersistence","Client "+(r?"is":"is not")+" eligible for a primary lease."),r})},e.prototype.Di=function(){return p.__awaiter(this,void 0,void 0,function(){var t=this;return p.__generator(this,function(n){switch(n.label){case 0:return this.Oa=!1,this._c(),this.qa&&(this.qa.cancel(),this.qa=null),this.fc(),this.dc(),[4,this.ja.runTransaction("shutdown","readwrite",[dt.store,Bt.store],function(r){var i=new ao(r,mt.ai);return t.sc(i).next(function(){return t.oc(i)})})];case 1:return n.sent(),this.ja.close(),this.wc(),[2]}})})},e.prototype.uc=function(t,n){var r=this;return t.filter(function(i){return r.cc(i.updateTimeMs,n)&&!r.lc(i.clientId)})},e.prototype.pi=function(){var t=this;return this.runTransaction("getActiveClients","readonly",function(n){return br(n).ts().next(function(r){return t.uc(r,18e5).map(function(i){return i.clientId})})})},Object.defineProperty(e.prototype,"Ei",{get:function(){return this.Oa}
16,enumerable:!1,configurable:!0}),e.prototype.mc=function(t){return ql.xo(t,this.serializer,this.Dr,this.No)},e.prototype.Tc=function(){return this.Ka},e.prototype.Ec=function(){return this.vr},e.prototype.Ic=function(){return this.Dr},e.prototype.runTransaction=function(t,n,r){var i=this;_("IndexedDbPersistence","Starting transaction:",t);var o,s=n==="readonly"?"readonly":"readwrite";return this.ja.runTransaction(t,s,Xl,function(u){return o=new ao(u,i.Ma?i.Ma.next():mt.ai),n==="readwrite-primary"?i.ec(o).next(function(a){return!!a||i.nc(o)}).next(function(a){if(!a)throw B("Failed to obtain primary lease for action '"+t+"'."),i.isPrimary=!1,i.fn.Cs(function(){return i.Qa(!1)}),new m(y.FAILED_PRECONDITION,Nc);return r(o)}).next(function(a){return i.ic(o).next(function(){return a})}):i.Ac(o).next(function(){return r(o)})}).then(function(u){return o.br(),u})},e.prototype.Ac=function(t){var n=this;return Tn(t).get(dt.key).next(function(r){if(r!==null&&n.cc(r.leaseTimestampMs,5e3)&&!n.lc(r.ownerId)&&!n.rc(r)&&!(n.ka||n.allowTabSynchronization&&r.allowTabSynchronization))throw new m(y.FAILED_PRECONDITION,uo)})},e.prototype.ic=function(t){var n=new dt(this.clientId,this.allowTabSynchronization,Date.now());return Tn(t).put(dt.key,n)},e.Ln=function(){return Ke.Ln()},e.prototype.sc=function(t){var n=this,r=Tn(t);return r.get(dt.key).next(function(i){return n.rc(i)?(_("IndexedDbPersistence","Releasing primary lease."),r.delete(dt.key)):w.resolve()})},e.prototype.cc=function(t,n){var r=Date.now();return!(t<r-n||t>r&&(B("Detected an update time that is in the future: "+t+" > "+r),1))},e.prototype.Ha=function(){var t=this;this.document!==null&&typeof this.document.addEventListener=="function"&&(this.Ba=function(){t.fn.ws(function(){return t.inForeground=t.document.visibilityState==="visible",t.za()})},this.document.addEventListener("visibilitychange",this.Ba),this.inForeground=this.document.visibilityState==="visible")},e.prototype.fc=function(){this.Ba&&(this.document.removeEventListener("visibilitychange",this.Ba),this.Ba=null)},e.prototype.Ya=function(){var t,n=this;typeof((t=this.window)===null||t===void 0?void 0:t.addEventListener)=="function"&&(this.La=function(){n._c(),n.fn.ws(function(){return n.Di()})},this.window.addEventListener("unload",this.La))},e.prototype.dc=function(){this.La&&(this.window.removeEventListener("unload",this.La),this.La=null)},e.prototype.lc=function(t){var n;try{var r=((n=this.Ga)===null||n===void 0?void 0:n.getItem(this.hc(t)))!==null;return _("IndexedDbPersistence","Client '"+t+"' "+(r?"is":"is not")+" zombied in LocalStorage"),r}catch(i){return B("IndexedDbPersistence","Failed to get zombied client id.",i),!1}},e.prototype._c=function(){if(this.Ga)try{this.Ga.setItem(this.hc(this.clientId),String(Date.now()))}catch(t){B("Failed to set zombie client id.",t)}},e.prototype.wc=function(){if(this.Ga)try{this.Ga.removeItem(this.hc(this.clientId))}catch{}},e.prototype.hc=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},e}();function Tn(e){return Et.Qn(e,dt.store)}function br(e){return Et.Qn(e,Bt.store)}var $l=function(){function e(t,n){this.db=t,this.wo=new Ml(this,n)}return e.prototype.Po=function(t){var n=this.Rc(t);return this.db.Tc().ba(t).next(function(r){return n.next(function(i){return r+i})})},e.prototype.Rc=function(t){var n=0;return this.Vo(t,function(r){n++}).next(function(){return n})},e.prototype.Ce=function(t,n){return this.db.Tc().Ce(t,n)},e.prototype.Vo=function(t,n){return this.gc(t,function(r,i){return n(i)})},e.prototype.Da=function(t,n,r){return Er(t,r)},e.prototype.Na=function(t,n,r){return Er(t,r)},e.prototype.po=function(t,n,r){return this.db.Tc().po(t,n,r)},e.prototype.Go=function(t,n){return Er(t,n)},e.prototype.Pc=function(t,n){return function(r,i){var o=!1;return Rc(r).os(function(s){return kc(r,s,i).next(function(u){return u&&(o=!0),w.resolve(!u)})}).next(function(){return o})}(t,n)},e.prototype.bo=function(t,n){var r=this,i=this.db.Ec().ra(),o=[],s=0;return this.gc(t,function(u,a){if(a<=n){var c=r.Pc(t,u).next(function(h){if(!h)return s++,i.Rr(t,u).next(function(){return i.Ar(u),Zt(t).delete([0,xt(u.path)])})});o.push(c)}}).next(function(){return w.$n(o)}).next(function(){return i.apply(t)}).next(function(){return s})},e.prototype.removeTarget=function(t,n){var r=n.st(t.xa);return this.db.Tc().ya(t,r)},e.prototype.yc=function(t,n){return Er(t,n)},e.prototype.gc=function(t,n){var r,i=Zt(t),o=mt.ai;return i.rs({index:Z.documentTargetsIndex},function(s,u){var a=s[0],c=(s[1],u.path),h=u.sequenceNumber;a===0?(o!==mt.ai&&n(new x(Gt(r)),o),o=h,r=c):o=mt.ai}).next(function(){o!==mt.ai&&n(new x(Gt(r)),o)})},e.prototype.So=function(t){return this.db.Ec().aa(t)},e}();function Er(e,t){return Zt(e).put(function(n,r){return new Z(0,xt(n.path),r)}(t,e.xa))}function co(e,t){var n=e.projectId;return e.j||(n+="."+e.database),"firestore/"+t+"/"+n+"/"}var Zl=function(){function e(t,n,r){this.persistence=t,this.Vc=n,this.bc=new ot(k),this.vc=new rn(function(i){return Mn(i)},Qr),this.Sc=R.min(),this.Sr=t.mc(r),this.Dc=t.Ec(),this.Ka=t.Tc(),this.Cc=new xc(this.Dc,this.Sr,this.persistence.Ic()),this.Vc.Nc(this.Cc)}return e.prototype.Io=function(t){var n=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(r){return t.vo(r,n.bc)})},e}();function tp(e,t){var n=I(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",function(r){var i=t.batch.keys(),o=n.Dc.ra({oa:!0});return function(s,u,a,c){var h=a.batch,f=h.keys(),l=w.resolve();return f.forEach(function(d){l=l.next(function(){return c.Rr(u,d)}).next(function(v){var g=v,E=a.dr.get(d);S(E!==null),(!g||g.version.L(E)<0)&&(g=h.cr(d,g,a))&&c.Er(g,a._r)})}),l.next(function(){return s.Sr.Wo(u,h)})}(n,r,t,o).next(function(){return o.apply(r)}).next(function(){return n.Sr.zo(r)}).next(function(){return n.Cc.kr(r,i)})})}function Pc(e){var t=I(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",function(n){return t.Ka.Ea(n)})}function ep(e,t){var n=I(e),r=t.nt,i=n.bc;return n.persistence.runTransaction("Apply remote event","readwrite-primary",function(o){var s=n.Dc.ra({oa:!0});i=n.bc;var u=[];t.zt.forEach(function(f,l){var d=i.get(l);if(d){u.push(n.Ka.Ca(o,f.se,l).next(function(){return n.Ka.Sa(o,f.ee,l)}));var v=f.resumeToken;if(v.O()>0){var g=d.it(v,r).st(o.xa);i=i.ot(l,g),function(E,b,N){return S(b.resumeToken.O()>0),E.resumeToken.O()===0||b.nt.X()-E.nt.X()>=3e8||N.ee.size+N.ne.size+N.se.size>0}(d,g,f)&&u.push(n.Ka.ya(o,g))}}});var a=de(),c=V();if(t.Yt.forEach(function(f,l){c=c.add(f)}),u.push(s.getEntries(o,c).next(function(f){t.Yt.forEach(function(l,d){var v=f.get(l);d instanceof $&&d.version.isEqual(R.min())?(s.Ar(l,r),a=a.ot(l,d)):v==null||d.version.L(v.version)>0||d.version.L(v.version)===0&&v.hasPendingWrites?(s.Er(d,r),a=a.ot(l,d)):_("LocalStore","Ignoring outdated watch update for ",l,". Current version:",v.version," Watch version:",d.version),t.Jt.has(l)&&u.push(n.persistence.No.yc(o,l))})})),!r.isEqual(R.min())){var h=n.Ka.Ea(o).next(function(f){return n.Ka.Aa(o,o.xa,r)});u.push(h)}return w.$n(u).next(function(){return s.apply(o)}).next(function(){return n.Cc.Mr(o,a)})}).then(function(o){return n.bc=i,o})}function np(e,t){var n=I(e);return n.persistence.runTransaction("Get next mutation batch","readonly",function(r){return t===void 0&&(t=-1),n.Sr.Bo(r,t)})}function Gr(e,t){var n=I(e);return n.persistence.runTransaction("Allocate target","readwrite",function(r){var i;return n.Ka.va(r,t).next(function(o){return o?(i=o,w.resolve(i)):n.Ka.wa(r).next(function(s){return i=new Xr(t,s,0,r.xa),n.Ka.Ra(r,i).next(function(){return i})})})}).then(function(r){var i=n.bc.get(r.targetId);return(i===null||r.nt.L(i.nt)>0)&&(n.bc=n.bc.ot(r.targetId,r),n.vc.set(t,r.targetId)),r})}function Ze(e,t,n){return p.__awaiter(this,void 0,void 0,function(){var r,i,o,s;return p.__generator(this,function(u){switch(u.label){case 0:r=I(e),i=r.bc.get(t),o=n?"readwrite":"readwrite-primary",u.label=1;case 1:return u.trys.push([1,4,,5]),n?[3,3]:[4,r.persistence.runTransaction("Release target",o,function(a){return r.persistence.No.removeTarget(a,i)})];case 2:u.sent(),u.label=3;case 3:return[3,5];case 4:if(!Ie(s=u.sent()))throw s;return _("LocalStore","Failed to update sequence numbers for target "+t+": "+s),[3,5];case 5:return r.bc=r.bc.remove(t),r.vc.delete(i.target),[2]}})})}function Br(e,t,n){var r=I(e),i=R.min(),o=V();
16return r.persistence.runTransaction("Execute query","readonly",function(s){return function(u,a,c){var h=I(u),f=h.vc.get(c);return f!==void 0?w.resolve(h.bc.get(f)):h.Ka.va(a,c)}(r,s,Vt(t)).next(function(u){if(u)return i=u.lastLimboFreeSnapshotVersion,r.Ka.Fa(s,u.targetId).next(function(a){o=a})}).next(function(){return r.Vc.Lr(s,t,n?i:R.min(),n?o:V())}).next(function(u){return{documents:u,Fc:o}})})}function Cc(e,t){var n=I(e),r=I(n.Ka),i=n.bc.get(t);return i?Promise.resolve(i.target):n.persistence.runTransaction("Get target data","readonly",function(o){return r.Ue(o,t).next(function(s){return s?s.target:null})})}function rp(e){var t=I(e);return t.persistence.runTransaction("Get new document changes","readonly",function(n){return function(r,i,o){var s=I(r),u=de(),a=Ko(o),c=Jt(i),h=IDBKeyRange.lowerBound(a,!0);return c.rs({index:z.readTimeIndex,range:h},function(f,l){var d=Eo(s.serializer,l);u=u.ot(d.key,d),a=l.readTime}).next(function(){return{xc:u,readTime:Dc(a)}})}(t.Dc,n,t.Sc)}).then(function(n){var r=n.xc,i=n.readTime;return t.Sc=i,r})}function ip(e){return p.__awaiter(this,void 0,void 0,function(){var t;return p.__generator(this,function(n){return[2,(t=I(e)).persistence.runTransaction("Synchronize last document change read time","readonly",function(r){return function(i){var o=Jt(i),s=R.min();return o.rs({index:z.readTimeIndex,reverse:!0},function(u,a,c){a.readTime&&(s=Dc(a.readTime)),c.done()}).next(function(){return s})}(r)}).then(function(r){t.Sc=r})]})})}function Te(e){return p.__awaiter(this,void 0,void 0,function(){return p.__generator(this,function(t){if(e.code!==y.FAILED_PRECONDITION||e.message!==Nc)throw e;return _("LocalStore","Unexpectedly lost primary lease"),[2]})})}var Ho=function(){function e(){this.$c=new Y(J.kc),this.Mc=new Y(J.Oc)}return e.prototype.m=function(){return this.$c.m()},e.prototype.Da=function(t,n){var r=new J(t,n);this.$c=this.$c.add(r),this.Mc=this.Mc.add(r)},e.prototype.Lc=function(t,n){var r=this;t.forEach(function(i){return r.Da(i,n)})},e.prototype.Na=function(t,n){this.Bc(new J(t,n))},e.prototype.qc=function(t,n){var r=this;t.forEach(function(i){return r.Na(i,n)})},e.prototype.Uc=function(t){var n=this,r=new x(new q([])),i=new J(r,t),o=new J(r,t+1),s=[];return this.Mc.Ft([i,o],function(u){n.Bc(u),s.push(u.key)}),s},e.prototype.Qc=function(){var t=this;this.$c.forEach(function(n){return t.Bc(n)})},e.prototype.Bc=function(t){this.$c=this.$c.delete(t),this.Mc=this.Mc.delete(t)},e.prototype.Wc=function(t){var n=new x(new q([])),r=new J(n,t),i=new J(n,t+1),o=V();return this.Mc.Ft([r,i],function(s){o=o.add(s.key)}),o},e.prototype.Ho=function(t){var n=new J(t,0),r=this.$c.$t(n);return r!==null&&t.isEqual(r.key)},e}(),J=function(){function e(t,n){this.key=t,this.jc=n}return e.kc=function(t,n){return x.i(t.key,n.key)||k(t.jc,n.jc)},e.Oc=function(t,n){return k(t.jc,n.jc)||x.i(t.key,n.key)},e}(),op=function(e,t){this.user=t,this.type="OAuth",this.Kc={},this.Kc.Authorization="Bearer "+e},Sa=function(){function e(){this.Gc=null}return e.prototype.getToken=function(){return Promise.resolve(null)},e.prototype.zc=function(){},e.prototype.Hc=function(t){this.Gc=t,t(_t.UNAUTHENTICATED)},e.prototype.Yc=function(){this.Gc=null},e}(),sp=function(){function e(t){var n=this;this.Jc=null,this.currentUser=_t.UNAUTHENTICATED,this.Xc=!1,this.Zc=0,this.Gc=null,this.forceRefresh=!1,this.Jc=function(){n.Zc++,n.currentUser=n.tu(),n.Xc=!0,n.Gc&&n.Gc(n.currentUser)},this.Zc=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.Jc):(this.Jc(null),t.get().then(function(r){n.auth=r,n.Jc&&n.auth.addAuthTokenListener(n.Jc)},function(){}))}return e.prototype.getToken=function(){var t=this,n=this.Zc,r=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(r).then(function(i){return t.Zc!==n?(_("FirebaseCredentialsProvider","getToken aborted due to token change."),t.getToken()):i?(S(typeof i.accessToken=="string"),new op(i.accessToken,t.currentUser)):null}):Promise.resolve(null)},e.prototype.zc=function(){this.forceRefresh=!0},e.prototype.Hc=function(t){this.Gc=t,this.Xc&&t(this.currentUser)},e.prototype.Yc=function(){this.auth&&this.auth.removeAuthTokenListener(this.Jc),this.Jc=null,this.Gc=null},e.prototype.tu=function(){var t=this.auth&&this.auth.getUid();return S(t===null||typeof t=="string"),new _t(t)},e}(),up=function(){function e(t,n){this.eu=t,this.nu=n,this.type="FirstParty",this.user=_t.ni}return Object.defineProperty(e.prototype,"Kc",{get:function(){var t={"X-Goog-AuthUser":this.nu},n=this.eu.auth.getAuthHeaderValueForFirstParty([]);return n&&(t.Authorization=n),t}
16,enumerable:!1,configurable:!0}),e}(),ap=function(){function e(t,n){this.eu=t,this.nu=n}return e.prototype.getToken=function(){return Promise.resolve(new up(this.eu,this.nu))},e.prototype.Hc=function(t){t(_t.ni)},e.prototype.Yc=function(){},e.prototype.zc=function(){},e}(),Uc=function(){function e(t,n,r,i,o,s){this.fn=t,this.su=r,this.iu=i,this.ru=o,this.listener=s,this.state=0,this.ou=0,this.au=null,this.stream=null,this.ys=new qo(t,n)}return e.prototype.cu=function(){return this.state===1||this.state===2||this.state===4},e.prototype.uu=function(){return this.state===2},e.prototype.start=function(){this.state!==3?this.auth():this.hu()},e.prototype.stop=function(){return p.__awaiter(this,void 0,void 0,function(){return p.__generator(this,function(t){switch(t.label){case 0:return this.cu()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},e.prototype.lu=function(){this.state=0,this.ys.reset()},e.prototype._u=function(){var t=this;this.uu()&&this.au===null&&(this.au=this.fn.yn(this.su,6e4,function(){return t.fu()}))},e.prototype.du=function(t){this.wu(),this.stream.send(t)},e.prototype.fu=function(){return p.__awaiter(this,void 0,void 0,function(){return p.__generator(this,function(t){return this.uu()?[2,this.close(0)]:[2]})})},e.prototype.wu=function(){this.au&&(this.au.cancel(),this.au=null)},e.prototype.close=function(t,n){return p.__awaiter(this,void 0,void 0,function(){return p.__generator(this,function(r){switch(r.label){case 0:return this.wu(),this.ys.cancel(),this.ou++,t!==3?this.ys.reset():n&&n.code===y.RESOURCE_EXHAUSTED?(B(n.toString()),B("Using maximum backoff delay to prevent overloading the backend."),this.ys.Rn()):n&&n.code===y.UNAUTHENTICATED&&this.ru.zc(),this.stream!==null&&(this.mu(),this.stream.close(),this.stream=null),this.state=t,[4,this.listener.Tu(n)];case 1:return r.sent(),[2]}})})},e.prototype.mu=function(){},e.prototype.auth=function(){var t=this;this.state=1;var n=this.Eu(this.ou),r=this.ou;this.ru.getToken().then(function(i){t.ou===r&&t.Iu(i)},function(i){n(function(){var o=new m(y.UNKNOWN,"Fetching auth token failed: "+i.message);return t.Au(o)})})},e.prototype.Iu=function(t){var n=this,r=this.Eu(this.ou);this.stream=this.Ru(t),this.stream.gu(function(){r(function(){return n.state=2,n.listener.gu()})}),this.stream.Tu(function(i){r(function(){return n.Au(i)})}),this.stream.onMessage(function(i){r(function(){return n.onMessage(i)})})},e.prototype.hu=function(){var t=this;this.state=4,this.ys.gn(function(){return p.__awaiter(t,void 0,void 0,function(){return p.__generator(this,function(n){return this.state=0,this.start(),[2]})})})},e.prototype.Au=function(t){return _("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},e.prototype.Eu=function(t){var n=this;return function(r){n.fn.ws(function(){return n.ou===t?r():(_("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},e}(),cp=function(e){function t(n,r,i,o,s){var u=this;return(u=e.call(this,n,"listen_stream_connection_backoff","listen_stream_idle",r,i,s)||this).serializer=o,u}return p.__extends(t,e),t.prototype.Ru=function(n){return this.iu.Pu("Listen",n)},t.prototype.onMessage=function(n){this.ys.reset();var r=function(o,s){var u;if("targetChange"in s){s.targetChange;var a=function(It){return It==="NO_CHANGE"?0:It==="ADD"?1:It==="REMOVE"?2:It==="CURRENT"?3:It==="RESET"?4:A()}(s.targetChange.targetChangeType||"NO_CHANGE"),c=s.targetChange.targetIds||[],h=function(It,Kt){return It.Qe?(S(Kt===void 0||typeof Kt=="string"),it.fromBase64String(Kt||"")):(S(Kt===void 0||Kt instanceof Uint8Array),it.fromUint8Array(Kt||new Uint8Array))}(o,s.targetChange.resumeToken),f=s.targetChange.cause,l=f&&function(It){var Kt=It.code===void 0?y.UNKNOWN:Ya(It.code);return new m(Kt,It.message||"")}(f);u=new Za(a,c,h,l||null)}else if("documentChange"in s){s.documentChange;var d=s.documentChange;d.document,d.document.name,d.document.updateTime;var v=Rt(o,d.document.name),g=Nt(d.document.updateTime),E=new ie({mapValue:{fields:d.document.fields}}),b=new C(v,g,E,{}),N=d.targetIds||[],D=d.removedTargetIds||[];u=new Tr(N,D,b.key,b)}
16else if("documentDelete"in s){s.documentDelete;var O=s.documentDelete;O.document;var U=Rt(o,O.document),M=O.readTime?Nt(O.readTime):R.min(),Lt=new $(U,M),Mt=O.removedTargetIds||[];u=new Tr([],Mt,Lt.key,Lt)}else if("documentRemove"in s){s.documentRemove;var xe=s.documentRemove;xe.document;var Hn=Rt(o,xe.document),an=xe.removedTargetIds||[];u=new Tr([],an,Hn,null)}else{if(!("filter"in s))return A();s.filter;var De=s.filter;De.targetId;var ni=De.count||0,ri=new Hf(ni),hh=De.targetId;u=new $a(hh,ri)}return u}(this.serializer,n),i=function(o){if(!("targetChange"in o))return R.min();var s=o.targetChange;return s.targetIds&&s.targetIds.length?R.min():s.readTime?Nt(s.readTime):R.min()}(n);return this.listener.yu(r,i)},t.prototype.Vu=function(n){var r={};r.database=Ln(this.serializer),r.addTarget=function(o,s){var u,a=s.target;return(u=Dr(a)?{documents:ac(o,a)}:{query:cc(o,a)}).targetId=s.targetId,s.resumeToken.O()>0&&(u.resumeToken=ic(o,s.resumeToken)),u}(this.serializer,n);var i=function(o,s){var u=function(a,c){switch(c){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return A()}}(0,s.et);return u==null?null:{"goog-listen-tags":u}}(this.serializer,n);i&&(r.labels=i),this.du(r)},t.prototype.pu=function(n){var r={};r.database=Ln(this.serializer),r.removeTarget=n,this.du(r)},t}(Uc),hp=function(e){function t(n,r,i,o,s){var u=this;return(u=e.call(this,n,"write_stream_connection_backoff","write_stream_idle",r,i,s)||this).serializer=o,u.bu=!1,u}return p.__extends(t,e),Object.defineProperty(t.prototype,"vu",{get:function(){return this.bu},enumerable:!1,configurable:!0}),t.prototype.start=function(){this.bu=!1,this.lastStreamToken=void 0,e.prototype.start.call(this)},t.prototype.mu=function(){this.bu&&this.Su([])},t.prototype.Ru=function(n){return this.iu.Pu("Write",n)},t.prototype.onMessage=function(n){if(S(!!n.streamToken),this.lastStreamToken=n.streamToken,this.bu){this.ys.reset();var r=function(o,s){return o&&o.length>0?(S(s!==void 0),o.map(function(u){return function(a,c){var h=a.updateTime?Nt(a.updateTime):Nt(c);h.isEqual(R.min())&&(h=Nt(c));var f=null;return a.transformResults&&a.transformResults.length>0&&(f=a.transformResults),new pl(h,f)}(u,s)})):[]}(n.writeResults,n.commitTime),i=Nt(n.commitTime);return this.listener.Du(i,r)}return S(!n.writeResults||n.writeResults.length===0),this.bu=!0,this.listener.Cu()},t.prototype.Nu=function(){var n={};n.database=Ln(this.serializer),this.du(n)},t.prototype.Su=function(n){var r=this,i={streamToken:this.lastStreamToken,writes:n.map(function(o){return Pr(r.serializer,o)})};this.du(i)},t}(Uc),fp=function(e){function t(n,r,i){var o=this;return(o=e.call(this)||this).credentials=n,o.iu=r,o.serializer=i,o.Fu=!1,o}return p.__extends(t,e),t.prototype.xu=function(){if(this.Fu)throw new m(y.FAILED_PRECONDITION,"The client has already been terminated.")},t.prototype.$u=function(n,r,i){var o=this;return this.xu(),this.credentials.getToken().then(function(s){return o.iu.$u(n,r,i,s)}).catch(function(s){throw s.code===y.UNAUTHENTICATED&&o.credentials.zc(),s})},t.prototype.ku=function(n,r,i){var o=this;return this.xu(),this.credentials.getToken().then(function(s){return o.iu.ku(n,r,i,s)}).catch(function(s){throw s.code===y.UNAUTHENTICATED&&o.credentials.zc(),s})},t.prototype.terminate=function(){this.Fu=!1},t}(function(){}),lp=function(){function e(t,n){this.cs=t,this.di=n,this.state="Unknown",this.Mu=0,this.Ou=null,this.Lu=!0}return e.prototype.Bu=function(){var t=this;this.Mu===0&&(this.qu("Unknown"),this.Ou=this.cs.yn("online_state_timeout",1e4,function(){return t.Ou=null,t.Uu("Backend didn't respond within 10 seconds."),t.qu("Offline"),Promise.resolve()}))},e.prototype.Qu=function(t){this.state==="Online"?this.qu("Unknown"):(this.Mu++,this.Mu>=1&&(this.Wu(),this.Uu("Connection failed 1 times. Most recent error: "+t.toString()),this.qu("Offline")))},e.prototype.set=function(t){this.Wu(),this.Mu=0,t==="Online"&&(this.Lu=!1),this.qu(t)}
16,e.prototype.qu=function(t){t!==this.state&&(this.state=t,this.di(t))},e.prototype.Uu=function(t){var n="Could not reach Cloud Firestore backend. "+t+` 17This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.Lu?(B(n),this.Lu=!1):_("OnlineStateTracker",n)},e.prototype.Wu=function(){this.Ou!==null&&(this.Ou.cancel(),this.Ou=null)},e}(),pp=function(e,t,n,r,i){var o=this;this.ju=e,this.Ku=t,this.cs=n,this.Gu={},this.zu=[],this.Hu=new Map,this.Yu=new Set,this.Ju=[],this.Xu=i,this.Xu.Zu(function(s){n.ws(function(){return p.__awaiter(o,void 0,void 0,function(){return p.__generator(this,function(u){switch(u.label){case 0:return oe(this)?(_("RemoteStore","Restarting streams for network reachability change."),[4,function(a){return p.__awaiter(this,void 0,void 0,function(){var c;return p.__generator(this,function(h){switch(h.label){case 0:return(c=I(a)).Yu.add(4),[4,tn(c)];case 1:return h.sent(),c.th.set("Unknown"),c.Yu.delete(4),[4,On(c)];case 2:return h.sent(),[2]}})})}(this)]):[3,2];case 1:u.sent(),u.label=2;case 2:return[2]}})})})}),this.th=new lp(n,r)};function On(e){return p.__awaiter(this,void 0,void 0,function(){var t,n;return p.__generator(this,function(r){switch(r.label){case 0:if(!oe(e))return[3,4];t=0,n=e.Ju,r.label=1;case 1:return t<n.length?[4,(0,n[t])(!0)]:[3,4];case 2:r.sent(),r.label=3;case 3:return t++,[3,1];case 4:return[2]}})})}function tn(e){return p.__awaiter(this,void 0,void 0,function(){var t,n;return p.__generator(this,function(r){switch(r.label){case 0:t=0,n=e.Ju,r.label=1;case 1:return t<n.length?[4,(0,n[t])(!1)]:[3,4];case 2:r.sent(),r.label=3;case 3:return t++,[3,1];case 4:return[2]}})})}function Vc(e){return p.__awaiter(this,void 0,void 0,function(){var t;return p.__generator(this,function(n){switch(n.label){case 0:return t=I(e),_("RemoteStore","RemoteStore shutting down."),t.Yu.add(5),[4,tn(t)];case 1:return n.sent(),t.Xu.Di(),t.th.set("Unknown"),[2]}})})}function $r(e,t){var n=I(e);n.Hu.has(t.targetId)||(n.Hu.set(t.targetId,t),Yo(n)?Xo(n):un(n).uu()&&Qo(n,t))}function Rn(e,t){var n=I(e),r=un(n);n.Hu.delete(t),r.uu()&&Mc(n,t),n.Hu.size===0&&(r.uu()?r._u():oe(n)&&n.th.set("Unknown"))}function Qo(e,t){e.eh.Ie(t.targetId),un(e).Vu(t)}function Mc(e,t){e.eh.Ie(t),un(e).pu(t)}function Xo(e){e.eh=new Zf({qe:function(t){return e.Gu.qe(t)},Ue:function(t){return e.Hu.get(t)||null}}),un(e).start(),e.th.Bu()}function Yo(e){return oe(e)&&!un(e).cu()&&e.Hu.size>0}function oe(e){return I(e).Yu.size===0}function Fc(e){e.eh=void 0}function dp(e){return p.__awaiter(this,void 0,void 0,function(){return p.__generator(this,function(t){return e.Hu.forEach(function(n,r){Qo(e,n)}),[2]})})}function vp(e,t){return p.__awaiter(this,void 0,void 0,function(){return p.__generator(this,function(n){return Fc(e),Yo(e)?(e.th.Qu(t),Xo(e)):e.th.set("Unknown"),[2]})})}function yp(e,t,n){return p.__awaiter(this,void 0,void 0,function(){var r,i,o;return p.__generator(this,function(s){switch(s.label){case 0:if(e.th.set("Online"),!(t instanceof Za&&t.state===2&&t.cause))return[3,6];s.label=1;case 1:return s.trys.push([1,3,,5]),[4,function(u,a){return p.__awaiter(this,void 0,void 0,function(){var c,h,f,l;return p.__generator(this,function(d){switch(d.label){case 0:c=a.cause,h=0,f=a.targetIds,d.label=1;case 1:return h<f.length?(l=f[h],u.Hu.has(l)?[4,u.Gu.nh(l,c)]:[3,3]):[3,5];case 2:d.sent(),u.Hu.delete(l),u.eh.removeTarget(l),d.label=3;case 3:d.label=4;case 4:return h++,[3,1];case 5:return[2]}})})}(e,t)];case 2:return s.sent(),[3,5];case 3:return r=s.sent(),_("RemoteStore","Failed to remove targets %s: %s ",t.targetIds.join(","),r),[4,zr(e,r)];case 4:return s.sent(),[3,5];case 5:return[3,13];case 6:if(t instanceof Tr?e.eh.be(t):t instanceof $a?e.eh.$e(t):e.eh.De(t),n.isEqual(R.min()))return[3,13];s.label=7;case 7:return s.trys.push([7,11,,13]),[4,Pc(e.ju)];case 8:return i=s.sent(),n.L(i)>=0?[4,function(u,a){var c=u.eh.Oe(a);return c.zt.forEach(function(h,f){if(h.resumeToken.O()>0){var l=u.Hu.get(f);l&&u.Hu.set(f,l.it(h.resumeToken,a))}}),c.Ht.forEach(function(h){var f=u.Hu.get(h);if(f){u.Hu.set(h,f.it(it.B,f.nt)),Mc(u,h);var l=new Xr(f.target,h,1,f.sequenceNumber);Qo(u,l)}}),u.Gu.sh(c)}(e,n)]:[3,10];case 9:s.sent(),s.label=10;case 10:return[3,13];case 11:return _("RemoteStore","Failed to raise snapshot:",o=s.sent()),[4,zr(e,o)];case 12:return s.sent(),[3,13];case 13:return[2]}})})}function zr(e,t,n){return p.__awaiter(this,void 0,void 0,function(){var r=this;return p.__generator(this,function(i){switch(i.label){case 0:if(!Ie(t))throw t;return e.Yu.add(1),[4,tn(e)];case 1:return i.sent(),e.th.set("Offline"),n||(n=function(){return Pc(e.ju)}),e.cs.Cs(function(){return p.__awaiter(r,void 0,void 0,function(){return p.__generator(this,function(o){switch(o.label){case 0:return _("RemoteStore","Retrying IndexedDB access"),[4,n()];case 1:return o.sent(),e.Yu.delete(1),[4,On(e)];case 2:return o.sent(),[2]}})})}),[2]}})})}function jc(e,t){return t().catch(function(n){return zr(e,n,t)})}function sn(e){return p.__awaiter(this,void 0,void 0,function(){var t,n,r,i,o;return p.__generator(this,function(s){switch(s.label){case 0:t=I(e),n=se(t),r=t.zu.length>0?t.zu[t.zu.length-1].batchId:-1,s.label=1;case 1:if(!function(u){return oe(u)&&u.zu.length<10}(t))return[3,7];s.label=2;case 2:return s.trys.push([2,4,,6]),[4,np(t.ju,r)];case 3:return(i=s.sent())===null?(t.zu.length===0&&n._u(),[3,7]):(r=i.batchId,function(u,a){u.zu.push(a);var c=se(u);c.uu()&&c.vu&&c.Su(a.mutations)}(t,i),[3,6]);case 4:return o=s.sent(),[4,zr(t,o)];case 5:return s.sent(),[3,6];case 6:return[3,1];case 7:return qc(t)&&Gc(t),[2]}})})}function qc(e){return oe(e)&&!se(e).cu()&&e.zu.length>0}function Gc(e){se(e).start()}function gp(e){return p.__awaiter(this,void 0,void 0,function(){return p.__generator(this,function(t){return se(e).Nu(),[2]})})}function mp(e){return p.__awaiter(this,void 0,void 0,function(){var t,n,r,i;return p.__generator(this,function(o){for(t=se(e),n=0,r=e.zu;n<r.length;n++)i=r[n],t.Su(i.mutations);return[2]})})}
17function wp(e,t,n){return p.__awaiter(this,void 0,void 0,function(){var r,i;return p.__generator(this,function(o){switch(o.label){case 0:return r=e.zu.shift(),i=Pl.from(r,t,n),[4,jc(e,function(){return e.Gu.ih(i)})];case 1:return o.sent(),[4,sn(e)];case 2:return o.sent(),[2]}})})}function _p(e,t){return p.__awaiter(this,void 0,void 0,function(){return p.__generator(this,function(n){switch(n.label){case 0:return t&&se(e).vu?[4,function(r,i){return p.__awaiter(this,void 0,void 0,function(){var o,s;return p.__generator(this,function(u){switch(u.label){case 0:return Xa(s=i.code)&&s!==y.ABORTED?(o=r.zu.shift(),se(r).lu(),[4,jc(r,function(){return r.Gu.rh(o.batchId,i)})]):[3,3];case 1:return u.sent(),[4,sn(r)];case 2:u.sent(),u.label=3;case 3:return[2]}})})}(e,t)]:[3,2];case 1:n.sent(),n.label=2;case 2:return qc(e)&&Gc(e),[2]}})})}function Io(e,t){return p.__awaiter(this,void 0,void 0,function(){var n,r;return p.__generator(this,function(i){switch(i.label){case 0:return n=I(e),t?(n.Yu.delete(2),[4,On(n)]):[3,2];case 1:return i.sent(),[3,5];case 2:return(r=t)?[3,4]:(n.Yu.add(2),[4,tn(n)]);case 3:i.sent(),r=n.th.set("Unknown"),i.label=4;case 4:i.label=5;case 5:return[2]}})})}function un(e){var t=this;return e.oh||(e.oh=function(n,r,i){var o=I(n);return o.xu(),new cp(r,o.iu,o.credentials,o.serializer,i)}(e.Ku,e.cs,{gu:dp.bind(null,e),Tu:vp.bind(null,e),yu:yp.bind(null,e)}),e.Ju.push(function(n){return p.__awaiter(t,void 0,void 0,function(){return p.__generator(this,function(r){switch(r.label){case 0:return n?(e.oh.lu(),Yo(e)?Xo(e):e.th.set("Unknown"),[3,3]):[3,1];case 1:return[4,e.oh.stop()];case 2:r.sent(),Fc(e),r.label=3;case 3:return[2]}})})})),e.oh}function se(e){var t=this;return e.ah||(e.ah=function(n,r,i){var o=I(n);return o.xu(),new hp(r,o.iu,o.credentials,o.serializer,i)}(e.Ku,e.cs,{gu:gp.bind(null,e),Tu:_p.bind(null,e),Cu:mp.bind(null,e),Du:wp.bind(null,e)}),e.Ju.push(function(n){return p.__awaiter(t,void 0,void 0,function(){return p.__generator(this,function(r){switch(r.label){case 0:return n?(e.ah.lu(),[4,sn(e)]):[3,2];case 1:return r.sent(),[3,4];case 2:return[4,e.ah.stop()];case 3:r.sent(),e.zu.length>0&&(_("RemoteStore","Stopping write stream with "+e.zu.length+" pending writes"),e.zu=[]),r.label=4;case 4:return[2]}})})})),e.ah}var Bc=function(e){this.key=e},zc=function(e){this.key=e},Kc=function(){function e(t,n){this.query=t,this.uh=n,this.hh=null,this.te=!1,this.lh=V(),this.Wt=V(),this._h=Ec(t),this.fh=new Ja(this._h)}return Object.defineProperty(e.prototype,"dh",{get:function(){return this.uh},enumerable:!1,configurable:!0}),e.prototype.wh=function(t,n){var r=this,i=n?n.mh:new Yu,o=n?n.fh:this.fh,s=n?n.Wt:this.Wt,u=o,a=!1,c=Ar(this.query)&&o.size===this.query.limit?o.last():null,h=Ur(this.query)&&o.size===this.query.limit?o.first():null;if(t.ht(function(l,d){var v=o.get(l),g=d instanceof C?d:null;g&&(g=Kn(r.query,g)?g:null);var E=!!v&&r.Wt.has(v.key),b=!!g&&(g.Je||r.Wt.has(g.key)&&g.hasCommittedMutations),N=!1;v&&g?v.data().isEqual(g.data())?E!==b&&(i.track({type:3,doc:g}),N=!0):r.Th(v,g)||(i.track({type:2,doc:g}),N=!0,(c&&r._h(g,c)>0||h&&r._h(g,h)<0)&&(a=!0)):!v&&g?(i.track({type:0,doc:g}),N=!0):v&&!g&&(i.track({type:1,doc:v}),N=!0,(c||h)&&(a=!0)),N&&(g?(u=u.add(g),s=b?s.add(l):s.delete(l)):(u=u.delete(l),s=s.delete(l)))}),Ar(this.query)||Ur(this.query))for(;u.size>this.query.limit;){var f=Ar(this.query)?u.last():u.first();u=u.delete(f.key),s=s.delete(f.key),i.track({type:1,doc:f})}return{fh:u,mh:i,Eh:a,Wt:s}},e.prototype.Th=function(t,n){return t.Je&&n.hasCommittedMutations&&!n.Je},e.prototype.yr=function(t,n,r){var i=this,o=this.fh;this.fh=t.fh,this.Wt=t.Wt;var s=t.mh.Ut();s.sort(function(h,f){return function(l,d){var v=function(g){switch(g){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return A()}};return v(l)-v(d)}(h.type,f.type)||i._h(h.doc,f.doc)}),this.Ih(r);var u=n?this.Ah():[],a=this.lh.size===0&&this.te?1:0,c=a!==this.hh;return this.hh=a,s.length!==0||c?{snapshot:new kr(this.query,t.fh,o,s,t.Wt,a===0,c,!1),Rh:u}:{Rh:u}},e.prototype.Qs=function(t){return this.te&&t==="Offline"?(this.te=!1,this.yr({fh:this.fh,mh:new Yu,Wt:this.Wt,Eh:!1},!1)):{Rh:[]}},e.prototype.gh=function(t){return!this.uh.has(t)&&!!this.fh.has(t)&&!this.fh.get(t).Je},e.prototype.Ih=function(t){var n=this;t&&(t.ee.forEach(function(r){return n.uh=n.uh.add(r)}),t.ne.forEach(function(r){}),t.se.forEach(function(r){return n.uh=n.uh.delete(r)}),this.te=t.te)},e.prototype.Ah=function(){var t=this;if(!this.te)return[];var n=this.lh;this.lh=V(),this.fh.forEach(function(i){t.gh(i.key)&&(t.lh=t.lh.add(i.key))});var r=[];
17return n.forEach(function(i){t.lh.has(i)||r.push(new zc(i))}),this.lh.forEach(function(i){n.has(i)||r.push(new Bc(i))}),r},e.prototype.Ph=function(t){this.uh=t.Fc,this.lh=V();var n=this.wh(t.documents);return this.yr(n,!0)},e.prototype.yh=function(){return kr.Gt(this.query,this.fh,this.Wt,this.hh===0)},e}(),bp=function(e,t,n){this.query=e,this.targetId=t,this.view=n},Ep=function(e){this.key=e,this.Vh=!1},Ip=function(){function e(t,n,r,i,o,s){this.ju=t,this.ph=n,this.bh=r,this.Sh=i,this.currentUser=o,this.Dh=s,this.Ch={},this.Nh=new rn(function(u){return bc(u)},on),this.Fh=new Map,this.xh=[],this.$h=new ot(x.i),this.kh=new Map,this.Mh=new Ho,this.Oh={},this.Lh=new Map,this.Bh=qr.da(),this.onlineState="Unknown",this.qh=void 0}return Object.defineProperty(e.prototype,"Uh",{get:function(){return this.qh===!0},enumerable:!1,configurable:!0}),e}();function Tp(e,t){return p.__awaiter(this,void 0,void 0,function(){var n,r,i,o,s,u;return p.__generator(this,function(a){switch(a.label){case 0:return n=es(e),(o=n.Nh.get(t))?(r=o.targetId,n.Sh.Oi(r),i=o.view.yh(),[3,4]):[3,1];case 1:return[4,Gr(n.ju,Vt(t))];case 2:return s=a.sent(),u=n.Sh.Oi(s.targetId),r=s.targetId,[4,Jo(n,t,r,u==="current")];case 3:i=a.sent(),n.Uh&&$r(n.ph,s),a.label=4;case 4:return[2,i]}})})}function Jo(e,t,n,r){return p.__awaiter(this,void 0,void 0,function(){var i,o,s,u,a,c;return p.__generator(this,function(h){switch(h.label){case 0:return e.Qh=function(f,l,d){return function(v,g,E,b){return p.__awaiter(this,void 0,void 0,function(){var N,D,O;return p.__generator(this,function(U){switch(U.label){case 0:return N=g.view.wh(E),N.Eh?[4,Br(v.ju,g.query,!1).then(function(M){var Lt=M.documents;return g.view.wh(Lt,N)})]:[3,2];case 1:N=U.sent(),U.label=2;case 2:return D=b&&b.zt.get(g.targetId),O=g.view.yr(N,v.Uh,D),[2,(To(v,g.targetId,O.Rh),O.snapshot)]}})})}(e,f,l,d)},[4,Br(e.ju,t,!0)];case 1:return i=h.sent(),o=new Kc(t,i.Fc),s=o.wh(i.documents),u=Lo.Zt(n,r&&e.onlineState!=="Offline"),a=o.yr(s,e.Uh,u),To(e,n,a.Rh),c=new bp(t,n,o),[2,(e.Nh.set(t,c),e.Fh.has(n)?e.Fh.get(n).push(t):e.Fh.set(n,[t]),a.snapshot)]}})})}function Ap(e,t){return p.__awaiter(this,void 0,void 0,function(){var n,r,i;return p.__generator(this,function(o){switch(o.label){case 0:return n=I(e),r=n.Nh.get(t),(i=n.Fh.get(r.targetId)).length>1?[2,(n.Fh.set(r.targetId,i.filter(function(s){return!on(s,t)})),void n.Nh.delete(t))]:n.Uh?(n.Sh.Bi(r.targetId),n.Sh.Fi(r.targetId)?[3,2]:[4,Ze(n.ju,r.targetId,!1).then(function(){n.Sh.Ui(r.targetId),Rn(n.ph,r.targetId),en(n,r.targetId)}).catch(Te)]):[3,3];case 1:o.sent(),o.label=2;case 2:return[3,5];case 3:return en(n,r.targetId),[4,Ze(n.ju,r.targetId,!0)];case 4:o.sent(),o.label=5;case 5:return[2]}})})}function Wc(e,t){return p.__awaiter(this,void 0,void 0,function(){var n,r;return p.__generator(this,function(i){switch(i.label){case 0:n=I(e),i.label=1;case 1:return i.trys.push([1,4,,6]),[4,ep(n.ju,t)];case 2:return r=i.sent(),t.zt.forEach(function(o,s){var u=n.kh.get(s);u&&(S(o.ee.size+o.ne.size+o.se.size<=1),o.ee.size>0?u.Vh=!0:o.ne.size>0?S(u.Vh):o.se.size>0&&(S(u.Vh),u.Vh=!1))}),[4,Ae(n,r,t)];case 3:return i.sent(),[3,6];case 4:return[4,Te(i.sent())];case 5:return i.sent(),[3,6];case 6:return[2]}})})}function xa(e,t,n){var r=I(e);if(r.Uh&&n===0||!r.Uh&&n===1){var i=[];r.Nh.forEach(function(o,s){var u=s.view.Qs(t);u.snapshot&&i.push(u.snapshot)}),function(o,s){var u=I(o);u.onlineState=s;var a=!1;u.Bs.forEach(function(c,h){for(var f=0,l=h.listeners;f<l.length;f++)l[f].Qs(s)&&(a=!0)}),a&&Bo(u)}(r.bh,t),i.length&&r.Ch.yu(i),r.onlineState=t,r.Uh&&r.Sh.Ki(t)}}function Np(e,t,n){return p.__awaiter(this,void 0,void 0,function(){var r,i,o,s,u,a;return p.__generator(this,function(c){switch(c.label){case 0:return(r=I(e)).Sh.Qi(t,"rejected",n),i=r.kh.get(t),(o=i&&i.key)?(s=(s=new ot(x.i)).ot(o,new $(o,R.min())),u=V().add(o),a=new Do(R.min(),new Map,new Y(k),s,u),[4,Wc(r,a)]):[3,2];case 1:return c.sent(),r.$h=r.$h.remove(o),r.kh.delete(t),ts(r),[3,4];case 2:return[4,Ze(r.ju,t,!1).then(function(){return en(r,t,n)}).catch(Te)];case 3:c.sent(),c.label=4;case 4:return[2]}})})}function Sp(e,t){return p.__awaiter(this,void 0,void 0,function(){var n,r,i;return p.__generator(this,function(o){switch(o.label){case 0:n=I(e),r=t.batch.batchId,o.label=1;case 1:return o.trys.push([1,4,,6]),[4,tp(n.ju,t)];case 2:return i=o.sent(),Zo(n,r,null),$o(n,r),n.Sh.ki(r,"acknowledged"),[4,Ae(n,i)];case 3:return o.sent(),[3,6];case 4:return[4,Te(o.sent())];case 5:return o.sent(),[3,6];case 6:return[2]}})})}function xp(e,t,n){return p.__awaiter(this,void 0,void 0,function(){var r,i;return p.__generator(this,function(o){switch(o.label){case 0:r=I(e),o.label=1;case 1:return o.trys.push([1,4,,6]),[4,function(s,u){var a=I(s);return a.persistence.runTransaction("Reject batch","readwrite-primary",function(c){var h;return a.Sr.Oo(c,u).next(function(f){return S(f!==null),h=f.keys(),a.Sr.Wo(c,f)}).next(function(){return a.Sr.zo(c)}).next(function(){return a.Cc.kr(c,h)})})}(r.ju,t)];case 2:return i=o.sent(),Zo(r,t,n),$o(r,t),r.Sh.ki(t,"rejected",n),[4,Ae(r,i)];case 3:return o.sent(),[3,6];case 4:return[4,Te(o.sent())];case 5:return o.sent(),[3,6];case 6:return[2]}})})}
17function $o(e,t){(e.Lh.get(t)||[]).forEach(function(n){n.resolve()}),e.Lh.delete(t)}function Zo(e,t,n){var r=I(e),i=r.Oh[r.currentUser.ti()];if(i){var o=i.get(t);o&&(n?o.reject(n):o.resolve(),i=i.remove(t)),r.Oh[r.currentUser.ti()]=i}}function en(e,t,n){n===void 0&&(n=null),e.Sh.Bi(t);for(var r=0,i=e.Fh.get(t);r<i.length;r++){var o=i[r];e.Nh.delete(o),n&&e.Ch.Wh(o,n)}e.Fh.delete(t),e.Uh&&e.Mh.Uc(t).forEach(function(s){e.Mh.Ho(s)||Hc(e,s)})}function Hc(e,t){var n=e.$h.get(t);n!==null&&(Rn(e.ph,n),e.$h=e.$h.remove(t),e.kh.delete(n),ts(e))}function To(e,t,n){for(var r=0,i=n;r<i.length;r++){var o=i[r];o instanceof Bc?(e.Mh.Da(o.key,t),Dp(e,o)):o instanceof zc?(_("SyncEngine","Document no longer in limbo: "+o.key),e.Mh.Na(o.key,t),e.Mh.Ho(o.key)||Hc(e,o.key)):A()}}function Dp(e,t){var n=t.key;e.$h.get(n)||(_("SyncEngine","New document in limbo: "+n),e.xh.push(n),ts(e))}function ts(e){for(;e.xh.length>0&&e.$h.size<e.Dh;){var t=e.xh.shift(),n=e.Bh.next();e.kh.set(n,new Ep(t)),e.$h=e.$h.ot(t,n),$r(e.ph,new Xr(Vt(zn(t.path)),n,2,mt.ai))}}function Ae(e,t,n){return p.__awaiter(this,void 0,void 0,function(){var r,i,o,s;return p.__generator(this,function(u){switch(u.label){case 0:return r=I(e),i=[],o=[],s=[],r.Nh.m()?[3,3]:(r.Nh.forEach(function(a,c){s.push(r.Qh(c,t,n).then(function(h){if(h){r.Uh&&r.Sh.Qi(c.targetId,h.fromCache?"not-current":"current"),i.push(h);var f=Cl.zr(c.targetId,h);o.push(f)}}))}),[4,Promise.all(s)]);case 1:return u.sent(),r.Ch.yu(i),[4,function(a,c){return p.__awaiter(this,void 0,void 0,function(){var h,f,l,d,v,g,E,b,N;return p.__generator(this,function(D){switch(D.label){case 0:h=I(a),D.label=1;case 1:return D.trys.push([1,3,,4]),[4,h.persistence.runTransaction("notifyLocalViewChanges","readwrite",function(O){return w.forEach(c,function(U){return w.forEach(U.Kr,function(M){return h.persistence.No.Da(O,U.targetId,M)}).next(function(){return w.forEach(U.Gr,function(M){return h.persistence.No.Na(O,U.targetId,M)})})})})];case 2:return D.sent(),[3,4];case 3:if(!Ie(f=D.sent()))throw f;return _("LocalStore","Failed to update sequence numbers: "+f),[3,4];case 4:for(l=0,d=c;l<d.length;l++)v=d[l],g=v.targetId,v.fromCache||(E=h.bc.get(g),b=E.nt,N=E.rt(b),h.bc=h.bc.ot(g,N));return[2]}})})}(r.ju,o)];case 2:u.sent(),u.label=3;case 3:return[2]}})})}function Lp(e,t){return p.__awaiter(this,void 0,void 0,function(){var n,r;return p.__generator(this,function(i){switch(i.label){case 0:return(n=I(e)).currentUser.isEqual(t)?[3,3]:(_("SyncEngine","User change. New user:",t.ti()),[4,function(o,s){return p.__awaiter(this,void 0,void 0,function(){var u,a,c,h;return p.__generator(this,function(f){switch(f.label){case 0:return u=I(o),a=u.Sr,c=u.Cc,[4,u.persistence.runTransaction("Handle user change","readonly",function(l){var d;return u.Sr.Uo(l).next(function(v){return d=v,a=u.persistence.mc(s),c=new xc(u.Dc,a,u.persistence.Ic()),a.Uo(l)}).next(function(v){for(var g=[],E=[],b=V(),N=0,D=d;N<D.length;N++){var O=D[N];g.push(O.batchId);for(var U=0,M=O.mutations;U<M.length;U++){var Lt=M[U];b=b.add(Lt.key)}}for(var Mt=0,xe=v;Mt<xe.length;Mt++){var Hn=xe[Mt];E.push(Hn.batchId);for(var an=0,De=Hn.mutations;an<De.length;an++){var ni=De[an];b=b.add(ni.key)}}return c.kr(l,b).next(function(ri){return{jh:ri,Kh:g,Gh:E}})})})];case 1:return h=f.sent(),[2,(u.Sr=a,u.Cc=c,u.Vc.Nc(u.Cc),h)]}})})}(n.ju,t)]);case 1:return r=i.sent(),n.currentUser=t,function(o,s){o.Lh.forEach(function(u){u.forEach(function(a){a.reject(new m(y.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))})}),o.Lh.clear()}(n),n.Sh.ji(t,r.Kh,r.Gh),[4,Ae(n,r.jh)];case 2:i.sent(),i.label=3;case 3:return[2]}})})}function kp(e,t){var n=I(e),r=n.kh.get(t);if(r&&r.Vh)return V().add(r.key);var i=V(),o=n.Fh.get(t);if(!o)return i;for(var s=0,u=o;s<u.length;s++){var a=u[s],c=n.Nh.get(a);i=i.kt(c.view.dh)}return i}function Op(e,t){return p.__awaiter(this,void 0,void 0,function(){var n,r,i;return p.__generator(this,function(o){switch(o.label){case 0:return[4,Br((n=I(e)).ju,t.query,!0)];case 1:return r=o.sent(),i=t.view.Ph(r),[2,(n.Uh&&To(n,t.targetId,i.Rh),i)]}})})}function Rp(e,t,n,r){return p.__awaiter(this,void 0,void 0,function(){var i,o;return p.__generator(this,function(s){switch(s.label){case 0:return[4,function(u,a){var c=I(u),h=I(c.Sr);return c.persistence.runTransaction("Lookup mutation documents","readonly",function(f){return h.Lo(f,a).next(function(l){return l?c.Cc.kr(f,l):w.resolve(null)})})}((i=I(e)).ju,t)];case 1:return(o=s.sent())===null?[3,6]:n!=="pending"?[3,3]:[4,sn(i.ph)];case 2:return s.sent(),[3,4];case 3:n==="acknowledged"||n==="rejected"?(Zo(i,t,r||null),$o(i,t),function(u,a){I(I(u).Sr).Ko(a)}(i.ju,t)):A(),s.label=4;case 4:return[4,Ae(i,o)];case 5:return s.sent(),[3,7];case 6:_("SyncEngine","Cannot apply mutation batch with id: "+t),s.label=7;case 7:return[2]}})})}function Pp(e,t){return p.__awaiter(this,void 0,void 0,function(){var n,r,i,o,s,u,a,c;return p.__generator(this,function(h){switch(h.label){case 0:return es(n=I(e)),ns(n),t!==!0||n.qh===!0?[3,3]:(r=n.Sh.Ci(),[4,Da(n,r.A
17())]);case 1:return i=h.sent(),n.qh=!0,[4,Io(n.ph,!0)];case 2:for(h.sent(),o=0,s=i;o<s.length;o++)u=s[o],$r(n.ph,u);return[3,7];case 3:return t!==!1||n.qh===!1?[3,7]:(a=[],c=Promise.resolve(),n.Fh.forEach(function(f,l){n.Sh.qi(l)?a.push(l):c=c.then(function(){return en(n,l),Ze(n.ju,l,!0)}),Rn(n.ph,l)}),[4,c]);case 4:return h.sent(),[4,Da(n,a)];case 5:return h.sent(),function(f){var l=I(f);l.kh.forEach(function(d,v){Rn(l.ph,v)}),l.Mh.Qc(),l.kh=new Map,l.$h=new ot(x.i)}(n),n.qh=!1,[4,Io(n.ph,!1)];case 6:h.sent(),h.label=7;case 7:return[2]}})})}function Da(e,t,n){return p.__awaiter(this,void 0,void 0,function(){var r,i,o,s,u,a,c,h,f,l,d,v,g,E;return p.__generator(this,function(b){switch(b.label){case 0:r=I(e),i=[],o=[],s=0,u=t,b.label=1;case 1:return s<u.length?(a=u[s],c=void 0,(h=r.Fh.get(a))&&h.length!==0?[4,Gr(r.ju,Vt(h[0]))]:[3,7]):[3,13];case 2:c=b.sent(),f=0,l=h,b.label=3;case 3:return f<l.length?(d=l[f],v=r.Nh.get(d),[4,Op(r,v)]):[3,6];case 4:(g=b.sent()).snapshot&&o.push(g.snapshot),b.label=5;case 5:return f++,[3,3];case 6:return[3,11];case 7:return[4,Cc(r.ju,a)];case 8:return E=b.sent(),[4,Gr(r.ju,E)];case 9:return c=b.sent(),[4,Jo(r,Qc(E),a,!1)];case 10:b.sent(),b.label=11;case 11:i.push(c),b.label=12;case 12:return s++,[3,1];case 13:return[2,(r.Ch.yu(o),i)]}})})}function Qc(e){return _c(e.path,e.collectionGroup,e.orderBy,e.filters,e.limit,"F",e.startAt,e.endAt)}function Cp(e){var t=I(e);return I(I(t.ju).persistence).pi()}function Up(e,t,n,r){return p.__awaiter(this,void 0,void 0,function(){var i,o,s;return p.__generator(this,function(u){switch(u.label){case 0:return(i=I(e)).qh?(_("SyncEngine","Ignoring unexpected query state notification."),[3,8]):[3,1];case 1:if(!i.Fh.has(t))return[3,8];switch(n){case"current":case"not-current":return[3,2];case"rejected":return[3,5]}return[3,7];case 2:return[4,rp(i.ju)];case 3:return o=u.sent(),s=Do.Xt(t,n==="current"),[4,Ae(i,o,s)];case 4:return u.sent(),[3,8];case 5:return[4,Ze(i.ju,t,!0)];case 6:return u.sent(),en(i,t,r),[3,8];case 7:A(),u.label=8;case 8:return[2]}})})}function Vp(e,t,n){return p.__awaiter(this,void 0,void 0,function(){var r,i,o,s,u,a,c,h,f,l;return p.__generator(this,function(d){switch(d.label){case 0:if(!(r=es(e)).qh)return[3,10];i=0,o=t,d.label=1;case 1:return i<o.length?(s=o[i],r.Fh.has(s)?(_("SyncEngine","Adding an already active target "+s),[3,5]):[4,Cc(r.ju,s)]):[3,6];case 2:return u=d.sent(),[4,Gr(r.ju,u)];case 3:return a=d.sent(),[4,Jo(r,Qc(u),a.targetId,!1)];case 4:d.sent(),$r(r.ph,a),d.label=5;case 5:return i++,[3,1];case 6:c=function(v){return p.__generator(this,function(g){switch(g.label){case 0:return r.Fh.has(v)?[4,Ze(r.ju,v,!1).then(function(){Rn(r.ph,v),en(r,v)}).catch(Te)]:[3,2];case 1:g.sent(),g.label=2;case 2:return[2]}})},h=0,f=n,d.label=7;case 7:return h<f.length?(l=f[h],[5,c(l)]):[3,10];case 8:d.sent(),d.label=9;case 9:return h++,[3,7];case 10:return[2]}})})}function es(e){var t=I(e);return t.ph.Gu.sh=Wc.bind(null,t),t.ph.Gu.qe=kp.bind(null,t),t.ph.Gu.nh=Np.bind(null,t),t.Ch.yu=kl.bind(null,t.bh),t.Ch.Wh=Ol.bind(null,t.bh),t}function ns(e){var t=I(e);return t.ph.Gu.ih=Sp.bind(null,t),t.ph.Gu.rh=xp.bind(null,t),t}var Mp=function(){function e(){}return e.prototype.Nc=function(t){this.zh=t},e.prototype.Lr=function(t,n,r,i){var o=this;return function(s){return s.filters.length===0&&s.limit===null&&s.startAt==null&&s.endAt==null&&(s.on.length===0||s.on.length===1&&s.on[0].field.p())}(n)||r.isEqual(R.min())?this.Hh(t,n):this.zh.kr(t,i).next(function(s){var u=o.Yh(n,s);return(Ar(n)||Ur(n))&&o.Eh(n.an,u,i,r)?o.Hh(t,n):(Sr()<=vt.LogLevel.DEBUG&&_("IndexFreeQueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),wo(n)),o.zh.Lr(t,n,r).next(function(a){return u.forEach(function(c){a=a.ot(c.key,c)}),a}))})},e.prototype.Yh=function(t,n){var r=new Y(Ec(t));return n.forEach(function(i,o){o instanceof C&&Kn(t,o)&&(r=r.add(o))}),r},e.prototype.Eh=function(t,n,r,i){if(r.size!==n.size)return!0;var o=t==="F"?n.last():n.first();return!!o&&(o.hasPendingWrites||o.version.L(i)>0)},e.prototype.Hh=function(t,n){return Sr()<=vt.LogLevel.DEBUG&&_("IndexFreeQueryEngine","Using full collection scan to execute query:",wo(n)),this.zh.Lr(t,n,R.min())},e}(),Fp=function(){function e(t,n){this.Dr=t,this.No=n,this.Sr=[],this.Jh=1,this.Xh=new Y(J.kc)}return e.prototype.$o=function(t){return w.resolve(this.Sr.length===0)},e.prototype.ko=function(t,n,r,i){var o=this.Jh;this.Jh++,this.Sr.length>0&&this.Sr[this.Sr.length-1];var s=new zo(o,n,r,i);this.Sr.push(s);for(var u=0,a=i;u<a.length;u++){var c=a[u];this.Xh=this.Xh.add(new J(c.key,o)),this.Dr.Mo(t,c.key.path.h())}return w.resolve(s)},e.prototype.Oo=function(t,n){return w.resolve(this.Zh(n))},e.prototype.Bo=function(t,n){var r=n+1,i=this.tl(r),o=i<0?0:i;return w.resolve(this.Sr.length>
17o?this.Sr[o]:null)},e.prototype.qo=function(){return w.resolve(this.Sr.length===0?-1:this.Jh-1)},e.prototype.Uo=function(t){return w.resolve(this.Sr.slice())},e.prototype.Nr=function(t,n){var r=this,i=new J(n,0),o=new J(n,Number.POSITIVE_INFINITY),s=[];return this.Xh.Ft([i,o],function(u){var a=r.Zh(u.jc);s.push(a)}),w.resolve(s)},e.prototype.Or=function(t,n){var r=this,i=new Y(k);return n.forEach(function(o){var s=new J(o,0),u=new J(o,Number.POSITIVE_INFINITY);r.Xh.Ft([s,u],function(a){i=i.add(a.jc)})}),w.resolve(this.el(i))},e.prototype.Wr=function(t,n){var r=n.path,i=r.length+1,o=r;x.F(o)||(o=o.child(""));var s=new J(new x(o),0),u=new Y(k);return this.Xh.xt(function(a){var c=a.key.path;return!!r.T(c)&&(c.length===i&&(u=u.add(a.jc)),!0)},s),w.resolve(this.el(u))},e.prototype.el=function(t){var n=this,r=[];return t.forEach(function(i){var o=n.Zh(i);o!==null&&r.push(o)}),r},e.prototype.Wo=function(t,n){var r=this;S(this.nl(n.batchId,"removed")===0),this.Sr.shift();var i=this.Xh;return w.forEach(n.mutations,function(o){var s=new J(o.key,n.batchId);return i=i.delete(s),r.No.Go(t,o.key)}).next(function(){r.Xh=i})},e.prototype.Ko=function(t){},e.prototype.Ho=function(t,n){var r=new J(n,0),i=this.Xh.$t(r);return w.resolve(n.isEqual(i&&i.key))},e.prototype.zo=function(t){return this.Sr.length,w.resolve()},e.prototype.nl=function(t,n){return this.tl(t)},e.prototype.tl=function(t){return this.Sr.length===0?0:t-this.Sr[0].batchId},e.prototype.Zh=function(t){var n=this.tl(t);return n<0||n>=this.Sr.length?null:this.Sr[n]},e}(),jp=function(){function e(t,n){this.Dr=t,this.sl=n,this.docs=new ot(x.i),this.size=0}return e.prototype.Er=function(t,n,r){var i=n.key,o=this.docs.get(i),s=o?o.size:0,u=this.sl(n);return this.docs=this.docs.ot(i,{ta:n,size:u,readTime:r}),this.size+=u-s,this.Dr.Mo(t,i.path.h())},e.prototype.Ar=function(t){var n=this.docs.get(t);n&&(this.docs=this.docs.remove(t),this.size-=n.size)},e.prototype.Rr=function(t,n){var r=this.docs.get(n);return w.resolve(r?r.ta:null)},e.prototype.getEntries=function(t,n){var r=this,i=Lr();return n.forEach(function(o){var s=r.docs.get(o);i=i.ot(o,s?s.ta:null)}),w.resolve(i)},e.prototype.Lr=function(t,n,r){for(var i=Sn(),o=new x(n.path.child("")),s=this.docs.ft(o);s.At();){var u=s.It(),a=u.key,c=u.value,h=c.ta,f=c.readTime;if(!n.path.T(a.path))break;f.L(r)<=0||h instanceof C&&Kn(n,h)&&(i=i.ot(h.key,h))}return w.resolve(i)},e.prototype.il=function(t,n){return w.forEach(this.docs,function(r){return n(r)})},e.prototype.ra=function(t){return new qp(this)},e.prototype.aa=function(t){return w.resolve(this.size)},e}(),qp=function(e){function t(n){var r=this;return(r=e.call(this)||this).ca=n,r}return p.__extends(t,e),t.prototype.yr=function(n){var r=this,i=[];return this.wr.forEach(function(o,s){s?i.push(r.ca.Er(n,s,r.readTime)):r.ca.Ar(o)}),w.$n(i)},t.prototype.gr=function(n,r){return this.ca.Rr(n,r)},t.prototype.Pr=function(n,r){return this.ca.getEntries(n,r)},t}(Ac),Gp=function(){function e(t){this.persistence=t,this.rl=new rn(function(n){return Mn(n)},Qr),this.lastRemoteSnapshotVersion=R.min(),this.highestTargetId=0,this.ol=0,this.al=new Ho,this.targetCount=0,this.cl=qr.fa()}return e.prototype.Ce=function(t,n){return this.rl.forEach(function(r,i){return n(i)}),w.resolve()},e.prototype.Ea=function(t){return w.resolve(this.lastRemoteSnapshotVersion)},e.prototype.Ia=function(t){return w.resolve(this.ol)},e.prototype.wa=function(t){return this.highestTargetId=this.cl.next(),w.resolve(this.highestTargetId)},e.prototype.Aa=function(t,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.ol&&(this.ol=n),w.resolve()},e.prototype.ga=function(t){this.rl.set(t.target,t);var n=t.targetId;n>this.highestTargetId&&(this.cl=new qr(n),this.highestTargetId=n),t.sequenceNumber>this.ol&&(this.ol=t.sequenceNumber)},e.prototype.Ra=function(t,n){return this.ga(n),this.targetCount+=1,w.resolve()},e.prototype.ya=function(t,n){return this.ga(n),w.resolve()},e.prototype.Va=function(t,n){return this.rl.delete(n.target),this.al.Uc(n.targetId),this.targetCount-=1,w.resolve()},e.prototype.po=function(t,n,r){var i=this,o=0,s=[];return this.rl.forEach(function(u,a){a.sequenceNumber<=n&&r.get(a.targetId)===null&&(i.rl.delete(u),s.push(i.pa(t,a.targetId)),o++)}),w.$n(s).next(function(){return o}
17)},e.prototype.ba=function(t){return w.resolve(this.targetCount)},e.prototype.va=function(t,n){var r=this.rl.get(n)||null;return w.resolve(r)},e.prototype.Sa=function(t,n,r){return this.al.Lc(n,r),w.resolve()},e.prototype.Ca=function(t,n,r){this.al.qc(n,r);var i=this.persistence.No,o=[];return i&&n.forEach(function(s){o.push(i.Go(t,s))}),w.$n(o)},e.prototype.pa=function(t,n){return this.al.Uc(n),w.resolve()},e.prototype.Fa=function(t,n){var r=this.al.Wc(n);return w.resolve(r)},e.prototype.Ho=function(t,n){return w.resolve(this.al.Ho(n))},e}(),Bp=function(){function e(t){var n=this;this.ul={},this.Ma=new mt(0),this.Oa=!1,this.Oa=!0,this.No=t(this),this.Ka=new Gp(this),this.Dr=new zl,this.vr=function(r,i){return new jp(r,function(o){return n.No.hl(o)})}(this.Dr)}return e.prototype.start=function(){return Promise.resolve()},e.prototype.Di=function(){return this.Oa=!1,Promise.resolve()},Object.defineProperty(e.prototype,"Ei",{get:function(){return this.Oa},enumerable:!1,configurable:!0}),e.prototype.Za=function(){},e.prototype.tc=function(){},e.prototype.Ic=function(){return this.Dr},e.prototype.mc=function(t){var n=this.ul[t.ti()];return n||(n=new Fp(this.Dr,this.No),this.ul[t.ti()]=n),n},e.prototype.Tc=function(){return this.Ka},e.prototype.Ec=function(){return this.vr},e.prototype.runTransaction=function(t,n,r){var i=this;_("MemoryPersistence","Starting transaction:",t);var o=new zp(this.Ma.next());return this.No.ll(),r(o).next(function(s){return i.No._l(o).next(function(){return s})}).Fn().then(function(s){return o.br(),s})},e.prototype.fl=function(t,n){return w.kn(Object.values(this.ul).map(function(r){return function(){return r.Ho(t,n)}}))},e}(),zp=function(e){function t(n){var r=this;return(r=e.call(this)||this).xa=n,r}return p.__extends(t,e),t}(Sc),Kp=function(){function e(t){this.persistence=t,this.dl=new Ho,this.wl=null}return e.ml=function(t){return new e(t)},Object.defineProperty(e.prototype,"Tl",{get:function(){if(this.wl)return this.wl;throw A()},enumerable:!1,configurable:!0}),e.prototype.Da=function(t,n,r){return this.dl.Da(r,n),this.Tl.delete(r.toString()),w.resolve()},e.prototype.Na=function(t,n,r){return this.dl.Na(r,n),this.Tl.add(r.toString()),w.resolve()},e.prototype.Go=function(t,n){return this.Tl.add(n.toString()),w.resolve()},e.prototype.removeTarget=function(t,n){var r=this;this.dl.Uc(n.targetId).forEach(function(o){return r.Tl.add(o.toString())});var i=this.persistence.Tc();return i.Fa(t,n.targetId).next(function(o){o.forEach(function(s){return r.Tl.add(s.toString())})}).next(function(){return i.Va(t,n)})},e.prototype.ll=function(){this.wl=new Set},e.prototype._l=function(t){var n=this,r=this.persistence.Ec().ra();return w.forEach(this.Tl,function(i){var o=x.D(i);return n.El(t,o).next(function(s){s||r.Ar(o)})}).next(function(){return n.wl=null,r.apply(t)})},e.prototype.yc=function(t,n){var r=this;return this.El(t,n).next(function(i){i?r.Tl.delete(n.toString()):r.Tl.add(n.toString())})},e.prototype.hl=function(t){return 0},e.prototype.El=function(t,n){var r=this;return w.kn([function(){return w.resolve(r.dl.Ho(n))},function(){return r.persistence.Tc().Ho(t,n)},function(){return r.persistence.fl(t,n)}])},e}(),Wp=function(){function e(t){this.Il=t.Il,this.Al=t.Al}return e.prototype.gu=function(t){this.Rl=t},e.prototype.Tu=function(t){this.gl=t},e.prototype.onMessage=function(t){this.Pl=t},e.prototype.close=function(){this.Al()},e.prototype.send=function(t){this.Il(t)},e.prototype.yl=function(){this.Rl()},e.prototype.Vl=function(t){this.gl(t)},e.prototype.pl=function(t){this.Pl(t)},e}(),Hp={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery"},Qp=function(e){function t(n){var r=this;return(r=e.call(this,n)||this).forceLongPolling=n.forceLongPolling,r.W=n.W,r}return p.__extends(t,e),t.prototype.Nl=function(n,r,i,o){return new Promise(function(s,u){var a=new Ot.XhrIo;a.listenOnce(Ot.EventType.COMPLETE,function(){try{switch(a.getLastErrorCode()){case Ot.ErrorCode.NO_ERROR:var h=a.getResponseJson();_("Connection","XHR received:",JSON.stringify(h)),s(h);break;case Ot.ErrorCode.TIMEOUT:_("Connection",'RPC "'+n+'" timed out'),u(new m(y.DEADLINE_EXCEEDED,"Request time out"));break;case Ot.ErrorCode.HTTP_ERROR:var f=a.getStatus();if(_("Connection",'RPC "'+n+'" failed with status:',f,"response text:",a.getResponseText()),f>0){var l=a.getResponseJson().error;if(l&&l.status&&l.message){var d=function(v){var g=v.toLowerCase().replace("_","-");return Object.values(y).indexOf(g)>=0?g:y.UNKNOWN}(l.status);u(new m(d,l.message))}else u(new m(y.UNKNOWN,"Server responded with status "+a.getStatus()))}else u(new m(y.UNAVAILABLE,"Connection failed."));break;default:A()}}finally{_("Connection",'RPC "'+n+'" completed.')}});var c=JSON.stringify(o);a.send(r,"POST",c,i,15)})},t.prototype.Pu=function(n,r){var i=[this.vl,"/","google.firestore.v1.Firestore","/",n,"/channel"],o=Ot.createWebChannelTransport(),s={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.U.projectId+"/databases/"+this.U.database}
17,sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.W};this.Cl(s.initMessageHeaders,r),jt.isMobileCordova()||jt.isReactNative()||jt.isElectron()||jt.isIE()||jt.isUWP()||jt.isBrowserExtension()||(s.httpHeadersOverwriteParam="$httpHeaders");var u=i.join("");_("Connection","Creating WebChannel: "+u,s);var a=o.createWebChannel(u,s),c=!1,h=!1,f=new Wp({Il:function(d){h?_("Connection","Not sending because WebChannel is closed:",d):(c||(_("Connection","Opening WebChannel transport."),a.open(),c=!0),_("Connection","WebChannel sending:",d),a.send(d))},Al:function(){return a.close()}}),l=function(d,v){a.listen(d,function(g){try{v(g)}catch(E){setTimeout(function(){throw E},0)}})};return l(Ot.WebChannel.EventType.OPEN,function(){h||_("Connection","WebChannel transport opened.")}),l(Ot.WebChannel.EventType.CLOSE,function(){h||(h=!0,_("Connection","WebChannel transport closed"),f.Vl())}),l(Ot.WebChannel.EventType.ERROR,function(d){h||(h=!0,qu("Connection","WebChannel transport errored:",d),f.Vl(new m(y.UNAVAILABLE,"The operation could not be completed")))}),l(Ot.WebChannel.EventType.MESSAGE,function(d){var v;if(!h){var g=d.data[0];S(!!g);var E=g,b=E.error||((v=E[0])===null||v===void 0?void 0:v.error);if(b){_("Connection","WebChannel received error:",b);var N=b.status,D=function(U){var M=K[U];if(M!==void 0)return Ya(M)}(N),O=b.message;D===void 0&&(D=y.INTERNAL,O="Unknown error status: "+N+" with message "+b.message),h=!0,f.Vl(new m(D,O)),a.close()}else _("Connection","WebChannel received:",g),f.pl(g)}}),setTimeout(function(){f.yl()},0),f},t}(function(){function e(t){this.bl=t,this.U=t.U;var n=t.ssl?"https":"http";this.vl=n+"://"+t.host,this.Sl="projects/"+this.U.projectId+"/databases/"+this.U.database+"/documents"}return e.prototype.$u=function(t,n,r,i){var o=this.Dl(t,n);_("RestConnection","Sending: ",o,r);var s={};return this.Cl(s,i),this.Nl(t,o,s,r).then(function(u){return _("RestConnection","Received: ",u),u},function(u){throw qu("RestConnection",t+" failed with error: ",u,"url: ",o,"request:",r),u})},e.prototype.ku=function(t,n,r,i){return this.$u(t,n,r,i)},e.prototype.Cl=function(t,n){if(t["X-Goog-Api-Client"]="gl-js/ fire/7.24.0",t["Content-Type"]="text/plain",n)for(var r in n.Kc)n.Kc.hasOwnProperty(r)&&(t[r]=n.Kc[r])},e.prototype.Dl=function(t,n){var r=Hp[t];return this.vl+"/v1/"+n+":"+r},e}()),La=function(){function e(){var t=this;this.Fl=function(){return t.xl()},this.$l=function(){return t.kl()},this.Ml=[],this.Ol()}return e.prototype.Zu=function(t){this.Ml.push(t)},e.prototype.Di=function(){window.removeEventListener("online",this.Fl),window.removeEventListener("offline",this.$l)},e.prototype.Ol=function(){window.addEventListener("online",this.Fl),window.addEventListener("offline",this.$l)},e.prototype.xl=function(){_("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,n=this.Ml;t<n.length;t++)(0,n[t])(0)},e.prototype.kl=function(){_("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(var t=0,n=this.Ml;t<n.length;t++)(0,n[t])(1)},e.Ln=function(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0},e}(),Xp=function(){function e(){}return e.prototype.Zu=function(t){},e.prototype.Di=function(){},e}();function rs(e){return new rl(e,!0)}var ka="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.",Kr=function(){function e(){}return e.prototype.initialize=function(t){return p.__awaiter(this,void 0,void 0,function(){return p.__generator(this,function(n){switch(n.label){case 0:return this.Sh=this.Ll(t),this.persistence=this.Bl(t),[4,this.persistence.start()];case 1:return n.sent(),this.ql=this.Ul(t),this.ju=this.Ql(t),[2]}})})},e.prototype.Ul=function(t){return null},e.prototype.Ql=function(t){return n=this.persistence,r=new Mp,i=t.Wl,new Zl(n,r,i);var n,r,i},e.prototype.Bl=function(t){if(t.persistenceSettings.jl)throw new m(y.FAILED_PRECONDITION,ka);return new Bp(Kp.ml)},e.prototype.Ll=function(t){return new bo},e.prototype.terminate=function(){return p.__awaiter(this,void 0,void 0,function(){return p.__generator(this,function(t){switch(t.label){case 0:return this.ql&&this.ql.stop(),[4,this.Sh.Di()];case 1:return t.sent(),[4,this.persistence.Di()];case 2:return t.sent(),[2]}})})}
17,e.prototype.clearPersistence=function(t,n){throw new m(y.FAILED_PRECONDITION,ka)},e}(),Yp=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return p.__extends(t,e),t.prototype.initialize=function(n){return p.__awaiter(this,void 0,void 0,function(){var r,i=this;return p.__generator(this,function(o){switch(o.label){case 0:return[4,e.prototype.initialize.call(this,n)];case 1:return o.sent(),r=this.Kl.fi,this.Sh instanceof so?(this.Sh.fi={er:Rp.bind(null,r),nr:Up.bind(null,r),sr:Vp.bind(null,r),pi:Cp.bind(null,r)},[4,this.Sh.start()]):[3,3];case 2:o.sent(),o.label=3;case 3:return[4,this.persistence.Xa(function(s){return p.__awaiter(i,void 0,void 0,function(){return p.__generator(this,function(u){switch(u.label){case 0:return[4,Pp(this.Kl.fi,s)];case 1:return u.sent(),this.ql&&(s&&!this.ql.Ei?this.ql.start(this.ju):s||this.ql.stop()),[2]}})})})];case 4:return o.sent(),[2]}})})},t.prototype.Ll=function(n){if(n.persistenceSettings.jl&&n.persistenceSettings.synchronizeTabs){var r=da();if(!so.Ln(r))throw new m(y.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var i=co(n.bl.U,n.bl.persistenceKey);return new so(r,n.cs,i,n.clientId,n.Wl)}return new bo},t}(function(e){function t(n){var r=this;return(r=e.call(this)||this).Kl=n,r}return p.__extends(t,e),t.prototype.initialize=function(n){return p.__awaiter(this,void 0,void 0,function(){return p.__generator(this,function(r){switch(r.label){case 0:return[4,e.prototype.initialize.call(this,n)];case 1:return r.sent(),[4,ip(this.ju)];case 2:return r.sent(),[4,this.Kl.initialize(this,n)];case 3:return r.sent(),[4,ns(this.Kl.fi)];case 4:return r.sent(),[4,sn(this.Kl.ph)];case 5:return r.sent(),[2]}})})},t.prototype.Ul=function(n){var r=this.persistence.No.wo;return new Vl(r,n.cs)},t.prototype.Bl=function(n){var r=co(n.bl.U,n.bl.persistenceKey),i=rs(n.bl.U);return new Et(n.persistenceSettings.synchronizeTabs,r,n.clientId,W.ao(n.persistenceSettings.cacheSizeBytes),n.cs,da(),Nr(),i,this.Sh,n.persistenceSettings.ka)},t.prototype.Ll=function(n){return new bo},t.prototype.clearPersistence=function(n,r){return function(i){return p.__awaiter(this,void 0,void 0,function(){var o;return p.__generator(this,function(s){switch(s.label){case 0:return Ke.Ln()?(o=i+"main",[4,Ke.delete(o)]):[2,Promise.resolve()];case 1:return s.sent(),[2]}})})}(co(n,r))},t}(Kr)),Wr=function(){function e(){}return e.prototype.initialize=function(t,n){return p.__awaiter(this,void 0,void 0,function(){var r=this;return p.__generator(this,function(i){switch(i.label){case 0:return this.ju?[3,2]:(this.ju=t.ju,this.Sh=t.Sh,this.Ku=this.Gl(n),this.ph=this.zl(n),this.bh=this.Hl(n),this.fi=this.Yl(n),this.Sh.di=function(o){return xa(r.fi,o,1)},this.ph.Gu.Jl=Lp.bind(null,this.fi),[4,Io(this.ph,this.fi.Uh)]);case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.Hl=function(t){return new Ll},e.prototype.Gl=function(t){var n,r=rs(t.bl.U),i=(n=t.bl,new Qp(n));return function(o,s,u){return new fp(o,s,u)}(t.credentials,i,r)},e.prototype.zl=function(t){var n,r,i,o,s,u=this;return n=this.ju,r=this.Ku,i=t.cs,o=function(a){return xa(u.fi,a,0)},s=La.Ln()?new La:new Xp,new pp(n,r,i,o,s)},e.prototype.Yl=function(t){return function(n,r,i,o,s,u,a){var c=new Ip(n,r,i,o,s,u);return a&&(c.qh=!0),c}(this.ju,this.ph,this.bh,this.Sh,t.Wl,t.Dh,!t.persistenceSettings.jl||!t.persistenceSettings.synchronizeTabs)},e.prototype.terminate=function(){return Vc(this.ph)},e}(),Ir=function(){function e(t){this.observer=t,this.muted=!1}return e.prototype.next=function(t){this.observer.next&&this.Xl(this.observer.next,t)},e.prototype.error=function(t){this.observer.error?this.Xl(this.observer.error,t):console.error("Uncaught Error in snapshot listener:",t)},e.prototype.Zl=function(){this.muted=!0},e.prototype.Xl=function(t,n){var r=this;this.muted||setTimeout(function(){r.muted||t(n)},0)},e}(),is=function(e){(function(n,r,i,o){if(!(r instanceof Array)||r.length<1)throw new m(y.INVALID_ARGUMENT,"Function FieldPath() requires its fieldNames argument to be an array with at least "+pe(1,"element")+".")})(0,e);for(var t=0;t<e.length;++t)if(Q("FieldPath","string",t,e[t]),e[t].length===0)throw new m
17(y.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this.t_=new Dt(e)},ge=function(e){function t(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return e.call(this,n)||this}return p.__extends(t,e),t.documentId=function(){return new t(Dt.v().R())},t.prototype.isEqual=function(n){if(!(n instanceof t))throw _e("isEqual","FieldPath",1,n);return this.t_.isEqual(n.t_)},t}(is),Jp=new RegExp("[~\\*/\\[\\]]"),Ne=function(e){this.e_=e},Pn=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return p.__extends(t,e),t.prototype.n_=function(n){if(n.s_!==2)throw n.s_===1?n.i_(this.e_+"() can only appear at the top level of your update data"):n.i_(this.e_+"() cannot be used with set() unless you pass {merge:true}");return n.We.push(n.path),null},t.prototype.isEqual=function(n){return n instanceof t},t}(Ne);function Xc(e,t,n){return new $c({s_:3,r_:t.settings.r_,methodName:e.e_,o_:n},t.U,t.serializer,t.ignoreUndefinedProperties)}var $p=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return p.__extends(t,e),t.prototype.n_=function(n){return new Fn(n.path,new Xe)},t.prototype.isEqual=function(n){return n instanceof t},t}(Ne),Zp=function(e){function t(n,r){var i=this;return(i=e.call(this,n)||this).a_=r,i}return p.__extends(t,e),t.prototype.n_=function(n){var r=Xc(this,n,!0),i=this.a_.map(function(s){return Se(s,r)}),o=new ve(i);return new Fn(n.path,o)},t.prototype.isEqual=function(n){return this===n},t}(Ne),td=function(e){function t(n,r){var i=this;return(i=e.call(this,n)||this).a_=r,i}return p.__extends(t,e),t.prototype.n_=function(n){var r=Xc(this,n,!0),i=this.a_.map(function(s){return Se(s,r)}),o=new ye(i);return new Fn(n.path,o)},t.prototype.isEqual=function(n){return this===n},t}(Ne),ed=function(e){function t(n,r){var i=this;return(i=e.call(this,n)||this).c_=r,i}return p.__extends(t,e),t.prototype.n_=function(n){var r=new Ye(n.serializer,rc(n.serializer,this.c_));return new Fn(n.path,r)},t.prototype.isEqual=function(n){return this===n},t}(Ne),Zr=function(){function e(t,n){if(j("GeoPoint",arguments,2),Q("GeoPoint","number",1,t),Q("GeoPoint","number",2,n),!isFinite(t)||t<-90||t>90)throw new m(y.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(n)||n<-180||n>180)throw new m(y.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this.u_=t,this.h_=n}return Object.defineProperty(e.prototype,"latitude",{get:function(){return this.u_},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"longitude",{get:function(){return this.h_},enumerable:!1,configurable:!0}),e.prototype.isEqual=function(t){return this.u_===t.u_&&this.h_===t.h_},e.prototype.toJSON=function(){return{latitude:this.u_,longitude:this.h_}},e.prototype.Y=function(t){return k(this.u_,t.u_)||k(this.h_,t.h_)},e}(),ti=function(e){this.l_=e},nd=/^__.*__$/,Wn=function(e,t,n){this.__=e,this.f_=t,this.d_=n},rd=function(){function e(t,n,r){this.data=t,this.We=n,this.fieldTransforms=r}return e.prototype.w_=function(t,n){var r=[];return this.We!==null?r.push(new ue(t,this.data,this.We,n)):r.push(new qn(t,this.data,n)),this.fieldTransforms.length>0&&r.push(new Ee(t,this.fieldTransforms)),r},e}(),Yc=function(){function e(t,n,r){this.data=t,this.We=n,this.fieldTransforms=r}return e.prototype.w_=function(t,n){var r=[new ue(t,this.data,this.We,n)];return this.fieldTransforms.length>0&&r.push(new Ee(t,this.fieldTransforms)),r},e}();function Jc(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw A()}}var $c=function(){function e(t,n,r,i,o,s){this.settings=t,this.U=n,this.serializer=r,this.ignoreUndefinedProperties=i,o===void 0&&this.m_(),this.fieldTransforms=o||[],this.We=s||[]}return Object.defineProperty(e.prototype,"path",{get:function(){return this.settings.path},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"s_",{get:function(){return this.settings.s_},enumerable:!1,configurable:!0}),e.prototype.T_=function(t){return new e(Object.assign(Object.assign({},this.settings),t),this.U,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.We)},e.prototype.E_=function(t){var n,r=(n=this.path)===null||n===void 0?void 0:n.child(t),i=this.T_({path:r,o_
17:!1});return i.I_(t),i},e.prototype.A_=function(t){var n,r=(n=this.path)===null||n===void 0?void 0:n.child(t),i=this.T_({path:r,o_:!1});return i.m_(),i},e.prototype.R_=function(t){return this.T_({path:void 0,o_:!0})},e.prototype.i_=function(t){return hs(t,this.settings.methodName,this.settings.g_||!1,this.path,this.settings.r_)},e.prototype.contains=function(t){return this.We.find(function(n){return t.T(n)})!==void 0||this.fieldTransforms.find(function(n){return t.T(n.field)})!==void 0},e.prototype.m_=function(){if(this.path)for(var t=0;t<this.path.length;t++)this.I_(this.path.get(t))},e.prototype.I_=function(t){if(t.length===0)throw this.i_("Document fields must not be empty");if(Jc(this.s_)&&nd.test(t))throw this.i_('Document fields cannot begin and end with "__"')},e}(),id=function(){function e(t,n,r){this.U=t,this.ignoreUndefinedProperties=n,this.serializer=r||rs(t)}return e.prototype.P_=function(t,n,r,i){return i===void 0&&(i=!1),new $c({s_:t,methodName:n,r_:r,path:Dt.P(),o_:!1,g_:i},this.U,this.serializer,this.ignoreUndefinedProperties)},e}();function os(e,t,n,r,i,o){o===void 0&&(o={});var s=e.P_(o.merge||o.mergeFields?2:0,t,n,i);as("Data must be an object, but it was:",s,r);var u,a,c=th(r,s);if(o.merge)u=new Je(s.We),a=s.fieldTransforms;else if(o.mergeFields){for(var h=[],f=0,l=o.mergeFields;f<l.length;f++){var d=l[f],v=void 0;if(d instanceof is)v=d.t_;else{if(typeof d!="string")throw A();v=cs(t,d,n)}if(!s.contains(v))throw new m(y.INVALID_ARGUMENT,"Field '"+v+"' is specified in your field mask but missing from your input data.");nh(h,v)||h.push(v)}u=new Je(h),a=s.fieldTransforms.filter(function(g){return u.Ye(g.field)})}else u=null,a=s.fieldTransforms;return new rd(new ie(c),u,a)}function ss(e,t,n,r){var i=e.P_(1,t,n);as("Data must be an object, but it was:",i,r);var o=[],s=new Bn;nn(r,function(a,c){var h=cs(t,a,n),f=i.A_(h);if(c instanceof Pn||c instanceof ti&&c.l_ instanceof Pn)o.push(h);else{var l=Se(c,f);l!=null&&(o.push(h),s.set(h,l))}});var u=new Je(o);return new Yc(s.Xe(),u,i.fieldTransforms)}function us(e,t,n,r,i,o){var s=e.P_(1,t,n),u=[Cn(t,r,n)],a=[i];if(o.length%2!=0)throw new m(y.INVALID_ARGUMENT,"Function "+t+"() 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(Cn(t,o[c])),a.push(o[c+1]);for(var h=[],f=new Bn,l=u.length-1;l>=0;--l)if(!nh(h,u[l])){var d=u[l],v=a[l],g=s.A_(d);if(v instanceof Pn||v instanceof ti&&v.l_ instanceof Pn)h.push(d);else{var E=Se(v,g);E!=null&&(h.push(d),f.set(d,E))}}var b=new Je(h);return new Yc(f.Xe(),b,s.fieldTransforms)}function Zc(e,t,n,r){return r===void 0&&(r=!1),Se(n,e.P_(r?4:3,t))}function Se(e,t){if(e instanceof ti&&(e=e.l_),eh(e))return as("Unsupported field value:",t,e),th(e,t);if(e instanceof Ne)return function(n,r){if(!Jc(r.s_))throw r.i_(n.e_+"() can only be used with update() and set()");if(!r.path)throw r.i_(n.e_+"() is not currently supported inside arrays");var i=n.n_(r);i&&r.fieldTransforms.push(i)}(e,t),null;if(t.path&&t.We.push(t.path),e instanceof Array){if(t.settings.o_&&t.s_!==4)throw t.i_("Nested arrays are not supported");return function(n,r){for(var i=[],o=0,s=0,u=n;s<u.length;s++){var a=Se(u[s],r.R_(o));a==null&&(a={nullValue:"NULL_VALUE"}),i.push(a),o++}return{arrayValue:{values:i}}}(e,t)}return function(n,r){if(n===null)return{nullValue:"NULL_VALUE"};if(typeof n=="number")return rc(r.serializer,n);if(typeof n=="boolean")return{booleanValue:n};if(typeof n=="string")return{stringValue:n};if(n instanceof Date){var i=ht.fromDate(n);return{timestampValue:Rr(r.serializer,i)}}if(n instanceof ht){var o=new ht(n.seconds,1e3*Math.floor(n.nanoseconds/1e3));return{timestampValue:Rr(r.serializer,o)}}if(n instanceof Zr)return{geoPointValue:{latitude:n.latitude,longitude:n.longitude}};if(n instanceof xo)return{bytesValue:ic(r.serializer,n.q)};if(n instanceof Wn){var s=r.U,u=n.__;if(!u.isEqual(s))throw r.i_("Document reference is for database "+u.projectId+"/"+u.database+" but should be for database "+s.projectId+"/"+s.database);return{referenceValue:Co(n.__||r.U,n.f_.path)}}if(n===void 0&&r.ignoreUndefinedProperties)return null;throw r.i_("Unsupported field value: "+Ct(n))}(e,t)}function th(e,t){var n={};return Fa(e)?t.path&&t.path.length>0&&t.We.push(t.path):nn(e,function(r,i){var o=Se(i,t.E_(r));o!=null&&(n[r]=o)}),{mapValue:{fields:n}}}function eh(e){return!(typeof e!="object"||e===null||e instanceof Array||e instanceof Date||e instanceof ht||e instanceof Zr||e instanceof xo||e instanceof Wn||e instanceof Ne)}function as(e,t,n){if(!eh(n)||!Ka(n)){var r=Ct(n);throw r==="an object"?t.i_(e+" a custom object"):t.i_(e+" "+r)}}function Cn(e,t,n){if(t instanceof is)return t.t_;if(typeof t=="string")return cs(e,t);throw hs("Field path arguments must be of type string or FieldPath.",e,!1,void 0,n)}function cs(e,t,n){try{return function(i){if(i.search(Jp)>
17=0)throw new m(y.INVALID_ARGUMENT,"Invalid field path ("+i+"). Paths must not contain '~', '*', '/', '[', or ']'");try{return new(ge.bind.apply(ge,p.__spreadArrays([void 0],i.split("."))))}catch{throw new m(y.INVALID_ARGUMENT,"Invalid field path ("+i+"). Paths must not be empty, begin with '.', end with '.', or contain '..'")}}(t).t_}catch(i){throw hs((r=i)instanceof Error?r.message:r.toString(),e,!1,void 0,n)}var r}function hs(e,t,n,r,i){var o=r&&!r.m(),s=i!==void 0,u="Function "+t+"() 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 m(y.INVALID_ARGUMENT,(u+=". ")+e+a)}function nh(e,t){return e.some(function(n){return n.isEqual(t)})}var od=function(){function e(t){this.Ku=t,this.y_=new Map,this.mutations=[],this.V_=!1,this.p_=null,this.b_=new Set}return e.prototype.v_=function(t){return p.__awaiter(this,void 0,void 0,function(){var n,r=this;return p.__generator(this,function(i){switch(i.label){case 0:if(this.S_(),this.mutations.length>0)throw new m(y.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(o,s){return p.__awaiter(this,void 0,void 0,function(){var u,a,c,h,f,l;return p.__generator(this,function(d){switch(d.label){case 0:return u=I(o),a=Ln(u.serializer)+"/documents",c={documents:s.map(function(v){return Be(u.serializer,v)})},[4,u.ku("BatchGetDocuments",a,c)];case 1:return h=d.sent(),f=new Map,h.forEach(function(v){var g=function(E,b){return"found"in b?function(N,D){S(!!D.found),D.found.name,D.found.updateTime;var O=Rt(N,D.found.name),U=Nt(D.found.updateTime),M=new ie({mapValue:{fields:D.found.fields}});return new C(O,U,M,{})}(E,b):"missing"in b?function(N,D){S(!!D.missing),S(!!D.readTime);var O=Rt(N,D.missing),U=Nt(D.readTime);return new $(O,U)}(E,b):A()}(u.serializer,v);f.set(g.key.toString(),g)}),l=[],[2,(s.forEach(function(v){var g=f.get(v.toString());S(!!g),l.push(g)}),l)]}})})}(this.Ku,t)];case 1:return[2,((n=i.sent()).forEach(function(o){o instanceof $||o instanceof C?r.D_(o):A()}),n)]}})})},e.prototype.set=function(t,n){this.write(n.w_(t,this.Ge(t))),this.b_.add(t.toString())},e.prototype.update=function(t,n){try{this.write(n.w_(t,this.C_(t)))}catch(r){this.p_=r}this.b_.add(t.toString())},e.prototype.delete=function(t){this.write([new Gn(t,this.Ge(t))]),this.b_.add(t.toString())},e.prototype.commit=function(){return p.__awaiter(this,void 0,void 0,function(){var t,n=this;return p.__generator(this,function(r){switch(r.label){case 0:if(this.S_(),this.p_)throw this.p_;return t=this.y_,this.mutations.forEach(function(i){t.delete(i.key.toString())}),t.forEach(function(i,o){var s=x.D(o);n.mutations.push(new Uo(s,n.Ge(s)))}),[4,function(i,o){return p.__awaiter(this,void 0,void 0,function(){var s,u,a;return p.__generator(this,function(c){switch(c.label){case 0:return s=I(i),u=Ln(s.serializer)+"/documents",a={writes:o.map(function(h){return Pr(s.serializer,h)})},[4,s.$u("Commit",u,a)];case 1:return c.sent(),[2]}})})}(this.Ku,this.mutations)];case 1:return r.sent(),this.V_=!0,[2]}})})},e.prototype.D_=function(t){var n;if(t instanceof C)n=t.version;else{if(!(t instanceof $))throw A();n=R.min()}var r=this.y_.get(t.key.toString());if(r){if(!n.isEqual(r))throw new m(y.ABORTED,"Document version changed between two reads.")}else this.y_.set(t.key.toString(),n)},e.prototype.Ge=function(t){var n=this.y_.get(t.toString());return!this.b_.has(t.toString())&&n?rt.updateTime(n):rt.ze()},e.prototype.C_=function(t){var n=this.y_.get(t.toString());if(!this.b_.has(t.toString())&&n){if(n.isEqual(R.min()))throw new m(y.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return rt.updateTime(n)}return rt.exists(!0)},e.prototype.write=function(t){this.S_(),this.mutations=this.mutations.concat(t)},e.prototype.S_=function(){},e}(),sd=function(){function e(t,n,r,i){this.cs=t,this.Ku=n,this.updateFunction=r,this.ls=i,this.N_=5,this.ys=new qo(this.cs,"transaction_retry")}return e.prototype.run=function(){this.F_()},e.prototype.F_=function(){var t=this;this.ys.gn(function(){return p.__awaiter(t,void 0,void 0,function(){var n,r,i=this;return p.__generator(this,function(o){return n=new od(this.Ku),(r=this.x_(n))&&r.then(function(s){i.cs.ws(function(){return n.commit().then(function(){i.ls.resolve(s)}).catch(function(u){i.k_(u)}
17)})}).catch(function(s){i.k_(s)}),[2]})})})},e.prototype.x_=function(t){try{var n=this.updateFunction(t);return!be(n)&&n.catch&&n.then?n:(this.ls.reject(Error("Transaction callback must return a Promise")),null)}catch(r){return this.ls.reject(r),null}},e.prototype.k_=function(t){var n=this;this.N_>0&&this.M_(t)?(this.N_-=1,this.cs.ws(function(){return n.F_(),Promise.resolve()})):this.ls.reject(t)},e.prototype.M_=function(t){if(t.name==="FirebaseError"){var n=t.code;return n==="aborted"||n==="failed-precondition"||!Xa(n)}return!1},e}(),ud=function(){function e(t,n){this.credentials=t,this.cs=n,this.clientId=Wa.k(),this.O_=new pt}return e.prototype.start=function(t,n,r,i){var o=this;this.L_(),this.bl=t;var s=new pt,u=!1;return this.credentials.Hc(function(a){if(!u)return u=!0,_("FirestoreClient","Initializing. user=",a.uid),o.B_(n,r,i,a,s).then(o.O_.resolve,o.O_.reject);o.cs.Cs(function(){return function(c,h){return p.__awaiter(this,void 0,void 0,function(){var f,l;return p.__generator(this,function(d){switch(d.label){case 0:return(f=I(c)).cs.xs(),_("RemoteStore","RemoteStore received new credentials"),l=oe(f),f.Yu.add(3),[4,tn(f)];case 1:return d.sent(),l&&f.th.set("Unknown"),[4,f.Gu.Jl(h)];case 2:return d.sent(),f.Yu.delete(3),[4,On(f)];case 3:return d.sent(),[2]}})})}(o.ph,a)})}),this.cs.ws(function(){return o.O_.promise}),s.promise},e.prototype.enableNetwork=function(){var t=this;return this.L_(),this.cs.enqueue(function(){return t.persistence.tc(!0),function(n){var r=I(n);return r.Yu.delete(0),On(r)}(t.ph)})},e.prototype.B_=function(t,n,r,i,o){return p.__awaiter(this,void 0,void 0,function(){var s,u,a=this;return p.__generator(this,function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),s={cs:this.cs,bl:this.bl,clientId:this.clientId,credentials:this.credentials,Wl:i,Dh:100,persistenceSettings:r},[4,t.initialize(s)];case 1:return c.sent(),[4,n.initialize(t,s)];case 2:return c.sent(),this.persistence=t.persistence,this.Sh=t.Sh,this.ju=t.ju,this.ql=t.ql,this.Ku=n.Ku,this.ph=n.ph,this.fi=n.fi,this.q_=n.bh,this.q_.Us=Tp.bind(null,this.fi),this.q_.js=Ap.bind(null,this.fi),this.persistence.Za(function(){return p.__awaiter(a,void 0,void 0,function(){return p.__generator(this,function(h){switch(h.label){case 0:return[4,this.terminate()];case 1:return h.sent(),[2]}})})}),o.resolve(),[3,4];case 3:if(u=c.sent(),o.reject(u),!this.U_(u))throw u;return[2,(console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+u),this.B_(new Kr,new Wr,{jl:!1},i,o))];case 4:return[2]}})})},e.prototype.U_=function(t){return t.name==="FirebaseError"?t.code===y.FAILED_PRECONDITION||t.code===y.UNIMPLEMENTED:!(typeof DOMException<"u"&&t instanceof DOMException)||t.code===22||t.code===20||t.code===11},e.prototype.L_=function(){if(this.cs.ps)throw new m(y.FAILED_PRECONDITION,"The client has already been terminated.")},e.prototype.disableNetwork=function(){var t=this;return this.L_(),this.cs.enqueue(function(){return t.persistence.tc(!1),function(n){return p.__awaiter(this,void 0,void 0,function(){var r;return p.__generator(this,function(i){switch(i.label){case 0:return(r=I(n)).Yu.add(0),[4,tn(r)];case 1:return i.sent(),r.th.set("Offline"),[2]}})})}(t.ph)})},e.prototype.terminate=function(){var t=this;this.cs.Ds();var n=new pt;return this.cs.bs(function(){return p.__awaiter(t,void 0,void 0,function(){var r,i;return p.__generator(this,function(o){switch(o.label){case 0:return o.trys.push([0,4,,5]),this.ql&&this.ql.stop(),[4,Vc(this.ph)];case 1:return o.sent(),[4,this.Sh.Di()];case 2:return o.sent(),[4,this.persistence.Di()];case 3:return o.sent(),this.credentials.Yc(),n.resolve(),[3,5];case 4:return r=o.sent(),i=Ve(r,"Failed to shutdown persistence"),n.reject(i),[3,5];case 5:return[2]}})})}),n.promise},e.prototype.waitForPendingWrites=function(){var t=this;this.L_();var n=new pt;return this.cs.ws(function(){return function(r,i){return p.__awaiter(this,void 0,void 0,function(){var o,s,u,a,c;return p.__generator(this,function(h){switch(h.label){case 0:oe((o=I(r)).ph)||_("SyncEngine","The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled."),h.label=1;case 1:return h.trys.push([1,3,,4]),[4,function(f){var l=I(f);return l.persistence.runTransaction("Get highest unacknowledged batch id","readonly",function(d){return l.Sr.qo(d)})}(o.ju)];case 2:return(s=h.sent())===-1?[2,void i.resolve()]:((u=o.Lh.get(s)||[]).push(i),o.Lh.set(s,u),[3,4]);case 3:return a=h.sent(),c=Ve(a,"Initialization of waitForPendingWrites() operation failed"),i.reject(c),[3,4];case 4:return[2]}})})}(t.fi,n)}),n.promise},e.prototype.listen=function(t,n,r){var i=this;this.L_();var o=new Ir(r),s=new ro(t,o,n);return this.cs.ws(function(){return eo(i.q_,s)}),function(){o.Zl(),i.cs.ws(function(){return no(i.q_,s)})}},e.prototype.Q_=function(t){return p.__awaiter(this,void 0,void 0,function(){var n,r=this;return p.__generator(this,function(i){switch(i.label){case 0:return this.L_(),[4,this.O_.promise];case 1:return i.sent(),n=new pt,[2,(this.cs.ws(function(){return function(o,s,u){return p.__awaiter(this,void 0,void 0,function(){var a,c,h;return p.__generator(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),[4,function(l,d){var v=I(l);return v.persistence.runTransaction("read document","readonly",function(g){return v.Cc.Cr(g,d)})}(o,s)];case 1:return(a=f.sent())instanceof C?u.resolve(a):a instanceof $?u.resolve(null):u.reject(new m(y.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 c=f.sent(),h=Ve(c,"Failed to get document '"+s+" from cache"),u.reject(h),[3,3];case 3:return[2]}})})}(r.ju,t,n)}),n.promise)]}})})},e.prototype.W_=function(t,n){return n===void 0&&(n={}),p.__awaiter(this,void 0,void 0,function(){var r,i=this;return p.__generator(this,function(o){switch(o.label){case 0:return this.L_(),[4,this.O_.promise];case 1:return o.sent(),r=new pt,[2,(this.cs.ws(function(){return function(s,u,a,c,h){var f=new Ir({next:function(d){u.ws(function(){return no(s,l)});var v=d.docs.has(a);!v&&d.fromCache?h.reject(new m(y.UNAVAILABLE,"Failed to get document because the client is offline.")):v&&d.fromCache&&c&&c.source==="server"?h.reject(new m(y.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.)')):h.resolve(d)},error:function(d){return h.reject(d)}}),l=new ro(zn(a.path),f,{includeMetadataChanges:!0,Xs:!0});return eo(s,l)}(i.q_,i.cs,t,n,r)}),r.promise)]}})})},e.prototype.j_=function(t){return p.__awaiter(this,void 0,void 0,function(){var n,r=this;return p.__generator(this,function(i){switch(i.label){case 0:return this.L_(),[4,this.O_.promise];case 1:return i.sent(),n=new pt,[2,(this.cs.ws(function(){return function(o,s,u){return p.__awaiter(this,void 0,void 0,function(){var a,c,h,f,l,d;return p.__generator(this,function(v){switch(v.label){case 0:return v.trys.push([0,2,,3]),[4,Br(o,s,!0)];case 1:return a=v.sent(),c=new Kc(s,a.Fc),h=c.wh(a.documents),f=c.yr(h,!1),u.resolve(f.snapshot),[3,3];case 2:return l=v.sent(),d=Ve(l,"Failed to execute query '"+s+" against cache"),u.reject(d),[3,3];case 3:return[2]}})})}(r.ju,t,n)}),n.promise)]}})})},e.prototype.K_=function(t,n){return n===void 0&&(n={}),p.__awaiter(this,void 0,void 0,function(){var r,i=this;return p.__generator(this,function(o){switch(o.label){case 0:return this.L_(),[4,this.O_.promise];case 1:return o.sent(),r=new pt,[2,(this.cs.ws(function(){return function(s,u,a,c,h){var f=new Ir({next:function(d){u.ws(function(){return no(s,l)}),d.fromCache&&c.source==="server"?h.reject(new m(y.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.)')):h.resolve(d)},error:function(d){return h.reject(d)}}),l=new ro(a,f,{includeMetadataChanges:!0,Xs:!0});return eo(s,l)}(i.q_,i.cs,t,n,r)}),r.promise)]}})})},e.prototype.write=function(t){var n=this;this.L_();var r=new pt;return this.cs.ws(function(){return function(i,o,s){return p.__awaiter(this,void 0,void 0,function(){var u,a,c,h;return p.__generator(this,function(f){switch(f.label){case 0:u=ns(i),f.label=1;case 1:return f.trys.push([1,5,,6]),[4,function(l,d){var v,g=I(l),E=ht.now(),b=d.reduce(function(N,D){return N.add(D.key)},V());return g.persistence.runTransaction("Locally write mutations","readwrite",function(N){return g.Cc.kr(N,b).next(function(D){v=D;for(var O=[],U=0,M=d;U<M.length;U++){var Lt=M[U],Mt=vl(Lt,v.get(Lt.key));Mt!=null&&O.push(new ue(Lt.key,Mt,wc(Mt.proto.mapValue),rt.exists(!0)))}return g.Sr.ko(N,E,O,d)})}).then(function(N){var D=N.lr(v);return{batchId:N.batchId,wr:D}})}(u.ju,o)];case 2:return a=f.sent(),u.Sh.xi(a.batchId),function(l,d,v){var g=l.Oh[l.currentUser.ti()];
17g||(g=new ot(k)),g=g.ot(d,v),l.Oh[l.currentUser.ti()]=g}(u,a.batchId,s),[4,Ae(u,a.wr)];case 3:return f.sent(),[4,sn(u.ph)];case 4:return f.sent(),[3,6];case 5:return c=f.sent(),h=Ve(c,"Failed to persist write"),s.reject(h),[3,6];case 6:return[2]}})})}(n.fi,t,r)}),r.promise},e.prototype.U=function(){return this.bl.U},e.prototype.G_=function(t){var n=this;this.L_();var r=new Ir(t);return this.cs.ws(function(){return p.__awaiter(n,void 0,void 0,function(){return p.__generator(this,function(i){return[2,function(o,s){I(o).qs.add(s),s.next()}(this.q_,r)]})})}),function(){r.Zl(),n.cs.ws(function(){return p.__awaiter(n,void 0,void 0,function(){return p.__generator(this,function(i){return[2,function(o,s){I(o).qs.delete(s)}(this.q_,r)]})})})}},Object.defineProperty(e.prototype,"z_",{get:function(){return this.cs.ps},enumerable:!1,configurable:!0}),e.prototype.transaction=function(t){var n=this;this.L_();var r=new pt;return this.cs.ws(function(){return new sd(n.cs,n.Ku,t,r).run(),Promise.resolve()}),r.promise},e}();function Un(e){return function(t,n){if(typeof t!="object"||t===null)return!1;for(var r=t,i=0,o=["next","error","complete"];i<o.length;i++){var s=o[i];if(s in r&&typeof r[s]=="function")return!0}return!1}(e)}var Oa=function(){function e(t,n,r,i,o){this.U=t,this.timestampsInSnapshots=n,this.H_=r,this.Y_=i,this.J_=o}return e.prototype.X_=function(t){switch(ne(t)){case 0:return null;case 1:return t.booleanValue;case 2:return H(t.integerValue||t.doubleValue);case 3:return this.Z_(t.timestampValue);case 4:return this.tf(t);case 5:return t.stringValue;case 6:return this.J_(Qe(t.bytesValue));case 7:return this.ef(t.referenceValue);case 8:return this.nf(t.geoPointValue);case 9:return this.sf(t.arrayValue);case 10:return this.if(t.mapValue);default:throw A()}},e.prototype.if=function(t){var n=this,r={};return nn(t.fields||{},function(i,o){r[i]=n.X_(o)}),r},e.prototype.nf=function(t){return new Zr(H(t.latitude),H(t.longitude))},e.prototype.sf=function(t){var n=this;return(t.values||[]).map(function(r){return n.X_(r)})},e.prototype.tf=function(t){switch(this.H_){case"previous":var n=tc(t);return n==null?null:this.X_(n);case"estimate":return this.Z_(xn(t));default:return null}},e.prototype.Z_=function(t){var n=re(t),r=new ht(n.seconds,n.nanos);return this.timestampsInSnapshots?r:r.toDate()},e.prototype.ef=function(t){var n=q.g(t);S(fc(n));var r=new fo(n.get(1),n.get(3)),i=new x(n.u(5));return r.isEqual(this.U)||B("Document "+i+" contains a document reference within a different database ("+r.projectId+"/"+r.database+") which is not supported. It will be treated as a reference in the current database ("+this.U.projectId+"/"+this.U.database+") instead."),this.Y_(i)},e}(),rh=W.ho,Ra=function(){function e(t){var n,r,i,o,s;if(t.host===void 0){if(t.ssl!==void 0)throw new m(y.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else qa("settings","non-empty string","host",t.host),this.host=t.host,Tt("settings","boolean","ssl",t.ssl),this.ssl=(n=t.ssl)===null||n===void 0||n;if(we("settings",t,["host","ssl","credentials","timestampsInSnapshots","cacheSizeBytes","experimentalForceLongPolling","experimentalAutoDetectLongPolling","ignoreUndefinedProperties"]),Tt("settings","object","credentials",t.credentials),this.credentials=t.credentials,Tt("settings","boolean","timestampsInSnapshots",t.timestampsInSnapshots),Tt("settings","boolean","ignoreUndefinedProperties",t.ignoreUndefinedProperties),t.timestampsInSnapshots===!0?B("The setting 'timestampsInSnapshots: true' is no longer required and should be removed."):t.timestampsInSnapshots===!1&&B("Support for 'timestampsInSnapshots: false' will be removed soon. You must update your code to handle Timestamp objects."),this.timestampsInSnapshots=(r=t.timestampsInSnapshots)===null||r===void 0||r,this.ignoreUndefinedProperties=(i=t.ignoreUndefinedProperties)!==null&&i!==void 0&&i,Tt("settings","number","cacheSizeBytes",t.cacheSizeBytes),t.cacheSizeBytes===void 0)this.cacheSizeBytes=W._o;else{if(t.cacheSizeBytes!==rh&&t.cacheSizeBytes<W.lo)throw new m
17(y.INVALID_ARGUMENT,"cacheSizeBytes must be at least "+W.lo);this.cacheSizeBytes=t.cacheSizeBytes}Tt("settings","boolean","experimentalForceLongPolling",t.experimentalForceLongPolling),this.experimentalForceLongPolling=(o=t.experimentalForceLongPolling)!==null&&o!==void 0&&o,Tt("settings","boolean","experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling),this.experimentalAutoDetectLongPolling=(s=t.experimentalAutoDetectLongPolling)!==null&&s!==void 0&&s,function(u,a,c,h){if(a===!0&&h===!0)throw new m(y.INVALID_ARGUMENT,"experimentalForceLongPolling and experimentalAutoDetectLongPolling cannot be used together.")}(0,t.experimentalForceLongPolling,0,t.experimentalAutoDetectLongPolling)}return e.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.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties},e}(),Ao=function(){function e(t,n,r,i){var o=this;if(r===void 0&&(r=new Kr),i===void 0&&(i=new Wr),this.rf=r,this.af=i,this.cf=null,this.uf=new xl,this.INTERNAL={delete:function(){return p.__awaiter(o,void 0,void 0,function(){return p.__generator(this,function(a){switch(a.label){case 0:return this.hf(),[4,this.lf.terminate()];case 1:return a.sent(),[2]}})})}},typeof t.options=="object"){var s=t;this.cf=s,this.__=e._f(s),this.ff=s.name,this.df=new sp(n)}else{var u=t;if(!u.projectId)throw new m(y.INVALID_ARGUMENT,"Must provide projectId");this.__=new fo(u.projectId,u.database),this.ff="[DEFAULT]",this.df=new Sa}this.wf=new Ra({})}return Object.defineProperty(e.prototype,"mf",{get:function(){return this.Tf||(this.Tf=new id(this.__,this.wf.ignoreUndefinedProperties)),this.Tf},enumerable:!1,configurable:!0}),e.prototype.settings=function(t){j("Firestore.settings",arguments,1),Q("Firestore.settings","object",1,t),t.merge&&delete(t=Object.assign(Object.assign({},this.wf),t)).merge;var n=new Ra(t);if(this.lf&&!this.wf.isEqual(n))throw new m(y.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.");this.wf=n,n.credentials!==void 0&&(this.df=function(r){if(!r)return new Sa;switch(r.type){case"gapi":var i=r.client;return S(!(typeof i!="object"||i===null||!i.auth||!i.auth.getAuthHeaderValueForFirstParty)),new ap(i,r.sessionIndex||"0");case"provider":return r.client;default:throw new m(y.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(n.credentials))},e.prototype.enableNetwork=function(){return this.hf(),this.lf.enableNetwork()},e.prototype.disableNetwork=function(){return this.hf(),this.lf.disableNetwork()},e.prototype.enablePersistence=function(t){var n,r;if(this.lf)throw new m(y.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 i=!1,o=!1;if(t&&(t.experimentalTabSynchronization!==void 0&&B("The 'experimentalTabSynchronization' setting will be removed. Use 'synchronizeTabs' instead."),i=(r=(n=t.synchronizeTabs)!==null&&n!==void 0?n:t.experimentalTabSynchronization)!==null&&r!==void 0&&r,o=!!t.experimentalForceOwningTab&&t.experimentalForceOwningTab,i&&o))throw new m(y.INVALID_ARGUMENT,"The 'experimentalForceOwningTab' setting cannot be used with 'synchronizeTabs'.");return this.Ef(this.rf,this.af,{jl:!0,cacheSizeBytes:this.wf.cacheSizeBytes,synchronizeTabs:i,ka:o})},e.prototype.clearPersistence=function(){return p.__awaiter(this,void 0,void 0,function(){var t,n=this;return p.__generator(this,function(r){if(this.lf!==void 0&&!this.lf.z_)throw new m(y.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");return t=new pt,[2,(this.uf.bs(function(){return p.__awaiter(n,void 0,void 0,function(){var i;return p.__generator(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.rf.clearPersistence(this.__,this.ff)];case 1:return o.sent(),t.resolve(),[3,3];case 2:return i=o.sent(),t.reject(i),[3,3];case 3:return[2]}})})}),t.promise)]})})},e.prototype.terminate=function(){return this.app._removeServiceInstance("firestore"),this.INTERNAL.delete()},Object.defineProperty(e.prototype,"If",{get:function(){return this.hf(),this.lf.z_}
17,enumerable:!1,configurable:!0}),e.prototype.waitForPendingWrites=function(){return this.hf(),this.lf.waitForPendingWrites()},e.prototype.onSnapshotsInSync=function(t){if(this.hf(),Un(t))return this.lf.G_(t);Q("Firestore.onSnapshotsInSync","function",1,t);var n={next:t};return this.lf.G_(n)},e.prototype.hf=function(){return this.lf||this.Ef(new Kr,new Wr,{jl:!1}),this.lf},e.prototype.Af=function(){return new Kf(this.__,this.ff,this.wf.host,this.wf.ssl,this.wf.experimentalForceLongPolling,this.wf.experimentalAutoDetectLongPolling)},e.prototype.Ef=function(t,n,r){var i=this.Af();return this.lf=new ud(this.df,this.uf),this.lf.start(i,t,n,r)},e._f=function(t){if(n=t.options,!Object.prototype.hasOwnProperty.call(n,"projectId"))throw new m(y.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');var n,r=t.options.projectId;if(!r||typeof r!="string")throw new m(y.INVALID_ARGUMENT,"projectId must be a string in FirebaseApp.options");return new fo(r)},Object.defineProperty(e.prototype,"app",{get:function(){if(!this.cf)throw new m(y.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.cf},enumerable:!1,configurable:!0}),e.prototype.collection=function(t){return j("Firestore.collection",arguments,1),Q("Firestore.collection","non-empty string",1,t),this.hf(),new Hr(q.g(t),this,null)},e.prototype.doc=function(t){return j("Firestore.doc",arguments,1),Q("Firestore.doc","non-empty string",1,t),this.hf(),ee.Rf(q.g(t),this,null)},e.prototype.collectionGroup=function(t){if(j("Firestore.collectionGroup",arguments,1),Q("Firestore.collectionGroup","non-empty string",1,t),t.indexOf("/")>=0)throw new m(y.INVALID_ARGUMENT,"Invalid collection ID '"+t+"' passed to function Firestore.collectionGroup(). Collection IDs must not contain '/'.");return this.hf(),new ei(function(n){return new zt(q.P(),n)}(t),this,null)},e.prototype.runTransaction=function(t){var n=this;return j("Firestore.runTransaction",arguments,1),Q("Firestore.runTransaction","function",1,t),this.hf().transaction(function(r){return t(new ih(n,r))})},e.prototype.batch=function(){return this.hf(),new oh(this)},Object.defineProperty(e,"logLevel",{get:function(){switch(Sr()){case vt.LogLevel.DEBUG:return"debug";case vt.LogLevel.ERROR:return"error";case vt.LogLevel.SILENT:return"silent";case vt.LogLevel.WARN:return"warn";case vt.LogLevel.INFO:return"info";case vt.LogLevel.VERBOSE:return"verbose";default:return"error"}},enumerable:!1,configurable:!0}),e.setLogLevel=function(t){var n;j("Firestore.setLogLevel",arguments,1),Ba("setLogLevel",["debug","error","silent","warn","info","verbose"],1,t),n=t,St.setLogLevel(n)},e.prototype.gf=function(){return this.wf.timestampsInSnapshots},e.prototype.Pf=function(){return this.wf},e}(),ih=function(){function e(t,n){this.yf=t,this.Vf=n}return e.prototype.get=function(t){var n=this;j("Transaction.get",arguments,1);var r=qt("Transaction.get",t,this.yf);return this.Vf.v_([r.f_]).then(function(i){if(!i||i.length!==1)return A();var o=i[0];if(o instanceof $)return new me(n.yf,r.f_,null,!1,!1,r.d_);if(o instanceof C)return new me(n.yf,r.f_,o,!1,!1,r.d_);throw A()})},e.prototype.set=function(t,n,r){bt("Transaction.set",arguments,2,3);var i=qt("Transaction.set",t,this.yf);r=ls("Transaction.set",r);var o=ps(i.d_,n,r),s=os(this.yf.mf,"Transaction.set",i.f_,o,i.d_!==null,r);return this.Vf.set(i.f_,s),this},e.prototype.update=function(t,n,r){for(var i,o,s=[],u=3;u<arguments.length;u++)s[u-3]=arguments[u];return typeof n=="string"||n instanceof ge?(At("Transaction.update",arguments,3),i=qt("Transaction.update",t,this.yf),o=us(this.yf.mf,"Transaction.update",i.f_,n,r,s)):(j("Transaction.update",arguments,2),i=qt("Transaction.update",t,this.yf),o=ss(this.yf.mf,"Transaction.update",i.f_,n)),this.Vf.update(i.f_,o),this},e.prototype.delete=function(t){j("Transaction.delete",arguments,1);var n=qt("Transaction.delete",t,this.yf);return this.Vf.delete(n.f_),this},e}(),oh=function(){function e(t){this.yf=t,this.pf=[],this.bf=!1}return e.prototype.set=function(t,n,r){bt("WriteBatch.set",arguments,2,3),this.vf();var i=qt("WriteBatch.set",t,this.yf);r=ls("WriteBatch.set",r);var o=ps(i.d_,n,r),s=os(this.yf.mf,"WriteBatch.set",i.f_,o,i.d_!==null,r);return this.pf=this.pf.concat(s.w_(i.f_,rt.ze())),this},e.prototype.update=function(t,n,r){for(var i,o,s=[],u=3;u<arguments.length;u++)s[u-3]=arguments[u];return this.vf(),typeof n=="string"||n instanceof ge?(At("WriteBatch.update",arguments,3),i=qt("WriteBatch.update",t,this.yf),o=us(this.yf.mf,"WriteBatch.update",i.f_,n,r,s)):(j("WriteBatch.update",arguments,2),i=qt("WriteBatch.update",t,this.yf),o=ss(this.yf.mf,"WriteBatch.update",i.f_,n)),this.pf=this.pf.concat(o.w_(i.f_,rt.exists(!0))),this},e.prototype.delete=function(t){j("WriteBatch.delete",arguments,1
17),this.vf();var n=qt("WriteBatch.delete",t,this.yf);return this.pf=this.pf.concat(new Gn(n.f_,rt.ze())),this},e.prototype.commit=function(){return this.vf(),this.bf=!0,this.pf.length>0?this.yf.hf().write(this.pf):Promise.resolve()},e.prototype.vf=function(){if(this.bf)throw new m(y.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},e}(),ee=function(e){function t(n,r,i){var o=this;return(o=e.call(this,r.__,n,i)||this).f_=n,o.firestore=r,o.d_=i,o.lf=o.firestore.hf(),o}return p.__extends(t,e),t.Rf=function(n,r,i){if(n.length%2!=0)throw new m(y.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+n.R()+" has "+n.length);return new t(new x(n),r,i)},Object.defineProperty(t.prototype,"id",{get:function(){return this.f_.path._()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return new Hr(this.f_.path.h(),this.firestore,this.d_)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return this.f_.path.R()},enumerable:!1,configurable:!0}),t.prototype.collection=function(n){if(j("DocumentReference.collection",arguments,1),Q("DocumentReference.collection","non-empty string",1,n),!n)throw new m(y.INVALID_ARGUMENT,"Must provide a non-empty collection name to collection()");var r=q.g(n);return new Hr(this.f_.path.child(r),this.firestore,null)},t.prototype.isEqual=function(n){if(!(n instanceof t))throw _e("isEqual","DocumentReference",1,n);return this.firestore===n.firestore&&this.f_.isEqual(n.f_)&&this.d_===n.d_},t.prototype.set=function(n,r){bt("DocumentReference.set",arguments,1,2),r=ls("DocumentReference.set",r);var i=ps(this.d_,n,r),o=os(this.firestore.mf,"DocumentReference.set",this.f_,i,this.d_!==null,r);return this.lf.write(o.w_(this.f_,rt.ze()))},t.prototype.update=function(n,r){for(var i,o=[],s=2;s<arguments.length;s++)o[s-2]=arguments[s];return typeof n=="string"||n instanceof ge?(At("DocumentReference.update",arguments,2),i=us(this.firestore.mf,"DocumentReference.update",this.f_,n,r,o)):(j("DocumentReference.update",arguments,1),i=ss(this.firestore.mf,"DocumentReference.update",this.f_,n)),this.lf.write(i.w_(this.f_,rt.exists(!0)))},t.prototype.delete=function(){return j("DocumentReference.delete",arguments,0),this.lf.write([new Gn(this.f_,rt.ze())])},t.prototype.onSnapshot=function(){for(var n,r,i,o=this,s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];bt("DocumentReference.onSnapshot",arguments,1,4);var a={includeMetadataChanges:!1},c=0;typeof s[c]!="object"||Un(s[c])||(we("DocumentReference.onSnapshot",a=s[c],["includeMetadataChanges"]),Tt("DocumentReference.onSnapshot","boolean","includeMetadataChanges",a.includeMetadataChanges),c++);var h={includeMetadataChanges:a.includeMetadataChanges};if(Un(s[c])){var f=s[c];s[c]=(n=f.next)===null||n===void 0?void 0:n.bind(f),s[c+1]=(r=f.error)===null||r===void 0?void 0:r.bind(f),s[c+2]=(i=f.complete)===null||i===void 0?void 0:i.bind(f)}else Q("DocumentReference.onSnapshot","function",c,s[c]),Ge("DocumentReference.onSnapshot","function",c+1,s[c+1]),Ge("DocumentReference.onSnapshot","function",c+2,s[c+2]);var l={next:function(d){s[c]&&s[c](o.Sf(d))},error:s[c+1],complete:s[c+2]};return this.lf.listen(zn(this.f_.path),h,l)},t.prototype.get=function(n){var r=this;bt("DocumentReference.get",arguments,0,1),ah("DocumentReference.get",n);var i=this.firestore.hf();return n&&n.source==="cache"?i.Q_(this.f_).then(function(o){return new me(r.firestore,r.f_,o,!0,o instanceof C&&o.Je,r.d_)}):i.W_(this.f_,n).then(function(o){return r.Sf(o)})},t.prototype.withConverter=function(n){return new t(this.f_,this.firestore,n)},t.prototype.Sf=function(n){var r=n.docs.get(this.f_);return new me(this.firestore,this.f_,r,n.fromCache,n.hasPendingWrites,this.d_)},t}(Wn),sh=function(){function e(t,n){this.hasPendingWrites=t,this.fromCache=n}return e.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},e}(),me=function(){function e(t,n,r,i,o,s){this.yf=t,this.f_=n,this.Df=r,this.Cf=i,this.Nf=o,this.d_=s}return e.prototype.data=function(t){var n=this;if(bt("DocumentSnapshot.data",arguments,0,1),t=Va("DocumentSnapshot.data",t),this.Df){if(this.d_){var r=new fs(this.yf,this.f_,this.Df,this.Cf,this.Nf,null);return this.d_.fromFirestore(r,t)}return new Oa(this.yf.__,this.yf.gf(),t.serverTimestamps||"none",function(i){return new ee(i,n.yf,null)},function(i){return new ho(i)}).X_(this.Df.rn())}},e.prototype.get=function(t,n){var r=this;if(bt("DocumentSnapshot.get",arguments,1,2),n=Va("DocumentSnapshot.get",n),this.Df){var i=this.Df.data().field(Cn("DocumentSnapshot.get",t,this.f_));if(i!==null)return new Oa(this.yf.__,this.yf.gf(),n.serverTimestamps||"none",function(o){return new ee(o,r.yf,r.d_)},function(o){return new ho(o)}).X_(i)}},Object.defineProperty(e.prototype,"id",{get:function(){return this.f_.path._()}
17,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ref",{get:function(){return new ee(this.f_,this.yf,this.d_)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"exists",{get:function(){return this.Df!==null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"metadata",{get:function(){return new sh(this.Nf,this.Cf)},enumerable:!1,configurable:!0}),e.prototype.isEqual=function(t){if(!(t instanceof e))throw _e("isEqual","DocumentSnapshot",1,t);return this.yf===t.yf&&this.Cf===t.Cf&&this.f_.isEqual(t.f_)&&(this.Df===null?t.Df===null:this.Df.isEqual(t.Df))&&this.d_===t.d_},e}(),fs=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return p.__extends(t,e),t.prototype.data=function(n){return e.prototype.data.call(this,n)},t}(me);function ad(e,t,n,r,i,o,s){var u;if(i.p()){if(o==="array-contains"||o==="array-contains-any")throw new m(y.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+o+"' queries on FieldPath.documentId().");if(o==="in"||o==="not-in"){Ca(s,o);for(var a=[],c=0,h=s;c<h.length;c++){var f=h[c];a.push(Pa(r,e,f))}u={arrayValue:{values:a}}}else u=Pa(r,e,s)}else o!=="in"&&o!=="not-in"&&o!=="array-contains-any"||Ca(s,o),u=Zc(n,t,s,o==="in"||o==="not-in");var l=gt.create(i,o,u);return function(d,v){if(v.hn()){var g=Fo(d);if(g!==null&&!g.isEqual(v.field))throw new m(y.INVALID_ARGUMENT,"Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on '"+g.toString()+"' and '"+v.field.toString()+"'");var E=Mo(d);E!==null&&uh(d,v.field,E)}var b=function(N,D){for(var O=0,U=N.filters;O<U.length;O++){var M=U[O];if(D.indexOf(M.op)>=0)return M.op}return null}(d,function(N){switch(N){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[]}}(v.op));if(b!==null)throw b===v.op?new m(y.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+v.op.toString()+"' filter."):new m(y.INVALID_ARGUMENT,"Invalid query. You cannot use '"+v.op.toString()+"' filters with '"+b.toString()+"' filters.")}(e,l),l}function cd(e,t,n){if(e.startAt!==null)throw new m(y.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(e.endAt!==null)throw new m(y.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");var r=new ze(t,n);return function(i,o){if(Mo(i)===null){var s=Fo(i);s!==null&&uh(i,s,o.field)}}(e,r),r}function Pa(e,t,n){if(typeof n=="string"){if(n==="")throw new m(y.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!jo(t)&&n.indexOf("/")!==-1)throw new m(y.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=t.path.child(q.g(n));if(!x.F(r))throw new m(y.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 Or(e,new x(r))}if(n instanceof Wn)return Or(e,n.f_);throw new m(y.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+Ct(n)+".")}function Ca(e,t){if(!Array.isArray(e)||e.length===0)throw new m(y.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+t.toString()+"' filters.");if(e.length>10)throw new m(y.INVALID_ARGUMENT,"Invalid Query. '"+t.toString()+"' filters support a maximum of 10 elements in the value array.");if(t==="in"||t==="array-contains-any"){if(e.indexOf(null)>=0)throw new m(y.INVALID_ARGUMENT,"Invalid Query. '"+t.toString()+"' filters cannot contain 'null' in the value array.");if(e.filter(function(n){return Number.isNaN(n)}).length>
170)throw new m(y.INVALID_ARGUMENT,"Invalid Query. '"+t.toString()+"' filters cannot contain 'NaN' in the value array.")}}function uh(e,t,n){if(!n.isEqual(t))throw new m(y.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+t.toString()+"' and so you must also use '"+t.toString()+"' as your first orderBy(), but your first orderBy() is on field '"+n.toString()+"' instead.")}function Ua(e){if(Ur(e)&&e.on.length===0)throw new m(y.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var ei=function(){function e(t,n,r){this.Ff=t,this.firestore=n,this.d_=r}return e.prototype.where=function(t,n,r){j("Query.where",arguments,3),zu("Query.where",3,r);var i=Ba("Query.where",["<","<=","==","!=",">=",">","array-contains","in","array-contains-any","not-in"],2,n),o=Cn("Query.where",t),s=ad(this.Ff,"Query.where",this.firestore.mf,this.firestore.__,o,i,r);return new e(function(u,a){var c=u.filters.concat([a]);return new zt(u.path,u.collectionGroup,u.on.slice(),c,u.limit,u.an,u.startAt,u.endAt)}(this.Ff,s),this.firestore,this.d_)},e.prototype.orderBy=function(t,n){var r;if(bt("Query.orderBy",arguments,1,2),Ge("Query.orderBy","non-empty string",2,n),n===void 0||n==="asc")r="asc";else{if(n!=="desc")throw new m(y.INVALID_ARGUMENT,"Function Query.orderBy() has unknown direction '"+n+"', expected 'asc' or 'desc'.");r="desc"}var i=Cn("Query.orderBy",t),o=cd(this.Ff,i,r);return new e(function(s,u){var a=s.on.concat([u]);return new zt(s.path,s.collectionGroup,a,s.filters.slice(),s.limit,s.an,s.startAt,s.endAt)}(this.Ff,o),this.firestore,this.d_)},e.prototype.limit=function(t){return j("Query.limit",arguments,1),Q("Query.limit","number",1,t),Ku("Query.limit",1,t),new e(aa(this.Ff,t,"F"),this.firestore,this.d_)},e.prototype.limitToLast=function(t){return j("Query.limitToLast",arguments,1),Q("Query.limitToLast","number",1,t),Ku("Query.limitToLast",1,t),new e(aa(this.Ff,t,"L"),this.firestore,this.d_)},e.prototype.startAt=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];At("Query.startAt",arguments,1);var i=this.xf("Query.startAt",t,n,!0);return new e(ca(this.Ff,i),this.firestore,this.d_)},e.prototype.startAfter=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];At("Query.startAfter",arguments,1);var i=this.xf("Query.startAfter",t,n,!1);return new e(ca(this.Ff,i),this.firestore,this.d_)},e.prototype.endBefore=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];At("Query.endBefore",arguments,1);var i=this.xf("Query.endBefore",t,n,!0);return new e(ha(this.Ff,i),this.firestore,this.d_)},e.prototype.endAt=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];At("Query.endAt",arguments,1);var i=this.xf("Query.endAt",t,n,!1);return new e(ha(this.Ff,i),this.firestore,this.d_)},e.prototype.isEqual=function(t){if(!(t instanceof e))throw _e("isEqual","Query",1,t);return this.firestore===t.firestore&&on(this.Ff,t.Ff)&&this.d_===t.d_},e.prototype.withConverter=function(t){return new e(this.Ff,this.firestore,t)},e.prototype.xf=function(t,n,r,i){if(zu(t,1,n),n instanceof me)return j(t,p.__spreadArrays([n],r),1),function(s,u,a,c,h){if(!c)throw new m(y.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+a+"().");for(var f=[],l=0,d=$e(s);l<d.length;l++){var v=d[l];if(v.field.p())f.push(Or(u,c.key));else{var g=c.field(v.field);if(ko(g))throw new m(y.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+v.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(g===null){var E=v.field.R();throw new m(y.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '"+E+"' (used as the orderBy) does not exist.")}f.push(g)}}return new kn(f,h)}(this.Ff,this.firestore.__,t,n.Df,i);var o=[n].concat(r);return function(s,u,a,c,h,f){var l=s.on;if(h.length>l.length)throw new m(y.INVALID_ARGUMENT,"Too many arguments provided to "+c+"(). The number of arguments must be less than or equal to the number of orderBy() clauses");for(var d=[],v=0;v<h.length;v++){var g=h[v];
17if(l[v].field.p()){if(typeof g!="string")throw new m(y.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+c+"(), but got a "+typeof g);if(!jo(s)&&g.indexOf("/")!==-1)throw new m(y.INVALID_ARGUMENT,"Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to "+c+"() must be a plain document ID, but '"+g+"' contains a slash.");var E=s.path.child(q.g(g));if(!x.F(E))throw new m(y.INVALID_ARGUMENT,"Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to "+c+"() must result in a valid document path, but '"+E+"' is not because it contains an odd number of segments.");var b=new x(E);d.push(Or(u,b))}else{var N=Zc(a,c,g);d.push(N)}}return new kn(d,f)}(this.Ff,this.firestore.__,this.firestore.mf,t,o,i)},e.prototype.onSnapshot=function(){for(var t,n,r,i=this,o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];bt("Query.onSnapshot",arguments,1,4);var u={},a=0;if(typeof o[a]!="object"||Un(o[a])||(we("Query.onSnapshot",u=o[a],["includeMetadataChanges"]),Tt("Query.onSnapshot","boolean","includeMetadataChanges",u.includeMetadataChanges),a++),Un(o[a])){var c=o[a];o[a]=(t=c.next)===null||t===void 0?void 0:t.bind(c),o[a+1]=(n=c.error)===null||n===void 0?void 0:n.bind(c),o[a+2]=(r=c.complete)===null||r===void 0?void 0:r.bind(c)}else Q("Query.onSnapshot","function",a,o[a]),Ge("Query.onSnapshot","function",a+1,o[a+1]),Ge("Query.onSnapshot","function",a+2,o[a+2]);var h={next:function(f){o[a]&&o[a](new No(i.firestore,i.Ff,f,i.d_))},error:o[a+1],complete:o[a+2]};return Ua(this.Ff),this.firestore.hf().listen(this.Ff,u,h)},e.prototype.get=function(t){var n=this;bt("Query.get",arguments,0,1),ah("Query.get",t),Ua(this.Ff);var r=this.firestore.hf();return(t&&t.source==="cache"?r.j_(this.Ff):r.K_(this.Ff,t)).then(function(i){return new No(n.firestore,n.Ff,i,n.d_)})},e}(),No=function(){function e(t,n,r,i){this.yf=t,this.$f=n,this.kf=r,this.d_=i,this.Mf=null,this.Of=null,this.metadata=new sh(r.hasPendingWrites,r.fromCache)}return Object.defineProperty(e.prototype,"docs",{get:function(){var t=[];return this.forEach(function(n){return t.push(n)}),t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"empty",{get:function(){return this.kf.docs.m()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.kf.docs.size},enumerable:!1,configurable:!0}),e.prototype.forEach=function(t,n){var r=this;bt("QuerySnapshot.forEach",arguments,1,2),Q("QuerySnapshot.forEach","function",1,t),this.kf.docs.forEach(function(i){t.call(n,r.Lf(i,r.metadata.fromCache,r.kf.Wt.has(i.key)))})},Object.defineProperty(e.prototype,"query",{get:function(){return new ei(this.$f,this.yf,this.d_)},enumerable:!1,configurable:!0}),e.prototype.docChanges=function(t){t&&(we("QuerySnapshot.docChanges",t,["includeMetadataChanges"]),Tt("QuerySnapshot.docChanges","boolean","includeMetadataChanges",t.includeMetadataChanges));var n=!(!t||!t.includeMetadataChanges);if(n&&this.kf.Kt)throw new m(y.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this.Mf&&this.Of===n||(this.Mf=function(r,i,o){if(r.Qt.m()){var s=0;return r.docChanges.map(function(a){var c=o(a.doc,r.fromCache,r.Wt.has(a.doc.key));return a.doc,{type:"added",doc:c,oldIndex:-1,newIndex:s++}})}var u=r.Qt;return r.docChanges.filter(function(a){return i||a.type!==3}).map(function(a){var c=o(a.doc,r.fromCache,r.Wt.has(a.doc.key)),h=-1,f=-1;return a.type!==0&&(h=u.indexOf(a.doc.key),u=u.delete(a.doc.key)),a.type!==1&&(f=(u=u.add(a.doc)).indexOf(a.doc.key)),{type:hd(a.type),doc:c,oldIndex:h,newIndex:f}})}(this.kf,n,this.Lf.bind(this)),this.Of=n),this.Mf},e.prototype.isEqual=function(t){if(!(t instanceof e))throw _e("isEqual","QuerySnapshot",1,t);return this.yf===t.yf&&on(this.$f,t.$f)&&this.kf.isEqual(t.kf)&&this.d_===t.d_},e.prototype.Lf=function(t,n,r){return new fs(this.yf,t.key,t,n,r,this.d_)},e}(),Hr=function(e){function t(n,r,i){var o=this;if((o=e.call(this,zn(n),r,i)||this).Bf=n,n.length%2!=1)throw new m
17(y.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+n.R()+" has "+n.length);return o}return p.__extends(t,e),Object.defineProperty(t.prototype,"id",{get:function(){return this.Ff.path._()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){var n=this.Ff.path.h();return n.m()?null:new ee(new x(n),this.firestore,null)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return this.Ff.path.R()},enumerable:!1,configurable:!0}),t.prototype.doc=function(n){bt("CollectionReference.doc",arguments,0,1),arguments.length===0&&(n=Wa.k()),Q("CollectionReference.doc","non-empty string",1,n);var r=q.g(n);return ee.Rf(this.Ff.path.child(r),this.firestore,this.d_)},t.prototype.add=function(n){j("CollectionReference.add",arguments,1);var r=this.d_?this.d_.toFirestore(n):n;Q("CollectionReference.add","object",1,r);var i=this.doc();return new ee(i.f_,this.firestore,null).set(r).then(function(){return i})},t.prototype.withConverter=function(n){return new t(this.Bf,this.firestore,n)},t}(ei);function ls(e,t){if(t===void 0)return{merge:!1};if(we(e,t,["merge","mergeFields"]),Tt(e,"boolean","merge",t.merge),function(n,r,i,o,s){o!==void 0&&function(u,a,c,h,f){if(!(h instanceof Array))throw new m(y.INVALID_ARGUMENT,"Function "+u+"() requires its "+a+" option to be an array, but it was: "+Ct(h));for(var l=0;l<h.length;++l)if(!f(h[l]))throw new m(y.INVALID_ARGUMENT,"Function "+u+"() requires all "+a+" elements to be "+c+", but the value at index "+l+" was: "+Ct(h[l]))}(n,r,i,o,s)}(e,"mergeFields","a string or a FieldPath",t.mergeFields,function(n){return typeof n=="string"||n instanceof ge}),t.mergeFields!==void 0&&t.merge!==void 0)throw new m(y.INVALID_ARGUMENT,"Invalid options passed to function "+e+'(): You cannot specify both "merge" and "mergeFields".');return t}function Va(e,t){return t===void 0?{}:(we(e,t,["serverTimestamps"]),Ga(e,0,"serverTimestamps",t.serverTimestamps,["estimate","previous","none"]),t)}function ah(e,t){Ge(e,"object",1,t),t&&(we(e,t,["source"]),Ga(e,0,"source",t.source,["default","server","cache"]))}function qt(e,t,n){if(t instanceof Wn){if(t.firestore!==n)throw new m(y.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}throw _e(e,"DocumentReference",1,t)}function hd(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return A()}}function ps(e,t,n){return e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t}var fd=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return p.__extends(t,e),t.serverTimestamp=function(){Bu("FieldValue.serverTimestamp",arguments);var n=new $p("serverTimestamp");return n.e_="FieldValue.serverTimestamp",new t(n)},t.delete=function(){Bu("FieldValue.delete",arguments);var n=new Pn("deleteField");return n.e_="FieldValue.delete",new t(n)},t.arrayUnion=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];At("FieldValue.arrayUnion",arguments,1);var i=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return At("arrayUnion()",arguments,1),new Zp("arrayUnion",o)}.apply(void 0,n);return i.e_="FieldValue.arrayUnion",new t(i)},t.arrayRemove=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];At("FieldValue.arrayRemove",arguments,1);var i=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return At("arrayRemove()",arguments,1),new td("arrayRemove",o)}.apply(void 0,n);return i.e_="FieldValue.arrayRemove",new t(i)},t.increment=function(n){Q("FieldValue.increment","number",1,n),j("FieldValue.increment",arguments,1);var r=function(i){return new ed("increment",i)}(n);return r.e_="FieldValue.increment",new t(r)},t.prototype.isEqual=function(n){return this.l_.isEqual(n.l_)},t}(ti),ld={Firestore:Ao,GeoPoint:Zr,Timestamp:ht,Blob:ho,Transaction:ih,WriteBatch:oh,DocumentReference:ee,DocumentSnapshot:me,Query:ei,QueryDocumentSnapshot:fs,QuerySnapshot:No,CollectionReference:Hr,FieldPath:ge,FieldValue:fd,setLogLevel:Ao.setLogLevel,CACHE_SIZE_UNLIMITED:rh};function Ma(e){(function(t,n){t.INTERNAL.registerComponent(new jf.Component("firestore",function(r){return function(i,o){var s=new Wr,u=new Yp(s);return new Ao(i,o,u,s)}(r.getProvider("app").getImmediate(),r.getProvider("auth-internal"))},"PUBLIC").setServiceProps(Object.assign({},ld)))})(e),e.registerVersion("@firebase/firestore","1.18.0")}Ma(Gf.default),ds.__PRIVATE_registerFirestore=Ma});var vd,pd=ii(()=>{vd=lh(ch())});pd();
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.