text: /*! For license information please see bundle.js.LICENSE.txt */
  (()=>{"use strict";var t={};t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,n)};function n(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}function i(t,e,n){if(n||2===arguments.length)for(var r,i=0,s=e.length;i<s;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}Object.create,Object.create;var s=function(){function t(){var t=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))}return t.prototype.wrapCallback=function(t){var e=this;return function(n,r){n?e.reject(n):e.resolve(r),"function"==typeof t&&(e.promise.catch((function(){})),1===t.length?t(n):t(n,r))}},t}();function o(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}var a=function(t){function n(e,r,i){var s=t.call(this,r)||this;return s.code=e,s.customData=i,s.name="FirebaseError",Object.setPrototypeOf(s,n.prototype),Error.captureStackTrace&&Error.captureStackTrace(s,c.prototype.create),s}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,t),n}(Error),c=function(){function t(t,e,n){this.service=t,this.serviceName=e,this.errors=n}return t.prototype.create=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=e[0]||{},i=this.service+"/"+t,s=this.errors[t],o=s?h(s,r):"Error",c=this.serviceName+": "+o+" ("+i+").",u=new a(i,c,r);return u},t}();function h(t,e){return t.replace(u,(function(t,n){var r=e[n];return null!=r?String(r):"<"+n+"?>"}))}var u=/\{\$([^}]+)}/g;function l(){}function f(t){return t&&t._delegate?t._delegate:t}!function(){function t(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(var t=1;t<this.blockSize;++t)this.pad_[t]=0;this.reset()}t.prototype.reset=function(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0},t.prototype.compress_=function(t,e){e||(e=0);var n=this.W_;if("string"==typeof t)for(var r=0;r<16;r++)n[r]=t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|t.charCodeAt(e+3),e+=4;else for(r=0;r<16;r++)n[r]=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3],e+=4;for(r=16;r<80;r++){var i=n[r-3]^n[r-8]^n[r-14]^n[r-16];n[r]=4294967295&(i<<1|i>>>31)}var s,o,a=this.chain_[0],c=this.chain_[1],h=this.chain_[2],u=this.chain_[3],l=this.chain_[4];for(r=0;r<80;r++)r<40?r<20?(s=u^c&(h^u),o=1518500249):(s=c^h^u,o=1859775393):r<60?(s=c&h|u&(c|h),o=2400959708):(s=c^h^u,o=3395469782),i=(a<<5|a>>>27)+s+l+o+n[r]&4294967295,l=u,u=h,h=4294967295&(c<<30|c>>>2),c=a,a=i;this.chain_[0]=this.chain_[0]+a&4294967295,this.chain_[1]=this.chain_[1]+c&4294967295,this.chain_[2]=this.chain_[2]+h&4294967295,this.chain_[3]=this.chain_[3]+u&4294967295,this.chain_[4]=this.chain_[4]+l&4294967295},t.prototype.update=function(t,e){if(null!=t){void 0===e&&(e=t.length);for(var n=e-this.blockSize,r=0,i=this.buf_,s=this.inbuf_;r<e;){if(0===s)for(;r<=n;)this.compress_(t,r),r+=this.blockSize;if("string"==typeof t){for(;r<e;)if(i[s]=t.charCodeAt(r),++r,++s===this.blockSize){this.compress_(i),s=0;break}}else for(;r<e;)if(i[s]=t[r],++r,++s===this.blockSize){this.compress_(i),s=0;break}}this.inbuf_=s,this.total_+=e}},t.prototype.digest=function(){var t=[],e=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(var n=this.blockSize-1;n>=56;n--)this.buf_[n]=255&e,e/=256;this.compress_(this.buf_);var r=0;for(n=0;n<5;n++)for(var i=24;i>=0;i-=8)t[r]=this.chain_[n]>>i&255,++r;return t}}(),function(){function t(t,e){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((function(){t(n)})).catch((function(t){n.error(t)}))}t.prototype.next=function(t){this.forEachObserver((function(e){e.next(t)}))},t.prototype.error=function(t){this.forEachObserver((function(e){e.error(t)})),this.close(t)},t.prototype.complete=function(){this.forEachObserver((function(t){t.complete()})),this.close()},t.prototype.subscribe=function(t,e,n){var r,i=this;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(t,e){if("object"!=typeof t||null===t)return!1;for(var n=0,r=["next","error","complete"];n<r.length;n++){var i=r[n];if(i in t&&"function"==typeof t[i])return!0}return!1}(t)?t:{next:t,error:e,complete:n}).next&&(r.next=l),void 0===r.error&&(r.error=l),void 0===r.complete&&(r.complete=l);var s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((function(){try{i.finalError?r.error(i.finalError):r.complete()}catch(t){}})),this.observers.push(r),s},t.prototype.unsubscribeOne=function(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},t.prototype.forEachObserver=function(t){if(!this.finalized)for(var e=0;e<this.observers.length;e++)this.sendOne(e,t)},t.prototype.sendOne=function(t,e){var n=this;this.task.then((function(){if(void 0!==n.observers&&void 0!==n.observers[t])try{e(n.observers[t])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}}))},t.prototype.close=function(t){var e=this;this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then((function(){e.observers=void 0,e.onNoObservers=void 0})))}}();var d,p=function(){function t(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}return t.prototype.setInstantiationMode=function(t){return this.instantiationMode=t,this},t.prototype.setMultipleInstances=function(t){return this.multipleInstances=t,this},t.prototype.setServiceProps=function(t){return this.serviceProps=t,this},t.prototype.setInstanceCreatedCallback=function(t){return this.onInstanceCreated=t,this},t}(),g="[DEFAULT]",m=function(){function t(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.onInitCallbacks=new Map}return t.prototype.get=function(t){var e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){var n=new s;if(this.instancesDeferred.set(e,n),this.isInitialized(e)||this.shouldAutoInitialize())try{var r=this.getOrInitializeService({instanceIdentifier:e});r&&n.resolve(r)}catch(t){}}return this.instancesDeferred.get(e).promise},t.prototype.getImmediate=function(t){var e,n=this.normalizeInstanceIdentifier(null==t?void 0:t.identifier),r=null!==(e=null==t?void 0:t.optional)&&void 0!==e&&e;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error("Service "+this.name+" is not available")}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(t){if(r)return null;throw t}},t.prototype.getComponent=function(){return this.component},t.prototype.setComponent=function(t){var e,i;if(t.name!==this.name)throw Error("Mismatching Component "+t.name+" for Provider "+this.name+".");if(this.component)throw Error("Component for "+this.name+" has already been provided");if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}(t))try{this.getOrInitializeService({instanceIdentifier:g})}catch(t){}try{for(var s=n(this.instancesDeferred.entries()),o=s.next();!o.done;o=s.next()){var a=r(o.value,2),c=a[0],h=a[1],u=this.normalizeInstanceIdentifier(c);try{var l=this.getOrInitializeService({instanceIdentifier:u});h.resolve(l)}catch(t){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}}},t.prototype.clearInstance=function(t){void 0===t&&(t=g),this.instancesDeferred.delete(t),this.instances.delete(t)},t.prototype.delete=function(){return function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))}(this,void 0,void 0,(function(){var t;return function(t,e){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}(this,(function(e){switch(e.label){case 0:return t=Array.from(this.instances.values()),[4,Promise.all(i(i([],r(t.filter((function(t){return"INTERNAL"in t})).map((function(t){return t.INTERNAL.delete()})))),r(t.filter((function(t){return"_delete"in t})).map((function(t){return t._delete()})))))];case 1:return e.sent(),[2]}}))}))},t.prototype.isComponentSet=function(){return null!=this.component},t.prototype.isInitialized=function(t){return void 0===t&&(t=g),this.instances.has(t)},t.prototype.initialize=function(t){var e,i;void 0===t&&(t={});var s=t.options,o=void 0===s?{}:s,a=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(a))throw Error(this.name+"("+a+") has already been initialized");if(!this.isComponentSet())throw Error("Component "+this.name+" has not been registered yet");var c=this.getOrInitializeService({instanceIdentifier:a,options:o});try{for(var h=n(this.instancesDeferred.entries()),u=h.next();!u.done;u=h.next()){var l=r(u.value,2),f=l[0],d=l[1];a===this.normalizeInstanceIdentifier(f)&&d.resolve(c)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(i=h.return)&&i.call(h)}finally{if(e)throw e.error}}return c},t.prototype.onInit=function(t,e){var n,r=this.normalizeInstanceIdentifier(e),i=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;i.add(t),this.onInitCallbacks.set(r,i);var s=this.instances.get(r);return s&&t(s,r),function(){i.delete(t)}},t.prototype.invokeOnInitCallbacks=function(t,e){var r,i,s=this.onInitCallbacks.get(e);if(s)try{for(var o=n(s),a=o.next();!a.done;a=o.next()){var c=a.value;try{c(t,e)}catch(t){}}}catch(t){r={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}},t.prototype.getOrInitializeService=function(t){var e,n=t.instanceIdentifier,r=t.options,i=void 0===r?{}:r,s=this.instances.get(n);if(!s&&this.component&&(s=this.component.instanceFactory(this.container,{instanceIdentifier:(e=n,e===g?void 0:e),options:i}),this.instances.set(n,s),this.invokeOnInitCallbacks(s,n),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,n,s)}catch(t){}return s||null},t.prototype.normalizeInstanceIdentifier=function(t){return void 0===t&&(t=g),this.component?this.component.multipleInstances?t:g:t},t.prototype.shouldAutoInitialize=function(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode},t}(),y=function(){function t(t){this.name=t,this.providers=new Map}return t.prototype.addComponent=function(t){var e=this.getProvider(t.name);if(e.isComponentSet())throw new Error("Component "+t.name+" has already been registered with "+this.name);e.setComponent(t)},t.prototype.addOrOverwriteComponent=function(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)},t.prototype.getProvider=function(t){if(this.providers.has(t))return this.providers.get(t);var e=new m(t,this);return this.providers.set(t,e),e},t.prototype.getProviders=function(){return Array.from(this.providers.values())},t}();function v(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)r[i]=s[o];return r}var w,E=[];!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(w||(w={}));var b={debug:w.DEBUG,verbose:w.VERBOSE,info:w.INFO,warn:w.WARN,error:w.ERROR,silent:w.SILENT},T=w.INFO,I=((d={})[w.DEBUG]="log",d[w.VERBOSE]="log",d[w.INFO]="info",d[w.WARN]="warn",d[w.ERROR]="error",d),S=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!(e<t.logLevel)){var i=(new Date).toISOString(),s=I[e];if(!s)throw new Error("Attempted to log a message with an invalid logType (value: "+e+")");console[s].apply(console,v(["["+i+"]  "+t.name+":"],n))}},_=function(){function t(t){this.name=t,this._logLevel=T,this._logHandler=S,this._userLogHandler=null,E.push(this)}return Object.defineProperty(t.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in w))throw new TypeError('Invalid value "'+t+'" assigned to `logLevel`');this._logLevel=t},enumerable:!1,configurable:!0}),t.prototype.setLogLevel=function(t){this._logLevel="string"==typeof t?b[t]:t},Object.defineProperty(t.prototype,"logHandler",{get:function(){return this._logHandler},set:function(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(t){this._userLogHandler=t},enumerable:!1,configurable:!0}),t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,v([this,w.DEBUG],t)),this._logHandler.apply(this,v([this,w.DEBUG],t))},t.prototype.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,v([this,w.VERBOSE],t)),this._logHandler.apply(this,v([this,w.VERBOSE],t))},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,v([this,w.INFO],t)),this._logHandler.apply(this,v([this,w.INFO],t))},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,v([this,w.WARN],t)),this._logHandler.apply(this,v([this,w.WARN],t))},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,v([this,w.ERROR],t)),this._logHandler.apply(this,v([this,w.ERROR],t))},t}();class A{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const N="@firebase/app-exp",C=new _("@firebase/app"),D={[N]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics-exp":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check-exp":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth-exp":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions-exp":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations-exp":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging-exp":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance-exp":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config-exp":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js","firebase-exp":"fire-js-all"},k=new Map,R=new Map;function L(t,e){try{t.container.addComponent(e)}catch(n){C.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function x(t){const e=t.name;if(R.has(e))return C.debug(`There were multiple attempts to register component ${e}.`),!1;R.set(e,t);for(const e of k.values())L(e,t);return!0}const O=new c("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists","app-deleted":"Firebase App named '{$appName}' already deleted","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function."});class M{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t),this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new p("app-exp",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw O.create("app-deleted",{appName:this._name})}}function P(t,e,n){var r;let i=null!==(r=D[t])&&void 0!==r?r:t;n&&(i+=`-${n}`);const s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const t=[`Unable to register library "${i}" with version "${e}":`];return s&&t.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&t.push("and"),o&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void C.warn(t.join(" "))}x(new p(`${i}-version`,(()=>({library:i,version:e})),"VERSION"))}x(new p("platform-logger",(t=>new A(t)),"PRIVATE")),P(N,"0.0.900-exp.6ef484a04",undefined),P("fire-js",""),P("firebase-exp","9.0.0-beta.7","app");var V=function(t,e){return(V=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function F(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var U,q="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t.g?t.g:"undefined"!=typeof self?self:{},j=j||{},B=q||self;function K(){}function z(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function $(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var H="closure_uid_"+(1e9*Math.random()>>>0),G=0;function W(t,e,n){return t.call.apply(t.bind,arguments)}function Q(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function X(t,e,n){return(X=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?W:Q).apply(null,arguments)}function Y(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function J(t,e){function n(){}n.prototype=e.prototype,t.Z=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Vb=function(t,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return e.prototype[n].apply(t,i)}}function Z(){this.s=this.s,this.o=this.o}var tt={};Z.prototype.s=!1,Z.prototype.na=function(){if(!this.s&&(this.s=!0,this.M(),0)){var t=function(t){return Object.prototype.hasOwnProperty.call(t,H)&&t[H]||(t[H]=++G)}(this);delete tt[t]}},Z.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var et=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1},nt=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,n){for(var r=t.length,i="string"==typeof t?t.split(""):t,s=0;s<r;s++)s in i&&e.call(n,i[s],s,t)};function rt(t){return Array.prototype.concat.apply([],arguments)}function it(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function st(t){return/^[\s\xa0]*$/.test(t)}var ot,at=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function ct(t,e){return-1!=t.indexOf(e)}function ht(t,e){return t<e?-1:t>e?1:0}t:{var ut=B.navigator;if(ut){var lt=ut.userAgent;if(lt){ot=lt;break t}}ot=""}function ft(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function dt(t){var e={};for(var n in t)e[n]=t[n];return e}var pt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function gt(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var s=0;s<pt.length;s++)n=pt[s],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function mt(t){return mt[" "](t),t}mt[" "]=K;var yt,vt,wt=ct(ot,"Opera"),Et=ct(ot,"Trident")||ct(ot,"MSIE"),bt=ct(ot,"Edge"),Tt=bt||Et,It=ct(ot,"Gecko")&&!(ct(ot.toLowerCase(),"webkit")&&!ct(ot,"Edge"))&&!(ct(ot,"Trident")||ct(ot,"MSIE"))&&!ct(ot,"Edge"),St=ct(ot.toLowerCase(),"webkit")&&!ct(ot,"Edge");function _t(){var t=B.document;return t?t.documentMode:void 0}t:{var At="",Nt=(vt=ot,It?/rv:([^\);]+)(\)|;)/.exec(vt):bt?/Edge\/([\d\.]+)/.exec(vt):Et?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(vt):St?/WebKit\/(\S+)/.exec(vt):wt?/(?:Version)[ \/]?(\S+)/.exec(vt):void 0);if(Nt&&(At=Nt?Nt[1]:""),Et){var Ct=_t();if(null!=Ct&&Ct>parseFloat(At)){yt=String(Ct);break t}}yt=At}var Dt,kt={};function Rt(){return t=kt,Object.prototype.hasOwnProperty.call(t,9)?t[9]:t[9]=function(){for(var t=0,e=at(String(yt)).split("."),n=at("9").split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var s=e[i]||"",o=n[i]||"";do{if(s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==s[0].length&&0==o[0].length)break;t=ht(0==s[1].length?0:parseInt(s[1],10),0==o[1].length?0:parseInt(o[1],10))||ht(0==s[2].length,0==o[2].length)||ht(s[2],o[2]),s=s[3],o=o[3]}while(0==t)}return 0<=t}();var t}B.document&&Et?Dt=_t()||parseInt(yt,10)||void 0:Dt=void 0;var Lt=Dt,xt=function(){if(!B.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{B.addEventListener("test",K,e),B.removeEventListener("test",K,e)}catch(t){}return t}();function Ot(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}function Mt(t,e){if(Ot.call(this,t?t.type:""),this.relatedTarget=this.g=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.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(It){t:{try{mt(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:Pt[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&Mt.Z.h.call(this)}}Ot.prototype.h=function(){this.defaultPrevented=!0},J(Mt,Ot);var Pt={2:"touch",3:"pen",4:"mouse"};Mt.prototype.h=function(){Mt.Z.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var Vt="closure_listenable_"+(1e6*Math.random()|0),Ft=0;function Ut(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ia=i,this.key=++Ft,this.ca=this.fa=!1}function qt(t){t.ca=!0,t.listener=null,t.proxy=null,t.src=null,t.ia=null}function jt(t){this.src=t,this.g={},this.h=0}function Bt(t,e){var n=e.type;if(n in t.g){var r,i=t.g[n],s=et(i,e);(r=0<=s)&&Array.prototype.splice.call(i,s,1),r&&(qt(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function Kt(t,e,n,r){for(var i=0;i<t.length;++i){var s=t[i];if(!s.ca&&s.listener==e&&s.capture==!!n&&s.ia==r)return i}return-1}jt.prototype.add=function(t,e,n,r,i){var s=t.toString();(t=this.g[s])||(t=this.g[s]=[],this.h++);var o=Kt(t,e,r,i);return-1<o?(e=t[o],n||(e.fa=!1)):((e=new Ut(e,this.src,s,!!r,i)).fa=n,t.push(e)),e};var zt="closure_lm_"+(1e6*Math.random()|0),$t={};function Ht(t,e,n,r,i){if(r&&r.once)return Wt(t,e,n,r,i);if(Array.isArray(e)){for(var s=0;s<e.length;s++)Ht(t,e[s],n,r,i);return null}return n=ee(n),t&&t[Vt]?t.N(e,n,$(r)?!!r.capture:!!r,i):Gt(t,e,n,!1,r,i)}function Gt(t,e,n,r,i,s){if(!e)throw Error("Invalid event type");var o=$(i)?!!i.capture:!!i,a=Zt(t);if(a||(t[zt]=a=new jt(t)),(n=a.add(e,n,r,o,s)).proxy)return n;if(r=function(){var t=Jt;return function e(n){return t.call(e.src,e.listener,n)}}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)xt||(i=o),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(Yt(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function Wt(t,e,n,r,i){if(Array.isArray(e)){for(var s=0;s<e.length;s++)Wt(t,e[s],n,r,i);return null}return n=ee(n),t&&t[Vt]?t.O(e,n,$(r)?!!r.capture:!!r,i):Gt(t,e,n,!0,r,i)}function Qt(t,e,n,r,i){if(Array.isArray(e))for(var s=0;s<e.length;s++)Qt(t,e[s],n,r,i);else r=$(r)?!!r.capture:!!r,n=ee(n),t&&t[Vt]?(t=t.i,(e=String(e).toString())in t.g&&-1<(n=Kt(s=t.g[e],n,r,i))&&(qt(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete t.g[e],t.h--))):t&&(t=Zt(t))&&(e=t.g[e.toString()],t=-1,e&&(t=Kt(e,n,r,i)),(n=-1<t?e[t]:null)&&Xt(n))}function Xt(t){if("number"!=typeof t&&t&&!t.ca){var e=t.src;if(e&&e[Vt])Bt(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Yt(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=Zt(e))?(Bt(n,t),0==n.h&&(n.src=null,e[zt]=null)):qt(t)}}}function Yt(t){return t in $t?$t[t]:$t[t]="on"+t}function Jt(t,e){if(t.ca)t=!0;else{e=new Mt(e,this);var n=t.listener,r=t.ia||t.src;t.fa&&Xt(t),t=n.call(r,e)}return t}function Zt(t){return(t=t[zt])instanceof jt?t:null}var te="__closure_events_fn_"+(1e9*Math.random()>>>0);function ee(t){return"function"==typeof t?t:(t[te]||(t[te]=function(e){return t.handleEvent(e)}),t[te])}function ne(){Z.call(this),this.i=new jt(this),this.P=this,this.I=null}function re(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new Ot(e,t);else if(e instanceof Ot)e.target=e.target||t;else{var i=e;gt(e=new Ot(r,t),i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];i=ie(o,r,!0,e)&&i}if(i=ie(o=e.g=t,r,!0,e)&&i,i=ie(o,r,!1,e)&&i,n)for(s=0;s<n.length;s++)i=ie(o=e.g=n[s],r,!1,e)&&i}function ie(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var i=!0,s=0;s<e.length;++s){var o=e[s];if(o&&!o.ca&&o.capture==n){var a=o.listener,c=o.ia||o.src;o.fa&&Bt(t.i,o),i=!1!==a.call(c,r)&&i}}return i&&!r.defaultPrevented}J(ne,Z),ne.prototype[Vt]=!0,ne.prototype.removeEventListener=function(t,e,n,r){Qt(this,t,e,n,r)},ne.prototype.M=function(){if(ne.Z.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)qt(n[r]);delete e.g[t],e.h--}}this.I=null},ne.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},ne.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var se=B.JSON.stringify;function oe(){var t=pe,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var ae,ce=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=he.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),he=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new ue}),(function(t){return t.reset()})),ue=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function le(t){B.setTimeout((function(){throw t}),0)}function fe(t,e){ae||function(){var t=B.Promise.resolve(void 0);ae=function(){t.then(ge)}}(),de||(ae(),de=!0),pe.add(t,e)}var de=!1,pe=new ce;function ge(){for(var t;t=oe();){try{t.h.call(t.g)}catch(t){le(t)}var e=he;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}de=!1}function me(t,e){ne.call(this),this.h=t||1,this.g=e||B,this.j=X(this.kb,this),this.l=Date.now()}function ye(t){t.da=!1,t.S&&(t.g.clearTimeout(t.S),t.S=null)}function ve(t,e,n){if("function"==typeof t)n&&(t=X(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=X(t.handleEvent,t)}return 2147483647<Number(e)?-1:B.setTimeout(t,e||0)}function we(t){t.g=ve((function(){t.g=null,t.i&&(t.i=!1,we(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}J(me,ne),(U=me.prototype).da=!1,U.S=null,U.kb=function(){if(this.da){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.S=this.g.setTimeout(this.j,this.h-t):(this.S&&(this.g.clearTimeout(this.S),this.S=null),re(this,"tick"),this.da&&(ye(this),this.start()))}},U.start=function(){this.da=!0,this.S||(this.S=this.g.setTimeout(this.j,this.h),this.l=Date.now())},U.M=function(){me.Z.M.call(this),ye(this),delete this.g};var Ee=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}V(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:we(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(B.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Z);function be(t){Z.call(this),this.h=t,this.g={}}J(be,Z);var Te=[];function Ie(t,e,n,r){Array.isArray(n)||(n&&(Te[0]=n.toString()),n=Te);for(var i=0;i<n.length;i++){var s=Ht(e,n[i],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}}function Se(t){ft(t.g,(function(t,e){this.g.hasOwnProperty(e)&&Xt(t)}),t),t.g={}}function _e(){this.g=!0}function Ae(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<i.length;o++)i[o]=""}}}return se(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}be.prototype.M=function(){be.Z.M.call(this),Se(this)},be.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},_e.prototype.Aa=function(){this.g=!1},_e.prototype.info=function(){};var Ne={},Ce=null;function De(){return Ce=Ce||new ne}function ke(t){Ot.call(this,Ne.Ma,t)}function Re(t){var e=De();re(e,new ke(e,t))}function Le(t,e){Ot.call(this,Ne.STAT_EVENT,t),this.stat=e}function xe(t){var e=De();re(e,new Le(e,t))}function Oe(t,e){Ot.call(this,Ne.Na,t),this.size=e}function Me(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return B.setTimeout((function(){t()}),e)}Ne.Ma="serverreachability",J(ke,Ot),Ne.STAT_EVENT="statevent",J(Le,Ot),Ne.Na="timingevent",J(Oe,Ot);var Pe={NO_ERROR:0,lb:1,yb:2,xb:3,sb:4,wb:5,zb:6,Ja:7,TIMEOUT:8,Cb:9},Ve={qb:"complete",Mb:"success",Ka:"error",Ja:"abort",Eb:"ready",Fb:"readystatechange",TIMEOUT:"timeout",Ab:"incrementaldata",Db:"progress",tb:"downloadprogress",Ub:"uploadprogress"};function Fe(){}function Ue(t){return t.h||(t.h=t.i())}function qe(){}Fe.prototype.h=null;var je,Be={OPEN:"a",pb:"b",Ka:"c",Bb:"d"};function Ke(){Ot.call(this,"d")}function ze(){Ot.call(this,"c")}function $e(){}function He(t,e,n,r){this.l=t,this.j=e,this.m=n,this.X=r||1,this.V=new be(this),this.P=We,t=Tt?125:void 0,this.W=new me(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.Y=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.N=-1,this.I=!1,this.O=0,this.L=null,this.aa=this.J=this.$=this.U=!1,this.h=new Ge}function Ge(){this.i=null,this.g="",this.h=!1}J(Ke,Ot),J(ze,Ot),J($e,Fe),$e.prototype.g=function(){return new XMLHttpRequest},$e.prototype.i=function(){return{}},je=new $e;var We=45e3,Qe={},Xe={};function Ye(t,e,n){t.K=1,t.v=bn(gn(e)),t.s=n,t.U=!0,Je(t,null)}function Je(t,e){t.F=Date.now(),nn(t),t.A=gn(t.v);var n=t.A,r=t.X;Array.isArray(r)||(r=[String(r)]),On(n.h,"t",r),t.C=0,n=t.l.H,t.h=new Ge,t.g=Mr(t.l,n?e:null,!t.s),0<t.O&&(t.L=new Ee(X(t.Ia,t,t.g),t.O)),Ie(t.V,t.g,"readystatechange",t.gb),e=t.H?dt(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.ea(t.A,t.u,t.s,e)):(t.u="GET",t.g.ea(t.A,t.u,null,e)),Re(1),function(t,e,n,r,i,s){t.info((function(){if(t.g)if(s)for(var o="",a=s.split("&"),c=0;c<a.length;c++){var h=a[c].split("=");if(1<h.length){var u=h[0];h=h[1];var l=u.split("_");o=2<=l.length&&"type"==l[1]?o+(u+"=")+h+"&":o+(u+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.X,t.s)}function Ze(t){return!!t.g&&"GET"==t.u&&2!=t.K&&t.l.Ba}function tn(t,e,n){for(var r,i=!0;!t.I&&t.C<n.length;){if((r=en(t,n))==Xe){4==e&&(t.o=4,xe(14),i=!1),Ae(t.j,t.m,null,"[Incomplete Response]");break}if(r==Qe){t.o=4,xe(15),Ae(t.j,t.m,n,"[Invalid Chunk]"),i=!1;break}Ae(t.j,t.m,r,null),cn(t,r)}Ze(t)&&r!=Xe&&r!=Qe&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,xe(16),i=!1),t.i=t.i&&i,i?0<n.length&&!t.aa&&(t.aa=!0,(e=t.l).g==t&&e.$&&!e.L&&(e.h.info("Great, no buffering proxy detected. Bytes received: "+n.length),Nr(e),e.L=!0,xe(11))):(Ae(t.j,t.m,n,"[Invalid Chunked Response]"),an(t),on(t))}function en(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?Xe:(n=Number(e.substring(n,r)),isNaN(n)?Qe:(r+=1)+n>e.length?Xe:(e=e.substr(r,n),t.C=r+n,e))}function nn(t){t.Y=Date.now()+t.P,rn(t,t.P)}function rn(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=Me(X(t.eb,t),e)}function sn(t){t.B&&(B.clearTimeout(t.B),t.B=null)}function on(t){0==t.l.G||t.I||kr(t.l,t)}function an(t){sn(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,ye(t.W),Se(t.V),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function cn(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||jn(n.i,t)))if(n.I=t.N,!t.J&&jn(n.i,t)&&3==n.G){try{var r=n.Ca.g.parse(e)}catch(s){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;Dr(n),vr(n)}Ar(n),xe(18)}}else n.ta=i[1],0<n.ta-n.U&&37500>i[2]&&n.N&&0==n.A&&!n.v&&(n.v=Me(X(n.ab,n),6e3));if(1>=qn(n.i)&&n.ka){try{n.ka()}catch(s){}n.ka=void 0}}else Lr(n,11)}else if((t.J||n.g==t)&&Dr(n),!st(e))for(i=n.Ca.g.parse(e),e=0;e<i.length;e++){var s=i[e];if(n.U=s[0],s=s[1],2==n.G)if("c"==s[0]){n.J=s[1],n.la=s[2];var o=s[3];null!=o&&(n.ma=o,n.h.info("VER="+n.ma));var a=s[4];null!=a&&(n.za=a,n.h.info("SVER="+n.za));var c=s[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.K=r,n.h.info("backChannelRequestTimeoutMs_="+r)),r=n;var h=t.g;if(h){var u=h.g?h.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(u){var l=r.i;!l.g&&(ct(u,"spdy")||ct(u,"quic")||ct(u,"h2"))&&(l.j=l.l,l.g=new Set,l.h&&(Bn(l,l.h),l.h=null))}if(r.D){var f=h.g?h.g.getResponseHeader("X-HTTP-Session-Id"):null;f&&(r.sa=f,En(r.F,r.D,f))}}n.G=3,n.j&&n.j.xa(),n.$&&(n.O=Date.now()-t.F,n.h.info("Handshake RTT: "+n.O+"ms"));var d=t;if((r=n).oa=Or(r,r.H?r.la:null,r.W),d.J){Kn(r.i,d);var p=d,g=r.K;g&&p.setTimeout(g),p.B&&(sn(p),nn(p)),r.g=d}else _r(r);0<n.l.length&&br(n)}else"stop"!=s[0]&&"close"!=s[0]||Lr(n,7);else 3==n.G&&("stop"==s[0]||"close"==s[0]?"stop"==s[0]?Lr(n,7):yr(n):"noop"!=s[0]&&n.j&&n.j.wa(s),n.A=0)}Re(4)}catch(s){}}function hn(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(z(t)||"string"==typeof t)nt(t,e,void 0);else{if(t.T&&"function"==typeof t.T)var n=t.T();else if(t.R&&"function"==typeof t.R)n=void 0;else if(z(t)||"string"==typeof t){n=[];for(var r=t.length,i=0;i<r;i++)n.push(i)}else for(i in n=[],r=0,t)n[r++]=i;i=(r=function(t){if(t.R&&"function"==typeof t.R)return t.R();if("string"==typeof t)return t.split("");if(z(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t)).length;for(var s=0;s<i;s++)e.call(void 0,r[s],n&&n[s],t)}}function un(t,e){this.h={},this.g=[],this.i=0;var n=arguments.length;if(1<n){if(n%2)throw Error("Uneven number of arguments");for(var r=0;r<n;r+=2)this.set(arguments[r],arguments[r+1])}else if(t)if(t instanceof un)for(n=t.T(),r=0;r<n.length;r++)this.set(n[r],t.get(n[r]));else for(r in t)this.set(r,t[r])}function ln(t){if(t.i!=t.g.length){for(var e=0,n=0;e<t.g.length;){var r=t.g[e];fn(t.h,r)&&(t.g[n++]=r),e++}t.g.length=n}if(t.i!=t.g.length){var i={};for(n=e=0;e<t.g.length;)fn(i,r=t.g[e])||(t.g[n++]=r,i[r]=1),e++;t.g.length=n}}function fn(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(U=He.prototype).setTimeout=function(t){this.P=t},U.gb=function(t){t=t.target;var e=this.L;e&&3==fr(t)?e.l():this.Ia(t)},U.Ia=function(t){try{if(t==this.g)t:{var e=fr(this.g),n=this.g.Da(),r=this.g.ba();if(!(3>e)&&(3!=e||Tt||this.g&&(this.h.h||this.g.ga()||dr(this.g)))){this.I||4!=e||7==n||Re(8==n||0>=r?3:2),sn(this);var i=this.g.ba();this.N=i;e:if(Ze(this)){var s=dr(this.g);t="";var o=s.length,a=4==fr(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){an(this),on(this);var c="";break e}this.h.i=new B.TextDecoder}for(n=0;n<o;n++)this.h.h=!0,t+=this.h.i.decode(s[n],{stream:a&&n==o-1});s.splice(0,o),this.h.g+=t,this.C=0,c=this.h.g}else c=this.g.ga();if(this.i=200==i,function(t,e,n,r,i,s,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+"\n"+n+"\n"+s+" "+o}))}(this.j,this.u,this.A,this.m,this.X,e,i),this.i){if(this.$&&!this.J){e:{if(this.g){var h,u=this.g;if((h=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!st(h)){var l=h;break e}}l=null}if(!(i=l)){this.i=!1,this.o=3,xe(12),an(this),on(this);break t}Ae(this.j,this.m,i,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,cn(this,i)}this.U?(tn(this,e,c),Tt&&this.i&&3==e&&(Ie(this.V,this.W,"tick",this.fb),this.W.start())):(Ae(this.j,this.m,c,null),cn(this,c)),4==e&&an(this),this.i&&!this.I&&(4==e?kr(this.l,this):(this.i=!1,nn(this)))}else 400==i&&0<c.indexOf("Unknown SID")?(this.o=3,xe(12)):(this.o=0,xe(13)),an(this),on(this)}}}catch(e){}},U.fb=function(){if(this.g){var t=fr(this.g),e=this.g.ga();this.C<e.length&&(sn(this),tn(this,t,e),this.i&&4!=t&&nn(this))}},U.cancel=function(){this.I=!0,an(this)},U.eb=function(){this.B=null;var t=Date.now();0<=t-this.Y?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(Re(3),xe(17)),an(this),this.o=2,on(this)):rn(this,this.Y-t)},(U=un.prototype).R=function(){ln(this);for(var t=[],e=0;e<this.g.length;e++)t.push(this.h[this.g[e]]);return t},U.T=function(){return ln(this),this.g.concat()},U.get=function(t,e){return fn(this.h,t)?this.h[t]:e},U.set=function(t,e){fn(this.h,t)||(this.i++,this.g.push(t)),this.h[t]=e},U.forEach=function(t,e){for(var n=this.T(),r=0;r<n.length;r++){var i=n[r],s=this.get(i);t.call(e,s,i,this)}};var dn=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function pn(t,e){if(this.i=this.s=this.j="",this.m=null,this.o=this.l="",this.g=!1,t instanceof pn){this.g=void 0!==e?e:t.g,mn(this,t.j),this.s=t.s,yn(this,t.i),vn(this,t.m),this.l=t.l,e=t.h;var n=new kn;n.i=e.i,e.g&&(n.g=new un(e.g),n.h=e.h),wn(this,n),this.o=t.o}else t&&(n=String(t).match(dn))?(this.g=!!e,mn(this,n[1]||"",!0),this.s=Tn(n[2]||""),yn(this,n[3]||"",!0),vn(this,n[4]),this.l=Tn(n[5]||"",!0),wn(this,n[6]||"",!0),this.o=Tn(n[7]||"")):(this.g=!!e,this.h=new kn(null,this.g))}function gn(t){return new pn(t)}function mn(t,e,n){t.j=n?Tn(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function yn(t,e,n){t.i=n?Tn(e,!0):e}function vn(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function wn(t,e,n){e instanceof kn?(t.h=e,function(t,e){e&&!t.j&&(Rn(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(Ln(this,e),On(this,n,t))}),t)),t.j=e}(t.h,t.g)):(n||(e=In(e,Cn)),t.h=new kn(e,t.g))}function En(t,e,n){t.h.set(e,n)}function bn(t){return En(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Tn(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function In(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Sn),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Sn(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}pn.prototype.toString=function(){var t=[],e=this.j;e&&t.push(In(e,_n,!0),":");var n=this.i;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(In(e,_n,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.i&&"/"!=n.charAt(0)&&t.push("/"),t.push(In(n,"/"==n.charAt(0)?Nn:An,!0))),(n=this.h.toString())&&t.push("?",n),(n=this.o)&&t.push("#",In(n,Dn)),t.join("")};var _n=/[#\/\?@]/g,An=/[#\?:]/g,Nn=/[#\?]/g,Cn=/[#\?@]/g,Dn=/#/g;function kn(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function Rn(t){t.g||(t.g=new un,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var s=t[n].substring(0,r);i=t[n].substring(r+1)}else s=t[n];e(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function Ln(t,e){Rn(t),e=Mn(t,e),fn(t.g.h,e)&&(t.i=null,t.h-=t.g.get(e).length,fn((t=t.g).h,e)&&(delete t.h[e],t.i--,t.g.length>2*t.i&&ln(t)))}function xn(t,e){return Rn(t),e=Mn(t,e),fn(t.g.h,e)}function On(t,e,n){Ln(t,e),0<n.length&&(t.i=null,t.g.set(Mn(t,e),it(n)),t.h+=n.length)}function Mn(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(U=kn.prototype).add=function(t,e){Rn(this),this.i=null,t=Mn(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},U.forEach=function(t,e){Rn(this),this.g.forEach((function(n,r){nt(n,(function(n){t.call(e,n,r,this)}),this)}),this)},U.T=function(){Rn(this);for(var t=this.g.R(),e=this.g.T(),n=[],r=0;r<e.length;r++)for(var i=t[r],s=0;s<i.length;s++)n.push(e[r]);return n},U.R=function(t){Rn(this);var e=[];if("string"==typeof t)xn(this,t)&&(e=rt(e,this.g.get(Mn(this,t))));else{t=this.g.R();for(var n=0;n<t.length;n++)e=rt(e,t[n])}return e},U.set=function(t,e){return Rn(this),this.i=null,xn(this,t=Mn(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},U.get=function(t,e){return t&&0<(t=this.R(t)).length?String(t[0]):e},U.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=this.g.T(),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r));r=this.R(r);for(var s=0;s<r.length;s++){var o=i;""!==r[s]&&(o+="="+encodeURIComponent(String(r[s]))),t.push(o)}}return this.i=t.join("&")};var Pn=function(t,e){this.h=t,this.g=e};function Vn(t){this.l=t||Fn,t=B.PerformanceNavigationTiming?0<(t=B.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):!!(B.g&&B.g.Ea&&B.g.Ea()&&B.g.Ea().Zb),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var Fn=10;function Un(t){return!!t.h||!!t.g&&t.g.size>=t.j}function qn(t){return t.h?1:t.g?t.g.size:0}function jn(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Bn(t,e){t.g?t.g.add(e):t.h=e}function Kn(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function zn(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var i=F(t.g.values()),s=i.next();!s.done;s=i.next()){var o=s.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}return it(t.i)}function $n(){}function Hn(){this.g=new $n}function Gn(t,e,n){var r=n||"";try{hn(t,(function(t,n){var i=t;$(t)&&(i=se(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function Wn(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}function Qn(t){this.l=t.$b||null,this.j=t.ib||!1}function Xn(t,e){ne.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Yn,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}Vn.prototype.cancel=function(){var t,e;if(this.i=zn(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=F(this.g.values()),r=n.next();!r.done;r=n.next())r.value.cancel()}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},$n.prototype.stringify=function(t){return B.JSON.stringify(t,void 0)},$n.prototype.parse=function(t){return B.JSON.parse(t,void 0)},J(Qn,Fe),Qn.prototype.g=function(){return new Xn(this.l,this.j)},Qn.prototype.i=function(t){return function(){return t}}({}),J(Xn,ne);var Yn=0;function Jn(t){t.j.read().then(t.Sa.bind(t)).catch(t.ha.bind(t))}function Zn(t){t.readyState=4,t.l=null,t.j=null,t.A=null,tr(t)}function tr(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(U=Xn.prototype).open=function(t,e){if(this.readyState!=Yn)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,tr(this)},U.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||B).fetch(new Request(this.B,e)).then(this.Va.bind(this),this.ha.bind(this))},U.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted."),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,Zn(this)),this.readyState=Yn},U.Va=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,tr(this)),this.g&&(this.readyState=3,tr(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ta.bind(this),this.ha.bind(this));else if(void 0!==B.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Jn(this)}else t.text().then(this.Ua.bind(this),this.ha.bind(this))},U.Sa=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?Zn(this):tr(this),3==this.readyState&&Jn(this)}},U.Ua=function(t){this.g&&(this.response=this.responseText=t,Zn(this))},U.Ta=function(t){this.g&&(this.response=t,Zn(this))},U.ha=function(){this.g&&Zn(this)},U.setRequestHeader=function(t,e){this.v.append(t,e)},U.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},U.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(Xn.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var er=B.JSON.parse;function nr(t){ne.call(this),this.headers=new un,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=rr,this.K=this.L=!1}J(nr,ne);var rr="",ir=/^https?$/i,sr=["POST","PUT"];function or(t){return"content-type"==t.toLowerCase()}function ar(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,cr(t),ur(t)}function cr(t){t.D||(t.D=!0,re(t,"complete"),re(t,"error"))}function hr(t){if(t.h&&void 0!==j&&(!t.C[1]||4!=fr(t)||2!=t.ba()))if(t.v&&4==fr(t))ve(t.Fa,0,t);else if(re(t,"readystatechange"),4==fr(t)){t.h=!1;try{var e,n=t.ba();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var s=String(t.H).match(dn)[1]||null;if(!s&&B.self&&B.self.location){var o=B.self.location.protocol;s=o.substr(0,o.length-1)}i=!ir.test(s?s.toLowerCase():"")}e=i}if(e)re(t,"complete"),re(t,"success");else{t.m=6;try{var a=2<fr(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.ba()+"]",cr(t)}}finally{ur(t)}}}function ur(t,e){if(t.g){lr(t);var n=t.g,r=t.C[0]?K:null;t.g=null,t.C=null,e||re(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function lr(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(B.clearTimeout(t.A),t.A=null)}function fr(t){return t.g?t.g.readyState:0}function dr(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case rr:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function pr(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=function(t){var e="";return ft(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):En(t,e,n))}function gr(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function mr(t){this.za=0,this.l=[],this.h=new _e,this.la=this.oa=this.F=this.W=this.g=this.sa=this.D=this.aa=this.o=this.P=this.s=null,this.Za=this.V=0,this.Xa=gr("failFast",!1,t),this.N=this.v=this.u=this.m=this.j=null,this.X=!0,this.I=this.ta=this.U=-1,this.Y=this.A=this.C=0,this.Pa=gr("baseRetryDelayMs",5e3,t),this.$a=gr("retryDelaySeedMs",1e4,t),this.Ya=gr("forwardChannelMaxRetries",2,t),this.ra=gr("forwardChannelRequestTimeoutMs",2e4,t),this.qa=t&&t.xmlHttpFactory||void 0,this.Ba=t&&t.Yb||!1,this.K=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.J="",this.i=new Vn(t&&t.concurrentRequestLimit),this.Ca=new Hn,this.ja=t&&t.fastHandshake||!1,this.Ra=t&&t.Wb||!1,t&&t.Aa&&this.h.Aa(),t&&t.forceLongPolling&&(this.X=!1),this.$=!this.ja&&this.X&&t&&t.detectBufferingProxy||!1,this.ka=void 0,this.O=0,this.L=!1,this.B=null,this.Wa=!t||!1!==t.Xb}function yr(t){if(wr(t),3==t.G){var e=t.V++,n=gn(t.F);En(n,"SID",t.J),En(n,"RID",e),En(n,"TYPE","terminate"),Ir(t,n),(e=new He(t,t.h,e,void 0)).K=2,e.v=bn(gn(n)),n=!1,B.navigator&&B.navigator.sendBeacon&&(n=B.navigator.sendBeacon(e.v.toString(),"")),!n&&B.Image&&((new Image).src=e.v,n=!0),n||(e.g=Mr(e.l,null),e.g.ea(e.v)),e.F=Date.now(),nn(e)}xr(t)}function vr(t){t.g&&(Nr(t),t.g.cancel(),t.g=null)}function wr(t){vr(t),t.u&&(B.clearTimeout(t.u),t.u=null),Dr(t),t.i.cancel(),t.m&&("number"==typeof t.m&&B.clearTimeout(t.m),t.m=null)}function Er(t,e){t.l.push(new Pn(t.Za++,e)),3==t.G&&br(t)}function br(t){Un(t.i)||t.m||(t.m=!0,fe(t.Ha,t),t.C=0)}function Tr(t,e){var n;n=e?e.m:t.V++;var r=gn(t.F);En(r,"SID",t.J),En(r,"RID",n),En(r,"AID",t.U),Ir(t,r),t.o&&t.s&&pr(r,t.o,t.s),n=new He(t,t.h,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.l=e.D.concat(t.l)),e=Sr(t,n,1e3),n.setTimeout(Math.round(.5*t.ra)+Math.round(.5*t.ra*Math.random())),Bn(t.i,n),Ye(n,r,e)}function Ir(t,e){t.j&&hn({},(function(t,n){En(e,n,t)}))}function Sr(t,e,n){n=Math.min(t.l.length,n);var r=t.j?X(t.j.Oa,t.j,t):null;t:for(var i=t.l,s=-1;;){var o=["count="+n];-1==s?0<n?(s=i[0].h,o.push("ofs="+s)):s=0:o.push("ofs="+s);for(var a=!0,c=0;c<n;c++){var h=i[c].h,u=i[c].g;if(0>(h-=s))s=Math.max(0,i[c].h-100),a=!1;else try{Gn(u,o,"req"+h+"_")}catch(t){r&&r(u)}}if(a){r=o.join("&");break t}}return t=t.l.splice(0,n),e.D=t,r}function _r(t){t.g||t.u||(t.Y=1,fe(t.Ga,t),t.A=0)}function Ar(t){return!(t.g||t.u||3<=t.A||(t.Y++,t.u=Me(X(t.Ga,t),Rr(t,t.A)),t.A++,0))}function Nr(t){null!=t.B&&(B.clearTimeout(t.B),t.B=null)}function Cr(t){t.g=new He(t,t.h,"rpc",t.Y),null===t.o&&(t.g.H=t.s),t.g.O=0;var e=gn(t.oa);En(e,"RID","rpc"),En(e,"SID",t.J),En(e,"CI",t.N?"0":"1"),En(e,"AID",t.U),Ir(t,e),En(e,"TYPE","xmlhttp"),t.o&&t.s&&pr(e,t.o,t.s),t.K&&t.g.setTimeout(t.K);var n=t.g;t=t.la,n.K=1,n.v=bn(gn(e)),n.s=null,n.U=!0,Je(n,t)}function Dr(t){null!=t.v&&(B.clearTimeout(t.v),t.v=null)}function kr(t,e){var n=null;if(t.g==e){Dr(t),Nr(t),t.g=null;var r=2}else{if(!jn(t.i,e))return;n=e.D,Kn(t.i,e),r=1}if(t.I=e.N,0!=t.G)if(e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var i=t.C;re(r=De(),new Oe(r,n,e,i)),br(t)}else _r(t);else if(3==(i=e.o)||0==i&&0<t.I||!(1==r&&function(t,e){return!(qn(t.i)>=t.i.j-(t.m?1:0)||(t.m?(t.l=e.D.concat(t.l),0):1==t.G||2==t.G||t.C>=(t.Xa?0:t.Ya)||(t.m=Me(X(t.Ha,t,e),Rr(t,t.C)),t.C++,0)))}(t,e)||2==r&&Ar(t)))switch(n&&0<n.length&&(e=t.i,e.i=e.i.concat(n)),i){case 1:Lr(t,5);break;case 4:Lr(t,10);break;case 3:Lr(t,6);break;default:Lr(t,2)}}function Rr(t,e){var n=t.Pa+Math.floor(Math.random()*t.$a);return t.j||(n*=2),n*e}function Lr(t,e){if(t.h.info("Error code "+e),2==e){var n=null;t.j&&(n=null);var r=X(t.jb,t);n||(n=new pn("//www.google.com/images/cleardot.gif"),B.location&&"http"==B.location.protocol||mn(n,"https"),bn(n)),function(t,e){var n=new _e;if(B.Image){var r=new Image;r.onload=Y(Wn,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Y(Wn,n,r,"TestLoadImage: error",!1,e),r.onabort=Y(Wn,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Y(Wn,n,r,"TestLoadImage: timeout",!1,e),B.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else xe(2);t.G=0,t.j&&t.j.va(e),xr(t),wr(t)}function xr(t){t.G=0,t.I=-1,t.j&&(0==zn(t.i).length&&0==t.l.length||(t.i.i.length=0,it(t.l),t.l.length=0),t.j.ua())}function Or(t,e,n){var r=function(t){return t instanceof pn?gn(t):new pn(t,void 0)}(n);if(""!=r.i)e&&yn(r,e+"."+r.i),vn(r,r.m);else{var i=B.location;r=function(t,e,n,r){var i=new pn(null,void 0);return t&&mn(i,t),e&&yn(i,e),n&&vn(i,n),r&&(i.l=r),i}(i.protocol,e?e+"."+i.hostname:i.hostname,+i.port,n)}return t.aa&&ft(t.aa,(function(t,e){En(r,e,t)})),e=t.D,n=t.sa,e&&n&&En(r,e,n),En(r,"VER",t.ma),Ir(t,r),r}function Mr(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Ba&&!t.qa?new nr(new Qn({ib:!0})):new nr(t.qa)).L=t.H,e}function Pr(){}function Vr(){if(Et&&!(10<=Number(Lt)))throw Error("Environmental error: no available transport.")}function Fr(t,e){ne.call(this),this.g=new mr(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.P=t,(t=e&&e.httpHeadersOverwriteParam)&&!st(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!st(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&e in(t=this.h)&&delete t[e]),this.j=new jr(this)}function Ur(t){Ke.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function qr(){ze.call(this),this.status=1}function jr(t){this.g=t}(U=nr.prototype).ea=function(t,e,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():je.g(),this.C=this.u?Ue(this.u):Ue(je),this.g.onreadystatechange=X(this.Fa,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(t){return void ar(this,t)}t=n||"";var i=new un(this.headers);r&&hn(r,(function(t,e){i.set(e,t)})),r=function(t){t:{for(var e=or,n=t.length,r="string"==typeof t?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t)){e=i;break t}e=-1}return 0>e?null:"string"==typeof t?t.charAt(e):t[e]}(i.T()),n=B.FormData&&t instanceof B.FormData,!(0<=et(sr,e))||r||n||i.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),i.forEach((function(t,e){this.g.setRequestHeader(e,t)}),this),this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{lr(this),0<this.B&&((this.K=function(t){return Et&&Rt()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=X(this.pa,this)):this.A=ve(this.pa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(t){ar(this,t)}},U.pa=function(){void 0!==j&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,re(this,"timeout"),this.abort(8))},U.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,re(this,"complete"),re(this,"abort"),ur(this))},U.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),ur(this,!0)),nr.Z.M.call(this)},U.Fa=function(){this.s||(this.F||this.v||this.l?hr(this):this.cb())},U.cb=function(){hr(this)},U.ba=function(){try{return 2<fr(this)?this.g.status:-1}catch(t){return-1}},U.ga=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},U.Qa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),er(e)}},U.Da=function(){return this.m},U.La=function(){return"string"==typeof this.j?this.j:String(this.j)},(U=mr.prototype).ma=8,U.G=1,U.hb=function(t){try{this.h.info("Origin Trials invoked: "+t)}catch(t){}},U.Ha=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.V=Math.floor(1e5*Math.random()),t=this.V++;var e=new He(this,this.h,t,void 0),n=this.s;if(this.P&&(n?gt(n=dt(n),this.P):n=this.P),null===this.o&&(e.H=n),this.ja)t:{for(var r=0,i=0;i<this.l.length;i++){var s=this.l[i];if(void 0===(s="__data__"in s.g&&"string"==typeof(s=s.g.__data__)?s.length:void 0))break;if(4096<(r+=s)){r=i;break t}if(4096===r||i===this.l.length-1){r=i+1;break t}}r=1e3}else r=1e3;r=Sr(this,e,r),En(i=gn(this.F),"RID",t),En(i,"CVER",22),this.D&&En(i,"X-HTTP-Session-Id",this.D),Ir(this,i),this.o&&n&&pr(i,this.o,n),Bn(this.i,e),this.Ra&&En(i,"TYPE","init"),this.ja?(En(i,"$req",r),En(i,"SID","null"),e.$=!0,Ye(e,i,null)):Ye(e,i,r),this.G=2}}else 3==this.G&&(t?Tr(this,t):0==this.l.length||Un(this.i)||Tr(this))},U.Ga=function(){if(this.u=null,Cr(this),this.$&&!(this.L||null==this.g||0>=this.O)){var t=2*this.O;this.h.info("BP detection timer enabled: "+t),this.B=Me(X(this.bb,this),t)}},U.bb=function(){this.B&&(this.B=null,this.h.info("BP detection timeout reached."),this.h.info("Buffering proxy detected and switch to long-polling!"),this.N=!1,this.L=!0,xe(10),vr(this),Cr(this))},U.ab=function(){null!=this.v&&(this.v=null,vr(this),Ar(this),xe(19))},U.jb=function(t){t?(this.h.info("Successfully pinged google.com"),xe(2)):(this.h.info("Failed to ping google.com"),xe(1))},(U=Pr.prototype).xa=function(){},U.wa=function(){},U.va=function(){},U.ua=function(){},U.Oa=function(){},Vr.prototype.g=function(t,e){return new Fr(t,e)},J(Fr,ne),Fr.prototype.m=function(){this.g.j=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;t.Wa&&(t.h.info("Origin Trials enabled."),fe(X(t.hb,t,e))),xe(0),t.W=e,t.aa=n||{},t.N=t.X,t.F=Or(t,null,t.W),br(t)},Fr.prototype.close=function(){yr(this.g)},Fr.prototype.u=function(t){if("string"==typeof t){var e={};e.__data__=t,Er(this.g,e)}else this.v?((e={}).__data__=se(t),Er(this.g,e)):Er(this.g,t)},Fr.prototype.M=function(){this.g.j=null,delete this.j,yr(this.g),delete this.g,Fr.Z.M.call(this)},J(Ur,Ke),J(qr,ze),J(jr,Pr),jr.prototype.xa=function(){re(this.g,"a")},jr.prototype.wa=function(t){re(this.g,new Ur(t))},jr.prototype.va=function(t){re(this.g,new qr(t))},jr.prototype.ua=function(){re(this.g,"b")},Vr.prototype.createWebChannel=Vr.prototype.g,Fr.prototype.send=Fr.prototype.u,Fr.prototype.open=Fr.prototype.m,Fr.prototype.close=Fr.prototype.close,Pe.NO_ERROR=0,Pe.TIMEOUT=8,Pe.HTTP_ERROR=6,Ve.COMPLETE="complete",qe.EventType=Be,Be.OPEN="a",Be.CLOSE="b",Be.ERROR="c",Be.MESSAGE="d",ne.prototype.listen=ne.prototype.N,nr.prototype.listenOnce=nr.prototype.O,nr.prototype.getLastError=nr.prototype.La,nr.prototype.getLastErrorCode=nr.prototype.Da,nr.prototype.getStatus=nr.prototype.ba,nr.prototype.getResponseJson=nr.prototype.Qa,nr.prototype.getResponseText=nr.prototype.ga,nr.prototype.send=nr.prototype.ea;var Br=Pe,Kr=Ve,zr=Ne,$r=10,Hr=11,Gr=Qn,Wr=qe,Qr=nr;let Xr="8.7.1";class Yr{constructor(t,e){this.previousValue=t,e&&(e.sequenceNumberHandler=t=>this.t(t),this.i=t=>e.writeSequenceNumber(t))}t(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this.i&&this.i(t),t}}Yr.o=-1;const Jr={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class Zr extends Error{constructor(t,e){super(e),this.code=t,this.message=e,this.name="FirebaseError",this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}const ti=new _("@firebase/firestore");function ei(){return ti.logLevel}function ni(t,...e){if(ti.logLevel<=w.DEBUG){const n=e.map(si);ti.debug(`Firestore (${Xr}): ${t}`,...n)}}function ri(t,...e){if(ti.logLevel<=w.ERROR){const n=e.map(si);ti.error(`Firestore (${Xr}): ${t}`,...n)}}function ii(t,...e){if(ti.logLevel<=w.WARN){const n=e.map(si);ti.warn(`Firestore (${Xr}): ${t}`,...n)}}function si(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}var e}function oi(t="Unexpected state"){const e=`FIRESTORE (${Xr}) INTERNAL ASSERTION FAILED: `+t;throw ri(e),new Error(e)}function ai(t,e){t||oi()}function ci(t,e){return t}function hi(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n}class ui{static u(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length;let n="";for(;n.length<20;){const r=hi(40);for(let i=0;i<r.length;++i)n.length<20&&r[i]<e&&(n+=t.charAt(r[i]%t.length))}return n}}function li(t,e){return t<e?-1:t>e?1:0}function fi(t,e,n){return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}class di{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Zr(Jr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Zr(Jr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Zr(Jr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Zr(Jr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return di.fromMillis(Date.now())}static fromDate(t){return di.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new di(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?li(this.nanoseconds,t.nanoseconds):li(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}class pi{constructor(t){this.timestamp=t}static fromTimestamp(t){return new pi(t)}static min(){return new pi(new di(0,0))}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}function gi(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function mi(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function yi(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}class vi{constructor(t,e,n){void 0===e?e=0:e>t.length&&oi(),void 0===n?n=t.length-e:n>t.length-e&&oi(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===vi.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof vi?t.forEach((t=>{e.push(t)})):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++){const n=t.get(r),i=e.get(r);if(n<i)return-1;if(n>i)return 1}return t.length<e.length?-1:t.length>e.length?1:0}}class wi extends vi{construct(t,e,n){return new wi(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new Zr(Jr.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new wi(e)}static emptyPath(){return new wi([])}}const Ei=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class bi extends vi{construct(t,e,n){return new bi(t,e,n)}static isValidIdentifier(t){return Ei.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),bi.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new bi(["__name__"])}static fromServerFormat(t){const e=[];let n="",r=0;const i=()=>{if(0===n.length)throw new Zr(Jr.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let s=!1;for(;r<t.length;){const e=t[r];if("\\"===e){if(r+1===t.length)throw new Zr(Jr.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[r+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new Zr(Jr.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=e,r+=2}else"`"===e?(s=!s,r++):"."!==e||s?(n+=e,r++):(i(),r++)}if(i(),s)throw new Zr(Jr.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new bi(e)}static emptyPath(){return new bi([])}}class Ti{constructor(t){this.fields=t,t.sort(bi.comparator)}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return fi(this.fields,t.fields,((t,e)=>t.isEqual(e)))}}class Ii{constructor(t){this.binaryString=t}static fromBase64String(t){const e=atob(t);return new Ii(e)}static fromUint8Array(t){const e=function(t){let e="";for(let n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t);return new Ii(e)}toBase64(){return t=this.binaryString,btoa(t);var t}toUint8Array(){return function(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return li(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}Ii.EMPTY_BYTE_STRING=new Ii("");const Si=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function _i(t){if(ai(!!t),"string"==typeof t){let e=0;const n=Si.exec(t);if(ai(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:Ai(t.seconds),nanos:Ai(t.nanos)}}function Ai(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function Ni(t){return"string"==typeof t?Ii.fromBase64String(t):Ii.fromUint8Array(t)}function Ci(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function Di(t){const e=t.mapValue.fields.__previous_value__;return Ci(e)?Di(e):e}function ki(t){const e=_i(t.mapValue.fields.__local_write_time__.timestampValue);return new di(e.seconds,e.nanos)}function Ri(t){return null==t}function Li(t){return 0===t&&1/t==-1/0}class xi{constructor(t){this.path=t}static fromPath(t){return new xi(wi.fromString(t))}static fromName(t){return new xi(wi.fromString(t).popFirst(5))}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}isEqual(t){return null!==t&&0===wi.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return wi.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new xi(new wi(t.slice()))}}function Oi(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?Ci(t)?4:10:oi()}function Mi(t,e){const n=Oi(t);if(n!==Oi(e))return!1;switch(n){case 0:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return ki(t).isEqual(ki(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=_i(t.timestampValue),r=_i(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return Ni(t.bytesValue).isEqual(Ni(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Ai(t.geoPointValue.latitude)===Ai(e.geoPointValue.latitude)&&Ai(t.geoPointValue.longitude)===Ai(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Ai(t.integerValue)===Ai(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=Ai(t.doubleValue),r=Ai(e.doubleValue);return n===r?Li(n)===Li(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return fi(t.arrayValue.values||[],e.arrayValue.values||[],Mi);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(gi(n)!==gi(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!Mi(n[t],r[t])))return!1;return!0}(t,e);default:return oi()}}function Pi(t,e){return void 0!==(t.values||[]).find((t=>Mi(t,e)))}function Vi(t,e){const n=Oi(t),r=Oi(e);if(n!==r)return li(n,r);switch(n){case 0:return 0;case 1:return li(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Ai(t.integerValue||t.doubleValue),r=Ai(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return Fi(t.timestampValue,e.timestampValue);case 4:return Fi(ki(t),ki(e));case 5:return li(t.stringValue,e.stringValue);case 6:return function(t,e){const n=Ni(t),r=Ni(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=li(n[t],r[t]);if(0!==e)return e}return li(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=li(Ai(t.latitude),Ai(e.latitude));return 0!==n?n:li(Ai(t.longitude),Ai(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=Vi(n[t],r[t]);if(e)return e}return li(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){const n=t.fields||{},r=Object.keys(n),i=e.fields||{},s=Object.keys(i);r.sort(),s.sort();for(let t=0;t<r.length&&t<s.length;++t){const e=li(r[t],s[t]);if(0!==e)return e;const o=Vi(n[r[t]],i[s[t]]);if(0!==o)return o}return li(r.length,s.length)}(t.mapValue,e.mapValue);default:throw oi()}}function Fi(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return li(t,e);const n=_i(t),r=_i(e),i=li(n.seconds,r.seconds);return 0!==i?i:li(n.nanos,r.nanos)}function Ui(t){return qi(t)}function qi(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=_i(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?Ni(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,xi.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const r of t.values||[])n?n=!1:e+=",",e+=qi(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const i of e)r?r=!1:n+=",",n+=`${i}:${qi(t.fields[i])}`;return n+"}"}(t.mapValue):oi();var e,n}function ji(t){return!!t&&"integerValue"in t}function Bi(t){return!!t&&"arrayValue"in t}function Ki(t){return!!t&&"nullValue"in t}function zi(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function $i(t){return!!t&&"mapValue"in t}function Hi(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return mi(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=Hi(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Hi(t.arrayValue.values[n]);return e}return Object.assign({},t)}class Gi{constructor(t){this.value=t}static empty(){return new Gi({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n<t.length-1;++n)if(e=(e.mapValue.fields||{})[t.get(n)],!$i(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Hi(e)}setAll(t){let e=bi.emptyPath(),n={},r=[];t.forEach(((t,i)=>{if(!e.isImmediateParentOf(i)){const t=this.getFieldsMap(e);this.applyChanges(t,n,r),n={},r=[],e=i.popLast()}t?n[i.lastSegment()]=Hi(t):r.push(i.lastSegment())}));const i=this.getFieldsMap(e);this.applyChanges(i,n,r)}delete(t){const e=this.field(t.popLast());$i(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Mi(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;n<t.length;++n){let r=e.mapValue.fields[t.get(n)];$i(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=r),e=r}return e.mapValue.fields}applyChanges(t,e,n){mi(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new Gi(Hi(this.value))}}function Wi(t){const e=[];return mi(t.fields,((t,n)=>{const r=new bi([t]);if($i(n)){const t=Wi(n.mapValue).fields;if(0===t.length)e.push(r);else for(const n of t)e.push(r.child(n))}else e.push(r)})),new Ti(e)}class Qi{constructor(t,e,n,r,i){this.key=t,this.documentType=e,this.version=n,this.data=r,this.documentState=i}static newInvalidDocument(t){return new Qi(t,0,pi.min(),Gi.empty(),0)}static newFoundDocument(t,e,n){return new Qi(t,1,e,n,0)}static newNoDocument(t,e){return new Qi(t,2,e,Gi.empty(),0)}static newUnknownDocument(t,e){return new Qi(t,3,e,Gi.empty(),2)}convertToFoundDocument(t,e){return this.version=t,this.documentType=1,this.data=e,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=Gi.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=Gi.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(t){return t instanceof Qi&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}clone(){return new Qi(this.key,this.documentType,this.version,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}class Xi{constructor(t,e=null,n=[],r=[],i=null,s=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=s,this.endAt=o,this.h=null}}function Yi(t,e=null,n=[],r=[],i=null,s=null,o=null){return new Xi(t,e,n,r,i,s,o)}function Ji(t){const e=ci(t);if(null===e.h){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>function(t){return t.field.canonicalString()+t.op.toString()+Ui(t.value)}(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),Ri(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=ls(e.startAt)),e.endAt&&(t+="|ub:",t+=ls(e.endAt)),e.h=t}return e.h}function Zi(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!ds(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let i=0;i<t.filters.length;i++)if(n=t.filters[i],r=e.filters[i],n.op!==r.op||!n.field.isEqual(r.field)||!Mi(n.value,r.value))return!1;var n,r;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!gs(t.startAt,e.startAt)&&gs(t.endAt,e.endAt)}function ts(t){return xi.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}class es extends class{}{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.l(t,e,n):new ns(t,e,n):"array-contains"===e?new os(t,n):"in"===e?new as(t,n):"not-in"===e?new cs(t,n):"array-contains-any"===e?new hs(t,n):new es(t,e,n)}static l(t,e,n){return"in"===e?new rs(t,n):new is(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.m(Vi(e,this.value)):null!==e&&Oi(this.value)===Oi(e)&&this.m(Vi(e,this.value))}m(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return oi()}}g(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}}class ns extends es{constructor(t,e,n){super(t,e,n),this.key=xi.fromName(n.referenceValue)}matches(t){const e=xi.comparator(t.key,this.key);return this.m(e)}}class rs extends es{constructor(t,e){super(t,"in",e),this.keys=ss(0,e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class is extends es{constructor(t,e){super(t,"not-in",e),this.keys=ss(0,e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function ss(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>xi.fromName(t.referenceValue)))}class os extends es{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Bi(e)&&Pi(e.arrayValue,this.value)}}class as extends es{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Pi(this.value.arrayValue,e)}}class cs extends es{constructor(t,e){super(t,"not-in",e)}matches(t){if(Pi(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Pi(this.value.arrayValue,e)}}class hs extends es{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Bi(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Pi(this.value.arrayValue,t)))}}class us{constructor(t,e){this.position=t,this.before=e}}function ls(t){return`${t.before?"b":"a"}:${t.position.map((t=>Ui(t))).join(",")}`}class fs{constructor(t,e="asc"){this.field=t,this.dir=e}}function ds(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}function ps(t,e,n){let r=0;for(let i=0;i<t.position.length;i++){const s=e[i],o=t.position[i];if(r=s.field.isKeyField()?xi.comparator(xi.fromName(o.referenceValue),n.key):Vi(o,n.data.field(s.field)),"desc"===s.dir&&(r*=-1),0!==r)break}return t.before?r<=0:r<0}function gs(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.before!==e.before||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!Mi(t.position[n],e.position[n]))return!1;return!0}class ms{constructor(t,e=null,n=[],r=[],i=null,s="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=s,this.startAt=o,this.endAt=a,this.p=null,this.T=null,this.startAt,this.endAt}}function ys(t){return new ms(t)}function vs(t){return!Ri(t.limit)&&"F"===t.limitType}function ws(t){return!Ri(t.limit)&&"L"===t.limitType}function Es(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function bs(t){for(const e of t.filters)if(e.g())return e.field;return null}function Ts(t){const e=ci(t);if(null===e.p){e.p=[];const t=bs(e),n=Es(e);if(null!==t&&null===n)t.isKeyField()||e.p.push(new fs(t)),e.p.push(new fs(bi.keyField(),"asc"));else{let t=!1;for(const n of e.explicitOrderBy)e.p.push(n),n.field.isKeyField()&&(t=!0);if(!t){const t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";e.p.push(new fs(bi.keyField(),t))}}}return e.p}function Is(t){const e=ci(t);if(!e.T)if("F"===e.limitType)e.T=Yi(e.path,e.collectionGroup,Ts(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Ts(e)){const e="desc"===n.dir?"asc":"desc";t.push(new fs(n.field,e))}const n=e.endAt?new us(e.endAt.position,!e.endAt.before):null,r=e.startAt?new us(e.startAt.position,!e.startAt.before):null;e.T=Yi(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}return e.T}function Ss(t,e){return Zi(Is(t),Is(e))&&t.limitType===e.limitType}function _s(t){return`${Ji(Is(t))}|lt:${t.limitType}`}function As(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map((t=>{return`${(e=t).field.canonicalString()} ${e.op} ${Ui(e.value)}`;var e})).join(", ")}]`),Ri(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=`, orderBy: [${t.orderBy.map((t=>function(t){return`${t.field.canonicalString()} (${t.dir})`}(t))).join(", ")}]`),t.startAt&&(e+=", startAt: "+ls(t.startAt)),t.endAt&&(e+=", endAt: "+ls(t.endAt)),`Target(${e})`}(Is(t))}; limitType=${t.limitType})`}function Ns(t,e){return e.isFoundDocument()&&function(t,e){const n=e.key.path;return null!==t.collectionGroup?e.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(n):xi.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of t.explicitOrderBy)if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!ps(t.startAt,Ts(t),e)||t.endAt&&ps(t.endAt,Ts(t),e))}(t,e)}function Cs(t){return(e,n)=>{let r=!1;for(const i of Ts(t)){const t=Ds(i,e,n);if(0!==t)return t;r=r||i.field.isKeyField()}return 0}}function Ds(t,e,n){const r=t.field.isKeyField()?xi.comparator(e.key,n.key):function(t,e,n){const r=e.data.field(t),i=n.data.field(t);return null!==r&&null!==i?Vi(r,i):oi()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return oi()}}function ks(t,e){if(t.I){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Li(e)?"-0":e}}function Rs(t){return{integerValue:""+t}}function Ls(t,e){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!Li(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Rs(e):ks(t,e)}class xs{constructor(){this._=void 0}}function Os(t,e,n){return t instanceof Vs?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof Fs?Us(t,e):t instanceof qs?js(t,e):function(t,e){const n=Ps(t,e),r=Ks(n)+Ks(t.A);return ji(n)&&ji(t.A)?Rs(r):ks(t.R,r)}(t,e)}function Ms(t,e,n){return t instanceof Fs?Us(t,e):t instanceof qs?js(t,e):n}function Ps(t,e){return t instanceof Bs?ji(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}class Vs extends xs{}class Fs extends xs{constructor(t){super(),this.elements=t}}function Us(t,e){const n=zs(e);for(const e of t.elements)n.some((t=>Mi(t,e)))||n.push(e);return{arrayValue:{values:n}}}class qs extends xs{constructor(t){super(),this.elements=t}}function js(t,e){let n=zs(e);for(const e of t.elements)n=n.filter((t=>!Mi(t,e)));return{arrayValue:{values:n}}}class Bs extends xs{constructor(t,e){super(),this.R=t,this.A=e}}function Ks(t){return Ai(t.integerValue||t.doubleValue)}function zs(t){return Bi(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class $s{constructor(t,e){this.version=t,this.transformResults=e}}class Hs{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new Hs}static exists(t){return new Hs(void 0,t)}static updateTime(t){return new Hs(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function Gs(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class Ws{}function Qs(t,e,n){t instanceof to?function(t,e,n){const r=t.value.clone(),i=ro(t.fieldTransforms,e,n.transformResults);r.setAll(i),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof eo?function(t,e,n){if(!Gs(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=ro(t.fieldTransforms,e,n.transformResults),i=e.data;i.setAll(no(t)),i.setAll(r),e.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function Xs(t,e,n){t instanceof to?function(t,e,n){if(!Gs(t.precondition,e))return;const r=t.value.clone(),i=io(t.fieldTransforms,n,e);r.setAll(i),e.convertToFoundDocument(Zs(e),r).setHasLocalMutations()}(t,e,n):t instanceof eo?function(t,e,n){if(!Gs(t.precondition,e))return;const r=io(t.fieldTransforms,n,e),i=e.data;i.setAll(no(t)),i.setAll(r),e.convertToFoundDocument(Zs(e),i).setHasLocalMutations()}(t,e,n):function(t,e){Gs(t.precondition,e)&&e.convertToNoDocument(pi.min())}(t,e)}function Ys(t,e){let n=null;for(const r of t.fieldTransforms){const t=e.data.field(r.field),i=Ps(r.transform,t||null);null!=i&&(null==n&&(n=Gi.empty()),n.set(r.field,i))}return n||null}function Js(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&fi(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Fs&&e instanceof Fs||t instanceof qs&&e instanceof qs?fi(t.elements,e.elements,Mi):t instanceof Bs&&e instanceof Bs?Mi(t.A,e.A):t instanceof Vs&&e instanceof Vs}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}function Zs(t){return t.isFoundDocument()?t.version:pi.min()}class to extends Ws{constructor(t,e,n,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}}class eo extends Ws{constructor(t,e,n,r,i=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}}function no(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}})),e}function ro(t,e,n){const r=new Map;ai(t.length===n.length);for(let i=0;i<n.length;i++){const s=t[i],o=s.transform,a=e.data.field(s.field);r.set(s.field,Ms(o,a,n[i]))}return r}function io(t,e,n){const r=new Map;for(const i of t){const t=i.transform,s=n.data.field(i.field);r.set(i.field,Os(t,s,e))}return r}class so extends Ws{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}}class oo extends Ws{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}}class ao{constructor(t){this.count=t}}var co,ho;function uo(t){if(void 0===t)return ri("GRPC error has no .code"),Jr.UNKNOWN;switch(t){case co.OK:return Jr.OK;case co.CANCELLED:return Jr.CANCELLED;case co.UNKNOWN:return Jr.UNKNOWN;case co.DEADLINE_EXCEEDED:return Jr.DEADLINE_EXCEEDED;case co.RESOURCE_EXHAUSTED:return Jr.RESOURCE_EXHAUSTED;case co.INTERNAL:return Jr.INTERNAL;case co.UNAVAILABLE:return Jr.UNAVAILABLE;case co.UNAUTHENTICATED:return Jr.UNAUTHENTICATED;case co.INVALID_ARGUMENT:return Jr.INVALID_ARGUMENT;case co.NOT_FOUND:return Jr.NOT_FOUND;case co.ALREADY_EXISTS:return Jr.ALREADY_EXISTS;case co.PERMISSION_DENIED:return Jr.PERMISSION_DENIED;case co.FAILED_PRECONDITION:return Jr.FAILED_PRECONDITION;case co.ABORTED:return Jr.ABORTED;case co.OUT_OF_RANGE:return Jr.OUT_OF_RANGE;case co.UNIMPLEMENTED:return Jr.UNIMPLEMENTED;case co.DATA_LOSS:return Jr.DATA_LOSS;default:return oi()}}(ho=co||(co={}))[ho.OK=0]="OK",ho[ho.CANCELLED=1]="CANCELLED",ho[ho.UNKNOWN=2]="UNKNOWN",ho[ho.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",ho[ho.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",ho[ho.NOT_FOUND=5]="NOT_FOUND",ho[ho.ALREADY_EXISTS=6]="ALREADY_EXISTS",ho[ho.PERMISSION_DENIED=7]="PERMISSION_DENIED",ho[ho.UNAUTHENTICATED=16]="UNAUTHENTICATED",ho[ho.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",ho[ho.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",ho[ho.ABORTED=10]="ABORTED",ho[ho.OUT_OF_RANGE=11]="OUT_OF_RANGE",ho[ho.UNIMPLEMENTED=12]="UNIMPLEMENTED",ho[ho.INTERNAL=13]="INTERNAL",ho[ho.UNAVAILABLE=14]="UNAVAILABLE",ho[ho.DATA_LOSS=15]="DATA_LOSS";class lo{constructor(t,e){this.comparator=t,this.root=e||po.EMPTY}insert(t,e){return new lo(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,po.BLACK,null,null))}remove(t){return new lo(this.comparator,this.root.remove(t,this.comparator).copy(null,null,po.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal(((e,n)=>(t(e,n),!1)))}toString(){const t=[];return this.inorderTraversal(((e,n)=>(t.push(`${e}:${n}`),!1))),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new fo(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new fo(this.root,t,this.comparator,!1)}getReverseIterator(){return new fo(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new fo(this.root,t,this.comparator,!0)}}class fo{constructor(t,e,n,r){this.isReverse=r,this.nodeStack=[];let i=1;for(;!t.isEmpty();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.isReverse?t.left:t.right;else{if(0===i){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class po{constructor(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:po.RED,this.left=null!=r?r:po.EMPTY,this.right=null!=i?i:po.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,r,i){return new po(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,e,n){let r=this;const i=n(t,r.key);return r=i<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return po.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let n,r=this;if(e(t,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===e(t,r.key)){if(r.right.isEmpty())return po.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,po.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,po.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw oi();if(this.right.isRed())throw oi();const t=this.left.check();if(t!==this.right.check())throw oi();return t+(this.isRed()?0:1)}}po.EMPTY=null,po.RED=!0,po.BLACK=!1,po.EMPTY=new class{constructor(){this.size=0}get key(){throw oi()}get value(){throw oi()}get color(){throw oi()}get left(){throw oi()}get right(){throw oi()}copy(t,e,n,r,i){return this}insert(t,e,n){return new po(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class go{constructor(t){this.comparator=t,this.data=new lo(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal(((e,n)=>(t(e),!1)))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,t[1])>=0)return;e(r.key)}}forEachWhile(t,e){let n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new mo(this.data.getIterator())}getIteratorFrom(t){return new mo(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let e=this;return e.size<t.size&&(e=t,t=this),t.forEach((t=>{e=e.add(t)})),e}isEqual(t){if(!(t instanceof go))return!1;if(this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(0!==this.comparator(t,r))return!1}return!0}toArray(){const t=[];return this.forEach((e=>{t.push(e)})),t}toString(){const t=[];return this.forEach((e=>t.push(e))),"SortedSet("+t.toString()+")"}copy(t){const e=new go(this.comparator);return e.data=t,e}}class mo{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}const yo=new lo(xi.comparator);function vo(){return yo}const wo=new lo(xi.comparator);function Eo(){return wo}const bo=new lo(xi.comparator);const To=new go(xi.comparator);function Io(...t){let e=To;for(const n of t)e=e.add(n);return e}const So=new go(li);function _o(){return So}class Ao{constructor(t,e,n,r,i){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(t,e){const n=new Map;return n.set(t,No.createSynthesizedTargetChangeForCurrentChange(t,e)),new Ao(pi.min(),n,_o(),vo(),Io())}}class No{constructor(t,e,n,r,i){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(t,e){return new No(Ii.EMPTY_BYTE_STRING,e,Io(),Io(),Io())}}class Co{constructor(t,e,n,r){this.P=t,this.removedTargetIds=e,this.key=n,this.v=r}}class Do{constructor(t,e){this.targetId=t,this.V=e}}class ko{constructor(t,e,n=Ii.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}class Ro{constructor(){this.S=0,this.D=Oo(),this.C=Ii.EMPTY_BYTE_STRING,this.N=!1,this.k=!0}get current(){return this.N}get resumeToken(){return this.C}get $(){return 0!==this.S}get O(){return this.k}F(t){t.approximateByteSize()>0&&(this.k=!0,this.C=t)}M(){let t=Io(),e=Io(),n=Io();return this.D.forEach(((r,i)=>{switch(i){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:oi()}})),new No(this.C,this.N,t,e,n)}L(){this.k=!1,this.D=Oo()}B(t,e){this.k=!0,this.D=this.D.insert(t,e)}U(t){this.k=!0,this.D=this.D.remove(t)}q(){this.S+=1}K(){this.S-=1}j(){this.k=!0,this.N=!0}}class Lo{constructor(t){this.W=t,this.G=new Map,this.H=vo(),this.J=xo(),this.Y=new go(li)}X(t){for(const e of t.P)t.v&&t.v.isFoundDocument()?this.Z(e,t.v):this.tt(e,t.key,t.v);for(const e of t.removedTargetIds)this.tt(e,t.key,t.v)}et(t){this.forEachTarget(t,(e=>{const n=this.nt(e);switch(t.state){case 0:this.st(e)&&n.F(t.resumeToken);break;case 1:n.K(),n.$||n.L(),n.F(t.resumeToken);break;case 2:n.K(),n.$||this.removeTarget(e);break;case 3:this.st(e)&&(n.j(),n.F(t.resumeToken));break;case 4:this.st(e)&&(this.it(e),n.F(t.resumeToken));break;default:oi()}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.G.forEach(((t,n)=>{this.st(n)&&e(n)}))}rt(t){const e=t.targetId,n=t.V.count,r=this.ot(e);if(r){const t=r.target;if(ts(t))if(0===n){const n=new xi(t.path);this.tt(e,n,Qi.newNoDocument(n,pi.min()))}else ai(1===n);else this.ct(e)!==n&&(this.it(e),this.Y=this.Y.add(e))}}ut(t){const e=new Map;this.G.forEach(((n,r)=>{const i=this.ot(r);if(i){if(n.current&&ts(i.target)){const e=new xi(i.target.path);null!==this.H.get(e)||this.at(r,e)||this.tt(r,e,Qi.newNoDocument(e,t))}n.O&&(e.set(r,n.M()),n.L())}}));let n=Io();this.J.forEach(((t,e)=>{let r=!0;e.forEachWhile((t=>{const e=this.ot(t);return!e||2===e.purpose||(r=!1,!1)})),r&&(n=n.add(t))}));const r=new Ao(t,e,this.Y,this.H,n);return this.H=vo(),this.J=xo(),this.Y=new go(li),r}Z(t,e){if(!this.st(t))return;const n=this.at(t,e.key)?2:0;this.nt(t).B(e.key,n),this.H=this.H.insert(e.key,e),this.J=this.J.insert(e.key,this.ht(e.key).add(t))}tt(t,e,n){if(!this.st(t))return;const r=this.nt(t);this.at(t,e)?r.B(e,1):r.U(e),this.J=this.J.insert(e,this.ht(e).delete(t)),n&&(this.H=this.H.insert(e,n))}removeTarget(t){this.G.delete(t)}ct(t){const e=this.nt(t).M();return this.W.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size}q(t){this.nt(t).q()}nt(t){let e=this.G.get(t);return e||(e=new Ro,this.G.set(t,e)),e}ht(t){let e=this.J.get(t);return e||(e=new go(li),this.J=this.J.insert(t,e)),e}st(t){const e=null!==this.ot(t);return e||ni("WatchChangeAggregator","Detected inactive target",t),e}ot(t){const e=this.G.get(t);return e&&e.$?null:this.W.lt(t)}it(t){this.G.set(t,new Ro),this.W.getRemoteKeysForTarget(t).forEach((e=>{this.tt(t,e,null)}))}at(t,e){return this.W.getRemoteKeysForTarget(t).has(e)}}function xo(){return new lo(xi.comparator)}function Oo(){return new lo(xi.comparator)}const Mo={asc:"ASCENDING",desc:"DESCENDING"},Po={"<":"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"};class Vo{constructor(t,e){this.databaseId=t,this.I=e}}function Fo(t,e){return t.I?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Uo(t,e){return t.I?e.toBase64():e.toUint8Array()}function qo(t,e){return Fo(t,e.toTimestamp())}function jo(t){return ai(!!t),pi.fromTimestamp(function(t){const e=_i(t);return new di(e.seconds,e.nanos)}(t))}function Bo(t,e){return function(t){return new wi(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Ko(t){const e=wi.fromString(t);return ai(ha(e)),e}function zo(t,e){return Bo(t.databaseId,e.path)}function $o(t,e){const n=Ko(e);if(n.get(1)!==t.databaseId.projectId)throw new Zr(Jr.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new Zr(Jr.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new xi(Wo(n))}function Ho(t,e){return Bo(t.databaseId,e)}function Go(t){return new wi(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function Wo(t){return ai(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function Qo(t,e,n){return{name:zo(t,e),fields:n.value.mapValue.fields}}function Xo(t,e){return{documents:[Ho(t,e.path)]}}function Yo(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Ho(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Ho(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const i=function(t){if(0===t.length)return;const e=t.map((t=>function(t){if("=="===t.op){if(zi(t.value))return{unaryFilter:{field:ia(t.field),op:"IS_NAN"}};if(Ki(t.value))return{unaryFilter:{field:ia(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(zi(t.value))return{unaryFilter:{field:ia(t.field),op:"IS_NOT_NAN"}};if(Ki(t.value))return{unaryFilter:{field:ia(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:ia(t.field),op:ra(t.op),value:t.value}}}(t)));return 1===e.length?e[0]:{compositeFilter:{op:"AND",filters:e}}}(e.filters);i&&(n.structuredQuery.where=i);const s=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:ia(t.field),direction:na(t.dir)}}(t)))}(e.orderBy);s&&(n.structuredQuery.orderBy=s);const o=function(t,e){return t.I||Ri(e)?e:{value:e}}(t,e.limit);return null!==o&&(n.structuredQuery.limit=o),e.startAt&&(n.structuredQuery.startAt=ta(e.startAt)),e.endAt&&(n.structuredQuery.endAt=ta(e.endAt)),n}function Jo(t){let e=function(t){const e=Ko(t);return 4===e.length?wi.emptyPath():Wo(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){ai(1===r);const t=n.from[0];t.allDescendants?i=t.collectionId:e=e.child(t.collectionId)}let s=[];n.where&&(s=Zo(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new fs(sa(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,Ri(e)?null:e}(n.limit));let c=null;n.startAt&&(c=ea(n.startAt));let h=null;return n.endAt&&(h=ea(n.endAt)),function(t,e,n,r,i,s,o,a){return new ms(t,e,n,r,i,s,o,a)}(e,i,o,s,a,"F",c,h)}function Zo(t){return t?void 0!==t.unaryFilter?[aa(t)]:void 0!==t.fieldFilter?[oa(t)]:void 0!==t.compositeFilter?t.compositeFilter.filters.map((t=>Zo(t))).reduce(((t,e)=>t.concat(e))):oi():[]}function ta(t){return{before:t.before,values:t.position}}function ea(t){const e=!!t.before,n=t.values||[];return new us(n,e)}function na(t){return Mo[t]}function ra(t){return Po[t]}function ia(t){return{fieldPath:t.canonicalString()}}function sa(t){return bi.fromServerFormat(t.fieldPath)}function oa(t){return es.create(sa(t.fieldFilter.field),function(t){switch(t){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return oi()}}(t.fieldFilter.op),t.fieldFilter.value)}function aa(t){switch(t.unaryFilter.op){case"IS_NAN":const e=sa(t.unaryFilter.field);return es.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=sa(t.unaryFilter.field);return es.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=sa(t.unaryFilter.field);return es.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const i=sa(t.unaryFilter.field);return es.create(i,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return oi()}}function ca(t){const e=[];return t.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function ha(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}function ua(t){let e="";for(let n=0;n<t.length;n++)e.length>0&&(e=fa(e)),e=la(t.get(n),e);return fa(e)}function la(t,e){let n=e;const r=t.length;for(let e=0;e<r;e++){const r=t.charAt(e);switch(r){case"\0":n+="";break;case"":n+="";break;default:n+=r}}return n}function fa(t){return t+""}class da{constructor(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n}}da.store="owner",da.key="owner";class pa{constructor(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n}}pa.store="mutationQueues",pa.keyPath="userId";class ga{constructor(t,e,n,r,i){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i}}ga.store="mutations",ga.keyPath="batchId",ga.userMutationsIndex="userMutationsIndex",ga.userMutationsKeyPath=["userId","batchId"];class ma{constructor(){}static prefixForUser(t){return[t]}static prefixForPath(t,e){return[t,ua(e)]}static key(t,e,n){return[t,ua(e),n]}}ma.store="documentMutations",ma.PLACEHOLDER=new ma;class ya{constructor(t,e,n,r,i,s){this.unknownDocument=t,this.noDocument=e,this.document=n,this.hasCommittedMutations=r,this.readTime=i,this.parentPath=s}}ya.store="remoteDocuments",ya.readTimeIndex="readTimeIndex",ya.readTimeIndexPath="readTime",ya.collectionReadTimeIndex="collectionReadTimeIndex",ya.collectionReadTimeIndexPath=["parentPath","readTime"];class va{constructor(t){this.byteSize=t}}va.store="remoteDocumentGlobal",va.key="remoteDocumentGlobalKey";class wa{constructor(t,e,n,r,i,s,o){this.targetId=t,this.canonicalId=e,this.readTime=n,this.resumeToken=r,this.lastListenSequenceNumber=i,this.lastLimboFreeSnapshotVersion=s,this.query=o}}wa.store="targets",wa.keyPath="targetId",wa.queryTargetsIndexName="queryTargetsIndex",wa.queryTargetsKeyPath=["canonicalId","targetId"];class Ea{constructor(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n}}Ea.store="targetDocuments",Ea.keyPath=["targetId","path"],Ea.documentTargetsIndex="documentTargetsIndex",Ea.documentTargetsKeyPath=["path","targetId"];class ba{constructor(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r}}ba.key="targetGlobalKey",ba.store="targetGlobal";class Ta{constructor(t,e){this.collectionId=t,this.parent=e}}Ta.store="collectionParents",Ta.keyPath=["collectionId","parent"];class Ia{constructor(t,e,n,r){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=r}}Ia.store="clientMetadata",Ia.keyPath="clientId";class Sa{constructor(t,e,n){this.bundleId=t,this.createTime=e,this.version=n}}Sa.store="bundles",Sa.keyPath="bundleId";class _a{constructor(t,e,n){this.name=t,this.readTime=e,this.bundledQuery=n}}_a.store="namedQueries",_a.keyPath="name",pa.store,ga.store,ma.store,ya.store,wa.store,da.store,ba.store,Ea.store,Ia.store,va.store,Ta.store,Sa.store,_a.store;class Aa{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}class Na{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t((t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)}),(t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)}))}catch(t){return this.next(void 0,t)}next(t,e){return this.callbackAttached&&oi(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new Na(((n,r)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,r)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,r)}}))}toPromise(){return new Promise(((t,e)=>{this.next(t,e)}))}wrapUserFunction(t){try{const e=t();return e instanceof Na?e:Na.resolve(e)}catch(t){return Na.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):Na.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):Na.reject(e)}static resolve(t){return new Na(((e,n)=>{e(t)}))}static reject(t){return new Na(((e,n)=>{n(t)}))}static waitFor(t){return new Na(((e,n)=>{let r=0,i=0,s=!1;t.forEach((t=>{++r,t.next((()=>{++i,s&&i===r&&e()}),(t=>n(t)))})),s=!0,i===r&&e()}))}static or(t){let e=Na.resolve(!1);for(const n of t)e=e.next((t=>t?Na.resolve(t):n()));return e}static forEach(t,e){const n=[];return t.forEach(((t,r)=>{n.push(e.call(this,t,r))})),this.waitFor(n)}}function Ca(t){return"IndexedDbTransactionError"===t.name}class Da{constructor(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const r=this.mutations[e];r.key.isEqual(t.key)&&Qs(r,t,n[e])}}applyToLocalView(t){for(const e of this.baseMutations)e.key.isEqual(t.key)&&Xs(e,t,this.localWriteTime);for(const e of this.mutations)e.key.isEqual(t.key)&&Xs(e,t,this.localWriteTime)}applyToLocalDocumentSet(t){this.mutations.forEach((e=>{const n=t.get(e.key),r=n;this.applyToLocalView(r),n.isValidDocument()||r.convertToNoDocument(pi.min())}))}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),Io())}isEqual(t){return this.batchId===t.batchId&&fi(this.mutations,t.mutations,((t,e)=>Js(t,e)))&&fi(this.baseMutations,t.baseMutations,((t,e)=>Js(t,e)))}}class ka{constructor(t,e,n,r){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=r}static from(t,e,n){ai(t.mutations.length===n.length);let r=bo;const i=t.mutations;for(let t=0;t<i.length;t++)r=r.insert(i[t].key,n[t].version);return new ka(t,e,n,r)}}class Ra{constructor(t,e,n,r,i=pi.min(),s=pi.min(),o=Ii.EMPTY_BYTE_STRING){this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=o}withSequenceNumber(t){return new Ra(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}withResumeToken(t,e){return new Ra(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)}withLastLimboFreeSnapshotVersion(t){return new Ra(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)}}class La{constructor(t){this.Lt=t}}function xa(t){const e=Jo({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?function(t,e,n){return new ms(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}(e,e.limit,"L"):e}class Oa{constructor(){this.Bt=new Ma}addToCollectionParentIndex(t,e){return this.Bt.add(e),Na.resolve()}getCollectionParents(t,e){return Na.resolve(this.Bt.getEntries(e))}}class Ma{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new go(wi.comparator),i=!r.has(n);return this.index[e]=r.add(n),i}has(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e];return r&&r.has(n)}getEntries(t){return(this.index[t]||new go(wi.comparator)).toArray()}}class Pa{constructor(t,e,n){this.cacheSizeCollectionThreshold=t,this.percentileToCollect=e,this.maximumSequenceNumbersToCollect=n}static withCacheSize(t){return new Pa(t,Pa.DEFAULT_COLLECTION_PERCENTILE,Pa.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}}Pa.DEFAULT_COLLECTION_PERCENTILE=10,Pa.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Pa.DEFAULT=new Pa(41943040,Pa.DEFAULT_COLLECTION_PERCENTILE,Pa.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Pa.DISABLED=new Pa(-1,0,0);class Va{constructor(t){this.Ht=t}next(){return this.Ht+=2,this.Ht}static Jt(){return new Va(0)}static Yt(){return new Va(-1)}}async function Fa(t){if(t.code!==Jr.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==t.message)throw t;ni("LocalStore","Unexpectedly lost primary lease")}class Ua{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={}}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(const[e,r]of n)if(this.equalsFn(e,t))return r}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),r=this.inner[n];if(void 0!==r){for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],t))return void(r[n]=[t,e]);r.push([t,e])}else this.inner[n]=[[t,e]]}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],t))return 1===n.length?delete this.inner[e]:n.splice(r,1),!0;return!1}forEach(t){mi(this.inner,((e,n)=>{for(const[e,r]of n)t(e,r)}))}isEmpty(){return yi(this.inner)}}class qa{constructor(t,e,n){this.qe=t,this._n=e,this.qt=n}mn(t,e){return this._n.getAllMutationBatchesAffectingDocumentKey(t,e).next((n=>this.gn(t,e,n)))}gn(t,e,n){return this.qe.getEntry(t,e).next((t=>{for(const e of n)e.applyToLocalView(t);return t}))}yn(t,e){t.forEach(((t,n)=>{for(const t of e)t.applyToLocalView(n)}))}pn(t,e){return this.qe.getEntries(t,e).next((e=>this.En(t,e).next((()=>e))))}En(t,e){return this._n.getAllMutationBatchesAffectingDocumentKeys(t,e).next((t=>this.yn(e,t)))}getDocumentsMatchingQuery(t,e,n){return function(t){return xi.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.Tn(t,e.path):function(t){return null!==t.collectionGroup}(e)?this.In(t,e,n):this.An(t,e,n)}Tn(t,e){return this.mn(t,new xi(e)).next((t=>{let e=Eo();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}In(t,e,n){const r=e.collectionGroup;let i=Eo();return this.qt.getCollectionParents(t,r).next((s=>Na.forEach(s,(s=>{const o=function(t,e){return new ms(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,s.child(r));return this.An(t,o,n).next((t=>{t.forEach(((t,e)=>{i=i.insert(t,e)}))}))})).next((()=>i))))}An(t,e,n){let r,i;return this.qe.getDocumentsMatchingQuery(t,e,n).next((n=>(r=n,this._n.getAllMutationBatchesAffectingQuery(t,e)))).next((e=>(i=e,this.Rn(t,i,r).next((t=>{r=t;for(const t of i)for(const e of t.mutations){const n=e.key;let i=r.get(n);null==i&&(i=Qi.newInvalidDocument(n),r=r.insert(n,i)),Xs(e,i,t.localWriteTime),i.isFoundDocument()||(r=r.remove(n))}}))))).next((()=>(r.forEach(((t,n)=>{Ns(e,n)||(r=r.remove(t))})),r)))}Rn(t,e,n){let r=Io();for(const t of e)for(const e of t.mutations)e instanceof eo&&null===n.get(e.key)&&(r=r.add(e.key));let i=n;return this.qe.getEntries(t,r).next((t=>(t.forEach(((t,e)=>{e.isFoundDocument()&&(i=i.insert(t,e))})),i)))}}class ja{constructor(t,e,n,r){this.targetId=t,this.fromCache=e,this.Pn=n,this.bn=r}static vn(t,e){let n=Io(),r=Io();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:r=r.add(t.doc.key)}return new ja(t,e.fromCache,n,r)}}class Ba{Vn(t){this.Sn=t}getDocumentsMatchingQuery(t,e,n,r){return function(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}(e)||n.isEqual(pi.min())?this.Dn(t,e):this.Sn.pn(t,r).next((i=>{const s=this.Cn(e,i);return(vs(e)||ws(e))&&this.Nn(e.limitType,s,r,n)?this.Dn(t,e):(ei()<=w.DEBUG&&ni("QueryEngine","Re-using previous result from %s to execute query: %s",n.toString(),As(e)),this.Sn.getDocumentsMatchingQuery(t,e,n).next((t=>(s.forEach((e=>{t=t.insert(e.key,e)})),t))))}))}Cn(t,e){let n=new go(Cs(t));return e.forEach(((e,r)=>{Ns(t,r)&&(n=n.add(r))})),n}Nn(t,e,n,r){if(n.size!==e.size)return!0;const i="F"===t?e.last():e.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}Dn(t,e){return ei()<=w.DEBUG&&ni("QueryEngine","Using full collection scan to execute query:",As(e)),this.Sn.getDocumentsMatchingQuery(t,e,pi.min())}}class Ka{constructor(t,e,n,r){this.persistence=t,this.xn=e,this.R=r,this.kn=new lo(li),this.$n=new Ua((t=>Ji(t)),Zi),this.On=pi.min(),this._n=t.getMutationQueue(n),this.Fn=t.getRemoteDocumentCache(),this.Ue=t.getTargetCache(),this.Mn=new qa(this.Fn,this._n,this.persistence.getIndexManager()),this.Ke=t.getBundleCache(),this.xn.Vn(this.Mn)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(e=>t.collect(e,this.kn)))}}async function za(t,e){const n=ci(t);let r=n._n,i=n.Mn;const s=await n.persistence.runTransaction("Handle user change","readonly",(t=>{let s;return n._n.getAllMutationBatches(t).next((o=>(s=o,r=n.persistence.getMutationQueue(e),i=new qa(n.Fn,r,n.persistence.getIndexManager()),r.getAllMutationBatches(t)))).next((e=>{const n=[],r=[];let o=Io();for(const t of s){n.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){r.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return i.pn(t,o).next((t=>({Ln:t,removedBatchIds:n,addedBatchIds:r})))}))}));return n._n=r,n.Mn=i,n.xn.Vn(n.Mn),s}function $a(t){const e=ci(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Ue.getLastRemoteSnapshotVersion(t)))}function Ha(t,e){const n=ci(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(t=>(void 0===e&&(e=-1),n._n.getNextMutationBatchAfterBatchId(t,e))))}async function Ga(t,e,n){const r=ci(t),i=r.kn.get(e),s=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",s,(t=>r.persistence.referenceDelegate.removeTarget(t,i)))}catch(t){if(!Ca(t))throw t;ni("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.kn=r.kn.remove(e),r.$n.delete(i.target)}function Wa(t,e,n){const r=ci(t);let i=pi.min(),s=Io();return r.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const r=ci(t),i=r.$n.get(n);return void 0!==i?Na.resolve(r.kn.get(i)):r.Ue.getTargetData(e,n)}(r,t,Is(e)).next((e=>{if(e)return i=e.lastLimboFreeSnapshotVersion,r.Ue.getMatchingKeysForTargetId(t,e.targetId).next((t=>{s=t}))})).next((()=>r.xn.getDocumentsMatchingQuery(t,e,n?i:pi.min(),n?s:Io()))).next((t=>({documents:t,Bn:s})))))}class Qa{constructor(t){this.R=t,this.jn=new Map,this.Qn=new Map}getBundleMetadata(t,e){return Na.resolve(this.jn.get(e))}saveBundleMetadata(t,e){var n;return this.jn.set(e.id,{id:(n=e).id,version:n.version,createTime:jo(n.createTime)}),Na.resolve()}getNamedQuery(t,e){return Na.resolve(this.Qn.get(e))}saveNamedQuery(t,e){return this.Qn.set(e.name,function(t){return{name:t.name,query:xa(t.bundledQuery),readTime:jo(t.readTime)}}(e)),Na.resolve()}}class Xa{constructor(){this.Wn=new go(Ya.Gn),this.zn=new go(Ya.Hn)}isEmpty(){return this.Wn.isEmpty()}addReference(t,e){const n=new Ya(t,e);this.Wn=this.Wn.add(n),this.zn=this.zn.add(n)}Jn(t,e){t.forEach((t=>this.addReference(t,e)))}removeReference(t,e){this.Yn(new Ya(t,e))}Xn(t,e){t.forEach((t=>this.removeReference(t,e)))}Zn(t){const e=new xi(new wi([])),n=new Ya(e,t),r=new Ya(e,t+1),i=[];return this.zn.forEachInRange([n,r],(t=>{this.Yn(t),i.push(t.key)})),i}ts(){this.Wn.forEach((t=>this.Yn(t)))}Yn(t){this.Wn=this.Wn.delete(t),this.zn=this.zn.delete(t)}es(t){const e=new xi(new wi([])),n=new Ya(e,t),r=new Ya(e,t+1);let i=Io();return this.zn.forEachInRange([n,r],(t=>{i=i.add(t.key)})),i}containsKey(t){const e=new Ya(t,0),n=this.Wn.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Ya{constructor(t,e){this.key=t,this.ns=e}static Gn(t,e){return xi.comparator(t.key,e.key)||li(t.ns,e.ns)}static Hn(t,e){return li(t.ns,e.ns)||xi.comparator(t.key,e.key)}}class Ja{constructor(t,e){this.qt=t,this.referenceDelegate=e,this._n=[],this.ss=1,this.rs=new go(Ya.Gn)}checkEmpty(t){return Na.resolve(0===this._n.length)}addMutationBatch(t,e,n,r){const i=this.ss;this.ss++,this._n.length>0&&this._n[this._n.length-1];const s=new Da(i,e,n,r);this._n.push(s);for(const e of r)this.rs=this.rs.add(new Ya(e.key,i)),this.qt.addToCollectionParentIndex(t,e.key.path.popLast());return Na.resolve(s)}lookupMutationBatch(t,e){return Na.resolve(this.os(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,r=this.cs(n),i=r<0?0:r;return Na.resolve(this._n.length>i?this._n[i]:null)}getHighestUnacknowledgedBatchId(){return Na.resolve(0===this._n.length?-1:this.ss-1)}getAllMutationBatches(t){return Na.resolve(this._n.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Ya(e,0),r=new Ya(e,Number.POSITIVE_INFINITY),i=[];return this.rs.forEachInRange([n,r],(t=>{const e=this.os(t.ns);i.push(e)})),Na.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new go(li);return e.forEach((t=>{const e=new Ya(t,0),r=new Ya(t,Number.POSITIVE_INFINITY);this.rs.forEachInRange([e,r],(t=>{n=n.add(t.ns)}))})),Na.resolve(this.us(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,r=n.length+1;let i=n;xi.isDocumentKey(i)||(i=i.child(""));const s=new Ya(new xi(i),0);let o=new go(li);return this.rs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(o=o.add(t.ns)),!0)}),s),Na.resolve(this.us(o))}us(t){const e=[];return t.forEach((t=>{const n=this.os(t);null!==n&&e.push(n)})),e}removeMutationBatch(t,e){ai(0===this.hs(e.batchId,"removed")),this._n.shift();let n=this.rs;return Na.forEach(e.mutations,(r=>{const i=new Ya(r.key,e.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(t,r.key)})).next((()=>{this.rs=n}))}Gt(t){}containsKey(t,e){const n=new Ya(e,0),r=this.rs.firstAfterOrEqual(n);return Na.resolve(e.isEqual(r&&r.key))}performConsistencyCheck(t){return this._n.length,Na.resolve()}hs(t,e){return this.cs(t)}cs(t){return 0===this._n.length?0:t-this._n[0].batchId}os(t){const e=this.cs(t);return e<0||e>=this._n.length?null:this._n[e]}}class Za{constructor(t,e){this.qt=t,this.ls=e,this.docs=new lo(xi.comparator),this.size=0}addEntry(t,e,n){const r=e.key,i=this.docs.get(r),s=i?i.size:0,o=this.ls(e);return this.docs=this.docs.insert(r,{document:e.clone(),size:o,readTime:n}),this.size+=o-s,this.qt.addToCollectionParentIndex(t,r.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return Na.resolve(n?n.document.clone():Qi.newInvalidDocument(e))}getEntries(t,e){let n=vo();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.clone():Qi.newInvalidDocument(t))})),Na.resolve(n)}getDocumentsMatchingQuery(t,e,n){let r=vo();const i=new xi(e.path.child("")),s=this.docs.getIteratorFrom(i);for(;s.hasNext();){const{key:t,value:{document:i,readTime:o}}=s.getNext();if(!e.path.isPrefixOf(t.path))break;o.compareTo(n)<=0||Ns(e,i)&&(r=r.insert(i.key,i.clone()))}return Na.resolve(r)}fs(t,e){return Na.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new tc(this)}getSize(t){return Na.resolve(this.size)}}class tc extends class{constructor(){this.changes=new Ua((t=>t.toString()),((t,e)=>t.isEqual(e))),this.changesApplied=!1}getReadTime(t){const e=this.changes.get(t);return e?e.readTime:pi.min()}addEntry(t,e){this.assertNotApplied(),this.changes.set(t.key,{document:t,readTime:e})}removeEntry(t,e=null){this.assertNotApplied(),this.changes.set(t,{document:Qi.newInvalidDocument(t),readTime:e})}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return void 0!==n?Na.resolve(n.document):this.getFromCache(t,e)}getEntries(t,e){return this.getAllFromCache(t,e)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}{constructor(t){super(),this.Ie=t}applyChanges(t){const e=[];return this.changes.forEach(((n,r)=>{r.document.isValidDocument()?e.push(this.Ie.addEntry(t,r.document,this.getReadTime(n))):this.Ie.removeEntry(n)})),Na.waitFor(e)}getFromCache(t,e){return this.Ie.getEntry(t,e)}getAllFromCache(t,e){return this.Ie.getEntries(t,e)}}class ec{constructor(t){this.persistence=t,this.ds=new Ua((t=>Ji(t)),Zi),this.lastRemoteSnapshotVersion=pi.min(),this.highestTargetId=0,this.ws=0,this._s=new Xa,this.targetCount=0,this.gs=Va.Jt()}forEachTarget(t,e){return this.ds.forEach(((t,n)=>e(n))),Na.resolve()}getLastRemoteSnapshotVersion(t){return Na.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return Na.resolve(this.ws)}allocateTargetId(t){return this.highestTargetId=this.gs.next(),Na.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.ws&&(this.ws=e),Na.resolve()}te(t){this.ds.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.gs=new Va(e),this.highestTargetId=e),t.sequenceNumber>this.ws&&(this.ws=t.sequenceNumber)}addTargetData(t,e){return this.te(e),this.targetCount+=1,Na.resolve()}updateTargetData(t,e){return this.te(e),Na.resolve()}removeTargetData(t,e){return this.ds.delete(e.target),this._s.Zn(e.targetId),this.targetCount-=1,Na.resolve()}removeTargets(t,e,n){let r=0;const i=[];return this.ds.forEach(((s,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.ds.delete(s),i.push(this.removeMatchingKeysForTargetId(t,o.targetId)),r++)})),Na.waitFor(i).next((()=>r))}getTargetCount(t){return Na.resolve(this.targetCount)}getTargetData(t,e){const n=this.ds.get(e)||null;return Na.resolve(n)}addMatchingKeys(t,e,n){return this._s.Jn(e,n),Na.resolve()}removeMatchingKeys(t,e,n){this._s.Xn(e,n);const r=this.persistence.referenceDelegate,i=[];return r&&e.forEach((e=>{i.push(r.markPotentiallyOrphaned(t,e))})),Na.waitFor(i)}removeMatchingKeysForTargetId(t,e){return this._s.Zn(e),Na.resolve()}getMatchingKeysForTargetId(t,e){const n=this._s.es(e);return Na.resolve(n)}containsKey(t,e){return Na.resolve(this._s.containsKey(e))}}class nc{constructor(t,e){this.ys={},this.Ne=new Yr(0),this.xe=!1,this.xe=!0,this.referenceDelegate=t(this),this.Ue=new ec(this),this.qt=new Oa,this.qe=function(t,e){return new Za(t,e)}(this.qt,(t=>this.referenceDelegate.ps(t))),this.R=new La(e),this.Ke=new Qa(this.R)}start(){return Promise.resolve()}shutdown(){return this.xe=!1,Promise.resolve()}get started(){return this.xe}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(){return this.qt}getMutationQueue(t){let e=this.ys[t.toKey()];return e||(e=new Ja(this.qt,this.referenceDelegate),this.ys[t.toKey()]=e),e}getTargetCache(){return this.Ue}getRemoteDocumentCache(){return this.qe}getBundleCache(){return this.Ke}runTransaction(t,e,n){ni("MemoryPersistence","Starting transaction:",t);const r=new rc(this.Ne.next());return this.referenceDelegate.Es(),n(r).next((t=>this.referenceDelegate.Ts(r).next((()=>t)))).toPromise().then((t=>(r.raiseOnCommittedEvent(),t)))}Is(t,e){return Na.or(Object.values(this.ys).map((n=>()=>n.containsKey(t,e))))}}class rc extends class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((t=>t()))}}{constructor(t){super(),this.currentSequenceNumber=t}}class ic{constructor(t){this.persistence=t,this.As=new Xa,this.Rs=null}static Ps(t){return new ic(t)}get bs(){if(this.Rs)return this.Rs;throw oi()}addReference(t,e,n){return this.As.addReference(n,e),this.bs.delete(n.toString()),Na.resolve()}removeReference(t,e,n){return this.As.removeReference(n,e),this.bs.add(n.toString()),Na.resolve()}markPotentiallyOrphaned(t,e){return this.bs.add(e.toString()),Na.resolve()}removeTarget(t,e){this.As.Zn(e.targetId).forEach((t=>this.bs.add(t.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,e.targetId).next((t=>{t.forEach((t=>this.bs.add(t.toString())))})).next((()=>n.removeTargetData(t,e)))}Es(){this.Rs=new Set}Ts(t){const e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Na.forEach(this.bs,(n=>{const r=xi.fromPath(n);return this.vs(t,r).next((t=>{t||e.removeEntry(r)}))})).next((()=>(this.Rs=null,e.apply(t))))}updateLimboDocument(t,e){return this.vs(t,e).next((t=>{t?this.bs.delete(e.toString()):this.bs.add(e.toString())}))}ps(t){return 0}vs(t,e){return Na.or([()=>Na.resolve(this.As.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Is(t,e)])}}class sc{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}sc.UNAUTHENTICATED=new sc(null),sc.GOOGLE_CREDENTIALS=new sc("google-credentials-uid"),sc.FIRST_PARTY=new sc("first-party-uid");class oc{constructor(){this.activeTargetIds=_o()}Ds(t){this.activeTargetIds=this.activeTargetIds.add(t)}Cs(t){this.activeTargetIds=this.activeTargetIds.delete(t)}Ss(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class ac{constructor(){this.li=new oc,this.fi={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t){return this.li.Ds(t),this.fi[t]||"not-current"}updateQueryState(t,e,n){this.fi[t]=e}removeLocalQueryTarget(t){this.li.Cs(t)}isLocalQueryTarget(t){return this.li.activeTargetIds.has(t)}clearQueryState(t){delete this.fi[t]}getAllActiveQueryTargets(){return this.li.activeTargetIds}isActiveQueryTarget(t){return this.li.activeTargetIds.has(t)}start(){return this.li=new oc,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(){}}class cc{di(t){}shutdown(){}}class hc{constructor(){this.wi=()=>this._i(),this.mi=()=>this.gi(),this.yi=[],this.pi()}di(t){this.yi.push(t)}shutdown(){window.removeEventListener("online",this.wi),window.removeEventListener("offline",this.mi)}pi(){window.addEventListener("online",this.wi),window.addEventListener("offline",this.mi)}_i(){ni("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.yi)t(0)}gi(){ni("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const t of this.yi)t(1)}static gt(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}const uc={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery"};class lc{constructor(t){this.Ei=t.Ei,this.Ti=t.Ti}Ii(t){this.Ai=t}Ri(t){this.Pi=t}onMessage(t){this.bi=t}close(){this.Ti()}send(t){this.Ei(t)}vi(){this.Ai()}Vi(t){this.Pi(t)}Si(t){this.bi(t)}}class fc extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http";this.Di=e+"://"+t.host,this.Ci="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}Ni(t,e,n,r){const i=this.xi(t,e);ni("RestConnection","Sending: ",i,n);const s={};return this.ki(s,r),this.$i(t,i,s,n).then((t=>(ni("RestConnection","Received: ",t),t)),(e=>{throw ii("RestConnection",`${t} failed with error: `,e,"url: ",i,"request:",n),e}))}Oi(t,e,n,r){return this.Ni(t,e,n,r)}ki(t,e){if(t["X-Goog-Api-Client"]="gl-js/ fire/"+Xr,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e)for(const n in e.authHeaders)e.authHeaders.hasOwnProperty(n)&&(t[n]=e.authHeaders[n])}xi(t,e){const n=uc[t];return`${this.Di}/v1/${e}:${n}`}}{constructor(t){super(t),this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams}$i(t,e,n,r){return new Promise(((i,s)=>{const o=new Qr;o.listenOnce(Kr.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case Br.NO_ERROR:const e=o.getResponseJson();ni("Connection","XHR received:",JSON.stringify(e)),i(e);break;case Br.TIMEOUT:ni("Connection",'RPC "'+t+'" timed out'),s(new Zr(Jr.DEADLINE_EXCEEDED,"Request time out"));break;case Br.HTTP_ERROR:const n=o.getStatus();if(ni("Connection",'RPC "'+t+'" failed with status:',n,"response text:",o.getResponseText()),n>0){const t=o.getResponseJson().error;if(t&&t.status&&t.message){const e=function(t){const e=t.toLowerCase().replace(/_/g,"-");return Object.values(Jr).indexOf(e)>=0?e:Jr.UNKNOWN}(t.status);s(new Zr(e,t.message))}else s(new Zr(Jr.UNKNOWN,"Server responded with status "+o.getStatus()))}else s(new Zr(Jr.UNAVAILABLE,"Connection failed."));break;default:oi()}}finally{ni("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(r);o.send(e,"POST",a,n,15)}))}Fi(t,e){const n=[this.Di,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=new Vr,i=De(),s={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling};var a;this.useFetchStreams&&(s.xmlHttpFactory=new Gr({})),this.ki(s.initMessageHeaders,e),"undefined"!=typeof window&&(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(o())||"object"==typeof navigator&&"ReactNative"===navigator.product||o().indexOf("Electron/")>=0||function(){var t=o();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()||o().indexOf("MSAppHost/")>=0||"object"==typeof(a="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0)&&void 0!==a.id||(s.httpHeadersOverwriteParam="$httpHeaders");const c=n.join("");ni("Connection","Creating WebChannel: "+c,s);const h=r.createWebChannel(c,s);let u=!1,l=!1;const f=new lc({Ei:t=>{l?ni("Connection","Not sending because WebChannel is closed:",t):(u||(ni("Connection","Opening WebChannel transport."),h.open(),u=!0),ni("Connection","WebChannel sending:",t),h.send(t))},Ti:()=>h.close()}),d=(t,e,n)=>{t.listen(e,(t=>{try{n(t)}catch(t){setTimeout((()=>{throw t}),0)}}))};return d(h,Wr.EventType.OPEN,(()=>{l||ni("Connection","WebChannel transport opened.")})),d(h,Wr.EventType.CLOSE,(()=>{l||(l=!0,ni("Connection","WebChannel transport closed"),f.Vi())})),d(h,Wr.EventType.ERROR,(t=>{l||(l=!0,ii("Connection","WebChannel transport errored:",t),f.Vi(new Zr(Jr.UNAVAILABLE,"The operation could not be completed")))})),d(h,Wr.EventType.MESSAGE,(t=>{var e;if(!l){const n=t.data[0];ai(!!n);const r=n,i=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(i){ni("Connection","WebChannel received error:",i);const t=i.status;let e=function(t){const e=co[t];if(void 0!==e)return uo(e)}(t),n=i.message;void 0===e&&(e=Jr.INTERNAL,n="Unknown error status: "+t+" with message "+i.message),l=!0,f.Vi(new Zr(e,n)),h.close()}else ni("Connection","WebChannel received:",n),f.Si(n)}})),d(i,zr.STAT_EVENT,(t=>{t.stat===$r?ni("Connection","Detected buffering proxy"):t.stat===Hr&&ni("Connection","Detected no buffering proxy")})),setTimeout((()=>{f.vi()}),0),f}}function dc(){return"undefined"!=typeof document?document:null}function pc(t){return new Vo(t,!0)}class gc{constructor(t,e,n=1e3,r=1.5,i=6e4){this.Se=t,this.timerId=e,this.Mi=n,this.Li=r,this.Bi=i,this.Ui=0,this.qi=null,this.Ki=Date.now(),this.reset()}reset(){this.Ui=0}ji(){this.Ui=this.Bi}Qi(t){this.cancel();const e=Math.floor(this.Ui+this.Wi()),n=Math.max(0,Date.now()-this.Ki),r=Math.max(0,e-n);r>0&&ni("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.Ui} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.qi=this.Se.enqueueAfterDelay(this.timerId,r,(()=>(this.Ki=Date.now(),t()))),this.Ui*=this.Li,this.Ui<this.Mi&&(this.Ui=this.Mi),this.Ui>this.Bi&&(this.Ui=this.Bi)}Gi(){null!==this.qi&&(this.qi.skipDelay(),this.qi=null)}cancel(){null!==this.qi&&(this.qi.cancel(),this.qi=null)}Wi(){return(Math.random()-.5)*this.Ui}}class mc{constructor(t,e,n,r,i,s){this.Se=t,this.zi=n,this.Hi=r,this.Ji=i,this.listener=s,this.state=0,this.Yi=0,this.Xi=null,this.stream=null,this.Zi=new gc(t,e)}tr(){return 1===this.state||2===this.state||4===this.state}er(){return 2===this.state}start(){3!==this.state?this.auth():this.nr()}async stop(){this.tr()&&await this.close(0)}sr(){this.state=0,this.Zi.reset()}ir(){this.er()&&null===this.Xi&&(this.Xi=this.Se.enqueueAfterDelay(this.zi,6e4,(()=>this.rr())))}cr(t){this.ur(),this.stream.send(t)}async rr(){if(this.er())return this.close(0)}ur(){this.Xi&&(this.Xi.cancel(),this.Xi=null)}async close(t,e){this.ur(),this.Zi.cancel(),this.Yi++,3!==t?this.Zi.reset():e&&e.code===Jr.RESOURCE_EXHAUSTED?(ri(e.toString()),ri("Using maximum backoff delay to prevent overloading the backend."),this.Zi.ji()):e&&e.code===Jr.UNAUTHENTICATED&&this.Ji.invalidateToken(),null!==this.stream&&(this.ar(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Ri(e)}ar(){}auth(){this.state=1;const t=this.hr(this.Yi),e=this.Yi;this.Ji.getToken().then((t=>{this.Yi===e&&this.lr(t)}),(e=>{t((()=>{const t=new Zr(Jr.UNKNOWN,"Fetching auth token failed: "+e.message);return this.dr(t)}))}))}lr(t){const e=this.hr(this.Yi);this.stream=this.wr(t),this.stream.Ii((()=>{e((()=>(this.state=2,this.listener.Ii())))})),this.stream.Ri((t=>{e((()=>this.dr(t)))})),this.stream.onMessage((t=>{e((()=>this.onMessage(t)))}))}nr(){this.state=4,this.Zi.Qi((async()=>{this.state=0,this.start()}))}dr(t){return ni("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(3,t)}hr(t){return e=>{this.Se.enqueueAndForget((()=>this.Yi===t?e():(ni("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class yc extends mc{constructor(t,e,n,r,i){super(t,"listen_stream_connection_backoff","listen_stream_idle",e,n,i),this.R=r}wr(t){return this.Hi.Fi("Listen",t)}onMessage(t){this.Zi.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:oi()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(t,e){return t.I?(ai(void 0===e||"string"==typeof e),Ii.fromBase64String(e||"")):(ai(void 0===e||e instanceof Uint8Array),Ii.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Jr.UNKNOWN:uo(t.code);return new Zr(e,t.message||"")}(o);n=new ko(r,i,s,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=$o(t,r.document.name),s=jo(r.document.updateTime),o=new Gi({mapValue:{fields:r.document.fields}}),a=Qi.newFoundDocument(i,s,o),c=r.targetIds||[],h=r.removedTargetIds||[];n=new Co(c,h,a.key,a)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=$o(t,r.document),s=r.readTime?jo(r.readTime):pi.min(),o=Qi.newNoDocument(i,s),a=r.removedTargetIds||[];n=new Co([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=$o(t,r.document),s=r.removedTargetIds||[];n=new Co([],s,i,null)}else{if(!("filter"in e))return oi();{e.filter;const t=e.filter;t.targetId;const r=t.count||0,i=new ao(r),s=t.targetId;n=new Do(s,i)}}return n}(this.R,t),n=function(t){if(!("targetChange"in t))return pi.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?pi.min():e.readTime?jo(e.readTime):pi.min()}(t);return this.listener._r(e,n)}mr(t){const e={};e.database=Go(this.R),e.addTarget=function(t,e){let n;const r=e.target;return n=ts(r)?{documents:Xo(t,r)}:{query:Yo(t,r)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=Uo(t,e.resumeToken):e.snapshotVersion.compareTo(pi.min())>0&&(n.readTime=Fo(t,e.snapshotVersion.toTimestamp())),n}(this.R,t);const n=function(t,e){const n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return oi()}}(0,e.purpose);return null==n?null:{"goog-listen-tags":n}}(this.R,t);n&&(e.labels=n),this.cr(e)}gr(t){const e={};e.database=Go(this.R),e.removeTarget=t,this.cr(e)}}class vc extends mc{constructor(t,e,n,r,i){super(t,"write_stream_connection_backoff","write_stream_idle",e,n,i),this.R=r,this.yr=!1}get pr(){return this.yr}start(){this.yr=!1,this.lastStreamToken=void 0,super.start()}ar(){this.yr&&this.Er([])}wr(t){return this.Hi.Fi("Write",t)}onMessage(t){if(ai(!!t.streamToken),this.lastStreamToken=t.streamToken,this.yr){this.Zi.reset();const e=function(t,e){return t&&t.length>0?(ai(void 0!==e),t.map((t=>function(t,e){let n=t.updateTime?jo(t.updateTime):jo(e);return n.isEqual(pi.min())&&(n=jo(e)),new $s(n,t.transformResults||[])}(t,e)))):[]}(t.writeResults,t.commitTime),n=jo(t.commitTime);return this.listener.Tr(n,e)}return ai(!t.writeResults||0===t.writeResults.length),this.yr=!0,this.listener.Ir()}Ar(){const t={};t.database=Go(this.R),this.cr(t)}Er(t){const e={streamToken:this.lastStreamToken,writes:t.map((t=>function(t,e){let n;if(e instanceof to)n={update:Qo(t,e.key,e.value)};else if(e instanceof so)n={delete:zo(t,e.key)};else if(e instanceof eo)n={update:Qo(t,e.key,e.data),updateMask:ca(e.fieldMask)};else{if(!(e instanceof oo))return oi();n={verify:zo(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((t=>function(t,e){const n=e.transform;if(n instanceof Vs)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Fs)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof qs)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Bs)return{fieldPath:e.field.canonicalString(),increment:n.A};throw oi()}(0,t)))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:qo(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:oi()}(t,e.precondition)),n}(this.R,t)))};this.cr(e)}}class wc extends class{}{constructor(t,e,n){super(),this.credentials=t,this.Hi=e,this.R=n,this.Rr=!1}Pr(){if(this.Rr)throw new Zr(Jr.FAILED_PRECONDITION,"The client has already been terminated.")}Ni(t,e,n){return this.Pr(),this.credentials.getToken().then((r=>this.Hi.Ni(t,e,n,r))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Jr.UNAUTHENTICATED&&this.credentials.invalidateToken(),t):new Zr(Jr.UNKNOWN,t.toString())}))}Oi(t,e,n){return this.Pr(),this.credentials.getToken().then((r=>this.Hi.Oi(t,e,n,r))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Jr.UNAUTHENTICATED&&this.credentials.invalidateToken(),t):new Zr(Jr.UNKNOWN,t.toString())}))}terminate(){this.Rr=!0}}class Ec{constructor(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.br=0,this.vr=null,this.Vr=!0}Sr(){0===this.br&&(this.Dr("Unknown"),this.vr=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.vr=null,this.Cr("Backend didn't respond within 10 seconds."),this.Dr("Offline"),Promise.resolve()))))}Nr(t){"Online"===this.state?this.Dr("Unknown"):(this.br++,this.br>=1&&(this.kr(),this.Cr(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.Dr("Offline")))}set(t){this.kr(),this.br=0,"Online"===t&&(this.Vr=!1),this.Dr(t)}Dr(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}Cr(t){const e=`Could not reach Cloud Firestore backend. ${t}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.Vr?(ri(e),this.Vr=!1):ni("OnlineStateTracker",e)}kr(){null!==this.vr&&(this.vr.cancel(),this.vr=null)}}class bc{constructor(t,e,n,r,i){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.$r=[],this.Or=new Map,this.Fr=new Set,this.Mr=[],this.Lr=i,this.Lr.di((t=>{n.enqueueAndForget((async()=>{kc(this)&&(ni("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=ci(t);e.Fr.add(4),await Ic(e),e.Br.set("Unknown"),e.Fr.delete(4),await Tc(e)}(this))}))})),this.Br=new Ec(n,r)}}async function Tc(t){if(kc(t))for(const e of t.Mr)await e(!0)}async function Ic(t){for(const e of t.Mr)await e(!1)}function Sc(t,e){const n=ci(t);n.Or.has(e.targetId)||(n.Or.set(e.targetId,e),Dc(n)?Cc(n):Hc(n).er()&&Ac(n,e))}function _c(t,e){const n=ci(t),r=Hc(n);n.Or.delete(e),r.er()&&Nc(n,e),0===n.Or.size&&(r.er()?r.ir():kc(n)&&n.Br.set("Unknown"))}function Ac(t,e){t.Ur.q(e.targetId),Hc(t).mr(e)}function Nc(t,e){t.Ur.q(e),Hc(t).gr(e)}function Cc(t){t.Ur=new Lo({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),lt:e=>t.Or.get(e)||null}),Hc(t).start(),t.Br.Sr()}function Dc(t){return kc(t)&&!Hc(t).tr()&&t.Or.size>0}function kc(t){return 0===ci(t).Fr.size}function Rc(t){t.Ur=void 0}async function Lc(t){t.Or.forEach(((e,n)=>{Ac(t,e)}))}async function xc(t,e){Rc(t),Dc(t)?(t.Br.Nr(e),Cc(t)):t.Br.set("Unknown")}async function Oc(t,e,n){if(t.Br.set("Online"),e instanceof ko&&2===e.state&&e.cause)try{await async function(t,e){const n=e.cause;for(const r of e.targetIds)t.Or.has(r)&&(await t.remoteSyncer.rejectListen(r,n),t.Or.delete(r),t.Ur.removeTarget(r))}(t,e)}catch(n){ni("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await Mc(t,n)}else if(e instanceof Co?t.Ur.X(e):e instanceof Do?t.Ur.rt(e):t.Ur.et(e),!n.isEqual(pi.min()))try{const e=await $a(t.localStore);n.compareTo(e)>=0&&await function(t,e){const n=t.Ur.ut(e);return n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const i=t.Or.get(r);i&&t.Or.set(r,i.withResumeToken(n.resumeToken,e))}})),n.targetMismatches.forEach((e=>{const n=t.Or.get(e);if(!n)return;t.Or.set(e,n.withResumeToken(Ii.EMPTY_BYTE_STRING,n.snapshotVersion)),Nc(t,e);const r=new Ra(n.target,e,1,n.sequenceNumber);Ac(t,r)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){ni("RemoteStore","Failed to raise snapshot:",e),await Mc(t,e)}}async function Mc(t,e,n){if(!Ca(e))throw e;t.Fr.add(1),await Ic(t),t.Br.set("Offline"),n||(n=()=>$a(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{ni("RemoteStore","Retrying IndexedDB access"),await n(),t.Fr.delete(1),await Tc(t)}))}function Pc(t,e){return e().catch((n=>Mc(t,n,e)))}async function Vc(t){const e=ci(t),n=Gc(e);let r=e.$r.length>0?e.$r[e.$r.length-1].batchId:-1;for(;Fc(e);)try{const t=await Ha(e.localStore,r);if(null===t){0===e.$r.length&&n.ir();break}r=t.batchId,Uc(e,t)}catch(t){await Mc(e,t)}qc(e)&&jc(e)}function Fc(t){return kc(t)&&t.$r.length<10}function Uc(t,e){t.$r.push(e);const n=Gc(t);n.er()&&n.pr&&n.Er(e.mutations)}function qc(t){return kc(t)&&!Gc(t).tr()&&t.$r.length>0}function jc(t){Gc(t).start()}async function Bc(t){Gc(t).Ar()}async function Kc(t){const e=Gc(t);for(const n of t.$r)e.Er(n.mutations)}async function zc(t,e,n){const r=t.$r.shift(),i=ka.from(r,e,n);await Pc(t,(()=>t.remoteSyncer.applySuccessfulWrite(i))),await Vc(t)}async function $c(t,e){e&&Gc(t).pr&&await async function(t,e){if(function(t){switch(t){case Jr.OK:return oi();case Jr.CANCELLED:case Jr.UNKNOWN:case Jr.DEADLINE_EXCEEDED:case Jr.RESOURCE_EXHAUSTED:case Jr.INTERNAL:case Jr.UNAVAILABLE:case Jr.UNAUTHENTICATED:return!1;case Jr.INVALID_ARGUMENT:case Jr.NOT_FOUND:case Jr.ALREADY_EXISTS:case Jr.PERMISSION_DENIED:case Jr.FAILED_PRECONDITION:case Jr.ABORTED:case Jr.OUT_OF_RANGE:case Jr.UNIMPLEMENTED:case Jr.DATA_LOSS:return!0;default:return oi()}}(n=e.code)&&n!==Jr.ABORTED){const n=t.$r.shift();Gc(t).sr(),await Pc(t,(()=>t.remoteSyncer.rejectFailedWrite(n.batchId,e))),await Vc(t)}var n}(t,e),qc(t)&&jc(t)}function Hc(t){return t.qr||(t.qr=function(t,e,n){const r=ci(t);return r.Pr(),new yc(e,r.Hi,r.credentials,r.R,n)}(t.datastore,t.asyncQueue,{Ii:Lc.bind(null,t),Ri:xc.bind(null,t),_r:Oc.bind(null,t)}),t.Mr.push((async e=>{e?(t.qr.sr(),Dc(t)?Cc(t):t.Br.set("Unknown")):(await t.qr.stop(),Rc(t))}))),t.qr}function Gc(t){return t.Kr||(t.Kr=function(t,e,n){const r=ci(t);return r.Pr(),new vc(e,r.Hi,r.credentials,r.R,n)}(t.datastore,t.asyncQueue,{Ii:Bc.bind(null,t),Ri:$c.bind(null,t),Ir:Kc.bind(null,t),Tr:zc.bind(null,t)}),t.Mr.push((async e=>{e?(t.Kr.sr(),await Vc(t)):(await t.Kr.stop(),t.$r.length>0&&(ni("RemoteStore",`Stopping write stream with ${t.$r.length} pending writes`),t.$r=[]))}))),t.Kr}class Wc{constructor(t,e,n,r,i){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new Aa,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((t=>{}))}static createAndSchedule(t,e,n,r,i){const s=Date.now()+n,o=new Wc(t,e,s,r,i);return o.start(n),o}start(t){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Zr(Jr.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((t=>this.deferred.resolve(t)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Qc(t,e){if(ri("AsyncQueue",`${e}: ${t}`),Ca(t))return new Zr(Jr.UNAVAILABLE,`${e}: ${t}`);throw t}class Xc{constructor(t){this.comparator=t?(e,n)=>t(e,n)||xi.comparator(e.key,n.key):(t,e)=>xi.comparator(t.key,e.key),this.keyedMap=Eo(),this.sortedSet=new lo(this.comparator)}static emptySet(t){return new Xc(t.comparator)}has(t){return null!=this.keyedMap.get(t)}get(t){return this.keyedMap.get(t)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(t){const e=this.keyedMap.get(t);return e?this.sortedSet.indexOf(e):-1}get size(){return this.sortedSet.size}forEach(t){this.sortedSet.inorderTraversal(((e,n)=>(t(e),!1)))}add(t){const e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))}delete(t){const e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this}isEqual(t){if(!(t instanceof Xc))return!1;if(this.size!==t.size)return!1;const e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(!t.isEqual(r))return!1}return!0}toString(){const t=[];return this.forEach((e=>{t.push(e.toString())})),0===t.length?"DocumentSet ()":"DocumentSet (\n  "+t.join("  \n")+"\n)"}copy(t,e){const n=new Xc;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}class Yc{constructor(){this.jr=new lo(xi.comparator)}track(t){const e=t.doc.key,n=this.jr.get(e);n?0!==t.type&&3===n.type?this.jr=this.jr.insert(e,t):3===t.type&&1!==n.type?this.jr=this.jr.insert(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.jr=this.jr.insert(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.jr=this.jr.insert(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.jr=this.jr.remove(e):1===t.type&&2===n.type?this.jr=this.jr.insert(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.jr=this.jr.insert(e,{type:2,doc:t.doc}):oi():this.jr=this.jr.insert(e,t)}Qr(){const t=[];return this.jr.inorderTraversal(((e,n)=>{t.push(n)})),t}}class Jc{constructor(t,e,n,r,i,s,o,a){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=s,this.syncStateChanged=o,this.excludesMetadataChanges=a}static fromInitialDocuments(t,e,n,r){const i=[];return e.forEach((t=>{i.push({type:0,doc:t})})),new Jc(t,e,Xc.emptySet(e),i,n,r,!0,!1)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(t){if(!(this.fromCache===t.fromCache&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&Ss(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))return!1;const e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].type!==n[t].type||!e[t].doc.isEqual(n[t].doc))return!1;return!0}}class Zc{constructor(){this.Wr=void 0,this.listeners=[]}}class th{constructor(){this.queries=new Ua((t=>_s(t)),Ss),this.onlineState="Unknown",this.Gr=new Set}}function eh(t,e){const n=ci(t);let r=!1;for(const t of e){const e=t.query,i=n.queries.get(e);if(i){for(const e of i.listeners)e.Hr(t)&&(r=!0);i.Wr=t}}r&&rh(n)}function nh(t,e,n){const r=ci(t),i=r.queries.get(e);if(i)for(const t of i.listeners)t.onError(n);r.queries.delete(e)}function rh(t){t.Gr.forEach((t=>{t.next()}))}class ih{constructor(t,e,n){this.query=t,this.Jr=e,this.Yr=!1,this.Xr=null,this.onlineState="Unknown",this.options=n||{}}Hr(t){if(!this.options.includeMetadataChanges){const e=[];for(const n of t.docChanges)3!==n.type&&e.push(n);t=new Jc(t.query,t.docs,t.oldDocs,e,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0)}let e=!1;return this.Yr?this.Zr(t)&&(this.Jr.next(t),e=!0):this.eo(t,this.onlineState)&&(this.no(t),e=!0),this.Xr=t,e}onError(t){this.Jr.error(t)}zr(t){this.onlineState=t;let e=!1;return this.Xr&&!this.Yr&&this.eo(this.Xr,t)&&(this.no(this.Xr),e=!0),e}eo(t,e){if(!t.fromCache)return!0;const n="Offline"!==e;return!(this.options.so&&n||t.docs.isEmpty()&&"Offline"!==e)}Zr(t){if(t.docChanges.length>0)return!0;const e=this.Xr&&this.Xr.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges}no(t){t=Jc.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache),this.Yr=!0,this.Jr.next(t)}}class sh{constructor(t){this.key=t}}class oh{constructor(t){this.key=t}}class ah{constructor(t,e){this.query=t,this.uo=e,this.ao=null,this.current=!1,this.ho=Io(),this.mutatedKeys=Io(),this.lo=Cs(t),this.fo=new Xc(this.lo)}get wo(){return this.uo}_o(t,e){const n=e?e.mo:new Yc,r=e?e.fo:this.fo;let i=e?e.mutatedKeys:this.mutatedKeys,s=r,o=!1;const a=vs(this.query)&&r.size===this.query.limit?r.last():null,c=ws(this.query)&&r.size===this.query.limit?r.first():null;if(t.inorderTraversal(((t,e)=>{const h=r.get(t),u=Ns(this.query,e)?e:null,l=!!h&&this.mutatedKeys.has(h.key),f=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations);let d=!1;h&&u?h.data.isEqual(u.data)?l!==f&&(n.track({type:3,doc:u}),d=!0):this.yo(h,u)||(n.track({type:2,doc:u}),d=!0,(a&&this.lo(u,a)>0||c&&this.lo(u,c)<0)&&(o=!0)):!h&&u?(n.track({type:0,doc:u}),d=!0):h&&!u&&(n.track({type:1,doc:h}),d=!0,(a||c)&&(o=!0)),d&&(u?(s=s.add(u),i=f?i.add(t):i.delete(t)):(s=s.delete(t),i=i.delete(t)))})),vs(this.query)||ws(this.query))for(;s.size>this.query.limit;){const t=vs(this.query)?s.last():s.first();s=s.delete(t.key),i=i.delete(t.key),n.track({type:1,doc:t})}return{fo:s,mo:n,Nn:o,mutatedKeys:i}}yo(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n){const r=this.fo;this.fo=t.fo,this.mutatedKeys=t.mutatedKeys;const i=t.mo.Qr();i.sort(((t,e)=>function(t,e){const n=t=>{switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return oi()}};return n(t)-n(e)}(t.type,e.type)||this.lo(t.doc,e.doc))),this.po(n);const s=e?this.Eo():[],o=0===this.ho.size&&this.current?1:0,a=o!==this.ao;return this.ao=o,0!==i.length||a?{snapshot:new Jc(this.query,t.fo,r,i,t.mutatedKeys,0===o,a,!1),To:s}:{To:s}}zr(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({fo:this.fo,mo:new Yc,mutatedKeys:this.mutatedKeys,Nn:!1},!1)):{To:[]}}Io(t){return!this.uo.has(t)&&!!this.fo.has(t)&&!this.fo.get(t).hasLocalMutations}po(t){t&&(t.addedDocuments.forEach((t=>this.uo=this.uo.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.uo=this.uo.delete(t))),this.current=t.current)}Eo(){if(!this.current)return[];const t=this.ho;this.ho=Io(),this.fo.forEach((t=>{this.Io(t.key)&&(this.ho=this.ho.add(t.key))}));const e=[];return t.forEach((t=>{this.ho.has(t)||e.push(new oh(t))})),this.ho.forEach((n=>{t.has(n)||e.push(new sh(n))})),e}Ao(t){this.uo=t.Bn,this.ho=Io();const e=this._o(t.documents);return this.applyChanges(e,!0)}Ro(){return Jc.fromInitialDocuments(this.query,this.fo,this.mutatedKeys,0===this.ao)}}class ch{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class hh{constructor(t){this.key=t,this.Po=!1}}class uh{constructor(t,e,n,r,i,s){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=s,this.bo={},this.vo=new Ua((t=>_s(t)),Ss),this.Vo=new Map,this.So=new Set,this.Do=new lo(xi.comparator),this.Co=new Map,this.No=new Xa,this.xo={},this.ko=new Map,this.$o=Va.Yt(),this.onlineState="Unknown",this.Oo=void 0}get isPrimaryClient(){return!0===this.Oo}}async function lh(t,e){const n=function(t){const e=ci(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=dh.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Nh.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=gh.bind(null,e),e.bo._r=eh.bind(null,e.eventManager),e.bo.Mo=nh.bind(null,e.eventManager),e}(t);let r,i;const s=n.vo.get(e);if(s)r=s.targetId,n.sharedClientState.addLocalQueryTarget(r),i=s.view.Ro();else{const t=await function(t,e){const n=ci(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Ue.getTargetData(t,e).next((i=>i?(r=i,Na.resolve(r)):n.Ue.allocateTargetId(t).next((i=>(r=new Ra(e,i,0,t.currentSequenceNumber),n.Ue.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.kn.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.kn=n.kn.insert(t.targetId,t),n.$n.set(e,t.targetId)),t}))}(n.localStore,Is(e)),s=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,i=await async function(t,e,n,r){t.Fo=(e,n,r)=>async function(t,e,n,r){let i=e.view._o(n);i.Nn&&(i=await Wa(t.localStore,e.query,!1).then((({documents:t})=>e.view._o(t,i))));const s=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(i,t.isPrimaryClient,s);return Th(t,e.targetId,o.To),o.snapshot}(t,e,n,r);const i=await Wa(t.localStore,e,!0),s=new ah(e,i.Bn),o=s._o(i.documents),a=No.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState),c=s.applyChanges(o,t.isPrimaryClient,a);Th(t,n,c.To);const h=new ch(e,n,s);return t.vo.set(e,h),t.Vo.has(n)?t.Vo.get(n).push(e):t.Vo.set(n,[e]),c.snapshot}(n,e,r,"current"===s),n.isPrimaryClient&&Sc(n.remoteStore,t)}return i}async function fh(t,e){const n=ci(t),r=n.vo.get(e),i=n.Vo.get(r.targetId);if(i.length>1)return n.Vo.set(r.targetId,i.filter((t=>!Ss(t,e)))),void n.vo.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await Ga(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),_c(n.remoteStore,r.targetId),Eh(n,r.targetId)})).catch(Fa)):(Eh(n,r.targetId),await Ga(n.localStore,r.targetId,!0))}async function dh(t,e){const n=ci(t);try{const t=await function(t,e){const n=ci(t),r=e.snapshotVersion;let i=n.kn;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const s=n.Fn.newChangeBuffer({trackRemovals:!0});i=n.kn;const o=[];e.targetChanges.forEach(((e,s)=>{const a=i.get(s);if(!a)return;o.push(n.Ue.removeMatchingKeys(t,e.removedDocuments,s).next((()=>n.Ue.addMatchingKeys(t,e.addedDocuments,s))));const c=e.resumeToken;if(c.approximateByteSize()>0){const h=a.withResumeToken(c,r).withSequenceNumber(t.currentSequenceNumber);i=i.insert(s,h),function(t,e,n){return ai(e.resumeToken.approximateByteSize()>0),0===t.resumeToken.approximateByteSize()||e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0}(a,h,e)&&o.push(n.Ue.updateTargetData(t,h))}}));let a=vo();if(e.documentUpdates.forEach(((r,i)=>{e.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,r))})),o.push(function(t,e,n,r,i){let s=Io();return n.forEach((t=>s=s.add(t))),e.getEntries(t,s).next((t=>{let s=vo();return n.forEach(((n,o)=>{const a=t.get(n),c=(null==i?void 0:i.get(n))||r;o.isNoDocument()&&o.version.isEqual(pi.min())?(e.removeEntry(n,c),s=s.insert(n,o)):!a.isValidDocument()||o.version.compareTo(a.version)>0||0===o.version.compareTo(a.version)&&a.hasPendingWrites?(e.addEntry(o,c),s=s.insert(n,o)):ni("LocalStore","Ignoring outdated watch update for ",n,". Current version:",a.version," Watch version:",o.version)})),s}))}(t,s,e.documentUpdates,r,void 0).next((t=>{a=t}))),!r.isEqual(pi.min())){const e=n.Ue.getLastRemoteSnapshotVersion(t).next((e=>n.Ue.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return Na.waitFor(o).next((()=>s.apply(t))).next((()=>n.Mn.En(t,a))).next((()=>a))})).then((t=>(n.kn=i,t)))}(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.Co.get(e);r&&(ai(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.Po=!0:t.modifiedDocuments.size>0?ai(r.Po):t.removedDocuments.size>0&&(ai(r.Po),r.Po=!1))})),await _h(n,t,e)}catch(t){await Fa(t)}}function ph(t,e,n){const r=ci(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.vo.forEach(((n,r)=>{const i=r.view.zr(e);i.snapshot&&t.push(i.snapshot)})),function(t,e){const n=ci(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.zr(e)&&(r=!0)})),r&&rh(n)}(r.eventManager,e),t.length&&r.bo._r(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function gh(t,e,n){const r=ci(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.Co.get(e),s=i&&i.key;if(s){let t=new lo(xi.comparator);t=t.insert(s,Qi.newNoDocument(s,pi.min()));const n=Io().add(s),i=new Ao(pi.min(),new Map,new go(li),t,n);await dh(r,i),r.Do=r.Do.remove(s),r.Co.delete(e),Sh(r)}else await Ga(r.localStore,e,!1).then((()=>Eh(r,e,n))).catch(Fa)}async function mh(t,e){const n=ci(t),r=e.batch.batchId;try{const t=await function(t,e){const n=ci(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const r=e.batch.keys(),i=n.Fn.newChangeBuffer({trackRemovals:!0});return function(t,e,n,r){const i=n.batch,s=i.keys();let o=Na.resolve();return s.forEach((t=>{o=o.next((()=>r.getEntry(e,t))).next((e=>{const s=n.docVersions.get(t);ai(null!==s),e.version.compareTo(s)<0&&(i.applyToRemoteDocument(e,n),e.isValidDocument()&&r.addEntry(e,n.commitVersion))}))})),o.next((()=>t._n.removeMutationBatch(e,i)))}(n,t,e,i).next((()=>i.apply(t))).next((()=>n._n.performConsistencyCheck(t))).next((()=>n.Mn.pn(t,r)))}))}(n.localStore,e);wh(n,r,null),vh(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await _h(n,t)}catch(t){await Fa(t)}}async function yh(t,e,n){const r=ci(t);try{const t=await function(t,e){const n=ci(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let r;return n._n.lookupMutationBatch(t,e).next((e=>(ai(null!==e),r=e.keys(),n._n.removeMutationBatch(t,e)))).next((()=>n._n.performConsistencyCheck(t))).next((()=>n.Mn.pn(t,r)))}))}(r.localStore,e);wh(r,e,n),vh(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await _h(r,t)}catch(n){await Fa(n)}}function vh(t,e){(t.ko.get(e)||[]).forEach((t=>{t.resolve()})),t.ko.delete(e)}function wh(t,e,n){const r=ci(t);let i=r.xo[r.currentUser.toKey()];if(i){const t=i.get(e);t&&(n?t.reject(n):t.resolve(),i=i.remove(e)),r.xo[r.currentUser.toKey()]=i}}function Eh(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.Vo.get(e))t.vo.delete(r),n&&t.bo.Mo(r,n);t.Vo.delete(e),t.isPrimaryClient&&t.No.Zn(e).forEach((e=>{t.No.containsKey(e)||bh(t,e)}))}function bh(t,e){t.So.delete(e.path.canonicalString());const n=t.Do.get(e);null!==n&&(_c(t.remoteStore,n),t.Do=t.Do.remove(e),t.Co.delete(n),Sh(t))}function Th(t,e,n){for(const r of n)r instanceof sh?(t.No.addReference(r.key,e),Ih(t,r)):r instanceof oh?(ni("SyncEngine","Document no longer in limbo: "+r.key),t.No.removeReference(r.key,e),t.No.containsKey(r.key)||bh(t,r.key)):oi()}function Ih(t,e){const n=e.key,r=n.path.canonicalString();t.Do.get(n)||t.So.has(r)||(ni("SyncEngine","New document in limbo: "+n),t.So.add(r),Sh(t))}function Sh(t){for(;t.So.size>0&&t.Do.size<t.maxConcurrentLimboResolutions;){const e=t.So.values().next().value;t.So.delete(e);const n=new xi(wi.fromString(e)),r=t.$o.next();t.Co.set(r,new hh(n)),t.Do=t.Do.insert(n,r),Sc(t.remoteStore,new Ra(Is(ys(n.path)),r,2,Yr.o))}}async function _h(t,e,n){const r=ci(t),i=[],s=[],o=[];r.vo.isEmpty()||(r.vo.forEach(((t,a)=>{o.push(r.Fo(a,e,n).then((t=>{if(t){r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,t.fromCache?"not-current":"current"),i.push(t);const e=ja.vn(a.targetId,t);s.push(e)}})))})),await Promise.all(o),r.bo._r(i),await async function(t,e){const n=ci(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>Na.forEach(e,(e=>Na.forEach(e.Pn,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>Na.forEach(e.bn,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!Ca(t))throw t;ni("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.kn.get(e),r=t.snapshotVersion,i=t.withLastLimboFreeSnapshotVersion(r);n.kn=n.kn.insert(e,i)}}}(r.localStore,s))}async function Ah(t,e){const n=ci(t);if(!n.currentUser.isEqual(e)){ni("SyncEngine","User change. New user:",e.toKey());const t=await za(n.localStore,e);n.currentUser=e,function(t,e){t.ko.forEach((t=>{t.forEach((t=>{t.reject(new Zr(Jr.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.ko.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await _h(n,t.Ln)}}function Nh(t,e){const n=ci(t),r=n.Co.get(e);if(r&&r.Po)return Io().add(r.key);{let t=Io();const r=n.Vo.get(e);if(!r)return t;for(const e of r){const r=n.vo.get(e);t=t.unionWith(r.view.wo)}return t}}function Ch(t){const e=ci(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=mh.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=yh.bind(null,e),e}class Dh{constructor(){this.synchronizeTabs=!1}async initialize(t){this.R=pc(t.databaseInfo.databaseId),this.sharedClientState=this.Bo(t),this.persistence=this.Uo(t),await this.persistence.start(),this.gcScheduler=this.qo(t),this.localStore=this.Ko(t)}qo(t){return null}Ko(t){return function(t,e,n,r){return new Ka(t,e,n,r)}(this.persistence,new Ba,t.initialUser,this.R)}Uo(t){return new nc(ic.Ps,this.R)}Bo(t){return new ac}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class kh{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>ph(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=Ah.bind(null,this.syncEngine),await async function(t,e){const n=ci(t);e?(n.Fr.delete(2),await Tc(n)):e||(n.Fr.add(2),await Ic(n),n.Br.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new th}createDatastore(t){const e=pc(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new fc(r));var r;return function(t,e,n){return new wc(t,e,n)}(t.credentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,i=t=>ph(this.syncEngine,t,0),s=hc.gt()?new hc:new cc,new bc(e,n,r,i,s);var e,n,r,i,s}createSyncEngine(t,e){return function(t,e,n,r,i,s,o){const a=new uh(t,e,n,r,i,s);return o&&(a.Oo=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}terminate(){return async function(t){const e=ci(t);ni("RemoteStore","RemoteStore shutting down."),e.Fr.add(5),await Ic(e),e.Lr.shutdown(),e.Br.set("Unknown")}(this.remoteStore)}}class Rh{constructor(t){this.observer=t,this.muted=!1}next(t){this.observer.next&&this.Qo(this.observer.next,t)}error(t){this.observer.error?this.Qo(this.observer.error,t):console.error("Uncaught Error in snapshot listener:",t)}Wo(){this.muted=!0}Qo(t,e){this.muted||setTimeout((()=>{this.muted||t(e)}),0)}}class Lh{constructor(t,e,n){this.credentials=t,this.asyncQueue=e,this.databaseInfo=n,this.user=sc.UNAUTHENTICATED,this.clientId=ui.u(),this.credentialListener=()=>Promise.resolve(),this.credentials.setChangeListener(e,(async t=>{ni("FirestoreClient","Received user=",t.uid),await this.credentialListener(t),this.user=t}))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,credentials:this.credentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.credentialListener=t}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new Zr(Jr.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new Aa;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this.onlineComponents&&await this.onlineComponents.terminate(),this.offlineComponents&&await this.offlineComponents.terminate(),this.credentials.removeChangeListener(),t.resolve()}catch(e){const n=Qc(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function xh(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(ni("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),ni("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener((async t=>{r.isEqual(t)||(await za(e.localStore,t),r=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new Dh)),t.offlineComponents}(t);ni("FirestoreClient","Initializing OnlineComponentProvider");const r=await t.getConfiguration();await e.initialize(n,r),t.setCredentialChangeListener((t=>async function(t,e){const n=ci(t);n.asyncQueue.verifyOperationInProgress(),ni("RemoteStore","RemoteStore received new credentials");const r=kc(n);n.Fr.add(3),await Ic(n),r&&n.Br.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.Fr.delete(3),await Tc(n)}(e.remoteStore,t))),t.onlineComponents=e}async function Oh(t){return t.onlineComponents||(ni("FirestoreClient","Using default OnlineComponentProvider"),await xh(t,new kh)),t.onlineComponents}async function Mh(t){const e=await Oh(t),n=e.eventManager;return n.onListen=lh.bind(null,e.syncEngine),n.onUnlisten=fh.bind(null,e.syncEngine),n}class Ph{constructor(t,e,n,r,i,s,o,a){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=s,this.autoDetectLongPolling=o,this.useFetchStreams=a}}class Vh{constructor(t,e){this.projectId=t,this.database=e||"(default)"}get isDefaultDatabase(){return"(default)"===this.database}isEqual(t){return t instanceof Vh&&t.projectId===this.projectId&&t.database===this.database}}const Fh=new Map;class Uh{constructor(t,e){this.user=e,this.type="OAuth",this.authHeaders={},this.authHeaders.Authorization=`Bearer ${t}`}}class qh{constructor(){this.changeListener=null}getToken(){return Promise.resolve(null)}invalidateToken(){}setChangeListener(t,e){this.changeListener=e,t.enqueueRetryable((()=>e(sc.UNAUTHENTICATED)))}removeChangeListener(){this.changeListener=null}}class jh{constructor(t){this.currentUser=sc.UNAUTHENTICATED,this.oc=new Aa,this.cc=0,this.forceRefresh=!1,this.auth=null,this.asyncQueue=null,this.uc=()=>{this.cc++,this.currentUser=this.ac(),this.oc.resolve(),this.changeListener&&this.asyncQueue.enqueueRetryable((()=>this.changeListener(this.currentUser)))};const e=t=>{ni("FirebaseCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.uc)};t.onInit((t=>e(t))),setTimeout((()=>{if(!this.auth){const n=t.getImmediate({optional:!0});n?e(n):(ni("FirebaseCredentialsProvider","Auth not yet detected"),this.oc.resolve())}}),0)}getToken(){const t=this.cc,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.cc!==t?(ni("FirebaseCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(ai("string"==typeof e.accessToken),new Uh(e.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}setChangeListener(t,e){this.asyncQueue=t,this.asyncQueue.enqueueRetryable((async()=>{await this.oc.promise,await e(this.currentUser),this.changeListener=e}))}removeChangeListener(){this.auth&&this.auth.removeAuthTokenListener(this.uc),this.changeListener=()=>Promise.resolve()}ac(){const t=this.auth&&this.auth.getUid();return ai(null===t||"string"==typeof t),new sc(t)}}class Bh{constructor(t,e,n){this.hc=t,this.lc=e,this.fc=n,this.type="FirstParty",this.user=sc.FIRST_PARTY}get authHeaders(){const t={"X-Goog-AuthUser":this.lc},e=this.hc.auth.getAuthHeaderValueForFirstParty([]);return e&&(t.Authorization=e),this.fc&&(t["X-Goog-Iam-Authorization-Token"]=this.fc),t}}class Kh{constructor(t,e,n){this.hc=t,this.lc=e,this.fc=n}getToken(){return Promise.resolve(new Bh(this.hc,this.lc,this.fc))}setChangeListener(t,e){t.enqueueRetryable((()=>e(sc.FIRST_PARTY)))}removeChangeListener(){}invalidateToken(){}}function zh(t,e,n){if(!n)throw new Zr(Jr.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function $h(t){if(!xi.isDocumentKey(t))throw new Zr(Jr.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function Hh(t){if(xi.isDocumentKey(t))throw new Zr(Jr.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Gh(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){if(t.constructor){const e=/function\s+([^\s(]+)\s*\(/.exec(t.constructor.toString());if(e&&e.length>1)return e[1]}return null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":oi()}function Wh(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Zr(Jr.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Gh(t);throw new Zr(Jr.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}class Qh{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Zr(Jr.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new Zr(Jr.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.useFetchStreams=!!t.useFetchStreams,function(t,e,n,r){if(!0===e&&!0===r)throw new Zr(Jr.INVALID_ARGUMENT,"experimentalForceLongPolling and experimentalAutoDetectLongPolling cannot be used together.")}(0,t.experimentalForceLongPolling,0,t.experimentalAutoDetectLongPolling)}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}class Xh{constructor(t,e){this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Qh({}),this._settingsFrozen=!1,t instanceof Vh?(this._databaseId=t,this._credentials=new qh):(this._app=t,this._databaseId=function(t){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Zr(Jr.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Vh(t.options.projectId)}(t),this._credentials=new jh(e))}get app(){if(!this._app)throw new Zr(Jr.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new Zr(Jr.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Qh(t),void 0!==t.credentials&&(this._credentials=function(t){if(!t)return new qh;switch(t.type){case"gapi":const e=t.client;return ai(!("object"!=typeof e||null===e||!e.auth||!e.auth.getAuthHeaderValueForFirstParty)),new Kh(e,t.sessionIndex||"0",t.iamToken||null);case"provider":return t.client;default:throw new Zr(Jr.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=Fh.get(t);e&&(ni("ComponentProvider","Removing Datastore"),Fh.delete(t),e.terminate())}(this),Promise.resolve()}}class Yh{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Zh(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Yh(this.firestore,t,this._key)}}class Jh{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Jh(this.firestore,t,this._query)}}class Zh extends Jh{constructor(t,e,n){super(t,e,ys(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new Yh(this.firestore,null,new xi(t))}withConverter(t){return new Zh(this.firestore,t,this._path)}}function tu(t,e,...n){if(t=f(t),1===arguments.length&&(e=ui.u()),zh("doc","path",e),t instanceof Xh){const r=wi.fromString(e,...n);return $h(r),new Yh(t,null,new xi(r))}{if(!(t instanceof Yh||t instanceof Zh))throw new Zr(Jr.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(wi.fromString(e,...n));return $h(r),new Yh(t.firestore,t instanceof Zh?t.converter:null,new xi(r))}}class eu{constructor(){this.dc=Promise.resolve(),this.wc=[],this._c=!1,this.mc=[],this.gc=null,this.yc=!1,this.Ec=!1,this.Tc=[],this.Zi=new gc(this,"async_queue_retry"),this.Ic=()=>{const t=dc();t&&ni("AsyncQueue","Visibility state changed to "+t.visibilityState),this.Zi.Gi()};const t=dc();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Ic)}get isShuttingDown(){return this._c}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.Ac(),this.Rc(t)}enterRestrictedMode(t){if(!this._c){this._c=!0,this.Ec=t||!1;const e=dc();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Ic)}}enqueue(t){if(this.Ac(),this._c)return new Promise((()=>{}));const e=new Aa;return this.Rc((()=>this._c&&this.Ec?Promise.resolve():(t().then(e.resolve,e.reject),e.promise))).then((()=>e.promise))}enqueueRetryable(t){this.enqueueAndForget((()=>(this.wc.push(t),this.Pc())))}async Pc(){if(0!==this.wc.length){try{await this.wc[0](),this.wc.shift(),this.Zi.reset()}catch(t){if(!Ca(t))throw t;ni("AsyncQueue","Operation failed with retryable error: "+t)}this.wc.length>0&&this.Zi.Qi((()=>this.Pc()))}}Rc(t){const e=this.dc.then((()=>(this.yc=!0,t().catch((t=>{throw this.gc=t,this.yc=!1,ri("INTERNAL UNHANDLED ERROR: ",function(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}(t)),t})).then((t=>(this.yc=!1,t))))));return this.dc=e,e}enqueueAfterDelay(t,e,n){this.Ac(),this.Tc.indexOf(t)>-1&&(e=0);const r=Wc.createAndSchedule(this,t,e,n,(t=>this.bc(t)));return this.mc.push(r),r}Ac(){this.gc&&oi()}verifyOperationInProgress(){}async vc(){let t;do{t=this.dc,await t}while(t!==this.dc)}Vc(t){for(const e of this.mc)if(e.timerId===t)return!0;return!1}Sc(t){return this.vc().then((()=>{this.mc.sort(((t,e)=>t.targetTimeMs-e.targetTimeMs));for(const e of this.mc)if(e.skipDelay(),"all"!==t&&e.timerId===t)break;return this.vc()}))}Dc(t){this.Tc.push(t)}bc(t){const e=this.mc.indexOf(t);this.mc.splice(e,1)}}function nu(t){return function(t,e){if("object"!=typeof t||null===t)return!1;const n=t;for(const t of["next","error","complete"])if(t in n&&"function"==typeof n[t])return!0;return!1}(t)}class ru extends Xh{constructor(t,e){super(t,e),this.type="firestore",this._queue=new eu,this._persistenceKey="name"in t?t.name:"[DEFAULT]"}_terminate(){return this._firestoreClient||su(this),this._firestoreClient.terminate()}}function iu(t){return t._firestoreClient||su(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function su(t){var e;const n=t._freezeSettings(),r=function(t,e,n,r){return new Ph(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,r.useFetchStreams)}(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new Lh(t._credentials,t._queue,r)}class ou{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Zr(Jr.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new bi(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}class au{constructor(t){this._byteString=t}static fromBase64String(t){try{return new au(Ii.fromBase64String(t))}catch(t){throw new Zr(Jr.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new au(Ii.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}class cu{constructor(t){this._methodName=t}}class hu{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Zr(Jr.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Zr(Jr.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return li(this._lat,t._lat)||li(this._long,t._long)}}const uu=/^__.*__$/;class lu{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return null!==this.fieldMask?new eo(t,this.data,this.fieldMask,e,this.fieldTransforms):new to(t,this.data,e,this.fieldTransforms)}}function fu(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw oi()}}class du{constructor(t,e,n,r,i,s){this.settings=t,this.databaseId=e,this.R=n,this.ignoreUndefinedProperties=r,void 0===i&&this.Cc(),this.fieldTransforms=i||[],this.fieldMask=s||[]}get path(){return this.settings.path}get Nc(){return this.settings.Nc}xc(t){return new du(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.R,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}kc(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.xc({path:n,$c:!1});return r.Oc(t),r}Fc(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.xc({path:n,$c:!1});return r.Cc(),r}Mc(t){return this.xc({path:void 0,$c:!0})}Lc(t){return Su(t,this.settings.methodName,this.settings.Bc||!1,this.path,this.settings.Uc)}contains(t){return void 0!==this.fieldMask.find((e=>t.isPrefixOf(e)))||void 0!==this.fieldTransforms.find((e=>t.isPrefixOf(e.field)))}Cc(){if(this.path)for(let t=0;t<this.path.length;t++)this.Oc(this.path.get(t))}Oc(t){if(0===t.length)throw this.Lc("Document fields must not be empty");if(fu(this.Nc)&&uu.test(t))throw this.Lc('Document fields cannot begin and end with "__"')}}class pu{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.R=n||pc(t)}qc(t,e,n,r=!1){return new du({Nc:t,methodName:e,Uc:n,path:bi.emptyPath(),$c:!1,Bc:r},this.databaseId,this.R,this.ignoreUndefinedProperties)}}function gu(t){const e=t._freezeSettings(),n=pc(t._databaseId);return new pu(t._databaseId,!!e.ignoreUndefinedProperties,n)}function mu(t,e,n,r,i,s={}){const o=t.qc(s.merge||s.mergeFields?2:0,e,n,i);Eu("Data must be an object, but it was:",o,r);const a=vu(r,o);let c,h;if(s.merge)c=new Ti(o.fieldMask),h=o.fieldTransforms;else if(s.mergeFields){const t=[];for(const r of s.mergeFields){const i=bu(e,r,n);if(!o.contains(i))throw new Zr(Jr.INVALID_ARGUMENT,`Field '${i}' is specified in your field mask but missing from your input data.`);_u(t,i)||t.push(i)}c=new Ti(t),h=o.fieldTransforms.filter((t=>c.covers(t.field)))}else c=null,h=o.fieldTransforms;return new lu(new Gi(a),c,h)}function yu(t,e){if(wu(t=f(t)))return Eu("Unsupported field value:",e,t),vu(t,e);if(t instanceof cu)return function(t,e){if(!fu(e.Nc))throw e.Lc(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.Lc(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.$c&&4!==e.Nc)throw e.Lc("Nested arrays are not supported");return function(t,e){const n=[];let r=0;for(const i of t){let t=yu(i,e.Mc(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=f(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Ls(e.R,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=di.fromDate(t);return{timestampValue:Fo(e.R,n)}}if(t instanceof di){const n=new di(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Fo(e.R,n)}}if(t instanceof hu)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof au)return{bytesValue:Uo(e.R,t._byteString)};if(t instanceof Yh){const n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.Lc(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Bo(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.Lc(`Unsupported field value: ${Gh(t)}`)}(t,e)}function vu(t,e){const n={};return yi(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):mi(t,((t,r)=>{const i=yu(r,e.kc(t));null!=i&&(n[t]=i)})),{mapValue:{fields:n}}}function wu(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof di||t instanceof hu||t instanceof au||t instanceof Yh||t instanceof cu)}function Eu(t,e,n){if(!wu(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=Gh(n);throw"an object"===r?e.Lc(t+" a custom object"):e.Lc(t+" "+r)}}function bu(t,e,n){if((e=f(e))instanceof ou)return e._internalPath;if("string"==typeof e)return Iu(t,e);throw Su("Field path arguments must be of type string or FieldPath.",t,!1,void 0,n)}const Tu=new RegExp("[~\\*/\\[\\]]");function Iu(t,e,n){if(e.search(Tu)>=0)throw Su(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new ou(...e.split("."))._internalPath}catch(r){throw Su(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function Su(t,e,n,r,i){const s=r&&!r.isEmpty(),o=void 0!==i;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(s||o)&&(c+=" (found",s&&(c+=` in field ${r}`),o&&(c+=` in document ${i}`),c+=")"),new Zr(Jr.INVALID_ARGUMENT,a+t+c)}function _u(t,e){return t.some((t=>t.isEqual(e)))}class Au{constructor(t,e,n,r,i){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Yh(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new Nu(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){const e=this._document.data.field(Cu("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class Nu extends Au{data(){return super.data()}}function Cu(t,e){return"string"==typeof e?Iu(t,e):e instanceof ou?e._internalPath:e._delegate._internalPath}class Du{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class ku extends Au{constructor(t,e,n,r,i,s){super(t,e,n,r,s),this._firestore=t,this._firestoreImpl=t,this.metadata=i}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Ru(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(Cu("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Ru extends ku{data(t={}){return super.data(t)}}class Lu{constructor(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new Du(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const t=[];return this.forEach((e=>t.push(e))),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach((n=>{t.call(e,new Ru(this._firestore,this._userDataWriter,n.key,n,new Du(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new Zr(Jr.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map((n=>({type:"added",doc:new Ru(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Du(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter),oldIndex:-1,newIndex:e++})))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const r=new Ru(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Du(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let i=-1,s=-1;return 0!==e.type&&(i=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),s=n.indexOf(e.doc.key)),{type:xu(e.type),doc:r,oldIndex:i,newIndex:s}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function xu(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return oi()}}class Ou extends class{}{constructor(t,e){super(),this.Qc=t,this.zc=e,this.type="orderBy"}_apply(t){const e=function(t,e,n){if(null!==t.startAt)throw new Zr(Jr.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==t.endAt)throw new Zr(Jr.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");const r=new fs(e,n);return function(t,e){if(null===Es(t)){const n=bs(t);null!==n&&function(t,e,n){if(!n.isEqual(e))throw new Zr(Jr.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,n,e.field)}}(t,r),r}(t._query,this.Qc,this.zc);return new Jh(t.firestore,t.converter,function(t,e){const n=t.explicitOrderBy.concat([e]);return new ms(t.path,t.collectionGroup,n,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(t._query,e))}}class Mu extends class{convertValue(t,e="none"){switch(Oi(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Ai(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(Ni(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw oi()}}convertObject(t,e){const n={};return mi(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new hu(Ai(t.latitude),Ai(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=Di(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(ki(t));default:return null}}convertTimestamp(t){const e=_i(t);return new di(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=wi.fromString(t);ai(ha(n));const r=new Vh(n.get(1),n.get(3)),i=new xi(n.popFirst(5));return r.isEqual(e)||ri(`Document ${i} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),i}}{constructor(t){super(),this.firestore=t}convertBytes(t){return new au(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new Yh(this.firestore,null,e)}}function Pu(t,e){return function(t,e){const n=new Aa;return t.asyncQueue.enqueueAndForget((async()=>async function(t,e,n){const r=Ch(t);try{const t=await function(t,e){const n=ci(t),r=di.now(),i=e.reduce(((t,e)=>t.add(e.key)),Io());let s;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>n.Mn.pn(t,i).next((i=>{s=i;const o=[];for(const t of e){const e=Ys(t,s.get(t.key));null!=e&&o.push(new eo(t.key,e,Wi(e.value.mapValue),Hs.exists(!0)))}return n._n.addMutationBatch(t,r,o,e)})))).then((t=>(t.applyToLocalDocumentSet(s),{batchId:t.batchId,changes:s})))}(r.localStore,e);r.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let r=t.xo[t.currentUser.toKey()];r||(r=new lo(li)),r=r.insert(e,n),t.xo[t.currentUser.toKey()]=r}(r,t.batchId,n),await _h(r,t.changes),await Vc(r.remoteStore)}catch(t){const e=Qc(t,"Failed to persist write");n.reject(e)}}(await function(t){return Oh(t).then((t=>t.syncEngine))}(t),e,n))),n.promise}(iu(t),e)}Xr="9.0.0-beta.7",x(new p("firestore-exp",((t,{options:e})=>{const n=t.getProvider("app-exp").getImmediate(),r=new ru(n,t.getProvider("auth-internal"));return e=Object.assign({useFetchStreams:!1},e),r._setSettings(e),r}),"PUBLIC")),P("@firebase/firestore","0.0.900-exp.6ef484a04",void 0),function(t,e={}){"object"!=typeof e&&(e={name:e});const n=Object.assign({name:"[DEFAULT]",automaticDataCollectionEnabled:!1},e),r=n.name;if("string"!=typeof r||!r)throw O.create("bad-app-name",{appName:String(r)});if(k.has(r))throw O.create("duplicate-app",{appName:r});const i=new y(r);for(const t of R.values())i.addComponent(t);const s=new M(t,n,i);k.set(r,s)}({apiKey:"AIzaSyCYFptob_Bc8P9Kw7VqIA4rZq1k-sRFhT4",authDomain:"ronaldoti.firebaseapp.com",databaseURL:"https://ronaldoti-default-rtdb.firebaseio.com",projectId:"ronaldoti",storageBucket:"ronaldoti.appspot.com",messagingSenderId:"510097924583",appId:"1:510097924583:web:2426d89be3b17d12d21d42",measurementId:"G-5GV9ZNWBPH"});const Vu=function(t=function(t="[DEFAULT]"){const e=k.get(t);if(!e)throw O.create("no-app",{appName:t});return e}()){return(e=t,n="firestore-exp",e.container.getProvider(n)).getImmediate();var e,n}();document.querySelector("#newsForm").addEventListener("submit",(function(t){t.preventDefault(),async function(t){let e=tu(Vu,"newsletterEmails",t.email);await function(t,e,n){t=Wh(t,Yh);const r=Wh(t.firestore,ru),i=function(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}(t.converter,e,n);return Pu(r,[mu(gu(r),"setDoc",t._key,i,null!==t.converter,n).toMutation(t._key,Hs.none())])}(e,t).then((()=>{console.log("data written")}))}({email:document.querySelector("#newsInput").value,timestamp:di.now().seconds})})),function(t,...e){var n,r,i;t=f(t);let s={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||nu(e[o])||(s=e[o],o++);const a={includeMetadataChanges:s.includeMetadataChanges};if(nu(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(i=t.complete)||void 0===i?void 0:i.bind(t)}let c,h,u;if(t instanceof Yh)h=Wh(t.firestore,ru),u=ys(t._key.path),c={next:n=>{e[o]&&e[o](function(t,e,n){const r=n.docs.get(e._key),i=new Mu(t);return new ku(t,i,e._key,r,new Du(n.hasPendingWrites,n.fromCache),e.converter)}(h,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Wh(t,Jh);h=Wh(n.firestore,ru),u=n._query;const r=new Mu(h);c={next:t=>{e[o]&&e[o](new Lu(h,r,n,t))},error:e[o+1],complete:e[o+2]},function(t){if(ws(t)&&0===t.explicitOrderBy.length)throw new Zr(Jr.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}(t._query)}!function(t,e,n,r){const i=new Rh(r),s=new ih(e,i,n);t.asyncQueue.enqueueAndForget((async()=>async function(t,e){const n=ci(t),r=e.query;let i=!1,s=n.queries.get(r);if(s||(i=!0,s=new Zc),i)try{s.Wr=await n.onListen(r)}catch(t){const n=Qc(t,`Initialization of query '${As(e.query)}' failed`);return void e.onError(n)}n.queries.set(r,s),s.listeners.push(e),e.zr(n.onlineState),s.Wr&&e.Hr(s.Wr)&&rh(n)}(await Mh(t),s)))}(iu(h),u,a,c)}(function(t,...e){for(const n of e)t=n._apply(t);return t}(function(t,e,...n){if(t=f(t),zh("collection","path",e),t instanceof Xh){const r=wi.fromString(e,...n);return Hh(r),new Zh(t,null,r)}{if(!(t instanceof Yh||t instanceof Zh))throw new Zr(Jr.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=wi.fromString(t.path,...n).child(wi.fromString(e));return Hh(r),new Zh(t.firestore,null,r)}}(Vu,"newsletterEmails"),function(t,e="asc"){const n=e,r=Cu("orderBy","timestamp");return new Ou(r,n)}(0,"desc")),(t=>{t.docChanges().forEach((t=>{"added"===t.type&&function(t){let e=document.querySelector("tbody"),n=new Date(1e3*t.data().timestamp).toLocaleDateString(),r=(new Date(1e3*t.data().timestamp).toLocaleTimeString(),document.createElement("button")),i=document.createElement("tr"),s=document.createElement("td");i.setAttribute("data-id",t.id),r.innerHTML="Del";let o=`\n\n              <td>${t.data().email}</td>\n              <td>${n}</td>\n\n  `;s.appendChild(r),i.innerHTML=o,i.appendChild(s),r.addEventListener("click",(()=>{!async function(t){var e;await(e=tu(Vu,"newsletterEmails",t),Pu(Wh(e.firestore,ru),[new so(e._key,Hs.none())]))}(t.id)})),i.classList.add("new-box"),e.appendChild(i)}(t.doc),"modified"===t.type&&console.log("Modified",t.doc.data()),"removed"===t.type&&(console.log("Removed",t.doc.data()),function(t){let e=document.querySelector(`[data-id= ${t.id}]`);e.style.background="hsl(0, 60%, 80%)",e.classList.remove("new-box"),e.classList.add("remove-box"),e.addEventListener("animationend",(()=>{e.remove()})),console.log(e)}(t.doc))}))}))})();