1/*! For license information please see 5596.297fe121ad.chunk.js.LICENSE.txt */ 2"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[5596],{76983:(t,e,n)=>{n.d(e,{Z:()=>E});var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)};function i(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 o,s,u=n(88448),a=n(48886),c=n(14594),h=((o={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",o["bad-app-name"]="Illegal App name: '{$appName}",o["duplicate-app"]="Firebase App named '{$appName}' already exists",o["app-deleted"]="Firebase App named '{$appName}' already deleted",o["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",o["invalid-log-argument"]="First argument to `onLog` must be null or a function.",o),f=new u.LL("app","Firebase",h),l="@firebase/app",p="[DEFAULT]",d=((s={})[l]="fire-core",s["@firebase/analytics"]="fire-analytics",s["@firebase/auth"]="fire-auth",s["@firebase/database"]="fire-rtdb",s["@firebase/functions"]="fire-fn",s["@firebase/installations"]="fire-iid",s["@firebase/messaging"]="fire-fcm",s["@firebase/performance"]="fire-perf",s["@firebase/remote-config"]="fire-rc",s["@firebase/storage"]="fire-gcs",s["@firebase/firestore"]="fire-fst",s["fire-js"]="fire-js",s["firebase-wrapper"]="fire-js-all",s),v=new c.Yd("@firebase/app"),y=function(){function t(t,e,n){var r,o,s=this;this.firebase_=n,this.isDeleted_=!1,this.name_=e.name,this.automaticDataCollectionEnabled_=e.automaticDataCollectionEnabled||!1,this.options_=(0,u.p$)(t),this.container=new a.H0(e.name),this._addComponent(new a.wA("app",(function(){return s}),"PUBLIC"));try{for(var c=i(this.firebase_.INTERNAL.components.values()),h=c.next();!h.done;h=c.next()){var f=h.value;this._addComponent(f)}}catch(t){r={error:t}}finally{try{h&&!h.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}}return Object.defineProperty(t.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(t){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!1,configurable:!0}),t.prototype.delete=function(){var t=this;return new Promise((function(e){t.checkDestroyed_(),e()})).then((function(){return t.firebase_.INTERNAL.removeApp(t.name_),Promise.all(t.container.getProviders().map((function(t){return t.delete()})))})).then((function(){t.isDeleted_=!0}))},t.prototype._getService=function(t,e){return void 0===e&&(e=p),this.checkDestroyed_(),this.container.getProvider(t).getImmediate({identifier:e})},t.prototype._removeServiceInstance=function(t,e){void 0===e&&(e=p),this.container.getProvider(t).clearInstance(e)},t.prototype._addComponent=function(t){try{this.container.addComponent(t)}catch(e){v.debug("Component "+t.name+" failed to register with FirebaseApp "+this.name,e)}},t.prototype._addOrOverwriteComponent=function(t){this.container.addOrOverwriteComponent(t)},t.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw f.create("app-deleted",{appName:this.name_})},t}();y.prototype.name&&y.prototype.options||y.prototype.delete||console.log("dc");var g=function t(){var e=function(t){var e={},n=new Map,r={__esModule:!0,initializeApp:function(n,i){void 0===i&&(i={}),"object"==typeof i&&null!==i||(i={name:i});var o=i;void 0===o.name&&(o.name=p);var s=o.name;if("string"!=typeof s||!s)throw f.create("bad-app-name",{appName:String(s)});if((0,u.r3)(e,s))throw f.create("duplicate-app",{appName:s});var a=new t(n,o,r);return e[s]=a,a},app:o,registerVersion:function(t,e,n){var r,i=null!==(r=d[t])&&void 0!==r?r:t;n&&(i+="-"+n);var o=i.match(/\s|\//),u=e.match(/\s|\//);if(o||u){var c=['Unable to register library "'+i+'" with version "'+e+'":'];return o&&c.push('library name "'+i+'" contains illegal characters (whitespace or "/")'),o&&u&&c.push("and"),u&&c.push('version name "'+e+'" contains illegal characters (whitespace or "/")'),void v.warn(c.join(" "))}s(new a.wA(i+"-version",(function(){return{library:i,version:e}}),"VERSION"))},setLogLevel:c.Ub,onLog:function(t,e){if(null!==t&&"function"!=typeof t)throw f.create("invalid-log-argument",{appName:name});(0,c.Am)(t,e)},apps:null,SDK_VERSION:"8.0.0",INTERNAL:{registerComponent:s,removeApp:function(t){delete e[t]},components:n,useAsService:function(t,e){return"serverAuth"===e?null:e}}};function o(t){if(t=t||p,!(0,u.r3)(e,t))throw f.create("no-app",{appName:t});return e[t]}function s(s){var a,c,h=s.name;if(n.has(h))return v.debug("There were multiple attempts to register component "+h+"."),"PUBLIC"===s.type?r[h]:null;if(n.set(h,s),"PUBLIC"===s.type){var l=function(t){if(void 0===t&&(t=o()),"function"!=typeof t[h])throw f.create("invalid-app-argument",{appName:h});return t[h]()};void 0!==s.serviceProps&&(0,u.ZB)(l,s.serviceProps),r[h]=l,t.prototype[h]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._getService.bind(this,h).apply(this,s.multipleInstances?t:[])}}try{for(var p=i(Object.keys(e)),d=p.next();!d.done;d=p.next()){var y=d.value;e[y]._addComponent(s)}}catch(t){a={error:t}}finally{try{d&&!d.done&&(c=p.return)&&c.call(p)}finally{if(a)throw a.error}}return"PUBLIC"===s.type?r[h]:null}return r.default=r,Object.defineProperty(r,"apps",{get:function(){return Object.keys(e).map((function(t){return e[t]}))}}),o.App=t,r}(y);return e.INTERNAL=r(r({},e.INTERNAL),{createFirebaseNamespace:t,extendNamespace:function(t){(0,u.ZB)(e,t)},createSubscribe:u.ne,ErrorFactory:u.LL,deepExtend:u.ZB}),e}(),m=function(){function t(t){this.container=t}return t.prototype.getPlatformInfoString=function(){return this.container.getProviders().map((function(t){if(function(t){var e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){var e=t.getImmediate();return e.library+"/"+e.version}return null})).filter((function(t){return t})).join(" ")},t}();if((0,u.jU)()&&void 0!==self.firebase){v.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n ");var b=self.firebase.SDK_VERSION;b&&b.indexOf("LITE")>=0&&v.warn("\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n ")}var w=g.initializeApp;g.initializeApp=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return(0,u.UG)()&&v.warn('\n Warning: This is a browser-targeted Firebase bundle but it appears it is being\n run in a Node environment. If running in a Node environment, make sure you\n are using the bundle specified by the "main" field in package.json.\n \n If you are using Webpack, you can specify "main" as the first item in\n "resolve.mainFields":\n https://webpack.js.org/configuration/resolve/#resolvemainfields\n \n If using Rollup, use the @rollup/plugin-node-resolve plugin and specify "main"\n as the first item in "mainFields", e.g. [\'main\', \'module\'].\n https://github.com/rollup/@rollup/plugin-node-resolve\n '),w.apply(void 0,t)};var I=g;!function(t,e){t.INTERNAL.registerComponent(new a.wA("platform-logger",(function(t){return new m(t)}),"PRIVATE")),t.registerVersion(l,"0.6.12",void 0),t.registerVersion("fire-js","")}(I);const E=I},48886:(t,e,n)=>{n.d(e,{wA:()=>u,H0:()=>h});var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)};function i(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function o(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(i(arguments[e]));return t}var s=n(88448),u=function(){function t(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}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}(),a="[DEFAULT]",c=function(){function t(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}return t.prototype.get=function(t){void 0===t&&(t=a);var e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){var n=new s.BH;this.instancesDeferred.set(e,n);try{var r=this.getOrInitializeService(e);r&&n.resolve(r)}catch(t){}}return this.instancesDeferred.get(e).promise},t.prototype.getImmediate=function(t){var e=r({identifier:a,optional:!1},t),n=e.identifier,i=e.optional,o=this.normalizeInstanceIdentifier(n);try{var s=this.getOrInitializeService(o);if(!s){if(i)return null;throw Error("Service "+this.name+" is not available")}return s}catch(t){if(i)return null;throw t}},t.prototype.getComponent=function(){return this.component},t.prototype.setComponent=function(t){var e,n;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");
2if(this.component=t,function(t){return"EAGER"===t.instantiationMode}(t))try{this.getOrInitializeService(a)}catch(t){}try{for(var r=function(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.")}(this.instancesDeferred.entries()),o=r.next();!o.done;o=r.next()){var s=i(o.value,2),u=s[0],c=s[1],h=this.normalizeInstanceIdentifier(u);try{var f=this.getOrInitializeService(h);c.resolve(f)}catch(t){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},t.prototype.clearInstance=function(t){void 0===t&&(t=a),this.instancesDeferred.delete(t),this.instances.delete(t)},t.prototype.delete=function(){return t=this,e=void 0,r=function(){var t;return function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}(this,(function(e){switch(e.label){case 0:return t=Array.from(this.instances.values()),[4,Promise.all(o(t.filter((function(t){return"INTERNAL"in t})).map((function(t){return t.INTERNAL.delete()})),t.filter((function(t){return"_delete"in t})).map((function(t){return t._delete()}))))];case 1:return e.sent(),[2]}}))},new((n=void 0)||(n=Promise))((function(i,o){function s(t){try{a(r.next(t))}catch(t){o(t)}}function u(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}a((r=r.apply(t,e||[])).next())}));var t,e,n,r},t.prototype.isComponentSet=function(){return null!=this.component},t.prototype.getOrInitializeService=function(t){var e=this.instances.get(t);return!e&&this.component&&(e=this.component.instanceFactory(this.container,function(t){return t===a?void 0:t}(t)),this.instances.set(t,e)),e||null},t.prototype.normalizeInstanceIdentifier=function(t){return this.component?this.component.multipleInstances?t:a:t},t}(),h=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 c(t,this);return this.providers.set(t,e),e},t.prototype.getProviders=function(){return Array.from(this.providers.values())},t}()},14594:(t,e,n)=>{function r(){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 o=arguments[e],s=0,u=o.length;s<u;s++,i++)r[i]=o[s];return r}var i;n.d(e,{Am:()=>p,Ub:()=>l,Yd:()=>f,in:()=>o});var o,s=[];!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"}(o||(o={}));var u={debug:o.DEBUG,verbose:o.VERBOSE,info:o.INFO,warn:o.WARN,error:o.ERROR,silent:o.SILENT},a=o.INFO,c=((i={})[o.DEBUG]="log",i[o.VERBOSE]="log",i[o.INFO]="info",i[o.WARN]="warn",i[o.ERROR]="error",i),h=function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];if(!(e<t.logLevel)){var o=(new Date).toISOString(),s=c[e];if(!s)throw new Error("Attempted to log a message with an invali
2d logType (value: "+e+")");console[s].apply(console,r(["["+o+"] "+t.name+":"],n))}},f=function(){function t(t){this.name=t,this._logLevel=a,this._logHandler=h,this._userLogHandler=null,s.push(this)}return Object.defineProperty(t.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in o))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?u[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,r([this,o.DEBUG],t)),this._logHandler.apply(this,r([this,o.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,r([this,o.VERBOSE],t)),this._logHandler.apply(this,r([this,o.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,r([this,o.INFO],t)),this._logHandler.apply(this,r([this,o.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,r([this,o.WARN],t)),this._logHandler.apply(this,r([this,o.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,r([this,o.ERROR],t)),this._logHandler.apply(this,r([this,o.ERROR],t))},t}();function l(t){s.forEach((function(e){e.setLogLevel(t)}))}function p(t,e){for(var n=function(n){var r=null;e&&e.level&&(r=u[e.level]),n.userLogHandler=null===t?null:function(e,n){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var u=i.map((function(t){if(null==t)return null;if("string"==typeof t)return t;if("number"==typeof t||"boolean"==typeof t)return t.toString();if(t instanceof Error)return t.message;try{return JSON.stringify(t)}catch(t){return null}})).filter((function(t){return t})).join(" ");n>=(null!=r?r:e.logLevel)&&t({level:o[n].toLowerCase(),message:u,args:i,type:e.name})}},r=0,i=s;r<i.length;r++)n(i[r])}},88448:(t,e,n)=>{n.d(e,{BH:()=>s,LL:()=>g,r3:()=>b,ne:()=>w,p$:()=>i,ZB:()=>o,z$:()=>u,jU:()=>h,ru:()=>f,d:()=>p,w1:()=>d,uI:()=>a,UG:()=>c,b$:()=>l,Mn:()=>v});var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},r(t,e)};function i(t){return o(void 0,t)}function o(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n in e)e.hasOwnProperty(n)&&(t[n]=o(t[n],e[n]));return t}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 u(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function a(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(u())}function c(){try{return"[object process]"===Object.prototype.toString.call(n.g.process)}catch(t){return!1}}function h(){return"object"==typeof self&&self.self===self}function f(){var t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}function l(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function p(){return u().indexOf("Electron/")>=0}function d(){var t=u();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function v(){return u().indexOf("MSAppHost/")>=0}var y=function(t){function e(n,r,i){var o=t.call(this,r)||this;return o.code=n,o.customData=i,o.name="FirebaseError",Object.setPrototypeOf(o,e.prototype),Error.captureStackTrace&&Error.captureStackTrace(o,g.prototype.create),o}return function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e}(Error),g=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,o=this.errors[t],s=o?function(t,e){return t.replace(m,(function(t,n){var r=e[n];return null!=r?String(r):"<"+n+"?>"}))}(o,r):"Error",u=this.serviceName+": "+s+" ("+i+").";return new y(i,u,r)},t}(),m=/\{\$([^}]+)}/g;function b(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function w(t,e){var n=new I(t,e);return n.subscribe.bind(n)}!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 o,s,u=this.chain_[0],a=this.chain_[1],c=this.chain_[2],h=this.chain_[3],f=this.chain_[4];for(r=0;r<80;r++)r<40?r<20?(o=h^a&(c^h),s=1518500249):(o=a^c^h,s=1859775393):r<60?(o=a&c|h&(a|c),s=2400959708):(o=a^c^h,s=3395469782),i=(u<<5|u>>>27)+o+f+s+n[r]&4294967295,f=h,h=c,c=4294967295&(a<<30|a>>>2),a=u,u=i;this.chain_[0]=this.chain_[0]+u&4294967295,this.chain_[1]=this.chain_[1]+a&4294967295,this.chain_[2]=this.chain_[2]+c&4294967295,this.chain_[3]=this.chain_[3]+h&4294967295,this.chain_[4]=this.chain_[4]+f&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_,o=this.inbuf_;r<e;){if(0===o)for(;r<=n;)this.compress_(t,r),r+=this.blockSize;if("string"==typeof t){for(;r<e;)if(i[o]=t.charCodeAt(r),++r,++o===this.blockSize){this.compress_(i),o=0;break}}else for(;r<e;)if(i[o]=t[r],++r,++o===this.blockSize){this.compress_(i),o=0;break}}this.inbuf_=o,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}}();var I=function(){function t(t,e){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Prom
2ise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((function(){t(n)})).catch((function(t){n.error(t)}))}return 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=E),void 0===r.error&&(r.error=E),void 0===r.complete&&(r.complete=E);var o=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),o},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})))},t}();function E(){}},15503:(t,e,n)=>{n.d(e,{Z:()=>r.Z});var r=n(76983);r.Z.registerVersion("firebase","8.0.0","app")},92627:(t,e,n)=>{var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},r(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function o(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{a(r.next(t))}catch(t){o(t)}}function u(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}a((r=r.apply(t,e||[])).next())}))}function s(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}function u(){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 o=arguments[e],s=0,u=o.length;s<u;s++,i++)r[i]=o[s];return r}var a=n(76983),c=n(14594),h=n(88448),f=function(t,e){return f=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])},f(t,e)};function l(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 p,d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},v=v||{},y=d||self;function g(){}function m(t){var e=typeof t;return"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}function b(t){var e=m(t);return"array"==e||"object"==e&&"number"==typeof t.length}function w(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var I="closure_uid_"+(1e9*Math.random()>>>0),E=0;function _(t,e,n){return t.call.apply(t.bind,arguments)}function T(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 A(t,e,n){return(A=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?_:T).apply(null,arguments)}
2function N(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)}}var S=Date.now;function D(t,e){function n(){}n.prototype=e.prototype,t.S=e.prototype,t.prototype=new n,t.prototype.constructor=t}function O(){this.j=this.j,this.i=this.i}O.prototype.j=!1,O.prototype.ja=function(){!this.j&&(this.j=!0,this.G(),0)&&function(t){Object.prototype.hasOwnProperty.call(t,I)&&t[I]||(t[I]=++E)}(this)},O.prototype.G=function(){if(this.i)for(;this.i.length;)this.i.shift()()};var x=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},k=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,n){for(var r=t.length,i="string"==typeof t?t.split(""):t,o=0;o<r;o++)o in i&&e.call(n,i[o],o,t)};function P(t){return Array.prototype.concat.apply([],arguments)}function L(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 R(t){return/^[\s\xa0]*$/.test(t)}var C,V=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function M(t,e){return-1!=t.indexOf(e)}function U(t,e){return t<e?-1:t>e?1:0}t:{var j=y.navigator;if(j){var F=j.userAgent;if(F){C=F;break t}}C=""}function q(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function G(t){var e={};for(var n in t)e[n]=t[n];return e}var B="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function z(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var o=0;o<B.length;o++)n=B[o],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function H(t){return H[" "](t),t}H[" "]=g;var K,W,X=M(C,"Opera"),Y=M(C,"Trident")||M(C,"MSIE"),Q=M(C,"Edge"),J=Q||Y,$=M(C,"Gecko")&&!(M(C.toLowerCase(),"webkit")&&!M(C,"Edge"))&&!(M(C,"Trident")||M(C,"MSIE"))&&!M(C,"Edge"),Z=M(C.toLowerCase(),"webkit")&&!M(C,"Edge");function tt(){var t=y.document;return t?t.documentMode:void 0}t:{var et="",nt=(W=C,$?/rv:([^\);]+)(\)|;)/.exec(W):Q?/Edge\/([\d\.]+)/.exec(W):Y?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(W):Z?/WebKit\/(\S+)/.exec(W):X?/(?:Version)[ \/]?(\S+)/.exec(W):void 0);if(nt&&(et=nt?nt[1]:""),Y){var rt=tt();if(null!=rt&&rt>parseFloat(et)){K=String(rt);break t}}K=et}var it,ot={};function st(t){return function(t,e){var n=ot;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e()}(t,(function(){for(var e=0,n=V(String(K)).split("."),r=V(String(t)).split("."),i=Math.max(n.length,r.length),o=0;0==e&&o<i;o++){var s=n[o]||"",u=r[o]||"";do{if(s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],u=/(\d*)(\D*)(.*)/.exec(u)||["","","",""],0==s[0].length&&0==u[0].length)break;e=U(0==s[1].length?0:parseInt(s[1],10),0==u[1].length?0:parseInt(u[1],10))||U(0==s[2].length,0==u[2].length)||U(s[2],u[2]),s=s[3],u=u[3]}while(0==e)}return 0<=e}))}y.document&&Y?it=tt()||parseInt(K,10)||void 0:it=void 0;var ut=it,at=!Y||9<=Number(ut),ct=Y&&!st("9"),ht=function(){if(!y.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{y.addEventListener("test",g,e),y.removeEventListener("test",g,e)}catch(t){}return t}();function ft(t,e){this.type=t,this.a=this.target=e,this.defaultPrevented=!1}function lt(t,e){if(ft.call(this,t?t.type:""),this.relatedTarget=this.a=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.pointerId=0,this.pointerType="",this.c=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.a=e,e=t.relatedTarget){if($){t:{try{H(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.c=t,t.defaultPrevented&&this.b()}}ft.prototype.b=function(){this.defaultPrevented=!0},D(lt,ft);var pt={2:"touch",3:"pen",4:"mouse"};lt.prototype.b=function(){lt.S.b.call(this);var t=this.c;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,ct)try{(t.ctrlKey||112<=t.keyCode&&123>=t.keyCode)&&(t.keyCode=-1)}catch(t){}};var dt="closure_listenable_"+(1e6*Math.random()|0),vt=0;function yt(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ca=i,this.key=++vt,this.Y=this.Z=!1}function gt(t){t.Y=!0,t.listener=null,t.proxy=null,t.src=null,t.ca=null}function mt(t){this.src=t,this.a={},this.b=0}function bt(t,e){var n=e.type;if(n in t.a){var r,i=t.a[n],o=x(i,e);(r=0<=o)&&Array.prototype.splice.call(i,o,1),r&&(gt(e),0==t.a[n].length&&(delete t.a[n],t.b--))}}function wt(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.Y&&o.listener==e&&o.capture==!!n&&o.ca==r)return i}return-1}mt.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var s=wt(t,e,r,i);return-1<s?(e=t[s],n||(e.Z=!1)):((e=new yt(e,this.src,o,!!r,i)).Z=n,t.push(e)),e};var It="closure_lm_"+(1e6*Math.random()|0),Et={};function _t(t,e,n,r,i){if(r&&r.once)return At(t,e,n,r,i);if(Array.isArray(e)){for(var o=0;o<e.length;o++)_t(t,e[o],n,r,i);return null}return n=Lt(n),t&&t[dt]?t.va(e,n,w(r)?!!r.capture:!!r,i):Tt(t,e,n,!1,r,i)}function Tt(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s=w(i)?!!i.capture:!!i;if(s&&!at)return null;var u=kt(t);if(u||(t[It]=u=new mt(t)),(n=u.add(e,n,r,s,o)).proxy)return n;if(r=function(){var t=xt,e=at?function(n){return t.call(e.src,e.listener,n)}:function(n){if(!(n=t.call(e.src,e.listener,n)))return n};return e}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)ht||(i=s),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(Dt(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function At(t,e,n,r,i){if(Array.isArray(e)){for(var o=0;o<e.length;o++)At(t,e[o],n,r,i);return null}return n=Lt(n),t&&t[dt]?t.wa(e,n,w(r)?!!r.capture:!!r,i):Tt(t,e,n,!0,r,i)}function Nt(t,e,n,r,i){if(Array.isArray(e))for(var o=0;o<e.length;o++)Nt(t,e[o],n,r,i);else r=w(r)?!!r.capture:!!r,n=Lt(n),t&&t[dt]?(t=t.c,(e=String(e).toString())in t.a&&-1<(n=wt(o=t.a[e],n,r,i))&&(gt(o[n]),Array.prototype.splice.call(o,n,1),0==o.length&&(delete t.a[e],t.b--))):t&&(t=kt(t))&&(e=t.a[e.toString()],t=-1,e&&(t=wt(e,n,r,i)),(n=-1<t?e[t]:null)&&St(n))}function St(t){if("number"!=typeof t&&t&&!t.Y){var e=t.src;if(e&&e[dt])bt(e.c,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Dt(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=kt(e))?(bt(n,t),0==n.b&&(n.src=null,e[It]=null)):gt(t)}}}function Dt(t){return t in Et?Et[t]:Et[t]="on"+t}function Ot(t,e){var n=t.listener,r=t.ca||t.src;return t.Z&&St(t),n.call(r,e)}function xt(t,e){if(t.Y)return!0;
2if(!at){if(!e)t:{e=["window","event"];for(var n=y,r=0;r<e.length;r++)if(null==(n=n[e[r]])){e=null;break t}e=n}return Ot(t,e=new lt(e,this))}return Ot(t,new lt(e,this))}function kt(t){return(t=t[It])instanceof mt?t:null}var Pt="__closure_events_fn_"+(1e9*Math.random()>>>0);function Lt(t){return"function"==m(t)?t:(t[Pt]||(t[Pt]=function(e){return t.handleEvent(e)}),t[Pt])}function Rt(){O.call(this),this.c=new mt(this),this.J=this,this.C=null}function Ct(t,e,n,r){if(!(e=t.c.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o<e.length;++o){var s=e[o];if(s&&!s.Y&&s.capture==n){var u=s.listener,a=s.ca||s.src;s.Z&&bt(t.c,s),i=!1!==u.call(a,r)&&i}}return i&&!r.defaultPrevented}D(Rt,O),Rt.prototype[dt]=!0,(p=Rt.prototype).addEventListener=function(t,e,n,r){_t(this,t,e,n,r)},p.removeEventListener=function(t,e,n,r){Nt(this,t,e,n,r)},p.dispatchEvent=function(t){var e,n=this.C;if(n)for(e=[];n;n=n.C)e.push(n);n=this.J;var r=t.type||t;if("string"==typeof t)t=new ft(t,n);else if(t instanceof ft)t.target=t.target||n;else{var i=t;z(t=new ft(r,n),i)}if(i=!0,e)for(var o=e.length-1;0<=o;o--){var s=t.a=e[o];i=Ct(s,r,!0,t)&&i}if(i=Ct(s=t.a=n,r,!0,t)&&i,i=Ct(s,r,!1,t)&&i,e)for(o=0;o<e.length;o++)i=Ct(s=t.a=e[o],r,!1,t)&&i;return i},p.G=function(){if(Rt.S.G.call(this),this.c){var t,e=this.c;for(t in e.a){for(var n=e.a[t],r=0;r<n.length;r++)gt(n[r]);delete e.a[t],e.b--}}this.C=null},p.va=function(t,e,n,r){return this.c.add(String(t),e,!1,n,r)},p.wa=function(t,e,n,r){return this.c.add(String(t),e,!0,n,r)};var Vt=y.JSON.stringify;function Mt(){this.b=this.a=null}var Ut,jt=new(function(){function t(t,e,n){this.f=n,this.c=t,this.g=e,this.b=0,this.a=null}return t.prototype.get=function(){var t;return 0<this.b?(this.b--,t=this.a,this.a=t.next,t.next=null):t=this.c(),t},t}())((function(){return new qt}),(function(t){t.reset()}),100);function Ft(){var t=Ht,e=null;return t.a&&(e=t.a,t.a=t.a.next,t.a||(t.b=null),e.next=null),e}function qt(){this.next=this.b=this.a=null}function Gt(t){y.setTimeout((function(){throw t}),0)}function Bt(t,e){Ut||function(){var t=y.Promise.resolve(void 0);Ut=function(){t.then(Kt)}}(),zt||(Ut(),zt=!0),Ht.add(t,e)}Mt.prototype.add=function(t,e){var n=jt.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},qt.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null},qt.prototype.reset=function(){this.next=this.b=this.a=null};var zt=!1,Ht=new Mt;function Kt(){for(var t;t=Ft();){try{t.a.call(t.b)}catch(t){Gt(t)}var e=jt;e.g(t),e.b<e.f&&(e.b++,t.next=e.a,e.a=t)}zt=!1}function Wt(t,e){Rt.call(this),this.b=t||1,this.a=e||y,this.f=A(this.Ya,this),this.g=S()}function Xt(t){t.aa=!1,t.M&&(t.a.clearTimeout(t.M),t.M=null)}function Yt(t,e,n){if("function"==m(t))n&&(t=A(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=A(t.handleEvent,t)}return 2147483647<Number(e)?-1:y.setTimeout(t,e||0)}function Qt(t){t.a=Yt((function(){t.a=null,t.c&&(t.c=!1,Qt(t))}),t.h);var e=t.b;t.b=null,t.g.apply(null,e)}D(Wt,Rt),(p=Wt.prototype).aa=!1,p.M=null,p.Ya=function(){if(this.aa){var t=S()-this.g;0<t&&t<.8*this.b?this.M=this.a.setTimeout(this.f,this.b-t):(this.M&&(this.a.clearTimeout(this.M),this.M=null),this.dispatchEvent("tick"),this.aa&&(Xt(this),this.start()))}},p.start=function(){this.aa=!0,this.M||(this.M=this.a.setTimeout(this.f,this.b),this.g=S())},p.G=function(){Wt.S.G.call(this),Xt(this),delete this.a};var Jt=function(t){function e(e,n,r){var i=t.call(this)||this;return i.g=null!=r?e.bind(r):e,i.h=n,i.b=null,i.c=!1,i.a=null,i}return function(t,e){function n(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.f=function(t){this.b=arguments,this.a?this.c=!0:Qt(this)},e.prototype.G=function(){t.prototype.G.call(this),this.a&&(y.clearTimeout(this.a),this.a=null,this.c=!1,this.b=null)},e}(O);function $t(t){O.call(this),this.b=t,this.a={}}D($t,O);var Zt=[];function te(t,e,n,r){Array.isArray(n)||(n&&(Zt[0]=n.toString()),n=Zt);for(var i=0;i<n.length;i++){var o=_t(e,n[i],r||t.handleEvent,!1,t.b||t);if(!o)break;t.a[o.key]=o}}function ee(t){q(t.a,(function(t,e){this.a.hasOwnProperty(e)&&St(t)}),t),t.a={}}function ne(){this.a=!0}function re(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.a)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var o=i[0];if("noop"!=o&&"stop"!=o&&"close"!=o)for(var s=1;s<i.length;s++)i[s]=""}}}return Vt(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}$t.prototype.G=function(){$t.S.G.call(this),ee(this)},$t.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},ne.prototype.info=function(){};var ie=null;function oe(){return ie=ie||new Rt}function se(t){ft.call(this,"serverreachability",t)}function ue(t){var e=oe();e.dispatchEvent(new se(e,t))}function ae(t){ft.call(this,"statevent",t)}function ce(t){var e=oe();e.dispatchEvent(new ae(e,t))}function he(t){ft.call(this,"timingevent",t)}function fe(t,e){if("function"!=m(t))throw Error("Fn must not be null and must be a function");return y.setTimeout((function(){t()}),e)}D(se,ft),D(ae,ft),D(he,ft);var le={NO_ERROR:0,Za:1,gb:2,fb:3,bb:4,eb:5,hb:6,Da:7,TIMEOUT:8,kb:9},pe={ab:"complete",ob:"success",Ea:"error",Da:"abort",mb:"ready",nb:"readystatechange",TIMEOUT:"timeout",ib:"incrementaldata",lb:"progress",cb:"downloadprogress",pb:"uploadprogress"};function de(){}function ve(t){var e;return(e=t.a)||(e=t.a={}),e}function ye(){}de.prototype.a=null;var ge,me={OPEN:"a",$a:"b",Ea:"c",jb:"d"};function be(){ft.call(this,"d")}function we(){ft.call(this,"c")}function Ie(){}function Ee(t,e,n,r){this.g=t,this.c=e,this.f=n,this.T=r||1,this.J=new $t(this),this.P=_e,t=J?125:void 0,this.R=new Wt(t),this.B=null,this.b=!1,this.j=this.l=this.i=this.H=this.u=this.U=this.o=null,this.s=[],this.a=null,this.D=0,this.h=this.m=null,this.N=-1,this.A=!1,this.O=0,this.F=null,this.W=this.C=this.V=this.I=!1}D(be,ft),D(we,ft),D(Ie,de),ge=new Ie;var _e=45e3,Te={},Ae={};function Ne(t,e,n){t.H=1,t.i=Xe(Ge(e)),t.j=n,t.I=!0,Se(t,null)}function Se(t,e){t.u=S(),xe(t),t.l=Ge(t.i);var n=t.l,r=t.T;Array.isArray(r)||(r=[String(r)]),an(n.b,"t",r),t.D=0,t.a=nr(t.g,t.g.C?e:null),0<t.O&&(t.F=new Jt(A(t.Ca,t,t.a),t.O)),te(t.J,t.a,"readystatechange",t.Wa),e=t.B?G(t.B):{},t.j?(t.m||(t.m="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.a.ba(t.l,t.m,t.j,e)):(t.m="GET",t.a.ba(t.l,t.m,null,e)),ue(1),function(t,e,n,r,i,o){t.info((function(){if(t.a)if(o)for(var s="",u=o.split("&"),a=0;a<u.length;a++){var c=u[a].split("=");if(1<c.length){var h=c[0];c=c[1];var f=h.split("_");s=2<=f.length&&"type"==f[1]?s+(h+"=")+c+"&":s+(h+"=redacted&")}}else s=null;else s=o;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+e+"\n"+n+"\n"+s}))}(t.c,t.m,t.l,t.f,t.T,t.j)}function De(t,e,n){for(var r=!0;!t.A&&t.D<n.length;){var i=Oe(t,n);if(i==Ae){4==e&&(t.h=4,ce(14),r=!1),re(t.c,t.f,null,"[Incomplete Response]");break}if(i==Te){t.h=4,ce(15),re(t.c,t.f,n,"[Invalid Chunk]"),r=!1;break}re(t.c,t.f,i,null),Ce(t,i)}4==e&&0==n.length&&(t.h=1,ce(16),r=!1),t.b=t.b&&r,r?0<n.length&&!t.W&&(t.W=!0,(e=t.g).a==t&&e.V&&!e.F&&(e.c.info("Great, no buffering proxy detected. Bytes received: "+n.length),Xn(e),e.F=!0)):(re(t.c,t.f,n,"[Invalid Chunked Response]"),Re(t),Le(t))}function Oe(t,e){var n=t.D,r=e.indexOf("\n",n);return-1==r?Ae:(n=Number(e.substring(n,r)),isNaN(n)?Te:(r+=1)+n>e.length?Ae:(e=e.substr(r,n),t.D=r+n,e))}function xe(t){t.U=S()+t.P,ke(t,t.P)}function ke(t,e){if(null!=t.o)throw Error("WatchDog timer not null");t.o=fe(A(t.Ua,t),e)}function Pe(t){t.o&&(y.clearTimeout(t.o),t.o=null)}function Le(t){0==t.g.v||t.A||Jn(t.g,t)}
2function Re(t){Pe(t);var e=t.F;e&&"function"==typeof e.ja&&e.ja(),t.F=null,Xt(t.R),ee(t.J),t.a&&(e=t.a,t.a=null,e.abort(),e.ja())}function Ce(t,e){try{var n=t.g;if(0!=n.v&&(n.a==t||vn(n.b,t)))if(n.I=t.N,!t.C&&vn(n.b,t)&&3==n.v){try{var r=n.ka.a.parse(e)}catch(t){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.j){if(n.a){if(!(n.a.u+3e3<t.u))break t;Qn(n),jn(n)}Wn(n),ce(18)}}else n.oa=i[1],0<n.oa-n.P&&37500>i[2]&&n.H&&0==n.o&&!n.m&&(n.m=fe(A(n.Ra,n),6e3));if(1>=dn(n.b)&&n.ea){try{n.ea()}catch(t){}n.ea=void 0}}else Zn(n,11)}else if((t.C||n.a==t)&&Qn(n),!R(e))for(e=r=n.ka.a.parse(e),r=0;r<e.length;r++)if(i=e[r],n.P=i[0],i=i[1],2==n.v)if("c"==i[0]){n.J=i[1],n.ga=i[2];var o=i[3];null!=o&&(n.ha=o,n.c.info("VER="+n.ha));var s=i[4];null!=s&&(n.pa=s,n.c.info("SVER="+n.pa));var u=i[5];if(null!=u&&"number"==typeof u&&0<u){var a=1.5*u;n.D=a,n.c.info("backChannelRequestTimeoutMs_="+a)}a=n;var c=t.a;if(c){var h=c.a?c.a.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var f=a.b;!f.a&&(M(h,"spdy")||M(h,"quic")||M(h,"h2"))&&(f.f=f.g,f.a=new Set,f.b&&(yn(f,f.b),f.b=null))}if(a.A){var l=c.a?c.a.getResponseHeader("X-HTTP-Session-Id"):null;l&&(a.na=l,We(a.B,a.A,l))}}n.v=3,n.f&&n.f.ta(),n.V&&(n.N=S()-t.u,n.c.info("Handshake RTT: "+n.N+"ms"));var p=t;if((a=n).la=er(a,a.C?a.ga:null,a.fa),p.C){gn(a.b,p);var d=p,v=a.D;v&&d.setTimeout(v),d.o&&(Pe(d),xe(d)),a.a=p}else Kn(a);0<n.g.length&&Gn(n)}else"stop"!=i[0]&&"close"!=i[0]||Zn(n,7);else 3==n.v&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?Zn(n,7):Un(n):"noop"!=i[0]&&n.f&&n.f.sa(i),n.o=0);ue(4)}catch(t){}}function Ve(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(b(t)||"string"==typeof t)k(t,e,void 0);else{if(t.L&&"function"==typeof t.L)var n=t.L();else if(t.K&&"function"==typeof t.K)n=void 0;else if(b(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;r=function(t){if(t.K&&"function"==typeof t.K)return t.K();if("string"==typeof t)return t.split("");if(b(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),i=r.length;for(var o=0;o<i;o++)e.call(void 0,r[o],n&&n[o],t)}}function Me(t,e){this.b={},this.a=[],this.c=0;var n=arguments.length;if(1<n){if(n%2)throw Error("Uneven number of arguments");for(var r=0;r<n;r+=2)this.set(arguments[r],arguments[r+1])}else if(t)if(t instanceof Me)for(n=t.L(),r=0;r<n.length;r++)this.set(n[r],t.get(n[r]));else for(r in t)this.set(r,t[r])}function Ue(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];je(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){var i={};for(n=e=0;e<t.a.length;)je(i,r=t.a[e])||(t.a[n++]=r,i[r]=1),e++;t.a.length=n}}function je(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(p=Ee.prototype).setTimeout=function(t){this.P=t},p.Wa=function(t){t=t.target;var e=this.F;e&&3==Rn(t)?e.f():this.Ca(t)},p.Ca=function(t){try{if(t==this.a)t:{var e=Rn(this.a),n=this.a.ua(),r=this.a.X();if(!(3>e||3==e&&!J&&!this.a.$())){this.A||4!=e||7==n||ue(8==n||0>=r?3:2),Pe(this);var i=this.a.X();this.N=i;var o=this.a.$();if(this.b=200==i,function(t,e,n,r,i,o,s){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+"\n"+n+"\n"+o+" "+s}))}(this.c,this.m,this.l,this.f,this.T,e,i),this.b){if(this.V&&!this.C){e:{if(this.a){var s,u=this.a;if((s=u.a?u.a.getResponseHeader("X-HTTP-Initial-Response"):null)&&!R(s)){var a=s;break e}}a=null}if(!a){this.b=!1,this.h=3,ce(12),Re(this),Le(this);break t}re(this.c,this.f,a,"Initial handshake response via X-HTTP-Initial-Response"),this.C=!0,Ce(this,a)}this.I?(De(this,e,o),J&&this.b&&3==e&&(te(this.J,this.R,"tick",this.Va),this.R.start())):(re(this.c,this.f,o,null),Ce(this,o)),4==e&&Re(this),this.b&&!this.A&&(4==e?Jn(this.g,this):(this.b=!1,xe(this)))}else 400==i&&0<o.indexOf("Unknown SID")?(this.h=3,ce(12)):(this.h=0,ce(13)),Re(this),Le(this)}}}catch(t){}},p.Va=function(){if(this.a){var t=Rn(this.a),e=this.a.$();this.D<e.length&&(Pe(this),De(this,t,e),this.b&&4!=t&&xe(this))}},p.cancel=function(){this.A=!0,Re(this)},p.Ua=function(){this.o=null;var t=S();0<=t-this.U?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.c,this.l),2!=this.H&&(ue(3),ce(17)),Re(this),this.h=2,Le(this)):ke(this,this.U-t)},(p=Me.prototype).K=function(){Ue(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},p.L=function(){return Ue(this),this.a.concat()},p.get=function(t,e){return je(this.b,t)?this.b[t]:e},p.set=function(t,e){je(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},p.forEach=function(t,e){for(var n=this.L(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var Fe=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function qe(t,e){if(this.c=this.j=this.f="",this.h=null,this.i=this.g="",this.a=!1,t instanceof qe){this.a=void 0!==e?e:t.a,Be(this,t.f),this.j=t.j,ze(this,t.c),He(this,t.h),this.g=t.g,e=t.b;var n=new rn;n.c=e.c,e.a&&(n.a=new Me(e.a),n.b=e.b),Ke(this,n),this.i=t.i}else t&&(n=String(t).match(Fe))?(this.a=!!e,Be(this,n[1]||"",!0),this.j=Ye(n[2]||""),ze(this,n[3]||"",!0),He(this,n[4]),this.g=Ye(n[5]||"",!0),Ke(this,n[6]||"",!0),this.i=Ye(n[7]||"")):(this.a=!!e,this.b=new rn(null,this.a))}function Ge(t){return new qe(t)}
2function Be(t,e,n){t.f=n?Ye(e,!0):e,t.f&&(t.f=t.f.replace(/:$/,""))}function ze(t,e,n){t.c=n?Ye(e,!0):e}function He(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.h=e}else t.h=null}function Ke(t,e,n){e instanceof rn?(t.b=e,function(t,e){e&&!t.f&&(on(t),t.c=null,t.a.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(sn(this,e),an(this,n,t))}),t)),t.f=e}(t.b,t.a)):(n||(e=Qe(e,en)),t.b=new rn(e,t.a))}function We(t,e,n){t.b.set(e,n)}function Xe(t){return We(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^S()).toString(36)),t}function Ye(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Qe(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Je),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Je(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}qe.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Qe(e,$e,!0),":");var n=this.c;return(n||"file"==e)&&(t.push("//"),(e=this.j)&&t.push(Qe(e,$e,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.h)&&t.push(":",String(n))),(n=this.g)&&(this.c&&"/"!=n.charAt(0)&&t.push("/"),t.push(Qe(n,"/"==n.charAt(0)?tn:Ze,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",Qe(n,nn)),t.join("")};var $e=/[#\/\?@]/g,Ze=/[#\?:]/g,tn=/[#\?]/g,en=/[#\?@]/g,nn=/#/g;function rn(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function on(t){t.a||(t.a=new Me,t.b=0,t.c&&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 o=t[n].substring(0,r);i=t[n].substring(r+1)}else o=t[n];e(o,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.c,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function sn(t,e){on(t),e=cn(t,e),je(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,je((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&Ue(t)))}function un(t,e){return on(t),e=cn(t,e),je(t.a.b,e)}function an(t,e,n){sn(t,e),0<n.length&&(t.c=null,t.a.set(cn(t,e),L(n)),t.b+=n.length)}function cn(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}function hn(t,e){this.b=t,this.a=e}function fn(t){this.g=t||ln,t=y.PerformanceNavigationTiming?0<(t=y.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):!!(y.ia&&y.ia.ya&&y.ia.ya()&&y.ia.ya().qb),this.f=t?this.g:1,this.a=null,1<this.f&&(this.a=new Set),this.b=null,this.c=[]}(p=rn.prototype).add=function(t,e){on(this),this.c=null,t=cn(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},p.forEach=function(t,e){on(this),this.a.forEach((function(n,r){k(n,(function(n){t.call(e,n,r,this)}),this)}),this)},p.L=function(){on(this);for(var t=this.a.K(),e=this.a.L(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},p.K=function(t){on(this);var e=[];if("string"==typeof t)un(this,t)&&(e=P(e,this.a.get(cn(this,t))));else{t=this.a.K();for(var n=0;n<t.length;n++)e=P(e,t[n])}return e},p.set=function(t,e){return on(this),this.c=null,un(this,t=cn(this,t))&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},p.get=function(t,e){return t&&0<(t=this.K(t)).length?String(t[0]):e},p.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var t=[],e=this.a.L(),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r));r=this.K(r);for(var o=0;o<r.length;o++){var s=i;""!==r[o]&&(s+="="+encodeURIComponent(String(r[o]))),t.push(s)}}return this.c=t.join("&")};var ln=10;function pn(t){return!!t.b||!!t.a&&t.a.size>=t.f}function dn(t){return t.b?1:t.a?t.a.size:0}function vn(t,e){return t.b?t.b==e:!!t.a&&t.a.has(e)}function yn(t,e){t.a?t.a.add(e):t.b=e}function gn(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function mn(t){var e,n;if(null!=t.b)return t.c.concat(t.b.s);if(null!=t.a&&0!==t.a.size){var r=t.c;try{for(var i=l(t.a.values()),o=i.next();!o.done;o=i.next()){var s=o.value;r=r.concat(s.s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}return L(t.c)}function bn(){}function wn(){this.a=new bn}function In(t,e,n){var r=n||"";try{Ve(t,(function(t,n){var i=t;w(t)&&(i=Vt(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function En(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}fn.prototype.cancel=function(){var t,e;if(this.c=mn(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=l(this.a.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.a.clear()}},bn.prototype.stringify=function(t){return y.JSON.stringify(t,void 0)},bn.prototype.parse=function(t){return y.JSON.parse(t,void 0)};var _n=y.JSON.parse;function Tn(t){Rt.call(this),this.headers=new Me,this.H=t||null,this.b=!1,this.s=this.a=null,this.B="",this.h=0,this.f="",this.g=this.A=this.l=this.u=!1,this.o=0,this.m=null,this.I=An,this.D=this.F=!1}D(Tn,Rt);var An="",Nn=/^https?$/i,Sn=["POST","PUT"];function Dn(t){return"content-type"==t.toLowerCase()}function On(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,xn(t),Pn(t)}function xn(t){t.u||(t.u=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function kn(t){if(t.b&&void 0!==v&&(!t.s[1]||4!=Rn(t)||2!=t.X()))if(t.l&&4==Rn(t))Yt(t.za,0,t);else if(t.dispatchEvent("readystatechange"),4==Rn(t)){t.b=!1;try{var e,n=t.X();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r
2=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var o=String(t.B).match(Fe)[1]||null;if(!o&&y.self&&y.self.location){var s=y.self.location.protocol;o=s.substr(0,s.length-1)}i=!Nn.test(o?o.toLowerCase():"")}e=i}if(e)t.dispatchEvent("complete"),t.dispatchEvent("success");else{t.h=6;try{var u=2<Rn(t)?t.a.statusText:""}catch(t){u=""}t.f=u+" ["+t.X()+"]",xn(t)}}finally{Pn(t)}}}function Pn(t,e){if(t.a){Ln(t);var n=t.a,r=t.s[0]?g:null;t.a=null,t.s=null,e||t.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){}}}function Ln(t){t.a&&t.D&&(t.a.ontimeout=null),t.m&&(y.clearTimeout(t.m),t.m=null)}function Rn(t){return t.a?t.a.readyState:0}function Cn(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=function(t){var e="";return q(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):We(t,e,n))}function Vn(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Mn(t){this.pa=0,this.g=[],this.c=new ne,this.ga=this.la=this.B=this.fa=this.a=this.na=this.A=this.W=this.i=this.O=this.l=null,this.La=this.R=0,this.Ia=Vn("failFast",!1,t),this.H=this.m=this.j=this.h=this.f=null,this.T=!0,this.I=this.oa=this.P=-1,this.U=this.o=this.u=0,this.Fa=Vn("baseRetryDelayMs",5e3,t),this.Ma=Vn("retryDelaySeedMs",1e4,t),this.Ja=Vn("forwardChannelMaxRetries",2,t),this.ma=Vn("forwardChannelRequestTimeoutMs",2e4,t),this.Ka=t&&t.g||void 0,this.D=void 0,this.C=t&&t.supportsCrossDomainXhr||!1,this.J="",this.b=new fn(t&&t.concurrentRequestLimit),this.ka=new wn,this.da=t&&t.fastHandshake||!1,this.Ga=t&&t.b||!1,t&&t.f&&(this.c.a=!1),t&&t.forceLongPolling&&(this.T=!1),this.V=!this.da&&this.T&&t&&t.c||!1,this.ea=void 0,this.N=0,this.F=!1,this.s=null}function Un(t){if(Fn(t),3==t.v){var e=t.R++,n=Ge(t.B);We(n,"SID",t.J),We(n,"RID",e),We(n,"TYPE","terminate"),zn(t,n),(e=new Ee(t,t.c,e,void 0)).H=2,e.i=Xe(Ge(n)),n=!1,y.navigator&&y.navigator.sendBeacon&&(n=y.navigator.sendBeacon(e.i.toString(),"")),!n&&y.Image&&((new Image).src=e.i,n=!0),n||(e.a=nr(e.g,null),e.a.ba(e.i)),e.u=S(),xe(e)}tr(t)}function jn(t){t.a&&(Xn(t),t.a.cancel(),t.a=null)}function Fn(t){jn(t),t.j&&(y.clearTimeout(t.j),t.j=null),Qn(t),t.b.cancel(),t.h&&("number"==typeof t.h&&y.clearTimeout(t.h),t.h=null)}function qn(t,e){t.g.push(new hn(t.La++,e)),3==t.v&&Gn(t)}function Gn(t){pn(t.b)||t.h||(t.h=!0,Bt(t.Ba,t),t.u=0)}function Bn(t,e){var n;n=e?e.f:t.R++;var r=Ge(t.B);We(r,"SID",t.J),We(r,"RID",n),We(r,"AID",t.P),zn(t,r),t.i&&t.l&&Cn(r,t.i,t.l),n=new Ee(t,t.c,n,t.u+1),null===t.i&&(n.B=t.l),e&&(t.g=e.s.concat(t.g)),e=Hn(t,n,1e3),n.setTimeout(Math.round(.5*t.ma)+Math.round(.5*t.ma*Math.random())),yn(t.b,n),Ne(n,r,e)}function zn(t,e){t.f&&Ve({},(function(t,n){We(e,n,t)}))}function Hn(t,e,n){n=Math.min(t.g.length,n);var r=t.f?A(t.f.Ha,t.f,t):null;t:for(var i=t.g,o=-1;;){var s=["count="+n];-1==o?0<n?(o=i[0].b,s.push("ofs="+o)):o=0:s.push("ofs="+o);for(var u=!0,a=0;a<n;a++){var c=i[a].b,h=i[a].a;if(0>(c-=o))o=Math.max(0,i[a].b-100),u=!1;else try{In(h,s,"req"+c+"_")}catch(t){r&&r(h)}}if(u){r=s.join("&");break t}}return t=t.g.splice(0,n),e.s=t,r}function Kn(t){t.a||t.j||(t.U=1,Bt(t.Aa,t),t.o=0)}function Wn(t){return!(t.a||t.j||3<=t.o||(t.U++,t.j=fe(A(t.Aa,t),$n(t,t.o)),t.o++,0))}function Xn(t){null!=t.s&&(y.clearTimeout(t.s),t.s=null)}function Yn(t){t.a=new Ee(t,t.c,"rpc",t.U),null===t.i&&(t.a.B=t.l),t.a.O=0;var e=Ge(t.la);We(e,"RID","rpc"),We(e,"SID",t.J),We(e,"CI",t.H?"0":"1"),We(e,"AID",t.P),zn(t,e),We(e,"TYPE","xmlhttp"),t.i&&t.l&&Cn(e,t.i,t.l),t.D&&t.a.setTimeout(t.D);var n=t.a;t=t.ga,n.H=1,n.i=Xe(Ge(e)),n.j=null,n.I=!0,Se(n,t)}function Qn(t){null!=t.m&&(y.clearTimeout(t.m),t.m=null)}function Jn(t,e){var n=null;if(t.a==e){Qn(t),Xn(t),t.a=null;var r=2}else{if(!vn(t.b,e))return;n=e.s,gn(t.b,e),r=1}if(t.I=e.N,0!=t.v)if(e.b)if(1==r){n=e.j?e.j.length:0,e=S()-e.u;var i=t.u;(r=oe()).dispatchEvent(new he(r,n,e,i)),Gn(t)}else Kn(t);else if(3==(i=e.h)||0==i&&0<t.I||!(1==r&&function(t,e){return!(dn(t.b)>=t.b.f-(t.h?1:0)||(t.h?(t.g=e.s.concat(t.g),0):1==t.v||2==t.v||t.u>=(t.Ia?0:t.Ja)||(t.h=fe(A(t.Ba,t,e),$n(t,t.u)),t.u++,0)))}(t,e)||2==r&&Wn(t)))switch(n&&0<n.length&&(e=t.b,e.c=e.c.concat(n)),i){case 1:Zn(t,5);break;case 4:Zn(t,10);break;case 3:Zn(t,6);break;default:Zn(t,2)}}function $n(t,e){var n=t.Fa+Math.floor(Math.random()*t.Ma);return t.f||(n*=2),n*e}function Zn(t,e){if(t.c.info("Error code "+e),2==e){var n=null;t.f&&(n=null);var r=A(t.Xa,t);n||(n=new qe("//www.google.com/images/cleardot.gif"),y.location&&"http"==y.location.protocol||Be(n,"https"),Xe(n)),function(t,e){var n=new ne;if(y.Image){var r=new Image;r.onload=N(En,n,r,"TestLoadImage: loaded",!0,e),r.onerror=N(En,n,r,"TestLoadImage: error",!1,e),r.onabort=N(En,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=N(En,n,r,"TestLoadImage: timeout",!1,e),y.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else ce(2);t.v=0,t.f&&t.f.ra(e),tr(t),Fn(t)}function tr(t){t.v=0,t.I=-1,t.f&&(0==mn(t.b).length&&0==t.g.length||(t.b.c.length=0,L(t.g),t.g.length=0),t.f.qa())}function er(t,e,n){var r=function(t){return t instanceof qe?Ge(t):new qe(t,void 0)}(n);if(""!=r.c)e&&ze(r,e+"."+r.c),He(r,r.h);else{var i=y.location;r=function(t,e,n,r){var i=new qe(null,void 0);return t&&Be(i,t),e&&ze(i,e),n&&He(i,n),r&&(i.g=r),i}(i.protocol,e?e+"."+i.hostname:i.hostname,+i.port,n)}return t.W&&q(t.W,(function(t,e){We(r,e,t)})),e=t.A,n=t.na,e&&n&&We(r,e,n),We(r,"VER",t.ha),zn(t,r),r}function nr(t,e){if(e&&!t.C)throw Error("Can't create secondary domain capable XhrIo object.");return(e=new Tn(t.Ka)).F=t.C,e}function rr(){}function ir(){if(Y&&!(10<=Number(ut)))throw Error("Environmental error: no available transport.")}function or(t,e){Rt.call(this),this.a=new Mn(e),this.l=t,this.b=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.a.l=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.a&&(t?t["X-WebChannel-Client-Profile"]=e.a:t={"X-WebChannel-Client-Profile":e.a}),this.a.O=t,(t=e&&e.httpHeadersOverwriteParam)&&!R(t)&&(this.a.i=t),this.h=e&&e.supportsCrossDomainXhr||!1,this.g=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!R(e)&&(this.a.A=e,null!==(t=this.b)&&e in t&&e in(t=this.b)&&delete t[e]),this.f=new ar(this)}function sr(t){be.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.c=t)?(t=this.c,this.data=null!==e&&t in e?e[t]:void 0):this.data=e}else this.data=t}function ur(){we.call(this),this.status=1}function ar(t){this.a=t}(p=Tn.prototype).ba=function(t,e,n,r){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.B+"; newUri="+t);e=e?e.toUpperCase():"GET",this.B=t,this.f="",this.h=0,this.u=!1,this.b=!0,this.a=new XMLHttpRequest,this.s=this.H?ve(this.H):ve(ge),this.a.onreadystatechange=A(this.za,this);try{this.A=!0,this.a.open(e,String(t),!0),this.A=!1}catch(t){return void On(this,t)}t=n||"";var i=new Me(this.headers);r&&Ve(r,(function(t,e){i.set(e,t)})),r=function(t){t:{for(var e=Dn,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.L()),n=y.FormData&&t instanceof y.FormData,!(0<=x(Sn,e))||r||n||i.set("Content-Type","application/x-www-form-urlencoded;
2charset=utf-8"),i.forEach((function(t,e){this.a.setRequestHeader(e,t)}),this),this.I&&(this.a.responseType=this.I),"withCredentials"in this.a&&this.a.withCredentials!==this.F&&(this.a.withCredentials=this.F);try{Ln(this),0<this.o&&((this.D=function(t){return Y&&st(9)&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.a))?(this.a.timeout=this.o,this.a.ontimeout=A(this.xa,this)):this.m=Yt(this.xa,this.o,this)),this.l=!0,this.a.send(t),this.l=!1}catch(t){On(this,t)}},p.xa=function(){void 0!==v&&this.a&&(this.f="Timed out after "+this.o+"ms, aborting",this.h=8,this.dispatchEvent("timeout"),this.abort(8))},p.abort=function(t){this.a&&this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1,this.h=t||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),Pn(this))},p.G=function(){this.a&&(this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1),Pn(this,!0)),Tn.S.G.call(this)},p.za=function(){this.j||(this.A||this.l||this.g?kn(this):this.Ta())},p.Ta=function(){kn(this)},p.X=function(){try{return 2<Rn(this)?this.a.status:-1}catch(t){return-1}},p.$=function(){try{return this.a?this.a.responseText:""}catch(t){return""}},p.Na=function(t){if(this.a){var e=this.a.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),_n(e)}},p.ua=function(){return this.h},p.Qa=function(){return"string"==typeof this.f?this.f:String(this.f)},(p=Mn.prototype).ha=8,p.v=1,p.Ba=function(t){if(this.h)if(this.h=null,1==this.v){if(!t){this.R=Math.floor(1e5*Math.random()),t=this.R++;var e,n=new Ee(this,this.c,t,void 0),r=this.l;if(this.O&&(r?z(r=G(r),this.O):r=this.O),null===this.i&&(n.B=r),this.da)t:{for(var i=e=0;i<this.g.length;i++){var o=this.g[i];if(void 0===(o="__data__"in o.a&&"string"==typeof(o=o.a.__data__)?o.length:void 0))break;if(4096<(e+=o)){e=i;break t}if(4096===e||i===this.g.length-1){e=i+1;break t}}e=1e3}else e=1e3;e=Hn(this,n,e),We(i=Ge(this.B),"RID",t),We(i,"CVER",22),this.A&&We(i,"X-HTTP-Session-Id",this.A),zn(this,i),this.i&&r&&Cn(i,this.i,r),yn(this.b,n),this.Ga&&We(i,"TYPE","init"),this.da?(We(i,"$req",e),We(i,"SID","null"),n.V=!0,Ne(n,i,null)):Ne(n,i,e),this.v=2}}else 3==this.v&&(t?Bn(this,t):0==this.g.length||pn(this.b)||Bn(this))},p.Aa=function(){if(this.j=null,Yn(this),this.V&&!(this.F||null==this.a||0>=this.N)){var t=2*this.N;this.c.info("BP detection timer enabled: "+t),this.s=fe(A(this.Sa,this),t)}},p.Sa=function(){this.s&&(this.s=null,this.c.info("BP detection timeout reached."),this.c.info("Buffering proxy detected and switch to long-polling!"),this.H=!1,this.F=!0,jn(this),Yn(this))},p.Ra=function(){null!=this.m&&(this.m=null,jn(this),Wn(this),ce(19))},p.Xa=function(t){t?(this.c.info("Successfully pinged google.com"),ce(2)):(this.c.info("Failed to ping google.com"),ce(1))},(p=rr.prototype).ta=function(){},p.sa=function(){},p.ra=function(){},p.qa=function(){},p.Ha=function(){},ir.prototype.a=function(t,e){return new or(t,e)},D(or,Rt),(p=or.prototype).addEventListener=function(t,e,n,r){or.S.addEventListener.call(this,t,e,n,r)},p.removeEventListener=function(t,e,n,r){or.S.removeEventListener.call(this,t,e,n,r)},p.Oa=function(){this.a.f=this.f,this.h&&(this.a.C=!0);var t=this.a,e=this.l,n=this.b||void 0;ce(0),t.fa=e,t.W=n||{},t.H=t.T,t.B=er(t,null,t.fa),Gn(t)},p.close=function(){Un(this.a)},p.Pa=function(t){if("string"==typeof t){var e={};e.__data__=t,qn(this.a,e)}else this.g?((e={}).__data__=Vt(t),qn(this.a,e)):qn(this.a,t)},p.G=function(){this.a.f=null,delete this.f,Un(this.a),delete this.a,or.S.G.call(this)},D(sr,be),D(ur,we),D(ar,rr),ar.prototype.ta=function(){this.a.dispatchEvent("a")},ar.prototype.sa=function(t){this.a.dispatchEvent(new sr(t))},ar.prototype.ra=function(t){this.a.dispatchEvent(new ur(t))},ar.prototype.qa=function(){this.a.dispatchEvent("b")},ir.prototype.createWebChannel=ir.prototype.a,or.prototype.send=or.prototype.Pa,or.prototype.open=or.prototype.Oa,or.prototype.close=or.prototype.close,le.NO_ERROR=0,le.TIMEOUT=8,le.HTTP_ERROR=6,pe.COMPLETE="complete",ye.EventType=me,me.OPEN="a",me.CLOSE="b",me.ERROR="c",me.MESSAGE="d",Rt.prototype.listen=Rt.prototype.va,Tn.prototype.listenOnce=Tn.prototype.wa,Tn.prototype.getLastError=Tn.prototype.Qa,Tn.prototype.getLastErrorCode=Tn.prototype.ua,Tn.prototype.getStatus=Tn.prototype.X,Tn.prototype.getResponseJson=Tn.prototype.Na,Tn.prototype.getResponseText=Tn.prototype.$,Tn.prototype.send=Tn.prototype.ba;var cr=le,hr=pe,fr=ye,lr=Tn,pr=n(48886),dr={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENT
2ED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},vr=function(t){function e(e,n){var r=this;return(r=t.call(this,n)||this).code=e,r.message=n,r.name="FirebaseError",r.toString=function(){return r.name+": [code="+r.code+"]: "+r.message},r}return i(e,t),e}(Error),yr=new c.Yd("@firebase/firestore");function gr(){return yr.logLevel}function mr(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(yr.logLevel<=c.in.DEBUG){var r=e.map(Ir);yr.debug.apply(yr,u(["Firestore (8.0.0): "+t],r))}}function br(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(yr.logLevel<=c.in.ERROR){var r=e.map(Ir);yr.error.apply(yr,u(["Firestore (8.0.0): "+t],r))}}function wr(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(yr.logLevel<=c.in.WARN){var r=e.map(Ir);yr.warn.apply(yr,u(["Firestore (8.0.0): "+t],r))}}function Ir(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}var e}function Er(t){void 0===t&&(t="Unexpected state");var e="FIRESTORE (8.0.0) INTERNAL ASSERTION FAILED: "+t;throw br(e),new Error(e)}function _r(t,e){t||Er()}function Tr(t,e){return t}function Ar(t){var e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(var r=0;r<t;r++)n[r]=Math.floor(256*Math.random());return n}var Nr=function(){function t(){}return t.t=function(){for(var t=62*Math.floor(256/62),e="";e.length<20;)for(var n=Ar(40),r=0;r<n.length;++r)e.length<20&&n[r]<t&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[r]%62));return e},t}();function Sr(t,e){return t<e?-1:t>e?1:0}function Dr(t,e,n){return t.length===e.length&&t.every((function(t,r){return n(t,e[r])}))}function Or(t){return t+"\0"}var xr=function(){function t(t){this.i=t}return t.fromBase64String=function(e){return new t(atob(e))},t.fromUint8Array=function(e){return new t(function(t){for(var e="",n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(e))},t.prototype.toBase64=function(){return t=this.i,btoa(t);var t},t.prototype.toUint8Array=function(){return function(t){for(var e=new Uint8Array(t.length),n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}(this.i)},t.prototype.o=function(){return 2*this.i.length},t.prototype.h=function(t){return Sr(this.i,t.i)},t.prototype.isEqual=function(t){return this.i===t.i},t}();xr.u=new xr("");var kr=function(){function t(t){this.l=t}return t.fromBase64String=function(e){try{return new t(xr.fromBase64String(e))}catch(e){throw new vr(dr.INVALID_ARGUMENT,"Failed to construct Bytes from Base64 string: "+e)}},t.fromUint8Array=function(e){return new t(xr.fromUint8Array(e))},t.prototype.toBase64=function(){return this.l.toBase64()},t.prototype.toUint8Array=function(){return this.l.toUint8Array()},t.prototype.toString=function(){return"Bytes(base64: "+this.toBase64()+")"},t.prototype.isEqual=function(t){return this.l.isEqual(t.l)},t}();function Pr(){if("undefined"==typeof Uint8Array)throw new vr(dr.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function Lr(){if("undefined"==typeof atob)throw new vr(dr.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var Rr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.fromBase64String=function(t){Lr();try{return new e(xr.fromBase64String(t))}catch(t){throw new vr(dr.INVALID_ARGUMENT,"Failed to construct Blob from Base64 string: "+t)}},e.fromUint8Array=function(t){return Pr(),new e(xr.fromUint8Array(t))},e.prototype.toBase64=function(){return Lr(),t.prototype.toBase64.call(this)},e.prototype.toUint8Array=function(){return Pr(),t.prototype.toUint8Array.call(this)},e.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},e}(kr),Cr=function(t,e,n,r,i,o){this._=t,this.persistenceKey=e,this.host=n,this.ssl=r,this.forceLongPolling=i,this.T=o},Vr=function(){function t(t,e){this.projectId=t,this.database=e||"(default)"}return Object.defineProperty(t.prototype,"I",{get:function(){return"(default)"===this.database}
2,enumerable:!1,configurable:!0}),t.prototype.isEqual=function(e){return e instanceof t&&e.projectId===this.projectId&&e.database===this.database},t.prototype.h=function(t){return Sr(this.projectId,t.projectId)||Sr(this.database,t.database)},t}();function Mr(t){var e=0;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function Ur(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function jr(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}var Fr=function(){function t(t,e){this.m=t,this.A=e,this.R={}}return t.prototype.get=function(t){var e=this.m(t),n=this.R[e];if(void 0!==n)for(var r=0,i=n;r<i.length;r++){var o=i[r],s=o[0],u=o[1];if(this.A(s,t))return u}},t.prototype.has=function(t){return void 0!==this.get(t)},t.prototype.set=function(t,e){var n=this.m(t),r=this.R[n];if(void 0!==r){for(var i=0;i<r.length;i++)if(this.A(r[i][0],t))return void(r[i]=[t,e]);r.push([t,e])}else this.R[n]=[[t,e]]},t.prototype.delete=function(t){var e=this.m(t),n=this.R[e];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(this.A(n[r][0],t))return 1===n.length?delete this.R[e]:n.splice(r,1),!0;return!1},t.prototype.forEach=function(t){Ur(this.R,(function(e,n){for(var r=0,i=n;r<i.length;r++){var o=i[r],s=o[0],u=o[1];t(s,u)}}))},t.prototype.P=function(){return jr(this.R)},t}(),qr=function(){function t(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new vr(dr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new vr(dr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new vr(dr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new vr(dr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}return t.now=function(){return t.fromMillis(Date.now())},t.fromDate=function(e){return t.fromMillis(e.getTime())},t.fromMillis=function(e){var n=Math.floor(e/1e3);return new t(n,1e6*(e-1e3*n))},t.prototype.toDate=function(){return new Date(this.toMillis())},t.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},t.prototype.g=function(t){return this.seconds===t.seconds?Sr(this.nanoseconds,t.nanoseconds):Sr(this.seconds,t.seconds)},t.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},t.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},t.prototype.toJSON=function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}},t.prototype.valueOf=function(){var t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")},t}(),Gr=function(){function t(t){this.timestamp=t}return t.V=function(e){return new t(e)},t.min=function(){return new t(new qr(0,0))},t.prototype.h=function(t){return this.timestamp.g(t.timestamp)},t.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},t.prototype.p=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},t.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},t.prototype.v=function(){return this.timestamp},t}(),Br=function(){function t(t,e,n){void 0===e?e=0:e>t.length&&Er(),void 0===n?n=t.length-e:n>t.length-e&&Er(),this.segments=t,this.offset=e,this.S=n}return Object.defineProperty(t.prototype,"length",{get:function(){return this.S},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(e){return 0===t.D(this,e)},t.prototype.child=function(e){var n=this.segments.slice(this.offset,this.limit());return e instanceof t?e.forEach((function(t){n.push(t)})):n.push(e),this.C(n)},t.prototype.limit=function(){return this.offset+this.length},t.prototype.N=function(t){return t=void 0===t?1:t,this.C(this.segments,this.offset+t,this.length-t)},t.prototype.F=function(){return this.C(this.segments,this.offset,this.length-1)},t.prototype.k=function(){return this.segments[this.offset]},t.prototype.O=function(){return this.get(this.length-1)},t.prototype.get=function(t){return this.segments[this.offset+t]},t.prototype.P=function(){return 0===this.length},t.prototype.M=function(t){if(t.length<this.length)return!1;for(var e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0},t.prototype.$=function(t){if(this.length+1!==t.length)return!1;for(var e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0},t.prototype.forEach=function(t){for(var e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])},t.prototype.L=function(){return this.segments.slice(this.offset,this.limit())},t.D=function(t,e){for(var n=Math.min(t.length,e.length),r=0;r<n;r++){var i=t.get(r),o=e.get(r);if(i<o)return-1;if(i>o)return 1}return t.length<e.length?-1:t.length>e.length?1:0},t}(),zr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.C=function(t,n,r){return new e(t,n,r)},e.prototype.B=function(){return this.L().join("/")},e.prototype.toString=function(){return this.B()},e.q=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=[],i=0,o=t;i<o.length;i++){var s=o[i];if(s.indexOf("//")>=0)throw new vr(dr.INVALID_ARGUMENT,"Invalid segment ("+s+"). Paths must not contain // in them.");r.push.apply(r,s.split("/").filter((function(t){return t.length>0})))}return new e(r)},e.U=function(){return new e([])},e}(Br),Hr=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Kr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.C=function(t,n,r){return new e(t,n,r)},e.K=function(t){return Hr.test(t)},e.prototype.B=function(){return this.L().map((function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),e.K(t)||(t="`"+t+"`"),t})).join(".")},e.prototype.toString=function(){return this.B()},e.prototype.W=function(){return 1===this.length&&"__name__"===this.get(0)},e.j=function(){return new e(["__name__"])},e.G=function(t){for(var n=[],r="",i=0,o=function(){if(0===r.length)throw new vr(dr.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");n.push(r),r=""},s=!1;i<t.length;){var u=t[i];if("\\"===u){if(i+1===t.length)throw new vr(dr.INVALID_ARGUMENT,"Path has trailing escape character: "+t);var a=t[i+1];if("\\"!==a&&"."!==a&&"`"!==a)throw new vr(dr.INVALID_ARGUMENT,"Path has invali
2d escape sequence: "+t);r+=a,i+=2}else"`"===u?(s=!s,i++):"."!==u||s?(r+=u,i++):(o(),i++)}if(o(),s)throw new vr(dr.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new e(n)},e.U=function(){return new e([])},e}(Br),Wr=function(){function t(t){this.path=t}return t.H=function(e){return new t(zr.q(e))},t.J=function(e){return new t(zr.q(e).N(5))},t.prototype.Y=function(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t},t.prototype.isEqual=function(t){return null!==t&&0===zr.D(this.path,t.path)},t.prototype.toString=function(){return this.path.toString()},t.D=function(t,e){return zr.D(t.path,e.path)},t.X=function(t){return t.length%2==0},t.Z=function(e){return new t(new zr(e.slice()))},t}();function Xr(t){return null==t}function Yr(t){return 0===t&&1/t==-1/0}function Qr(t){return"number"==typeof t&&Number.isInteger(t)&&!Yr(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}var Jr=function(t,e,n,r,i,o,s){void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o=null),void 0===s&&(s=null),this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=o,this.endAt=s,this.tt=null};function $r(t,e,n,r,i,o,s){return void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o=null),void 0===s&&(s=null),new Jr(t,e,n,r,i,o,s)}function Zr(t){var e=Tr(t);if(null===e.tt){var n=e.path.B();null!==e.collectionGroup&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map((function(t){return function(t){return t.field.B()+t.op.toString()+zi(t.value)}(t)})).join(","),n+="|ob:",n+=e.orderBy.map((function(t){return(e=t).field.B()+e.dir;var e})).join(","),Xr(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=Ys(e.startAt)),e.endAt&&(n+="|ub:",n+=Ys(e.endAt)),e.tt=n}return e.tt}function ti(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(var n=0;n<t.orderBy.length;n++)if(!tu(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(var r=0;r<t.filters.length;r++)if(i=t.filters[r],o=e.filters[r],i.op!==o.op||!i.field.isEqual(o.field)||!Fi(i.value,o.value))return!1;var i,o;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!Js(t.startAt,e.startAt)&&Js(t.endAt,e.endAt)}function ei(t){return Wr.X(t.path)&&null===t.collectionGroup&&0===t.filters.length}var ni,ri,ii=function(){function t(t,e,n,r,i,o,s){void 0===i&&(i=Gr.min()),void 0===o&&(o=Gr.min()),void 0===s&&(s=xr.u),this.target=t,this.targetId=e,this.et=n,this.sequenceNumber=r,this.nt=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=s}return t.prototype.st=function(e){return new t(this.target,this.targetId,this.et,e,this.nt,this.lastLimboFreeSnapshotVersion,this.resumeToken)},t.prototype.it=function(e,n){return new t(this.target,this.targetId,this.et,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e)},t.prototype.rt=function(e){return new t(this.target,this.targetId,this.et,this.sequenceNumber,this.nt,e,this.resumeToken)},t}(),oi=function(t){this.count=t};function si(t){switch(t){case dr.OK:return Er();case dr.CANCELLED:case dr.UNKNOWN:case dr.DEADLINE_EXCEEDED:case dr.RESOURCE_EXHAUSTED:case dr.INTERNAL:case dr.UNAVAILABLE:case dr.UNAUTHENTICATED:return!1;case dr.INVALID_ARGUMENT:case dr.NOT_FOUND:case dr.ALREADY_EXISTS:case dr.PERMISSION_DENIED:case dr.FAILED_PRECONDITION:case dr.ABORTED:case dr.OUT_OF_RANGE:case dr.UNIMPLEMENTED:case dr.DATA_LOSS:return!0;default:return Er()}}function ui(t){if(void 0===t)return br("GRPC error has no .code"),dr.UNKNOWN;switch(t){case ni.OK:return dr.OK;case ni.CANCELLED:return dr.CANCELLED;case ni.UNKNOWN:return dr.UNKNOWN;case ni.DEADLINE_EXCEEDED:return dr.DEADLINE_EXCEEDED;case ni.RESOURCE_EXHAUSTED:return dr.RESOURCE_EXHAUSTED;case ni.INTERNAL:return dr.INTERNAL;case ni.UNAVAILABLE:return dr.UNAVAILABLE;case ni.UNAUTHENTICATED:return dr.UNAUTHENTICATED;case ni.INVALID_ARGUMENT:return dr.INVALID_ARGUMENT;case ni.NOT_FOUND:return dr.NOT_FOUND;case ni.ALREADY_EXISTS:return dr.ALREADY_EXISTS;case ni.PERMISSION_DENIED:return dr.PERMISSION_DENIED;case ni.FAILED_PRECONDITION:return dr.FAILED_PRECONDITION;case ni.ABORTED:return dr.ABORTED;case ni.OUT_OF_RANGE:return dr.OUT_OF_RANGE;
2case ni.UNIMPLEMENTED:return dr.UNIMPLEMENTED;case ni.DATA_LOSS:return dr.DATA_LOSS;default:return Er()}}(ri=ni||(ni={}))[ri.OK=0]="OK",ri[ri.CANCELLED=1]="CANCELLED",ri[ri.UNKNOWN=2]="UNKNOWN",ri[ri.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",ri[ri.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",ri[ri.NOT_FOUND=5]="NOT_FOUND",ri[ri.ALREADY_EXISTS=6]="ALREADY_EXISTS",ri[ri.PERMISSION_DENIED=7]="PERMISSION_DENIED",ri[ri.UNAUTHENTICATED=16]="UNAUTHENTICATED",ri[ri.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",ri[ri.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",ri[ri.ABORTED=10]="ABORTED",ri[ri.OUT_OF_RANGE=11]="OUT_OF_RANGE",ri[ri.UNIMPLEMENTED=12]="UNIMPLEMENTED",ri[ri.INTERNAL=13]="INTERNAL",ri[ri.UNAVAILABLE=14]="UNAVAILABLE",ri[ri.DATA_LOSS=15]="DATA_LOSS";var ai=function(){function t(t,e){this.D=t,this.root=e||hi.EMPTY}return t.prototype.ot=function(e,n){return new t(this.D,this.root.ot(e,n,this.D).copy(null,null,hi.at,null,null))},t.prototype.remove=function(e){return new t(this.D,this.root.remove(e,this.D).copy(null,null,hi.at,null,null))},t.prototype.get=function(t){for(var e=this.root;!e.P();){var n=this.D(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null},t.prototype.indexOf=function(t){for(var e=0,n=this.root;!n.P();){var r=this.D(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1},t.prototype.P=function(){return this.root.P()},Object.defineProperty(t.prototype,"size",{get:function(){return this.root.size},enumerable:!1,configurable:!0}),t.prototype.ht=function(){return this.root.ht()},t.prototype.ct=function(){return this.root.ct()},t.prototype.ut=function(t){return this.root.ut(t)},t.prototype.forEach=function(t){this.ut((function(e,n){return t(e,n),!1}))},t.prototype.toString=function(){var t=[];return this.ut((function(e,n){return t.push(e+":"+n),!1})),"{"+t.join(", ")+"}"},t.prototype.lt=function(t){return this.root.lt(t)},t.prototype._t=function(){return new ci(this.root,null,this.D,!1)},t.prototype.ft=function(t){return new ci(this.root,t,this.D,!1)},t.prototype.dt=function(){return new ci(this.root,null,this.D,!0)},t.prototype.wt=function(t){return new ci(this.root,t,this.D,!0)},t}(),ci=function(){function t(t,e,n,r){this.Et=r,this.Tt=[];for(var i=1;!t.P();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.Et?t.left:t.right;else{if(0===i){this.Tt.push(t);break}this.Tt.push(t),t=this.Et?t.right:t.left}}return t.prototype.It=function(){var t=this.Tt.pop(),e={key:t.key,value:t.value};if(this.Et)for(t=t.left;!t.P();)this.Tt.push(t),t=t.right;else for(t=t.right;!t.P();)this.Tt.push(t),t=t.left;return e},t.prototype.At=function(){return this.Tt.length>0},t.prototype.Rt=function(){if(0===this.Tt.length)return null;var t=this.Tt[this.Tt.length-1];return{key:t.key,value:t.value}},t}(),hi=function(){function t(e,n,r,i,o){this.key=e,this.value=n,this.color=null!=r?r:t.RED,this.left=null!=i?i:t.EMPTY,this.right=null!=o?o:t.EMPTY,this.size=this.left.size+1+this.right.size}return t.prototype.copy=function(e,n,r,i,o){return new t(null!=e?e:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=o?o:this.right)},t.prototype.P=function(){return!1},t.prototype.ut=function(t){return this.left.ut(t)||t(this.key,this.value)||this.right.ut(t)},t.prototype.lt=function(t){return this.right.lt(t)||t(this.key,this.value)||this.left.lt(t)},t.prototype.min=function(){return this.left.P()?this:this.left.min()},t.prototype.ht=function(){return this.min().key},t.prototype.ct=function(){return this.right.P()?this.key:this.right.ct()},t.prototype.ot=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.copy(null,null,null,r.left.ot(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.ot(t,e,n))).Pt()},t.prototype.gt=function(){if(this.left.P())return t.EMPTY;var e=this;return e.left.Vt()||e.left.left.Vt()||(e=e.yt()),(e=e.copy(null,null,null,e.left.gt(),null)).Pt()},t.prototype.remove=function(e,n){var r,i=this;if(n(e,i.key)<0)i.left.P()||i.left.Vt()||i.left.left.Vt()||(i=i.yt()),i=i.copy(null,null,null,i.left.remove(e,n),null);
2else{if(i.left.Vt()&&(i=i.bt()),i.right.P()||i.right.Vt()||i.right.left.Vt()||(i=i.vt()),0===n(e,i.key)){if(i.right.P())return t.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.gt())}i=i.copy(null,null,null,null,i.right.remove(e,n))}return i.Pt()},t.prototype.Vt=function(){return this.color},t.prototype.Pt=function(){var t=this;return t.right.Vt()&&!t.left.Vt()&&(t=t.St()),t.left.Vt()&&t.left.left.Vt()&&(t=t.bt()),t.left.Vt()&&t.right.Vt()&&(t=t.Dt()),t},t.prototype.yt=function(){var t=this.Dt();return t.right.left.Vt()&&(t=(t=(t=t.copy(null,null,null,null,t.right.bt())).St()).Dt()),t},t.prototype.vt=function(){var t=this.Dt();return t.left.left.Vt()&&(t=(t=t.bt()).Dt()),t},t.prototype.St=function(){var e=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)},t.prototype.bt=function(){var e=this.copy(null,null,t.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)},t.prototype.Dt=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},t.prototype.Ct=function(){var t=this.Nt();return Math.pow(2,t)<=this.size+1},t.prototype.Nt=function(){if(this.Vt()&&this.left.Vt())throw Er();if(this.right.Vt())throw Er();var t=this.left.Nt();if(t!==this.right.Nt())throw Er();return t+(this.Vt()?0:1)},t}();hi.EMPTY=null,hi.RED=!0,hi.at=!1,hi.EMPTY=new(function(){function t(){this.size=0}return Object.defineProperty(t.prototype,"key",{get:function(){throw Er()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){throw Er()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){throw Er()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){throw Er()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){throw Er()},enumerable:!1,configurable:!0}),t.prototype.copy=function(t,e,n,r,i){return this},t.prototype.ot=function(t,e,n){return new hi(t,e)},t.prototype.remove=function(t,e){return this},t.prototype.P=function(){return!0},t.prototype.ut=function(t){return!1},t.prototype.lt=function(t){return!1},t.prototype.ht=function(){return null},t.prototype.ct=function(){return null},t.prototype.Vt=function(){return!1},t.prototype.Ct=function(){return!0},t.prototype.Nt=function(){return 0},t}());var fi=function(){function t(t){this.D=t,this.data=new ai(this.D)}return t.prototype.has=function(t){return null!==this.data.get(t)},t.prototype.first=function(){return this.data.ht()},t.prototype.last=function(){return this.data.ct()},Object.defineProperty(t.prototype,"size",{get:function(){return this.data.size},enumerable:!1,configurable:!0}),t.prototype.indexOf=function(t){return this.data.indexOf(t)},t.prototype.forEach=function(t){this.data.ut((function(e,n){return t(e),!1}))},t.prototype.xt=function(t,e){for(var n=this.data.ft(t[0]);n.At();){var r=n.It();if(this.D(r.key,t[1])>=0)return;e(r.key)}},t.prototype.Ft=function(t,e){var n;for(n=void 0!==e?this.data.ft(e):this.data._t();n.At();)if(!t(n.It().key))return},t.prototype.kt=function(t){var e=this.data.ft(t);return e.At()?e.It().key:null},t.prototype._t=function(){return new li(this.data._t())},t.prototype.ft=function(t){return new li(this.data.ft(t))},t.prototype.add=function(t){return this.copy(this.data.remove(t).ot(t,!0))},t.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},t.prototype.P=function(){return this.data.P()},t.prototype.Ot=function(t){var e=this;return e.size<t.size&&(e=t,t=this),t.forEach((function(t){e=e.add(t)})),e},t.prototype.isEqual=function(e){if(!(e instanceof t))return!1;if(this.size!==e.size)return!1;for(var n=this.data._t(),r=e.data._t();n.At();){var i=n.It().key,o=r.It().key;if(0!==this.D(i,o))return!1}return!0},t.prototype.L=function(){var t=[];return this.forEach((function(e){t.push(e)})),t},t.prototype.toString=function(){var t=[];return this.forEach((function(e){return t.push(e)})),"SortedSet("+t.toString()+")"},t.prototype.copy=function(e){var n=new t(this.D);return n.data=e,n},t}(),li=function(){function t(t){this.Mt=t}return t.prototype.It=function(){return this.Mt.It().key},t.prototype.At=function(){return this.Mt.At()},t}(),pi=new ai(Wr.D);function di(){return pi}function vi(){return di()}var yi=new ai(Wr.D);function gi(){return yi}var mi=new ai(Wr.D),bi=new fi(Wr.D);function wi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=bi,r=0,i=t;r<i.length;r++){var o=i[r];n=n.add(o)}return n}var Ii=new fi(Sr);function Ei(){return Ii}var _i=function(){function t(t){this.D=t?function(e,n){return t(e,n)||Wr.D(e.key,n.key)}:function(t,e){return Wr.D(t.key,e.key)}
2,this.$t=gi(),this.Lt=new ai(this.D)}return t.Bt=function(e){return new t(e.D)},t.prototype.has=function(t){return null!=this.$t.get(t)},t.prototype.get=function(t){return this.$t.get(t)},t.prototype.first=function(){return this.Lt.ht()},t.prototype.last=function(){return this.Lt.ct()},t.prototype.P=function(){return this.Lt.P()},t.prototype.indexOf=function(t){var e=this.$t.get(t);return e?this.Lt.indexOf(e):-1},Object.defineProperty(t.prototype,"size",{get:function(){return this.Lt.size},enumerable:!1,configurable:!0}),t.prototype.forEach=function(t){this.Lt.ut((function(e,n){return t(e),!1}))},t.prototype.add=function(t){var e=this.delete(t.key);return e.copy(e.$t.ot(t.key,t),e.Lt.ot(t,null))},t.prototype.delete=function(t){var e=this.get(t);return e?this.copy(this.$t.remove(t),this.Lt.remove(e)):this},t.prototype.isEqual=function(e){if(!(e instanceof t))return!1;if(this.size!==e.size)return!1;for(var n=this.Lt._t(),r=e.Lt._t();n.At();){var i=n.It().key,o=r.It().key;if(!i.isEqual(o))return!1}return!0},t.prototype.toString=function(){var t=[];return this.forEach((function(e){t.push(e.toString())})),0===t.length?"DocumentSet ()":"DocumentSet (\n "+t.join(" \n")+"\n)"},t.prototype.copy=function(e,n){var r=new t;return r.D=this.D,r.$t=e,r.Lt=n,r},t}(),Ti=function(){function t(){this.qt=new ai(Wr.D)}return t.prototype.track=function(t){var e=t.doc.key,n=this.qt.get(e);n?0!==t.type&&3===n.type?this.qt=this.qt.ot(e,t):3===t.type&&1!==n.type?this.qt=this.qt.ot(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.qt=this.qt.ot(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.qt=this.qt.ot(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.qt=this.qt.remove(e):1===t.type&&2===n.type?this.qt=this.qt.ot(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.qt=this.qt.ot(e,{type:2,doc:t.doc}):Er():this.qt=this.qt.ot(e,t)},t.prototype.Ut=function(){var t=[];return this.qt.ut((function(e,n){t.push(n)})),t},t}(),Ai=function(){function t(t,e,n,r,i,o,s,u){this.query=t,this.docs=e,this.Kt=n,this.docChanges=r,this.Qt=i,this.fromCache=o,this.Wt=s,this.jt=u}return t.Gt=function(e,n,r,i){var o=[];return n.forEach((function(t){o.push({type:0,doc:t})})),new t(e,n,_i.Bt(n),o,r,i,!0,!1)},Object.defineProperty(t.prototype,"hasPendingWrites",{get:function(){return!this.Qt.P()},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(t){if(!(this.fromCache===t.fromCache&&this.Wt===t.Wt&&this.Qt.isEqual(t.Qt)&&Rs(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.Kt.isEqual(t.Kt)))return!1;var e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(var r=0;r<e.length;r++)if(e[r].type!==n[r].type||!e[r].doc.isEqual(n[r].doc))return!1;return!0},t}(),Ni=function(){function t(t,e,n,r,i){this.nt=t,this.zt=e,this.Ht=n,this.Jt=r,this.Yt=i}return t.Xt=function(e,n){var r=new Map;return r.set(e,Si.Zt(e,n)),new t(Gr.min(),r,Ei(),di(),wi())},t}(),Si=function(){function t(t,e,n,r,i){this.resumeToken=t,this.te=e,this.ee=n,this.ne=r,this.se=i}return t.Zt=function(e,n){return new t(xr.u,n,wi(),wi(),wi())},t}(),Di=function(t,e,n,r){this.ie=t,this.removedTargetIds=e,this.key=n,this.re=r},Oi=function(t,e){this.targetId=t,this.oe=e},xi=function(t,e,n,r){void 0===n&&(n=xr.u),void 0===r&&(r=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r},ki=function(){function t(){this.ae=0,this.he=Ri(),this.ce=xr.u,this.ue=!1,this.le=!0}return Object.defineProperty(t.prototype,"te",{get:function(){return this.ue},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resumeToken",{get:function(){return this.ce},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_e",{get:function(){return 0!==this.ae},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fe",{get:function(){return this.le},enumerable:!1,configurable:!0}),t.prototype.de=function(t){t.o()>0&&(this.le=!0,this.ce=t)},t.prototype.we=function(){var t=wi(),e=wi(),n=wi();return this.he.forEach((function(r,i){switch(i){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:Er()}})),new Si(this.ce,this.ue,t,e,n)},t.prototype.Ee=function(){this.le=!1,this.he=Ri()},t.prototype.Te=function(t,e){this.le=!0,this.he=this.he.ot(t,e)},t.prototype.Ie=function(t){this.le=!0,this.he=this.he.remove(t)},t.prototype.me=function(){this.ae+=1},t.prototype.Ae=function(){this.ae-=1},t.prototype.Re=function(){this.le=!0,this.ue=!0},t}(),Pi=function(){function t(t){this.Pe=t,this.ge=new Map,this.Ve=di(),this.ye=Li(),this.pe=new fi(Sr)}return t.prototype.be=function(t){for(var e=0,n=t.ie;e<n.length;e++){var r=n[e];t.re instanceof ms?this.ve(r,t.re):t.re instanceof bs&&this.Se(r,t.key,t.re)}for(var i=0,o=t.removedTargetIds;i<o.length;i++){var s=o[i];this.Se(s,t.key,t.re)}},t.prototype.De=function(t){var e=this;this.Ce(t,(function(n){var r=e.Ne(n);switch(t.state){case 0:e.xe(n)&&r.de(t.resumeToken);break;case 1:r.Ae(),r._e||r.Ee(),r.de(t.resumeToken);break;case 2:r.Ae(),r._e||e.removeTarget(n);break;case 3:e.xe(n)&&(r.Re(),r.de(t.resumeToken));break;case 4:e.xe(n)&&(e.Fe(n),r.de(t.resumeToken));break;default:Er()}}))},t.prototype.Ce=function(t,e){var n=this;t.targetIds.length>0?t.targetIds.forEach(e):this.ge.forEach((function(t,r){n.xe(r)&&e(r)}))},t.prototype.ke=function(t){var e=t.targetId,n=t.oe.count,r=this.Oe(e);
2if(r){var i=r.target;if(ei(i))if(0===n){var o=new Wr(i.path);this.Se(e,o,new bs(o,Gr.min()))}else _r(1===n);else this.Me(e)!==n&&(this.Fe(e),this.pe=this.pe.add(e))}},t.prototype.$e=function(t){var e=this,n=new Map;this.ge.forEach((function(r,i){var o=e.Oe(i);if(o){if(r.te&&ei(o.target)){var s=new Wr(o.target.path);null!==e.Ve.get(s)||e.Le(i,s)||e.Se(i,s,new bs(s,t))}r.fe&&(n.set(i,r.we()),r.Ee())}}));var r=wi();this.ye.forEach((function(t,n){var i=!0;n.Ft((function(t){var n=e.Oe(t);return!n||2===n.et||(i=!1,!1)})),i&&(r=r.add(t))}));var i=new Ni(t,n,this.pe,this.Ve,r);return this.Ve=di(),this.ye=Li(),this.pe=new fi(Sr),i},t.prototype.ve=function(t,e){if(this.xe(t)){var n=this.Le(t,e.key)?2:0;this.Ne(t).Te(e.key,n),this.Ve=this.Ve.ot(e.key,e),this.ye=this.ye.ot(e.key,this.Be(e.key).add(t))}},t.prototype.Se=function(t,e,n){if(this.xe(t)){var r=this.Ne(t);this.Le(t,e)?r.Te(e,1):r.Ie(e),this.ye=this.ye.ot(e,this.Be(e).delete(t)),n&&(this.Ve=this.Ve.ot(e,n))}},t.prototype.removeTarget=function(t){this.ge.delete(t)},t.prototype.Me=function(t){var e=this.Ne(t).we();return this.Pe.qe(t).size+e.ee.size-e.se.size},t.prototype.me=function(t){this.Ne(t).me()},t.prototype.Ne=function(t){var e=this.ge.get(t);return e||(e=new ki,this.ge.set(t,e)),e},t.prototype.Be=function(t){var e=this.ye.get(t);return e||(e=new fi(Sr),this.ye=this.ye.ot(t,e)),e},t.prototype.xe=function(t){var e=null!==this.Oe(t);return e||mr("WatchChangeAggregator","Detected inactive target",t),e},t.prototype.Oe=function(t){var e=this.ge.get(t);return e&&e._e?null:this.Pe.Ue(t)},t.prototype.Fe=function(t){var e=this;this.ge.set(t,new ki),this.Pe.qe(t).forEach((function(n){e.Se(t,n,null)}))},t.prototype.Le=function(t,e){return this.Pe.qe(t).has(e)},t}();function Li(){return new ai(Wr.D)}function Ri(){return new ai(Wr.D)}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 Vi(t){var e=t.mapValue.fields.__previous_value__;return Ci(e)?Vi(e):e}function Mi(t){var e=Ki(t.mapValue.fields.__local_write_time__.timestampValue);return new qr(e.seconds,e.nanos)}var Ui=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function ji(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:Er()}function Fi(t,e){var n=ji(t);if(n!==ji(e))return!1;switch(n){case 0:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Mi(t).isEqual(Mi(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;var n=Ki(t.timestampValue),r=Ki(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 Xi(t.bytesValue).isEqual(Xi(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Wi(t.geoPointValue.latitude)===Wi(e.geoPointValue.latitude)&&Wi(t.geoPointValue.longitude)===Wi(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Wi(t.integerValue)===Wi(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){var n=Wi(t.doubleValue),r=Wi(e.doubleValue);return n===r?Yr(n)===Yr(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return Dr(t.arrayValue.values||[],e.arrayValue.values||[],Fi);case 10:return function(t,e){var n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(Mr(n)!==Mr(r))return!1;for(var i in n)if(n.hasOwnProperty(i)&&(void 0===r[i]||!Fi(n[i],r[i])))return!1;return!0}(t,e);default:return Er()}}function qi(t,e){return void 0!==(t.values||[]).find((function(t){return Fi(t,e)}))}function Gi(t,e){var n=ji(t),r=ji(e);if(n!==r)return Sr(n,r);switch(n){case 0:return 0;case 1:return Sr(t.booleanValue,e.booleanValue);case 2:return function(t,e){var n=Wi(t.integerValue||t.doubleValue),r=Wi(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 Bi(t.timestampValue,e.timestampValue);case 4:return Bi(Mi(t),Mi(e));case 5:return Sr(t.stringValue,e.stringValue);case 6:return function(t,e){var n=Xi(t),r=Xi(e);return n.h(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){for(var n=t.split("/"),r=e.split("/"),i=0;i<n.length&&i<r.length;i++){var o=Sr(n[i],r[i]);if(0!==o)return o}return Sr(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){var n=Sr(Wi(t.latitude),Wi(e.latitude));return 0!==n?n:Sr(Wi(t.longitude),Wi(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){for(var n=t.values||[],r=e.values||[],i=0;i<n.length&&i<r.length;++i){var o=Gi(n[i],r[i]);if(o)return o}return Sr(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){var n=t.fields||{},r=Object.keys(n),i=e.fields||{},o=Object.keys(i);r.sort(),o.sort();for(var s=0;s<r.length&&s<o.length;++s){var u=Sr(r[s],o[s]);if(0!==u)return u;var a=Gi(n[r[s]],i[o[s]]);if(0!==a)return a}return Sr(r.length,o.length)}(t.mapValue,e.mapValue);default:throw Er()}}function Bi(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Sr(t,e);var n=Ki(t),r=Ki(e),i=Sr(n.seconds,r.seconds);return 0!==i?i:Sr(n.nanos,r.nanos)}function zi(t){return Hi(t)}function Hi(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){var e=Ki(t);return"time("+e.seconds+","+e.nanos+")"}
2(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?Xi(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,Wr.J(n).toString()):"geoPointValue"in t?"geo("+(e=t.geoPointValue).latitude+","+e.longitude+")":"arrayValue"in t?function(t){for(var e="[",n=!0,r=0,i=t.values||[];r<i.length;r++)n?n=!1:e+=",",e+=Hi(i[r]);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){for(var e="{",n=!0,r=0,i=Object.keys(t.fields||{}).sort();r<i.length;r++){var o=i[r];n?n=!1:e+=",",e+=o+":"+Hi(t.fields[o])}return e+"}"}(t.mapValue):Er();var e,n}function Ki(t){if(_r(!!t),"string"==typeof t){var e=0,n=Ui.exec(t);if(_r(!!n),n[1]){var r=n[1];r=(r+"000000000").substr(0,9),e=Number(r)}var i=new Date(t);return{seconds:Math.floor(i.getTime()/1e3),nanos:e}}return{seconds:Wi(t.seconds),nanos:Wi(t.nanos)}}function Wi(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function Xi(t){return"string"==typeof t?xr.fromBase64String(t):xr.fromUint8Array(t)}function Yi(t,e){return{referenceValue:"projects/"+t.projectId+"/databases/"+t.database+"/documents/"+e.path.B()}}function Qi(t){return!!t&&"integerValue"in t}function Ji(t){return!!t&&"arrayValue"in t}function $i(t){return!!t&&"nullValue"in t}function Zi(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function to(t){return!!t&&"mapValue"in t}var eo={asc:"ASCENDING",desc:"DESCENDING"},no={"<":"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"},ro=function(t,e){this._=t,this.Ke=e};function io(t){return{integerValue:""+t}}function oo(t,e){if(t.Ke){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Yr(e)?"-0":e}}function so(t,e){return Qr(e)?io(e):oo(t,e)}function uo(t,e){return t.Ke?new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+e.nanoseconds).slice(-9)+"Z":{seconds:""+e.seconds,nanos:e.nanoseconds}}function ao(t,e){return t.Ke?e.toBase64():e.toUint8Array()}function co(t,e){return uo(t,e.v())}function ho(t){return _r(!!t),Gr.V(function(t){var e=Ki(t);return new qr(e.seconds,e.nanos)}(t))}function fo(t,e){return function(t){return new zr(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).B()}function lo(t){var e=zr.q(t);return _r(Vo(e)),e}function po(t,e){return fo(t._,e.path)}function vo(t,e){var n=lo(e);return _r(n.get(1)===t._.projectId),_r(!n.get(3)&&!t._.database||n.get(3)===t._.database),new Wr(bo(n))}function yo(t,e){return fo(t._,e)}function go(t){var e=lo(t);return 4===e.length?zr.U():bo(e)}function mo(t){return new zr(["projects",t._.projectId,"databases",t._.database]).B()}function bo(t){return _r(t.length>4&&"documents"===t.get(4)),t.N(5)}function wo(t,e,n){return{name:po(t,e),fields:n.proto.mapValue.fields}}function Io(t,e){var n;if(e instanceof ss)n={update:wo(t,e.key,e.value)};else if(e instanceof ls)n={delete:po(t,e.key)};else if(e instanceof us)n={update:wo(t,e.key,e.data),updateMask:Co(e.Qe)};else if(e instanceof cs)n={transform:{document:po(t,e.key),fieldTransforms:e.fieldTransforms.map((function(t){return function(t,e){var n=e.transform;if(n instanceof qo)return{fieldPath:e.field.B(),setToServerValue:"REQUEST_TIME"};if(n instanceof Go)return{fieldPath:e.field.B(),appendMissingElements:{values:n.elements}};if(n instanceof zo)return{fieldPath:e.field.B(),removeAllFromArray:{values:n.elements}};if(n instanceof Ko)return{fieldPath:e.field.B(),increment:n.We};throw Er()}(0,t)}))}};else{if(!(e instanceof ps))return Er();n={verify:po(t,e.key)}}return e.Ge.je||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:co(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:Er()}(t,e.Ge)),n}function Eo(t,e){var n=e.currentDocument?function(t){return void 0!==t.updateTime?$o.updateTime(ho(t.updateTime)):void 0!==t.exists?$o.exists(t.exists):$o.ze()}(e.currentDocument):$o.ze();if(e.update){e.update.name;var r=vo(t,e.update.name),i=new ds({mapValue:{fields:e.update.fields}});if(e.updateMask){var o=function(t){var e=t.fieldPaths||[];return new Yo(e.map((function(t){return Kr.G(t)})))}(e.updateMask);return new us(r,i,o,n)}return new ss(r,i,n)}if(e.delete){var s=vo(t,e.delete);return new ls(s,n)}if(e.transform){var u=vo(t,e.transform.document),a=e.transform.fieldTransforms.map((function(e){return function(t,e){var n=null;if("setToServerValue"in e)_r("REQUEST_TIME"===e.setToServerValue),n=new qo;else if("appendMissingElements"in e){var r=e.appendMissingElements.values||[];n=new Go(r)}else if("removeAllFromArray"in e){var i=e.removeAllFromArray.values||[];n=new zo(i)}else"increment"in e?n=new Ko(t,e.increment):Er();var o=Kr.G(e.fieldPath);return new Qo(o,n)}(t,e)}));return _r(!0===n.exists),new cs(u,a)}if(e.verify){var c=vo(t,e.verify);return new ps(c,n)}return Er()}function _o(t,e){return{documents:[yo(t,e.path)]}}function To(t,e){var n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=yo(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=yo(t,r.F()),n.structuredQuery.from=[{collectionId:r.O()}]);var i=function(t){if(0!==t.length){var e=t.map((function(t){return function(t){if("=="===t.op){if(Zi(t.value))return{unaryFilter:{field:ko(t.field),op:"IS_NAN"}};if($i(t.value))return{unaryFilter:{field:ko(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(Zi(t.value))return{unaryFilter:{field:ko(t.field),op:"IS_NOT_NA
2N"}};if($i(t.value))return{unaryFilter:{field:ko(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:ko(t.field),op:xo(t.op),value:t.value}}}(t)}));return 1===e.length?e[0]:{compositeFilter:{op:"AND",filters:e}}}}(e.filters);i&&(n.structuredQuery.where=i);var o=function(t){if(0!==t.length)return t.map((function(t){return function(t){return{field:ko(t.field),direction:Oo(t.dir)}}(t)}))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);var s=function(t,e){return t.Ke||Xr(e)?e:{value:e}}(t,e.limit);return null!==s&&(n.structuredQuery.limit=s),e.startAt&&(n.structuredQuery.startAt=So(e.startAt)),e.endAt&&(n.structuredQuery.endAt=So(e.endAt)),n}function Ao(t){var e=go(t.parent),n=t.structuredQuery,r=n.from?n.from.length:0,i=null;if(r>0){_r(1===r);var o=n.from[0];o.allDescendants?i=o.collectionId:e=e.child(o.collectionId)}var s=[];n.where&&(s=No(n.where));var u=[];n.orderBy&&(u=n.orderBy.map((function(t){return function(t){return new $s(Po(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t)})));var a=null;n.limit&&(a=function(t){var e;return Xr(e="object"==typeof t?t.value:t)?null:e}(n.limit));var c=null;n.startAt&&(c=Do(n.startAt));var h=null;return n.endAt&&(h=Do(n.endAt)),xs(Es(e,i,u,s,a,"F",c,h))}function No(t){return t?void 0!==t.unaryFilter?[Ro(t)]:void 0!==t.fieldFilter?[Lo(t)]:void 0!==t.compositeFilter?t.compositeFilter.filters.map((function(t){return No(t)})).reduce((function(t,e){return t.concat(e)})):Er():[]}function So(t){return{before:t.before,values:t.position}}function Do(t){var e=!!t.before,n=t.values||[];return new Xs(n,e)}function Oo(t){return eo[t]}function xo(t){return no[t]}function ko(t){return{fieldPath:t.B()}}function Po(t){return Kr.G(t.fieldPath)}function Lo(t){return js.create(Po(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";default:return Er()}}(t.fieldFilter.op),t.fieldFilter.value)}function Ro(t){switch(t.unaryFilter.op){case"IS_NAN":var e=Po(t.unaryFilter.field);return js.create(e,"==",{doubleValue:NaN});case"IS_NULL":var n=Po(t.unaryFilter.field);return js.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var r=Po(t.unaryFilter.field);return js.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":var i=Po(t.unaryFilter.field);return js.create(i,"!=",{nullValue:"NULL_VALUE"});default:return Er()}}function Co(t){var e=[];return t.fields.forEach((function(t){return e.push(t.B())})),{fieldPaths:e}}function Vo(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}var Mo=function(){this.He=void 0};function Uo(t,e,n){return t instanceof qo?function(t,e){var n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof Go?Bo(t,e):t instanceof zo?Ho(t,e):function(t,e){var n=Fo(t,e),r=Wo(n)+Wo(t.We);return Qi(n)&&Qi(t.We)?io(r):oo(t.serializer,r)}(t,e)}function jo(t,e,n){return t instanceof Go?Bo(t,e):t instanceof zo?Ho(t,e):n}function Fo(t,e){return t instanceof Ko?Qi(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}var qo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(Mo),Go=function(t){function e(e){var n=this;return(n=t.call(this)||this).elements=e,n}return i(e,t),e}(Mo);function Bo(t,e){for(var n=Xo(e),r=function(t){n.some((function(e){return Fi(e,t)}))||n.push(t)},i=0,o=t.elements;i<o.length;i++)r(o[i]);return{arrayValue:{values:n}}}var zo=function(t){function e(e){var n=this;return(n=t.call(this)||this).elements=e,n}return i(e,t),e}(Mo);function Ho(t,e){for(var n=Xo(e),r=function(t){n=n.filter((function(e){return!Fi(e,t)}))},i=0,o=t.elements;i<o.length;i++)r(o[i]);return{arrayValue:{values:n}}}var Ko=function(t){function e(e,n){var r=this;
2return(r=t.call(this)||this).serializer=e,r.We=n,r}return i(e,t),e}(Mo);function Wo(t){return Wi(t.integerValue||t.doubleValue)}function Xo(t){return Ji(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}var Yo=function(){function t(t){this.fields=t,t.sort(Kr.D)}return t.prototype.Je=function(t){for(var e=0,n=this.fields;e<n.length;e++)if(n[e].M(t))return!0;return!1},t.prototype.isEqual=function(t){return Dr(this.fields,t.fields,(function(t,e){return t.isEqual(e)}))},t}(),Qo=function(t,e){this.field=t,this.transform=e},Jo=function(t,e){this.version=t,this.transformResults=e},$o=function(){function t(t,e){this.updateTime=t,this.exists=e}return t.ze=function(){return new t},t.exists=function(e){return new t(void 0,e)},t.updateTime=function(e){return new t(e)},Object.defineProperty(t.prototype,"je",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)},t}();function Zo(t,e){return void 0!==t.updateTime?e instanceof ms&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e instanceof ms}var ts=function(){};function es(t,e,n){return t instanceof ss?function(t,e,n){return new ms(t.key,n.version,t.value,{hasCommittedMutations:!0})}(t,0,n):t instanceof us?function(t,e,n){if(!Zo(t.Ge,e))return new ws(t.key,n.version);var r=as(t,e);return new ms(t.key,n.version,r,{hasCommittedMutations:!0})}(t,e,n):t instanceof cs?function(t,e,n){if(_r(null!=n.transformResults),!Zo(t.Ge,e))return new ws(t.key,n.version);var r=hs(0,e),i=function(t,e,n){var r=[];_r(t.length===n.length);for(var i=0;i<n.length;i++){var o=t[i],s=o.transform,u=null;e instanceof ms&&(u=e.field(o.field)),r.push(jo(s,u,n[i]))}return r}(t.fieldTransforms,e,n.transformResults),o=n.version,s=fs(t,r.data(),i);return new ms(t.key,o,s,{hasCommittedMutations:!0})}(t,e,n):function(t,e,n){return new bs(t.key,n.version,{hasCommittedMutations:!0})}(t,0,n)}function ns(t,e,n,r){return t instanceof ss?function(t,e){if(!Zo(t.Ge,e))return e;var n=os(e);return new ms(t.key,n,t.value,{Ye:!0})}(t,e):t instanceof us?function(t,e){if(!Zo(t.Ge,e))return e;var n=os(e),r=as(t,e);return new ms(t.key,n,r,{Ye:!0})}(t,e):t instanceof cs?function(t,e,n,r){if(!Zo(t.Ge,e))return e;var i=hs(0,e),o=function(t,e,n,r){for(var i=[],o=0,s=t;o<s.length;o++){var u=s[o],a=u.transform,c=null;n instanceof ms&&(c=n.field(u.field)),null===c&&r instanceof ms&&(c=r.field(u.field)),i.push(Uo(a,c,e))}return i}(t.fieldTransforms,n,e,r),s=fs(t,i.data(),o);return new ms(t.key,i.version,s,{Ye:!0})}(t,e,r,n):function(t,e){return Zo(t.Ge,e)?new bs(t.key,Gr.min()):e}(t,e)}function rs(t,e){return t instanceof cs?function(t,e){for(var n=null,r=0,i=t.fieldTransforms;r<i.length;r++){var o=i[r],s=e instanceof ms?e.field(o.field):void 0,u=Fo(o.transform,s||null);null!=u&&(n=null==n?(new vs).set(o.field,u):n.set(o.field,u))}return n?n.Xe():null}(t,e):null}function is(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.Ge.isEqual(e.Ge)&&(0===t.type?t.value.isEqual(e.value):1===t.type?t.data.isEqual(e.data)&&t.Qe.isEqual(e.Qe):2!==t.type||Dr(t.fieldTransforms,t.fieldTransforms,(function(t,e){return function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Go&&e instanceof Go||t instanceof zo&&e instanceof zo?Dr(t.elements,e.elements,Fi):t instanceof Ko&&e instanceof Ko?Fi(t.We,e.We):t instanceof qo&&e instanceof qo}(t.transform,e.transform)}(t,e)})))}function os(t){return t instanceof ms?t.version:Gr.min()}var ss=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).key=e,i.value=n,i.Ge=r,i.type=0,i}return i(e,t),e}(ts),us=function(t){function e(e,n,r,i){var o=this;return(o=t.call(this)||this).key=e,o.data=n,o.Qe=r,o.Ge=i,o.type=1,o}return i(e,t),e}(ts);function as(t,e){return function(t,e){var n=new vs(e);return t.Qe.fields.forEach((function(e){if(!e.P()){var r=t.data.field(e);null!==r?n.set(e,r):n.delete(e)}})),n.Xe()}(t,e instanceof ms?e.data():ds.empty())}var cs=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).key=e,r.fieldTransforms=n,r.type=2,r.Ge=$o.exists(!0),r}return i(e,t),e}(ts);function hs(t,e){return e}function fs(t,e,n){for(var r=new vs(e),i=0;i<t.fieldTransforms.length;i++){var o=t.fieldTransforms[i];r.set(o.field,n[i])}return r.Xe()}var ls=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).key=e,r.Ge=n,r.type=3,r}return i(e,t),e}(ts),ps=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).key=e,r.Ge=n,r.type=4,r}return i(e,t),e}(ts),ds=function(){function t(t){this.proto=t}return t.empty=function(){return new t({mapValue:{}})},t.prototype.field=function(t){if(t.P())return this.proto;for(var e=this.proto,n=0;n<t.length-1;++n){if(!e.mapValue.fields)return null;if(!to(e=e.mapValue.fields[t.get(n)]))return null}return(e=(e.mapValue.fields||{})[t.O()])||null},t.prototype.isEqual=function(t){return Fi(this.proto,t.proto)},t}(),vs=function(){function t(t){void 0===t&&(t=ds.empty()),this.Ze=t,this.tn=new Map}return t.prototype.set=function(t,e){return this.en(t,e),this}
2,t.prototype.delete=function(t){return this.en(t,null),this},t.prototype.en=function(t,e){for(var n=this.tn,r=0;r<t.length-1;++r){var i=t.get(r),o=n.get(i);o instanceof Map?n=o:o&&10===ji(o)?(o=new Map(Object.entries(o.mapValue.fields||{})),n.set(i,o),n=o):(o=new Map,n.set(i,o),n=o)}n.set(t.O(),e)},t.prototype.Xe=function(){var t=this.nn(Kr.U(),this.tn);return null!=t?new ds(t):this.Ze},t.prototype.nn=function(t,e){var n=this,r=!1,i=this.Ze.field(t),o=to(i)?Object.assign({},i.mapValue.fields):{};return e.forEach((function(e,i){if(e instanceof Map){var s=n.nn(t.child(i),e);null!=s&&(o[i]=s,r=!0)}else null!==e?(o[i]=e,r=!0):o.hasOwnProperty(i)&&(delete o[i],r=!0)})),r?{mapValue:{fields:o}}:null},t}();function ys(t){var e=[];return Ur(t.fields||{},(function(t,n){var r=new Kr([t]);if(to(n)){var i=ys(n.mapValue).fields;if(0===i.length)e.push(r);else for(var o=0,s=i;o<s.length;o++){var u=s[o];e.push(r.child(u))}}else e.push(r)})),new Yo(e)}var gs=function(t,e){this.key=t,this.version=e},ms=function(t){function e(e,n,r,i){var o=this;return(o=t.call(this,e,n)||this).sn=r,o.Ye=!!i.Ye,o.hasCommittedMutations=!!i.hasCommittedMutations,o}return i(e,t),e.prototype.field=function(t){return this.sn.field(t)},e.prototype.data=function(){return this.sn},e.prototype.rn=function(){return this.sn.proto},e.prototype.isEqual=function(t){return t instanceof e&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.Ye===t.Ye&&this.hasCommittedMutations===t.hasCommittedMutations&&this.sn.isEqual(t.sn)},e.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+this.sn.toString()+", {hasLocalMutations: "+this.Ye+"}), {hasCommittedMutations: "+this.hasCommittedMutations+"})"},Object.defineProperty(e.prototype,"hasPendingWrites",{get:function(){return this.Ye||this.hasCommittedMutations},enumerable:!1,configurable:!0}),e}(gs),bs=function(t){function e(e,n,r){var i=this;return(i=t.call(this,e,n)||this).hasCommittedMutations=!(!r||!r.hasCommittedMutations),i}return i(e,t),e.prototype.toString=function(){return"NoDocument("+this.key+", "+this.version+")"},Object.defineProperty(e.prototype,"hasPendingWrites",{get:function(){return this.hasCommittedMutations},enumerable:!1,configurable:!0}),e.prototype.isEqual=function(t){return t instanceof e&&t.hasCommittedMutations===this.hasCommittedMutations&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},e}(gs),ws=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.toString=function(){return"UnknownDocument("+this.key+", "+this.version+")"},Object.defineProperty(e.prototype,"hasPendingWrites",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.isEqual=function(t){return t instanceof e&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},e}(gs),Is=function(t,e,n,r,i,o,s,u){void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o="F"),void 0===s&&(s=null),void 0===u&&(u=null),this.path=t,this.collectionGroup=e,this.on=n,this.filters=r,this.limit=i,this.an=o,this.startAt=s,this.endAt=u,this.hn=null,this.cn=null,this.startAt,this.endAt};function Es(t,e,n,r,i,o,s,u){return new Is(t,e,n,r,i,o,s,u)}function _s(t){return new Is(t)}function Ts(t){return!Xr(t.limit)&&"F"===t.an}function As(t){return!Xr(t.limit)&&"L"===t.an}function Ns(t){return t.on.length>0?t.on[0].field:null}function Ss(t){for(var e=0,n=t.filters;e<n.length;e++){var r=n[e];if(r.un())return r.field}return null}function Ds(t){return null!==t.collectionGroup}function Os(t){var e=Tr(t);if(null===e.hn){e.hn=[];var n=Ss(e),r=Ns(e);if(null!==n&&null===r)n.W()||e.hn.push(new $s(n)),e.hn.push(new $s(Kr.j(),"asc"));else{for(var i=!1,o=0,s=e.on;o<s.length;o++){var u=s[o];e.hn.push(u),u.field.W()&&(i=!0)}if(!i){var a=e.on.length>0?e.on[e.on.length-1].dir:"asc";e.hn.push(new $s(Kr.j(),a))}}}return e.hn}function xs(t){var e=Tr(t);if(!e.cn)if("F"===e.an)e.cn=$r(e.path,e.collectionGroup,Os(e),e.filters,e.limit,e.startAt,e.endAt);else{for(var n=[],r=0,i=Os(e);r<i.length;r++){var o=i[r],s="desc"===o.dir?"asc":"desc";n.push(new $s(o.field,s))}var u=e.endAt?new Xs(e.endAt.position,!e.endAt.before):null,a=e.startAt?new Xs(e.startAt.position,!e.startAt.before):null;e.cn=$r(e.path,e.collectionGroup,n,e.filters,e.limit,u,a)}return e.cn}function ks(t,e,n){return new Is(t.path,t.collectionGroup,t.on.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Ps(t,e){return new Is(t.path,t.collectionGroup,t.on.slice(),t.filters.slice(),t.limit,t.an,e,t.endAt)}function Ls(t,e){return new Is(t.path,t.collectionGroup,t.on.slice(),t.filters.slice(),t.limit,t.an,t.startAt,e)}function Rs(t,e){return ti(xs(t),xs(e))&&t.an===e.an}function Cs(t){return Zr(xs(t))+"|lt:"+t.an}function Vs(t){return"Query(target="+function(t){var e=t.path.B();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=", filters: ["+t.filters.map((function(t){return(e=t).field.B()+" "+e.op+" "+zi(e.value);var e})).join(", ")+"]"),Xr(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=", orderBy: ["+t.orderBy.map((function(t){return(e=t).field.B()+" ("+e.dir+")";var e})).join(", ")+"]"),t.startAt&&(e+=", startAt: "+Ys(t.startAt)),t.endAt&&(e+=", endAt: "+Ys(t.endAt)),"Target("+e+")"}(xs(t))+"; limitType="+t.an+")"}function Ms(t,e){return function(t,e){var n=e.key.path;return null!==t.collectionGroup?e.key.Y(t.collectionGroup)&&t.path.M(n):Wr.X(t.path)?t.path.isEqual(n):t.path.$(n)}(t,e)&&function(t,e){for(var n=0,r=t.on;n<r.length;n++){var i=r[n];if(!i.field.W()&&null===e.field(i.field))return!1}return!0}(t,e)&&function(t,e){for(var n=0,r=t.filters;n<r.length;n++)if(!r[n].matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!Qs(t.startAt,Os(t),e)||t.endAt&&Qs(t.endAt,Os(t),e))}(t,e)}function Us(t){return function(e,n){for(var r=!1,i=0,o=Os(t);i<o.length;i++){var s=o[i],u=Zs(s,e,n);if(0!==u)return u;r=r||s.field.W()}return 0}}var js=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).field=e,i.op=n,i.value=r,i}return i(e,t),e.create=function(t,n,r){return t.W()?"in"===n||"not-in"===n?this.ln(t,
2n,r):new Fs(t,n,r):"array-contains"===n?new zs(t,r):"in"===n?new Hs(t,r):"not-in"===n?new Ks(t,r):"array-contains-any"===n?new Ws(t,r):new e(t,n,r)},e.ln=function(t,e,n){return"in"===e?new qs(t,n):new Gs(t,n)},e.prototype.matches=function(t){var e=t.field(this.field);return"!="===this.op?null!==e&&this._n(Gi(e,this.value)):null!==e&&ji(this.value)===ji(e)&&this._n(Gi(e,this.value))},e.prototype._n=function(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return Er()}},e.prototype.un=function(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0},e}((function(){})),Fs=function(t){function e(e,n,r){var i=this;return(i=t.call(this,e,n,r)||this).key=Wr.J(r.referenceValue),i}return i(e,t),e.prototype.matches=function(t){var e=Wr.D(t.key,this.key);return this._n(e)},e}(js),qs=function(t){function e(e,n){var r=this;return(r=t.call(this,e,"in",n)||this).keys=Bs(0,n),r}return i(e,t),e.prototype.matches=function(t){return this.keys.some((function(e){return e.isEqual(t.key)}))},e}(js),Gs=function(t){function e(e,n){var r=this;return(r=t.call(this,e,"not-in",n)||this).keys=Bs(0,n),r}return i(e,t),e.prototype.matches=function(t){return!this.keys.some((function(e){return e.isEqual(t.key)}))},e}(js);function Bs(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((function(t){return Wr.J(t.referenceValue)}))}var zs=function(t){function e(e,n){return t.call(this,e,"array-contains",n)||this}return i(e,t),e.prototype.matches=function(t){var e=t.field(this.field);return Ji(e)&&qi(e.arrayValue,this.value)},e}(js),Hs=function(t){function e(e,n){return t.call(this,e,"in",n)||this}return i(e,t),e.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&qi(this.value.arrayValue,e)},e}(js),Ks=function(t){function e(e,n){return t.call(this,e,"not-in",n)||this}return i(e,t),e.prototype.matches=function(t){if(qi(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;var e=t.field(this.field);return null!==e&&!qi(this.value.arrayValue,e)},e}(js),Ws=function(t){function e(e,n){return t.call(this,e,"array-contains-any",n)||this}return i(e,t),e.prototype.matches=function(t){var e=this,n=t.field(this.field);return!(!Ji(n)||!n.arrayValue.values)&&n.arrayValue.values.some((function(t){return qi(e.value.arrayValue,t)}))},e}(js),Xs=function(t,e){this.position=t,this.before=e};function Ys(t){return(t.before?"b":"a")+":"+t.position.map((function(t){return zi(t)})).join(",")}function Qs(t,e,n){for(var r=0,i=0;i<t.position.length;i++){var o=e[i],s=t.position[i];if(r=o.field.W()?Wr.D(Wr.J(s.referenceValue),n.key):Gi(s,n.field(o.field)),"desc"===o.dir&&(r*=-1),0!==r)break}return t.before?r<=0:r<0}function Js(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.before!==e.before||t.position.length!==e.position.length)return!1;for(var n=0;n<t.position.length;n++)if(!Fi(t.position[n],e.position[n]))return!1;return!0}var $s=function(t,e){void 0===e&&(e="asc"),this.field=t,this.dir=e};function Zs(t,e,n){var r=t.field.W()?Wr.D(e.key,n.key):function(t,e,n){var r=e.field(t),i=n.field(t);return null!==r&&null!==i?Gi(r,i):Er()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Er()}}function tu(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}var eu=function(){var t=this;this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))},nu=function(){function t(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this.fn=t,this.dn=e,this.wn=n,this.En=r,this.Tn=i,this.In=0,this.mn=null,this.An=Date.now(),this.reset()}return t.prototype.reset=function(){this.In=0},t.prototype.Rn=function(){this.In=this.Tn},t.prototype.Pn=function(t){var e=this;this.cancel();var n=Math.floor(this.In+this.gn()),r=Math.max(0,Date.now()-this.An),i=Math.max(0,n-r);i>0&&mr("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.In+" ms, delay with jitter: "+n+" ms, last attempt: "+r+" ms ago)"),this.mn=this.fn.Vn(this.dn,i,(function(){return e.An=Date.now(),t()})),this.In*=this.En,this.In<this.wn&&(this.In=this.wn),this.In>this.Tn&&(this.In=this.Tn)},t.prototype.yn=function(){null!==this.mn&&(this.mn.pn(),this.mn=null)},t.prototype.cancel=function(){null!==this.mn&&(this.mn.cancel(),this.mn=null)},t.prototype.gn=function(){return(Math.random()-.5)*this.In},t}(),ru=function(){function t(t){var e=this;this.bn=null,this.vn=null,this.result=void 0,this.error=void 0,this.Sn=!1,this.Dn=!1,t((function(t){e.Sn=!0,e.result=t,e.bn&&e.bn(t)}),(function(t){e.Sn=!0,e.error=t,e.vn&&e.vn(t)}))}return t.prototype.catch=function(t){return this.next(void 0,t)},t.prototype.next=function(e,n){var r=this;return this.Dn&&Er(),this.Dn=!0,this.Sn?this.error?this.Cn(n,this.error):this.Nn(e,this.result):new t((function(t,i){r.bn=function(n){r.Nn(e,n).next(t,i)},r.vn=function(e){r.Cn(n,e).next(t,i)}}))},t.prototype.xn=function(){var t=this;return new Promise((function(e,n){t.next(e,n)}))},t.prototype.Fn=function(e){try{var n=e();return n instanceof t?n:t.resolve(n)}catch(e){return t.reject(e)}},t.prototype.Nn=function(e,n){return e?this.Fn((function(){return e(n)})):t.resolve(n)},t.prototype.Cn=function(e,n){return e?this.Fn((function(){return e(n)})):t.reject(n)},t.resolve=function(e){return new t((function(t,n){t(e)}))},t.reject=function(e){return new t((function(t,n){n(e)}))},t.kn=function(e){return new t((function(t,n){var r=0,i=0,o=!1;e.forEach((function(e){++r,e.next((function(){++i,o&&i===r&&t()}),(function(t){return n(t)}))})),o=!0,i===r&&t()}))},t.On=function(e){for(var n=t.resolve(!1),r=function(e){n=n.next((function(n){return n?t.resolve(n):e()}))},i=0,o=e;i<o.length;i++)r(o[i]);return n},t.forEach=function(t,e){var n=this,r=[];return t.forEach((function(t,i){r.push(e.call(n,t,i))})),this.kn(r)},t}(),iu=function(){function t(e,n,r){this.name=e,this.version=n,this.Mn=r,12.2===t.$n((0,h.z$)())&&br("Firestore persistence suffers from a bug in
2iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}return t.delete=function(t){return mr("SimpleDb","Removing database:",t),hu(window.indexedDB.deleteDatabase(t)).xn()},t.Ln=function(){if("undefined"==typeof indexedDB)return!1;if(t.Bn())return!0;var e=(0,h.z$)(),n=t.$n(e),r=0<n&&n<10,i=t.qn(e),o=0<i&&i<4.5;return!(e.indexOf("MSIE ")>0||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||r||o)},t.Bn=function(){var t;return"undefined"!=typeof process&&"YES"===(null===(t={PORT:"8090",NODE_ENV:"production",API_HOST:"https://www.nykaa.com",API_INTERNAL_HOST:"http://www.nykaa-internal.com",OMIT_SOURCEMAP:"true",PLATFORM:"nykaa",GTM_ID:"GTM-MWT2MSJ",GA_ID:"UA-31866293-9",OPTIMIZE_ID:"GTM-TJ4ZB5M",SENTRY_DSN:"https://[email protected]/51",IMPRESSION_LOG_DOMAIN:"https://prod-events.nykaa.com",googleAppId:"140085884300-na7igu81hs7fcufr0bganb40su9ab4pq.apps.googleusercontent.com",DEALS_INTERNAL_ENDPOINT:"https://nykaa-widgets.nykaa.com",DEALS_ENDPOINT:"https://www.nykaa.com/gateway-api",SEARCH_INTERNAL:"http://search-aggregator.mumbai-nyk.internal",GAMOOGA_TRACKING_ID:"96148074-8fb3-4e8c-94a0-13f2012c5623",PUBLIC_PATH:"//asset.nykaa.com",REGEX_FOR_SW_CACHING:"^https:\\/\\/asset\\.nykaa\\.com\\/static\\/.*\\.(js|svg|woff|woff2|jpg|png|jpeg)$",SP_EVENTS_URL:"https://prod-retina-api.nykaa.com/v1/events/beauty",APP_VERSION:"0.0.81",NEWRELIC_APP_ID:"1001474717",NEWRELIC_AGENT_ID:"1001474717",CMS_API_INTERNAL:"http://prod-cms-pageapi.nyk00-int.network",G_RECAPTCHA_V3:"6LcFevoUAAAAACEdtUxI8JKtDeA1ssM9rrw4B0U5",ZENDESK_EXTERNAL_ID:"c474c4a8-e0ac-4b57-af32-e089d7e3670e",DEPLOY_ENV:"prod-dweb",API_NYKAA:"https://api.nykaa.com"})||void 0===t?void 0:t.Un)},t.Kn=function(t,e){return t.store(e)},t.$n=function(t){var e=t.match(/i(?:phone|pad|pod) os ([\d_]+)/i),n=e?e[1].split("_").slice(0,2).join("."):"-1";return Number(n)},t.qn=function(t){var e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)},t.prototype.Qn=function(t){return o(this,void 0,void 0,(function(){var e,n=this;return s(this,(function(r){switch(r.label){case 0:return this.db?[3,2]:(mr("SimpleDb","Opening database:",this.name),e=this,[4,new Promise((function(e,r){var i=indexedDB.open(n.name,n.version);i.onsuccess=function(t){var n=t.target.result;e(n)},i.onblocked=function(){r(new su(t,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=function(e){var n=e.target.error;"VersionError"===n.name?r(new vr(dr.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):r(new su(t,n))},i.onupgradeneeded=function(t){mr("SimpleDb",'Database "'+n.name+'" requires upgrade from version:',t.oldVersion);var e=t.target.result;n.Mn.createOrUpgrade(e,i.transaction,t.oldVersion,n.version).next((function(){mr("SimpleDb","Database upgrade to version "+n.version+" complete")}))}}))]);case 1:e.db=r.sent(),r.label=2;case 2:return[2,(this.Wn&&(this.db.onversionchange=function(t){return n.Wn(t)}),this.db)]}}))}))},t.prototype.jn=function(t){this.Wn=t,this.db&&(this.db.onversionchange=function(e){return t(e)})},t.prototype.runTransaction=function(t,e,n,r){return o(this,void 0,void 0,(function(){var i,o,u,a,c;return s(this,(function(h){switch(h.label){case 0:i="readonly"===e,o=0,u=function(){var e,u,c,h,f;return s(this,(function(s){switch(s.label){case 0:++o,s.label=1;case 1:return s.trys.push([1,4,,5]),[4,a.Qn(t)];case 2:return a.db=s.sent(),e=au.open(a.db,t,i?"readonly":"readwrite",n),u=r(e).catch((function(t){return e.abort(t),ru.reject(t)})).xn(),c={},u.catch((function(){})),[4,e.Gn];case 3:return[2,(c.value=(s.sent(),u),c)];case 4:return h=s.sent(),f="FirebaseError"!==h.name&&o<3,mr("SimpleDb","Transaction failed with error:",h.message,"Retrying:",f),a.close(),f?[3,5]:[2,{value:Promise.reject(h)}];case 5:return[2]}}
2))},a=this,h.label=1;case 1:return[5,u()];case 2:if("object"==typeof(c=h.sent()))return[2,c.value];h.label=3;case 3:return[3,1];case 4:return[2]}}))}))},t.prototype.close=function(){this.db&&this.db.close(),this.db=void 0},t}(),ou=function(){function t(t){this.zn=t,this.Hn=!1,this.Jn=null}return Object.defineProperty(t.prototype,"Sn",{get:function(){return this.Hn},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Yn",{get:function(){return this.Jn},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cursor",{set:function(t){this.zn=t},enumerable:!1,configurable:!0}),t.prototype.done=function(){this.Hn=!0},t.prototype.Xn=function(t){this.Jn=t},t.prototype.delete=function(){return hu(this.zn.delete())},t}(),su=function(t){function e(e,n){var r=this;return(r=t.call(this,dr.UNAVAILABLE,"IndexedDB transaction '"+e+"' failed: "+n)||this).name="IndexedDbTransactionError",r}return i(e,t),e}(vr);function uu(t){return"IndexedDbTransactionError"===t.name}var au=function(){function t(t,e){var n=this;this.action=t,this.transaction=e,this.aborted=!1,this.Zn=new eu,this.transaction.oncomplete=function(){n.Zn.resolve()},this.transaction.onabort=function(){e.error?n.Zn.reject(new su(t,e.error)):n.Zn.resolve()},this.transaction.onerror=function(e){var r=lu(e.target.error);n.Zn.reject(new su(t,r))}}return t.open=function(e,n,r,i){try{return new t(n,e.transaction(i,r))}catch(e){throw new su(n,e)}},Object.defineProperty(t.prototype,"Gn",{get:function(){return this.Zn.promise},enumerable:!1,configurable:!0}),t.prototype.abort=function(t){t&&this.Zn.reject(t),this.aborted||(mr("SimpleDb","Aborting transaction:",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())},t.prototype.store=function(t){var e=this.transaction.objectStore(t);return new cu(e)},t}(),cu=function(){function t(t){this.store=t}return t.prototype.put=function(t,e){var n;return void 0!==e?(mr("SimpleDb","PUT",this.store.name,t,e),n=this.store.put(e,t)):(mr("SimpleDb","PUT",this.store.name,"<auto-key>",t),n=this.store.put(t)),hu(n)},t.prototype.add=function(t){return mr("SimpleDb","ADD",this.store.name,t,t),hu(this.store.add(t))},t.prototype.get=function(t){var e=this;return hu(this.store.get(t)).next((function(n){return void 0===n&&(n=null),mr("SimpleDb","GET",e.store.name,t,n),n}))},t.prototype.delete=function(t){return mr("SimpleDb","DELETE",this.store.name,t),hu(this.store.delete(t))},t.prototype.count=function(){return mr("SimpleDb","COUNT",this.store.name),hu(this.store.count())},t.prototype.ts=function(t,e){var n=this.cursor(this.options(t,e)),r=[];return this.es(n,(function(t,e){r.push(e)})).next((function(){return r}))},t.prototype.ns=function(t,e){mr("SimpleDb","DELETE ALL",this.store.name);var n=this.options(t,e);n.ss=!1;var r=this.cursor(n);return this.es(r,(function(t,e,n){return n.delete()}))},t.prototype.rs=function(t,e){var n;e?n=t:(n={},e=t);var r=this.cursor(n);return this.es(r,e)},t.prototype.os=function(t){var e=this.cursor({});return new ru((function(n,r){e.onerror=function(t){var e=lu(t.target.error);r(e)},e.onsuccess=function(e){var r=e.target.result;r?t(r.primaryKey,r.value).next((function(t){t?r.continue():n()})):n()}}))},t.prototype.es=function(t,e){var n=[];return new ru((function(r,i){t.onerror=function(t){i(t.target.error)},t.onsuccess=function(t){var i=t.target.result;if(i){var o=new ou(i),s=e(i.primaryKey,i.value,o);if(s instanceof ru){var u=s.catch((function(t){return o.done(),ru.reject(t)}));n.push(u)}o.Sn?r():null===o.Yn?i.continue():i.continue(o.Yn)}else r()}})).next((function(){return ru.kn(n)}))},t.prototype.options=function(t,e){var n=void 0;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},t.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.ss?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},t}();function hu(t){return new ru((function(e,n){t.onsuccess=function(t){var n=t.target.result;e(n)},t.onerror=function(t){var e=lu(t.target.error);n(e)}}))}var fu=!1;function lu(t){var e=iu.$n((0,h.z$)());if(e>=12.2&&e<13){var n="An internal error was encountered in the Indexed Database server";if(t.message.indexOf(n)>=0){var r=new vr("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '"+n+"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");return fu||(fu=!0,setTimeout((function(){throw r}),0)),r}}return t}function pu(){return"undefined"!=typeof window?window:null}function du(){return"undefined"!=typeof document?document:null}var vu=function(){function t(t,e,n,r,i){this.hs=t,this.dn=e,this.cs=n,this.op=r,this.us=i,this.ls=new eu,this.then=this.ls.promise.then.bind(this.ls.promise),this.ls.promise.catch((function(t){}))}return t._s=function(e,n,r,i,o){var s=new t(e,n,Date.now()+r,i,o);return s.start(r),s},t.prototype.start=function(t){var e=this;this.fs=setTimeout((function(){return e.ds()}),t)},t.prototype.pn=function(){return this.ds()},t.prototype.cancel=function(t){null!==this.fs&&(this.clearTimeout(),this.ls.reject(new vr(dr.CANCELLED,"Operation cancelled"+(t?": "+t:"")))
2)},t.prototype.ds=function(){var t=this;this.hs.ws((function(){return null!==t.fs?(t.clearTimeout(),t.op().then((function(e){return t.ls.resolve(e)}))):Promise.resolve()}))},t.prototype.clearTimeout=function(){null!==this.fs&&(this.us(this),clearTimeout(this.fs),this.fs=null)},t}(),yu=function(){function t(){var t=this;this.Es=Promise.resolve(),this.Ts=[],this.Is=!1,this.As=[],this.Rs=null,this.Ps=!1,this.gs=[],this.Vs=new nu(this,"async_queue_retry"),this.ys=function(){var e=du();e&&mr("AsyncQueue","Visibility state changed to ",e.visibilityState),t.Vs.yn()};var e=du();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.ys)}return Object.defineProperty(t.prototype,"ps",{get:function(){return this.Is},enumerable:!1,configurable:!0}),t.prototype.ws=function(t){this.enqueue(t)},t.prototype.bs=function(t){this.vs(),this.Ss(t)},t.prototype.Ds=function(){if(!this.Is){this.Is=!0;var t=du();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.ys)}},t.prototype.enqueue=function(t){return this.vs(),this.Is?new Promise((function(t){})):this.Ss(t)},t.prototype.Cs=function(t){var e=this;this.ws((function(){return e.Ts.push(t),e.Ns()}))},t.prototype.Ns=function(){return o(this,void 0,void 0,(function(){var t,e=this;return s(this,(function(n){switch(n.label){case 0:if(0===this.Ts.length)return[3,5];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.Ts[0]()];case 2:return n.sent(),this.Ts.shift(),this.Vs.reset(),[3,4];case 3:if(!uu(t=n.sent()))throw t;return mr("AsyncQueue","Operation failed with retryable error: "+t),[3,4];case 4:this.Ts.length>0&&this.Vs.Pn((function(){return e.Ns()})),n.label=5;case 5:return[2]}}
2))}))},t.prototype.Ss=function(t){var e=this,n=this.Es.then((function(){return e.Ps=!0,t().catch((function(t){throw e.Rs=t,e.Ps=!1,br("INTERNAL UNHANDLED ERROR: ",function(t){var e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}(t)),t})).then((function(t){return e.Ps=!1,t}))}));return this.Es=n,n},t.prototype.Vn=function(t,e,n){var r=this;this.vs(),this.gs.indexOf(t)>-1&&(e=0);var i=vu._s(this,t,e,n,(function(t){return r.xs(t)}));return this.As.push(i),i},t.prototype.vs=function(){this.Rs&&Er()},t.prototype.Fs=function(){},t.prototype.ks=function(){return o(this,void 0,void 0,(function(){var t;return s(this,(function(e){switch(e.label){case 0:return[4,t=this.Es];case 1:e.sent(),e.label=2;case 2:if(t!==this.Es)return[3,0];e.label=3;case 3:return[2]}}))}))},t.prototype.Os=function(t){for(var e=0,n=this.As;e<n.length;e++)if(n[e].dn===t)return!0;return!1},t.prototype.Ms=function(t){var e=this;return this.ks().then((function(){e.As.sort((function(t,e){return t.cs-e.cs}));for(var n=0,r=e.As;n<r.length;n++){var i=r[n];if(i.pn(),"all"!==t&&i.dn===t)break}return e.ks()}))},t.prototype.$s=function(t){this.gs.push(t)},t.prototype.xs=function(t){var e=this.As.indexOf(t);this.As.splice(e,1)},t}();function gu(t,e){if(br("AsyncQueue",e+": "+t),uu(t))return new vr(dr.UNAVAILABLE,e+": "+t);throw t}var mu=function(){this.Ls=void 0,this.listeners=[]},bu=function(){this.Bs=new Fr((function(t){return Cs(t)}),Rs),this.onlineState="Unknown",this.qs=new Set};function wu(t,e){return o(this,void 0,void 0,(function(){var n,r,i,o,u,a,c;return s(this,(function(s){switch(s.label){case 0:if(n=Tr(t),r=e.query,i=!1,(o=n.Bs.get(r))||(i=!0,o=new mu),!i)return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),u=o,[4,n.Us(r)];case 2:return u.Ls=s.sent(),[3,4];case 3:return a=s.sent(),c=gu(a,"Initialization of query '"+Vs(e.query)+"' failed"),[2,void e.onError(c)];case 4:return n.Bs.set(r,o),o.listeners.push(e),e.Ks(n.onlineState),o.Ls&&e.Qs(o.Ls)&&Tu(n),[2]}}))}))}function Iu(t,e){return o(this,void 0,void 0,(function(){var n,r,i,o,u;return s(this,(function(s){return n=Tr(t),r=e.query,i=!1,(o=n.Bs.get(r))&&(u=o.listeners.indexOf(e))>=0&&(o.listeners.splice(u,1),i=0===o.listeners.length),i?[2,(n.Bs.delete(r),n.Ws(r))]:[2]}))}))}function Eu(t,e){for(var n=Tr(t),r=!1,i=0,o=e;i<o.length;i++){var s=o[i],u=s.query,a=n.Bs.get(u);if(a){for(var c=0,h=a.listeners;c<h.length;c++)h[c].Qs(s)&&(r=!0);a.Ls=s}}r&&Tu(n)}function _u(t,e,n){var r=Tr(t),i=r.Bs.get(e);if(i)for(var o=0,s=i.listeners;o<s.length;o++)s[o].onError(n);r.Bs.delete(e)}function Tu(t){t.qs.forEach((function(t){t.next()}))}var Au=function(){function t(t,e,n){this.query=t,this.js=e,this.Gs=!1,this.zs=null,this.onlineState="Unknown",this.options=n||{}}return t.prototype.Qs=function(t){if(!this.options.includeMetadataChanges){for(var e=[],n=0,r=t.docChanges;n<r.length;n++){var i=r[n];3!==i.type&&e.push(i)}t=new Ai(t.query,t.docs,t.Kt,e,t.Qt,t.fromCache,t.Wt,!0)}var o=!1;return this.Gs?this.Hs(t)&&(this.js.next(t),o=!0):this.Js(t,this.onlineState)&&(this.Ys(t),o=!0),this.zs=t,o},t.prototype.onError=function(t){this.js.error(t)},t.prototype.Ks=function(t){this.onlineState=t;var e=!1;return this.zs&&!this.Gs&&this.Js(this.zs,t)&&(this.Ys(this.zs),e=!0),e},t.prototype.Js=function(t,e){if(!t.fromCache)return!0;var n="Offline"!==e;return!(this.options.Xs&&n||t.docs.P()&&"Offline"!==e)},t.prototype.Hs=function(t){if(t.docChanges.length>0)return!0;var e=this.zs&&this.zs.hasPendingWrites!==t.hasPendingWrites;return!(!t.Wt&&!e)&&!0===this.options.includeMetadataChanges},t.prototype.Ys=function(t){t=Ai.Gt(t.query,t.docs,t.Qt,t.fromCache),this.Gs=!0,this.js.next(t)},t}(),Nu=function(){function t(t){this.uid=t}return t.prototype.Zs=function(){return null!=this.uid},t.prototype.ti=function(){return this.Zs()?"uid:"+this.uid:"anonymous-user"},t.prototype.isEqual=function(t){return t.uid===this.uid},t}();Nu.UNAUTHENTICATED=new Nu(null),Nu.ei=new Nu("google-credentials-uid"),Nu.ni=new Nu("first-party-uid");var Su=function(){function t(t,e){var n=this;this.previousValue=t,e&&(e.si=function(t){return n.ii(t)},this.ri=function(t){return e.oi(t)})}return t.prototype.ii=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},t.prototype.next=function(){var t=++this.previousValue;return this.ri&&this.ri(t),t},t}();function Du(t,e){return"firestore_clients_"+t+"_"+e}function Ou(t,e,n){var r="firestore_mutations_"+t+"_"+n;return e.Zs()&&(r+="_"+e.uid),r}function xu(t,e){return"firestore_targets_"+t+"_"+e}Su.ai=-1;var ku=function(){function t(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r}return t.hi=function(e,n,r){var i=JSON.parse(r),o="object"==typeof i&&-1!==["pending","acknowledged","rejected"].indexOf(i.state)&&(void 0===i.error||"object"==typeof i.error),s=void 0;return o&&i.error&&(o="string"==typeof i.error.message&&"string"==typeof i.error.code)&&(s=new vr(i.error.code,i.error.message)),o?new t(e,n,i.state,s):(br("SharedCl
2ientState","Failed to parse mutation state for ID '"+n+"': "+r),null)},t.prototype.ci=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},t}(),Pu=function(){function t(t,e,n){this.targetId=t,this.state=e,this.error=n}return t.hi=function(e,n){var r=JSON.parse(n),i="object"==typeof r&&-1!==["not-current","current","rejected"].indexOf(r.state)&&(void 0===r.error||"object"==typeof r.error),o=void 0;return i&&r.error&&(i="string"==typeof r.error.message&&"string"==typeof r.error.code)&&(o=new vr(r.error.code,r.error.message)),i?new t(e,r.state,o):(br("SharedClientState","Failed to parse target state for ID '"+e+"': "+n),null)},t.prototype.ci=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},t}(),Lu=function(){function t(t,e){this.clientId=t,this.activeTargetIds=e}return t.hi=function(e,n){for(var r=JSON.parse(n),i="object"==typeof r&&r.activeTargetIds instanceof Array,o=Ei(),s=0;i&&s<r.activeTargetIds.length;++s)i=Qr(r.activeTargetIds[s]),o=o.add(r.activeTargetIds[s]);return i?new t(e,o):(br("SharedClientState","Failed to parse client data for instance '"+e+"': "+n),null)},t}(),Ru=function(){function t(t,e){this.clientId=t,this.onlineState=e}return t.hi=function(e){var n=JSON.parse(e);return"object"==typeof n&&-1!==["Unknown","Online","Offline"].indexOf(n.onlineState)&&"string"==typeof n.clientId?new t(n.clientId,n.onlineState):(br("SharedClientState","Failed to parse online state: "+e),null)},t}(),Cu=function(){function t(){this.activeTargetIds=Ei()}return t.prototype.ui=function(t){this.activeTargetIds=this.activeTargetIds.add(t)},t.prototype.li=function(t){this.activeTargetIds=this.activeTargetIds.delete(t)},t.prototype.ci=function(){var t={activeTargetIds:this.activeTargetIds.L(),updateTimeMs:Date.now()};return JSON.stringify(t)},t}(),Vu=function(){function t(t,e,n,r,i){this.window=t,this.fn=e,this.persistenceKey=n,this._i=r,this.fi=null,this.di=null,this.si=null,this.wi=this.Ei.bind(this),this.Ti=new ai(Sr),this.Ii=!1,this.mi=[];var o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=i,this.Ai=Du(this.persistenceKey,this._i),this.Ri=function(t){return"firestore_sequence_number_"+t}(this.persistenceKey),this.Ti=this.Ti.ot(this._i,new Cu),this.Pi=new RegExp("^firestore_clients_"+o+"_([^_]*)$"),this.gi=new RegExp("^firestore_mutations_"+o+"_(\\d+)(?:_(.*))?$"),this.Vi=new RegExp("^firestore_targets_"+o+"_(\\d+)$"),this.yi=function(t){return"firestore_online_state_"+t}(this.persistenceKey),this.window.addEventListener("storage",this.wi)}return t.Ln=function(t){return!(!t||!t.localStorage)},t.prototype.start=function(){return o(this,void 0,void 0,(function(){var t,e,n,r,i,o,u,a,c,h,f,l=this;return s(this,(function(s){switch(s.label){case 0:return[4,this.fi.pi()];case 1:for(t=s.sent(),e=0,n=t;e<n.length;e++)(r=n[e])!==this._i&&(i=this.getItem(Du(this.persistenceKey,r)))&&(o=Lu.hi(r,i))&&(this.Ti=this.Ti.ot(o.clientId,o));for(this.bi(),(u=this.storage.getItem(this.yi))&&(a=this.vi(u))&&this.Si(a),c=0,h=this.mi;c<h.length;c++)f=h[c],this.Ei(f);return this.mi=[],this.window.addEventListener("unload",(function(){return l.Di()})),this.Ii=!0,[2]}}))}))},t.prototype.oi=function(t){this.setItem(this.Ri,JSON.stringify(t))},t.prototype.Ci=function(){return this.Ni(this.Ti)},t.prototype.xi=function(t){var e=!1;return this.Ti.forEach((function(n,r){r.activeTargetIds.has(t)&&(e=!0)})),e},t.prototype.Fi=function(t){this.ki(t,"pending")},t.prototype.Oi=function(t,e,n){this.ki(t,e,n),this.Mi(t)},t.prototype.$i=function(t){var e="not-current";if(this.xi(t)){var n=this.storage.getItem(xu(this.persistenceKey,t));if(n){var r=Pu.hi(t,n);r&&(e=r.state)}}return this.Li.ui(t),this.bi(),e},t.prototype.Bi=function(t){this.Li.li(t),this.bi()},t.prototype.qi=function(t){return this.Li.activeTargetIds.has(t)},t.prototype.Ui=function(t){this.removeItem(xu(this.persistenceKey,t))},t.prototype.Ki=function(t,e,n){this.Qi(t,e,n)},t.prototype.Wi=function(t,e,n){var r=this;e.forEach((function(t){r.Mi(t)}
2)),this.currentUser=t,n.forEach((function(t){r.Fi(t)}))},t.prototype.ji=function(t){this.Gi(t)},t.prototype.Di=function(){this.Ii&&(this.window.removeEventListener("storage",this.wi),this.removeItem(this.Ai),this.Ii=!1)},t.prototype.getItem=function(t){var e=this.storage.getItem(t);return mr("SharedClientState","READ",t,e),e},t.prototype.setItem=function(t,e){mr("SharedClientState","SET",t,e),this.storage.setItem(t,e)},t.prototype.removeItem=function(t){mr("SharedClientState","REMOVE",t),this.storage.removeItem(t)},t.prototype.Ei=function(t){var e=this,n=t;if(n.storageArea===this.storage){if(mr("SharedClientState","EVENT",n.key,n.newValue),n.key===this.Ai)return void br("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.fn.Cs((function(){return o(e,void 0,void 0,(function(){var t,e,r,i,o,u;return s(this,(function(s){if(this.Ii){if(null!==n.key)if(this.Pi.test(n.key)){if(null==n.newValue)return t=this.zi(n.key),[2,this.Hi(t,null)];if(e=this.Ji(n.key,n.newValue))return[2,this.Hi(e.clientId,e)]}else if(this.gi.test(n.key)){if(null!==n.newValue&&(r=this.Yi(n.key,n.newValue)))return[2,this.Xi(r)]}else if(this.Vi.test(n.key)){if(null!==n.newValue&&(i=this.Zi(n.key,n.newValue)))return[2,this.tr(i)]}else if(n.key===this.yi){if(null!==n.newValue&&(o=this.vi(n.newValue)))return[2,this.Si(o)]}else n.key===this.Ri&&(u=function(t){var e=Su.ai;if(null!=t)try{var n=JSON.parse(t);_r("number"==typeof n),e=n}catch(t){br("SharedClientState","Failed to read sequence number from WebStorage",t)}return e}(n.newValue))!==Su.ai&&this.si(u)}else this.mi.push(n);return[2]}))}))}))}},Object.defineProperty(t.prototype,"Li",{get:function(){return this.Ti.get(this._i)},enumerable:!1,configurable:!0}),t.prototype.bi=function(){this.setItem(this.Ai,this.Li.ci())},t.prototype.ki=function(t,e,n){var r=new ku(this.currentUser,t,e,n),i=Ou(this.persistenceKey,this.currentUser,t);this.setItem(i,r.ci())},t.prototype.Mi=function(t){var e=Ou(this.persistenceKey,this.currentUser,t);this.removeItem(e)},t.prototype.Gi=function(t){var e={clientId:this._i,onlineState:t};this.storage.setItem(this.yi,JSON.stringify(e))},t.prototype.Qi=function(t,e,n){var r=xu(this.persistenceKey,t),i=new Pu(t,e,n);this.setItem(r,i.ci())},t.prototype.zi=function(t){var e=this.Pi.exec(t);return e?e[1]:null},t.prototype.Ji=function(t,e){var n=this.zi(t);return Lu.hi(n,e)},t.prototype.Yi=function(t,e){var n=this.gi.exec(t),r=Number(n[1]),i=void 0!==n[2]?n[2]:null;return ku.hi(new Nu(i),r,e)},t.prototype.Zi=function(t,e){var n=this.Vi.exec(t),r=Number(n[1]);return Pu.hi(r,e)},t.prototype.vi=function(t){return Ru.hi(t)},t.prototype.Xi=function(t){return o(this,void 0,void 0,(function(){return s(this,(function(e){return t.user.uid===this.currentUser.uid?[2,this.fi.er(t.batchId,t.state,t.error)]:(mr("SharedClientState","Ignoring mutation for non-active user "+t.user.uid),[2])}))}))},t.prototype.tr=function(t){return this.fi.nr(t.targetId,t.state,t.error)},t.prototype.Hi=function(t,e){var n=this,r=e?this.Ti.ot(t,e):this.Ti.remove(t),i=this.Ni(this.Ti),o=this.Ni(r),s=[],u=[];return o.forEach((function(t){i.has(t)||s.push(t)})),i.forEach((function(t){o.has(t)||u.push(t)})),this.fi.sr(s,u).then((function(){n.Ti=r}))},t.prototype.Si=function(t){this.Ti.get(t.clientId)&&this.di(t.onlineState)},t.prototype.Ni=function(t){var e=Ei();return t.forEach((function(t,n){e=e.Ot(n.activeTargetIds)})),e},t}(),Mu=function(){function t(){this.ir=new Cu,this.rr={},this.di=null,this.si=null}return t.prototype.Fi=function(t){},t.prototype.Oi=function(t,e,n){},t.prototype.$i=function(t){return this.ir.ui(t),this.rr[t]||"not-current"},t.prototype.Ki=function(t,e,n){this.rr[t]=e},t.prototype.Bi=function(t){this.ir.li(t)},t.prototype.qi=function(t){return this.ir.activeTargetIds.has(t)},t.prototype.Ui=function(t){delete this.rr[t]},t.prototype.Ci=function(){return this.ir.activeTargetIds},t.prototype.xi=function(t){return this.ir.activeTargetIds.has(t)},t.prototype.start=function(){return this.ir=new Cu,Promise.resolve()},t.prototype.Wi=function(t,e,n){},t.prototype.ji=function(t){},t.prototype.Di=function(){},t.prototype.oi=function(t){},t}(),Uu=function(){function t(t,e,n,r){this.batchId=t,this.ar=e,this.baseMutations=n,this.mutations=r}return t.prototype.hr=function(t,e,n){for(var r=n.cr,i=0;i<this.mutations.length;i++){var o=this.mutations[i];o.key.isEqual(t)&&(e=es(o,e,r[i]))}return e},t.prototype.ur=function(t,e){for(var n=0,r=this.baseMutations;n<r.length;n++){var i=r[n];i.key.isEqual(t)&&(e=ns(i,e,e,this.ar))}for(var o=e,s=0,u=this.mutations;s<u.length;s++){var a=u[s];a.key.isEqual(t)&&(e=ns(a,e,o,this.ar))}return e},t.prototype.lr=function(t){var e=this,n=t;return this.mutations.forEach((function(r){var i=e.ur(r.key,t.get(r.key));i&&(n=n.ot(r.key,i))})),n},t.prototype.keys=function(){return this.mutations.reduce((function(t,e){return t.add(e.key)}),wi())},t.prototype.isEqual=function(t){return this.batchId===t.batchId&&Dr(this.mutations,t.mutations,(function(t,e){return is(t,e)}))&&Dr(this.baseMutations,t.baseMutations,(function(t,e){return is(t,e)}))},t}(),ju=function(){function t(t,e,n,r){this.batch=t,this._r=e,this.cr=n,this.dr=r}return t.from=function(e,n,r){_r(e.mutations.length===r.length);for(var i=mi,o=e.mutations,s=0;s<o.length;s++)i=i.ot(o[s].key,r[s].version);return new t(e,n,r,i)},t}(),Fu=function(){function t(){this.wr=new Fr((function(t){return t.toString()}),(function(t,e){return t.isEqual(e)})),this.Er=!1}return Object.defineProperty(t.prototype,"readTime",{get:function(){return this.Tr},set:function(t){this.Tr=t}
2,enumerable:!1,configurable:!0}),t.prototype.Ir=function(t,e){this.mr(),this.readTime=e,this.wr.set(t.key,t)},t.prototype.Ar=function(t,e){this.mr(),e&&(this.readTime=e),this.wr.set(t,null)},t.prototype.Rr=function(t,e){this.mr();var n=this.wr.get(e);return void 0!==n?ru.resolve(n):this.Pr(t,e)},t.prototype.getEntries=function(t,e){return this.gr(t,e)},t.prototype.apply=function(t){return this.mr(),this.Er=!0,this.Vr(t)},t.prototype.mr=function(){},t}(),qu="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",Gu=function(){function t(){this.yr=[]}return t.prototype.pr=function(t){this.yr.push(t)},t.prototype.br=function(){this.yr.forEach((function(t){return t()}))},t}(),Bu=function(){function t(t,e,n){this.vr=t,this.Sr=e,this.Dr=n}return t.prototype.Cr=function(t,e){var n=this;return this.Sr.Nr(t,e).next((function(r){return n.Fr(t,e,r)}))},t.prototype.Fr=function(t,e,n){return this.vr.Rr(t,e).next((function(t){for(var r=0,i=n;r<i.length;r++)t=i[r].ur(e,t);return t}))},t.prototype.kr=function(t,e,n){var r=vi();return e.forEach((function(t,e){for(var i=0,o=n;i<o.length;i++)e=o[i].ur(t,e);r=r.ot(t,e)})),r},t.prototype.Or=function(t,e){var n=this;return this.vr.getEntries(t,e).next((function(e){return n.Mr(t,e)}))},t.prototype.Mr=function(t,e){var n=this;return this.Sr.$r(t,e).next((function(r){var i=n.kr(t,e,r),o=di();return i.forEach((function(t,e){e||(e=new bs(t,Gr.min())),o=o.ot(t,e)})),o}))},t.prototype.Lr=function(t,e,n){return function(t){return Wr.X(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.Br(t,e.path):Ds(e)?this.qr(t,e,n):this.Ur(t,e,n)},t.prototype.Br=function(t,e){return this.Cr(t,new Wr(e)).next((function(t){var e=gi();return t instanceof ms&&(e=e.ot(t.key,t)),e}))},t.prototype.qr=function(t,e,n){var r=this,i=e.collectionGroup,o=gi();return this.Dr.Kr(t,i).next((function(s){return ru.forEach(s,(function(s){var u=function(t,e){return new Is(e,null,t.on.slice(),t.filters.slice(),t.limit,t.an,t.startAt,t.endAt)}(e,s.child(i));return r.Ur(t,u,n).next((function(t){t.forEach((function(t,e){o=o.ot(t,e)}))}))})).next((function(){return o}))}))},t.prototype.Ur=function(t,e,n){var r,i,o=this;return this.vr.Lr(t,e,n).next((function(n){return r=n,o.Sr.Qr(t,e)})).next((function(e){return i=e,o.Wr(t,i,r).next((function(t){r=t;for(var e=0,n=i;e<n.length;e++)for(var o=n[e],s=0,u=o.mutations;s<u.length;s++){var a=u[s],c=a.key,h=r.get(c),f=ns(a,h,h,o.ar);r=f instanceof ms?r.ot(c,f):r.remove(c)}}))})).next((function(){return r.forEach((function(t,n){Ms(e,n)||(r=r.remove(t))})),r}))},t.prototype.Wr=function(t,e,n){for(var r=wi(),i=0,o=e;i<o.length;i++)for(var s=0,u=o[i].mutations;s<u.length;s++){var a=u[s];a instanceof us&&null===n.get(a.key)&&(r=r.add(a.key))}var c=n;return this.vr.getEntries(t,r).next((function(t){return t.forEach((function(t,e){null!==e&&e instanceof ms&&(c=c.ot(t,e))})),c}))},t}(),zu=function(){function t(t,e,n,r){this.targetId=t,this.fromCache=e,this.jr=n,this.Gr=r}return t.zr=function(e,n){for(var r=wi(),i=wi(),o=0,s=n.docChanges;o<s.length;o++){var u=s[o];switch(u.type){case 0:r=r.add(u.doc.key);break;case 1:i=i.add(u.doc.key)}}return new t(e,n.fromCache,r,i)},t}();function Hu(t,e){var n=t[0],r=t[1],i=e[0],o=e[1],s=Sr(n,i);return 0===s?Sr(r,o):s}var Ku=function(){function t(t){this.Hr=t,this.buffer=new fi(Hu),this.Jr=0}return t.prototype.Yr=function(){return++this.Jr},t.prototype.Xr=function(t){var e=[t,this.Yr()];if(this.buffer.size<this.Hr)this.buffer=this.buffer.add(e);else{var n=this.buffer.last();Hu(e,n)<0&&(this.buffer=this.buffer.delete(n).add(e))}},Object.defineProperty(t.prototype,"maxValue",{get:function(){return this.buffer.last()[0]},enumerable:!1,configurable:!0}),t}(),Wu={Zr:!1,eo:0,no:0,so:0},Xu=function(){function t(t,e,n){this.io=t,this.ro=e,this.oo=n}return t.ao=function(e){return new t(e,t.ho,t.co)},t}();Xu.uo=-1,Xu.lo=1048576,Xu._o=41943040,Xu.ho=10,Xu.co=1e3,Xu.fo=new Xu(Xu._o,Xu.ho,Xu.co),Xu.do=new Xu(Xu.uo,0,0);var Yu=function(){function t(t,e){this.wo=t,this.hs=e,this.Eo=!1,this.To=null}return t.prototype.start=function(t){this.wo.params.io!==Xu.uo&&this.Io(t)},t.prototype.stop=function(){this.To&&(this.To.cancel(),this.To=null)},Object.defineProperty(t.prototype,"Ii",{get:function(){return null!==this.To}
2,enumerable:!1,configurable:!0}),t.prototype.Io=function(t){var e=this,n=this.Eo?3e5:6e4;mr("LruGarbageCollector","Garbage collection scheduled in "+n+"ms"),this.To=this.hs.Vn("lru_garbage_collection",n,(function(){return o(e,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:this.To=null,this.Eo=!0,n.label=1;case 1:return n.trys.push([1,3,,7]),[4,t.mo(this.wo)];case 2:return n.sent(),[3,7];case 3:return uu(e=n.sent())?(mr("LruGarbageCollector","Ignoring IndexedDB error during garbage collection: ",e),[3,6]):[3,4];case 4:return[4,dc(e)];case 5:n.sent(),n.label=6;case 6:return[3,7];case 7:return[4,this.Io(t)];case 8:return n.sent(),[2]}}))}))}))},t}(),Qu=function(){function t(t,e){this.Ao=t,this.params=e}return t.prototype.Ro=function(t,e){return this.Ao.Po(t).next((function(t){return Math.floor(e/100*t)}))},t.prototype.Vo=function(t,e){var n=this;if(0===e)return ru.resolve(Su.ai);var r=new Ku(e);return this.Ao.Ce(t,(function(t){return r.Xr(t.sequenceNumber)})).next((function(){return n.Ao.yo(t,(function(t){return r.Xr(t)}))})).next((function(){return r.maxValue}))},t.prototype.po=function(t,e,n){return this.Ao.po(t,e,n)},t.prototype.bo=function(t,e){return this.Ao.bo(t,e)},t.prototype.vo=function(t,e){var n=this;return this.params.io===Xu.uo?(mr("LruGarbageCollector","Garbage collection skipped; disabled"),ru.resolve(Wu)):this.So(t).next((function(r){return r<n.params.io?(mr("LruGarbageCollector","Garbage collection skipped; Cache size "+r+" is lower than threshold "+n.params.io),Wu):n.Do(t,e)}))},t.prototype.So=function(t){return this.Ao.So(t)},t.prototype.Do=function(t,e){var n,r,i,o,s,u,a,h=this,f=Date.now();return this.Ro(t,this.params.ro).next((function(e){return e>h.params.oo?(mr("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+h.params.oo+" from "+e),r=h.params.oo):r=e,o=Date.now(),h.Vo(t,r)})).next((function(r){return n=r,s=Date.now(),h.po(t,n,e)})).next((function(e){return i=e,u=Date.now(),h.bo(t,n)})).next((function(t){return a=Date.now(),gr()<=c.in.DEBUG&&mr("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(o-f)+"ms\n\tDetermined least recently used "+r+" in "+(s-o)+"ms\n\tRemoved "+i+" targets in "+(u-s)+"ms\n\tRemoved "+t+" documents in "+(a-u)+"ms\nTotal Duration: "+(a-f)+"ms"),ru.resolve({Zr:!0,eo:r,no:i,so:t})}))},t}();function Ju(t){for(var e="",n=0;n<t.length;n++)e.length>0&&(e=Zu(e)),e=$u(t.get(n),e);return Zu(e)}function $u(t,e){for(var n=e,r=t.length,i=0;i<r;i++){var o=t.charAt(i);switch(o){case"\0":n+="��";break;case"�":n+="��";break;default:n+=o}}return n}function Zu(t){return t+"��"}function ta(t){var e=t.length;if(_r(e>=2),2===e)return _r("�"===t.charAt(0)&&"�"===t.charAt(1)),zr.U();for(var n=e-2,r=[],i="",o=0;o<e;){var s=t.indexOf("�",o);switch((s<0||s>n)&&Er(),t.charAt(s+1)){case"�":var u=t.substring(o,s),a=void 0;0===i.length?a=u:(a=i+=u,i=""),r.push(a);break;case"�":i+=t.substring(o,s),i+="\0";break;case"�":i+=t.substring(o,s+1);break;default:Er()}o=s+2}return new zr(r)}var ea=function(t){this.Co=t};function na(t,e){if(e.document)return function(t,e,n){var r=vo(t,e.name),i=ho(e.updateTime),o=new ds({mapValue:{fields:e.fields}});return new ms(r,i,o,{hasCommittedMutations:!!n})}(t.Co,e.document,!!e.hasCommittedMutations);if(e.noDocument){var n=Wr.Z(e.noDocument.path),r=ua(e.noDocument.readTime);return new bs(n,r,{hasCommittedMutations:!!e.hasCommittedMutations})}if(e.unknownDocument){var i=Wr.Z(e.unknownDocument.path),o=ua(e.unknownDocument.version);return new ws(i,o)}return Er()}function ra(t,e,n){var r=ia(n),i=e.key.path.F().L();if(e instanceof ms){var o=function(t,e){return{name:po(t,e.key),fields:e.rn().mapValue.fields,updateTime:uo(t,e.version.v())}}(t.Co,e),s=e.hasCommittedMutations;return new La(null,null,o,s,r,i)}if(e instanceof bs){var u=e.key.path.L(),a=sa(e.version),c=e.hasCommittedMutations;return new La(null,new ka(u,a),null,c,r,i)}if(e instanceof ws){var h=e.key.path.L(),f=sa(e.version);return new La(new Pa(h,f),null,null,!0,r,i)}return Er()}function ia(t){var e=t.v();return[e.seconds,e.nanoseconds]}function oa(t){var e=new qr(t[0],t[1]);return Gr.V(e)}function sa(t){var e=t.v();return new Na(e.seconds,e.nanoseconds)}function ua(t){var e=new qr(t.seconds,t.nanoseconds);return Gr.V(e)}function aa(t,e){var n=(e.baseMutations||[]).map((function(e){return Eo(t.Co,e)})),r=e.mutations.map((function(e){return Eo(t.Co,e)})),i=qr.fromMillis(e.localWriteTimeMs);return new Uu(e.batchId,i,n,r)}function ca(t){var e,n,r=ua(t.readTime),i=void 0!==t.lastLimboFreeSnapshotVersion?ua(t.lastLimboFreeSnapshotVersion):Gr.min();return void 0!==t.query.documents?(_r(1===(n=t.query).documents.length),e=xs(_s(go(n.documents[0])))):e=Ao(t.query),new ii(e,t.targetId,0,t.lastListenSequenceNumber,r,i,xr.fromBase64String(t.resumeToken))}function ha(t,e){var n,r=sa(e.nt),i=sa(e.lastLimboFreeSnapshotVersion);n=ei(e.target)?_o(t.Co,e.target):To(t.Co,e.target);var o=e.resumeToken.toBase64();return new Ca(e.targetId,Zr(e.target),r,o,e.sequenceNumber,i,n)}var fa=function(){function t(t,e,n,r){this.userId=t,this.serializer
2=e,this.Dr=n,this.No=r,this.xo={}}return t.Fo=function(e,n,r,i){return _r(""!==e.uid),new t(e.Zs()?e.uid:"",n,r,i)},t.prototype.ko=function(t){var e=!0,n=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return da(t).rs({index:Oa.userMutationsIndex,range:n},(function(t,n,r){e=!1,r.done()})).next((function(){return e}))},t.prototype.Oo=function(t,e,n,r){var i=this,o=va(t),s=da(t);return s.add({}).next((function(u){_r("number"==typeof u);for(var a=new Uu(u,e,n,r),c=function(t,e,n){var r=n.baseMutations.map((function(e){return Io(t.Co,e)})),i=n.mutations.map((function(e){return Io(t.Co,e)}));return new Oa(e,n.batchId,n.ar.toMillis(),r,i)}(i.serializer,i.userId,a),h=[],f=new fi((function(t,e){return Sr(t.B(),e.B())})),l=0,p=r;l<p.length;l++){var d=p[l],v=xa.key(i.userId,d.key.path,u);f=f.add(d.key.path.F()),h.push(s.put(c)),h.push(o.put(v,xa.PLACEHOLDER))}return f.forEach((function(e){h.push(i.Dr.Mo(t,e))})),t.pr((function(){i.xo[u]=a.keys()})),ru.kn(h).next((function(){return a}))}))},t.prototype.$o=function(t,e){var n=this;return da(t).get(e).next((function(t){return t?(_r(t.userId===n.userId),aa(n.serializer,t)):null}))},t.prototype.Lo=function(t,e){var n=this;return this.xo[e]?ru.resolve(this.xo[e]):this.$o(t,e).next((function(t){if(t){var r=t.keys();return n.xo[e]=r,r}return null}))},t.prototype.Bo=function(t,e){var n=this,r=e+1,i=IDBKeyRange.lowerBound([this.userId,r]),o=null;return da(t).rs({index:Oa.userMutationsIndex,range:i},(function(t,e,i){e.userId===n.userId&&(_r(e.batchId>=r),o=aa(n.serializer,e)),i.done()})).next((function(){return o}))},t.prototype.qo=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),n=-1;return da(t).rs({index:Oa.userMutationsIndex,range:e,reverse:!0},(function(t,e,r){n=e.batchId,r.done()})).next((function(){return n}))},t.prototype.Uo=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return da(t).ts(Oa.userMutationsIndex,n).next((function(t){return t.map((function(t){return aa(e.serializer,t)}))}))},t.prototype.Nr=function(t,e){var n=this,r=xa.prefixForPath(this.userId,e.path),i=IDBKeyRange.lowerBound(r),o=[];return va(t).rs({range:i},(function(r,i,s){var u=r[0],a=r[1],c=r[2],h=ta(a);if(u===n.userId&&e.path.isEqual(h))return da(t).get(c).next((function(t){if(!t)throw Er();_r(t.userId===n.userId),o.push(aa(n.serializer,t))}));s.done()})).next((function(){return o}))},t.prototype.$r=function(t,e){var n=this,r=new fi(Sr),i=[];return e.forEach((function(e){var o=xa.prefixForPath(n.userId,e.path),s=IDBKeyRange.lowerBound(o),u=va(t).rs({range:s},(function(t,i,o){var s=t[0],u=t[1],a=t[2],c=ta(u);s===n.userId&&e.path.isEqual(c)?r=r.add(a):o.done()}));i.push(u)})),ru.kn(i).next((function(){return n.Ko(t,r)}))},t.prototype.Qr=function(t,e){var n=this,r=e.path,i=r.length+1,o=xa.prefixForPath(this.userId,r),s=IDBKeyRange.lowerBound(o),u=new fi(Sr);return va(t).rs({range:s},(function(t,e,o){var s=t[0],a=t[1],c=t[2],h=ta(a);s===n.userId&&r.M(h)?h.length===i&&(u=u.add(c)):o.done()})).next((function(){return n.Ko(t,u)}))},t.prototype.Ko=function(t,e){var n=this,r=[],i=[];return e.forEach((function(e){i.push(da(t).get(e).next((function(t){if(null===t)throw Er();_r(t.userId===n.userId),r.push(aa(n.serializer,t))})))})),ru.kn(i).next((function(){return r}))},t.prototype.Qo=function(t,e){var n=this;return pa(t.Wo,this.userId,e).next((function(r){return t.pr((function(){n.jo(e.batchId)})),ru.forEach(r,(function(e){return n.No.Go(t,e)}))}))},t.prototype.jo=function(t){delete this.xo[t]},t.prototype.zo=function(t){var e=this;return this.ko(t).next((function(n){if(!n)return ru.resolve();var r=IDBKeyRange.lowerBound(xa.prefixForUser(e.userId)),i=[];return va(t).rs({range:r},(function(t,n,r){if(t[0]===e.userId){var o=ta(t[1]);i.push(o)}else r.done()})).next((function(){_r(0===i.length)}))}))},t.prototype.Ho=function(t,e){return la(t,this.userId,e)},t.prototype.Jo=function(t){var e=this;return ya(t).get(this.userId).next((function(t){return t||new Da(e.userId,-1,"")}))},t}();
2function la(t,e,n){var r=xa.prefixForPath(e,n.path),i=r[1],o=IDBKeyRange.lowerBound(r),s=!1;return va(t).rs({range:o,ss:!0},(function(t,n,r){var o=t[0],u=t[1];t[2],o===e&&u===i&&(s=!0),r.done()})).next((function(){return s}))}function pa(t,e,n){var r=t.store(Oa.store),i=t.store(xa.store),o=[],s=IDBKeyRange.only(n.batchId),u=0,a=r.rs({range:s},(function(t,e,n){return u++,n.delete()}));o.push(a.next((function(){_r(1===u)})));for(var c=[],h=0,f=n.mutations;h<f.length;h++){var l=f[h],p=xa.key(e,l.key.path,n.batchId);o.push(i.delete(p)),c.push(l.key)}return ru.kn(o).next((function(){return c}))}function da(t){return Ja.Kn(t,Oa.store)}function va(t){return Ja.Kn(t,xa.store)}function ya(t){return Ja.Kn(t,Da.store)}var ga=function(){function t(t,e){this.serializer=t,this.Dr=e}return t.prototype.Ir=function(t,e,n){return wa(t).put(Ia(e),n)},t.prototype.Ar=function(t,e){var n=wa(t),r=Ia(e);return n.delete(r)},t.prototype.updateMetadata=function(t,e){var n=this;return this.getMetadata(t).next((function(r){return r.byteSize+=e,n.Yo(t,r)}))},t.prototype.Rr=function(t,e){var n=this;return wa(t).get(Ia(e)).next((function(t){return n.Xo(t)}))},t.prototype.Zo=function(t,e){var n=this;return wa(t).get(Ia(e)).next((function(t){var e=n.Xo(t);return e?{ta:e,size:Ea(t)}:null}))},t.prototype.getEntries=function(t,e){var n=this,r=vi();return this.ea(t,e,(function(t,e){var i=n.Xo(e);r=r.ot(t,i)})).next((function(){return r}))},t.prototype.na=function(t,e){var n=this,r=vi(),i=new ai(Wr.D);return this.ea(t,e,(function(t,e){var o=n.Xo(e);o?(r=r.ot(t,o),i=i.ot(t,Ea(e))):(r=r.ot(t,null),i=i.ot(t,0))})).next((function(){return{sa:r,ia:i}}))},t.prototype.ea=function(t,e,n){if(e.P())return ru.resolve();var r=IDBKeyRange.bound(e.first().path.L(),e.last().path.L()),i=e._t(),o=i.It();return wa(t).rs({range:r},(function(t,e,r){for(var s=Wr.Z(t);o&&Wr.D(o,s)<0;)n(o,null),o=i.It();o&&o.isEqual(s)&&(n(o,e),o=i.At()?i.It():null),o?r.Xn(o.path.L()):r.done()})).next((function(){for(;o;)n(o,null),o=i.At()?i.It():null}))},t.prototype.Lr=function(t,e,n){var r=this,i=gi(),o=e.path.length+1,s={};if(n.isEqual(Gr.min())){var u=e.path.L();s.range=IDBKeyRange.lowerBound(u)}else{var a=e.path.L(),c=ia(n);s.range=IDBKeyRange.lowerBound([a,c],!0),s.index=La.collectionReadTimeIndex}return wa(t).rs(s,(function(t,n,s){if(t.length===o){var u=na(r.serializer,n);e.path.M(u.key.path)?u instanceof ms&&Ms(e,u)&&(i=i.ot(u.key,u)):s.done()}})).next((function(){return i}))},t.prototype.ra=function(t){return new ma(this,!!t&&t.oa)},t.prototype.aa=function(t){return this.getMetadata(t).next((function(t){return t.byteSize}))},t.prototype.getMetadata=function(t){return ba(t).get(Ra.key).next((function(t){return _r(!!t),t}))},t.prototype.Yo=function(t,e){return ba(t).put(Ra.key,e)},t.prototype.Xo=function(t){if(t){var e=na(this.serializer,t);return e instanceof bs&&e.version.isEqual(Gr.min())?null:e}return null},t}(),ma=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).ha=e,r.oa=n,r.ca=new Fr((function(t){return t.toString()}),(function(t,e){return t.isEqual(e)})),r}return i(e,t),e.prototype.Vr=function(t){var e=this,n=[],r=0,i=new fi((function(t,e){return Sr(t.B(),e.B())}));return this.wr.forEach((function(o,s){var u=e.ca.get(o);if(s){var a=ra(e.ha.serializer,s,e.readTime);i=i.add(o.path.F());var c=Ea(a);r+=c-u,n.push(e.ha.Ir(t,o,a))}else if(r-=u,e.oa){var h=ra(e.ha.serializer,new bs(o,Gr.min()),e.readTime);n.push(e.ha.Ir(t,o,h))}else n.push(e.ha.Ar(t,o))})),i.forEach((function(r){n.push(e.ha.Dr.Mo(t,r))})),n.push(this.ha.updateMetadata(t,r)),ru.kn(n)},e.prototype.Pr=function(t,e){var n=this;return this.ha.Zo(t,e).next((function(t){return null===t?(n.ca.set(e,0),null):(n.ca.set(e,t.size),t.ta)}))},e.prototype.gr=function(t,e){var n=this;return this.ha.na(t,e).next((function(t){var e=t.sa;return t.ia.forEach((function(t,e){n.ca.set(t,e)})),e}))},e}(Fu);function ba(t){return Ja.Kn(t,Ra.store)}function wa(t){return Ja.Kn(t,La.store)}function Ia(t){return t.path.L()}function Ea(t){var e;if(t.document)e=t.document;else if(t.unknownDocument)e=t.unknownDocument;else{if(!t.noDocument)throw Er();e=t.noDocument}return JSON.stringify(e).length}var _a=function(){function t(){this.ua=new Ta}return t.prototype.Mo=function(t,e){return this.ua.add(e),ru.resolve()},t.prototype.Kr=function(t,e){return ru.resolve(this.ua.getEntries(e))},t}(),Ta=function(){function t(){this.index={}}return t.prototype.add=function(t){var e=t.O(),n=t.F(),r=this.index[e]||new fi(zr.D),i=!r.has(n);return this.index[e]=r.add(n),i},t.prototype.has=function(t){var e=t.O(),n=t.F(),r=this.index[e];return r&&r.has(n)},t.prototype.getEntries=function(t){return(this.index[t]||new fi(zr.D)).L()},t}
2(),Aa=function(){function t(t){this.serializer=t}return t.prototype.createOrUpgrade=function(t,e,n,r){var i=this;_r(n<r&&n>=0&&r<=10);var o=new au("createOrUpgrade",e);n<1&&r>=1&&(function(t){t.createObjectStore(Sa.store)}(t),function(t){t.createObjectStore(Da.store,{keyPath:Da.keyPath}),t.createObjectStore(Oa.store,{keyPath:Oa.keyPath,autoIncrement:!0}).createIndex(Oa.userMutationsIndex,Oa.userMutationsKeyPath,{unique:!0}),t.createObjectStore(xa.store)}(t),ja(t),function(t){t.createObjectStore(La.store)}(t));var s=ru.resolve();return n<3&&r>=3&&(0!==n&&(function(t){t.deleteObjectStore(Va.store),t.deleteObjectStore(Ca.store),t.deleteObjectStore(Ma.store)}(t),ja(t)),s=s.next((function(){return function(t){var e=t.store(Ma.store),n=new Ma(0,0,Gr.min().v(),0);return e.put(Ma.key,n)}(o)}))),n<4&&r>=4&&(0!==n&&(s=s.next((function(){return function(t,e){return e.store(Oa.store).ts().next((function(n){t.deleteObjectStore(Oa.store),t.createObjectStore(Oa.store,{keyPath:Oa.keyPath,autoIncrement:!0}).createIndex(Oa.userMutationsIndex,Oa.userMutationsKeyPath,{unique:!0});var r=e.store(Oa.store),i=n.map((function(t){return r.put(t)}));return ru.kn(i)}))}(t,o)}))),s=s.next((function(){!function(t){t.createObjectStore(Fa.store,{keyPath:Fa.keyPath})}(t)}))),n<5&&r>=5&&(s=s.next((function(){return i.removeAcknowledgedMutations(o)}))),n<6&&r>=6&&(s=s.next((function(){return function(t){t.createObjectStore(Ra.store)}(t),i.addDocumentGlobal(o)}))),n<7&&r>=7&&(s=s.next((function(){return i.ensureSequenceNumbers(o)}))),n<8&&r>=8&&(s=s.next((function(){return i.createCollectionParentIndex(t,o)}))),n<9&&r>=9&&(s=s.next((function(){!function(t){t.objectStoreNames.contains("remoteDocumentChanges")&&t.deleteObjectStore("remoteDocumentChanges")}(t),function(t){var e=t.objectStore(La.store);e.createIndex(La.readTimeIndex,La.readTimeIndexPath,{unique:!1}),e.createIndex(La.collectionReadTimeIndex,La.collectionReadTimeIndexPath,{unique:!1})}(e)}))),n<10&&r>=10&&(s=s.next((function(){return i.rewriteCanonicalIds(o)}))),s},t.prototype.addDocumentGlobal=function(t){var e=0;return t.store(La.store).rs((function(t,n){e+=Ea(n)})).next((function(){var n=new Ra(e);return t.store(Ra.store).put(Ra.key,n)}))},t.prototype.removeAcknowledgedMutations=function(t){var e=this,n=t.store(Da.store),r=t.store(Oa.store);return n.ts().next((function(n){return ru.forEach(n,(function(n){var i=IDBKeyRange.bound([n.userId,-1],[n.userId,n.lastAcknowledgedBatchId]);return r.ts(Oa.userMutationsIndex,i).next((function(r){return ru.forEach(r,(function(r){_r(r.userId===n.userId);var i=aa(e.serializer,r);return pa(t,n.userId,i).next((function(){}))}))}))}))}))},t.prototype.ensureSequenceNumbers=function(t){var e=t.store(Va.store),n=t.store(La.store);return t.store(Ma.store).get(Ma.key).next((function(t){var r=[];return n.rs((function(n,i){var o=new zr(n),s=function(t){return[0,Ju(t)]}(o);r.push(e.get(s).next((function(n){return n?ru.resolve():function(n){return e.put(new Va(0,Ju(n),t.highestListenSequenceNumber))}(o)})))})).next((function(){return ru.kn(r)}))}))},t.prototype.createCollectionParentIndex=function(t,e){t.createObjectStore(Ua.store,{keyPath:Ua.keyPath});var n=e.store(Ua.store),r=new Ta,i=function(t){if(r.add(t)){var e=t.O(),i=t.F();return n.put({collectionId:e,parent:Ju(i)})}};return e.store(La.store).rs({ss:!0},(function(t,e){var n=new zr(t);return i(n.F())})).next((function(){return e.store(xa.store).rs({ss:!0},(function(t,e){t[0];var n=t[1],r=(t[2],ta(n));return i(r.F())}))}))},t.prototype.rewriteCanonicalIds=function(t){var e=this,n=t.store(Ca.store);return n.rs((function(t,r){var i=ca(r),o=ha(e.serializer,i);return n.put(o)}))},t}(),Na=function(t,e){this.seconds=t,this.nanoseconds=e},Sa=function(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n};Sa.store="owner",Sa.key="owner";var Da=function(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n};Da.store="mutationQueues",Da.keyPath="userId";var Oa=function(t,e,n,r,i){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i};Oa.store="mutations",Oa.keyPath="batchId",Oa.userMutationsIndex="userMutationsIndex",Oa.userMutationsKeyPath=["userId","batchId"];var xa=function(){function t(){}return t.prefixForUser=function(t){return[t]},t.prefixForPath=function(t,e){return[t,Ju(e)]},t.key=function(t,e,n){return[t,Ju(e),n]},t}();xa.store="documentMutations",xa.PLACEHOLDER=new xa;var ka=function(t,e){this.path=t,this.readTime=e},Pa=function(t,e){this.path=t,this.version=e},La=function(t,e,n,r,i,o){this.unknownDocument=t,this.noDocument=e,this.document=n,this.hasCommittedMutations=r,this.readTime=i,this.parentPath=o};La.store="remoteDocuments",La.readTimeIndex="readTimeIndex",La.readTimeIndexPath="readTime",La.collectionReadTimeIndex="collectionReadTimeIndex",La.collectionReadTimeIndexPath=["parentPath","readTime"];var Ra=function(t){this.byteSize=t};Ra.store="remoteDocumentGlobal",Ra.key="remoteDocumentGlobalKey";var Ca=function(t,e,n,r,i,o,s){this.targetId=t,this.canonicalId=e,this.readTime=n,this.resumeToken=r,this.lastListenSequenceNumber=i,this.lastLimboFreeSnapshotVersion=o,this.query=s};Ca.store="targets",Ca.keyPath="targetId",Ca.queryTargetsIndexName="queryTargetsIndex",Ca.queryTargetsKeyPath=["canonicalId","targetId"];var Va=function(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n};Va.store="targetDocuments",Va.keyPath=["targetId","path"],Va.documentTargetsIndex="documentTargetsIndex",Va.documentTargetsKeyPath=["path","targetId"];var Ma=function(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r};Ma.key="targetGlobalKey",Ma.store="targetGlobal";var Ua=function(t,e){this.collectionId=t,this.parent=e};function ja(t){t.createObjectStore(Va.store,{keyPath:Va.keyPath}).createIndex(Va.documentTargetsIndex,Va.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(Ca.store,{keyPath:Ca.keyPath}).createIndex(Ca.queryTargetsIndexName,Ca.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(Ma.store)}Ua.store="collectionParents",Ua.keyPath=["collectionId","parent"];var Fa=function(t,e,n,r){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=r};Fa.store="clientMetadata",Fa.keyPath="clientId";var qa=u(u(u([Da.store,Oa.store,xa.store,La.store,Ca.store,Sa.store,Ma.store,Va.store],[Fa.store]),[Ra.store]),[Ua.store]),Ga=function(){function t(){this.la=new Ta}return t.prototype.Mo=function(t,e){var n=this;if(!this.la.has(e)){var r=e.O(),i=e.F();t.pr((function(){n.la.add(e)}));var o={collectionId:r,parent:Ju(i)};return Ba(t).put(o)}return ru.resolve()},t.prototype.Kr=function(t,e){var n=[],r=IDBKeyRange.bound([e,""],[Or(e),""],!1,!0);return Ba(t).ts(r).next((function(t){for(var r=0,i=t;r<i.length;r++){var o=i[r];if(o.collectionId!==e)break;n.push(ta(o.parent))}return n}))},t}();function Ba(t){return Ja.Kn(t,Ua.store)}var za=function(){function t(t){this._a=t}return t.prototype.next=function(){return this._a+=2,this._a},t.fa=function(){return new t(0)},t.da=function(){return new t(-1)},t}
2(),Ha=function(){function t(t,e){this.No=t,this.serializer=e}return t.prototype.wa=function(t){var e=this;return this.Ea(t).next((function(n){var r=new za(n.highestTargetId);return n.highestTargetId=r.next(),e.Ta(t,n).next((function(){return n.highestTargetId}))}))},t.prototype.Ia=function(t){return this.Ea(t).next((function(t){return Gr.V(new qr(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))}))},t.prototype.ma=function(t){return this.Ea(t).next((function(t){return t.highestListenSequenceNumber}))},t.prototype.Aa=function(t,e,n){var r=this;return this.Ea(t).next((function(i){return i.highestListenSequenceNumber=e,n&&(i.lastRemoteSnapshotVersion=n.v()),e>i.highestListenSequenceNumber&&(i.highestListenSequenceNumber=e),r.Ta(t,i)}))},t.prototype.Ra=function(t,e){var n=this;return this.Pa(t,e).next((function(){return n.Ea(t).next((function(r){return r.targetCount+=1,n.ga(e,r),n.Ta(t,r)}))}))},t.prototype.Va=function(t,e){return this.Pa(t,e)},t.prototype.ya=function(t,e){var n=this;return this.pa(t,e.targetId).next((function(){return Ka(t).delete(e.targetId)})).next((function(){return n.Ea(t)})).next((function(e){return _r(e.targetCount>0),e.targetCount-=1,n.Ta(t,e)}))},t.prototype.po=function(t,e,n){var r=this,i=0,o=[];return Ka(t).rs((function(s,u){var a=ca(u);a.sequenceNumber<=e&&null===n.get(a.targetId)&&(i++,o.push(r.ya(t,a)))})).next((function(){return ru.kn(o)})).next((function(){return i}))},t.prototype.Ce=function(t,e){return Ka(t).rs((function(t,n){var r=ca(n);e(r)}))},t.prototype.Ea=function(t){return Wa(t).get(Ma.key).next((function(t){return _r(null!==t),t}))},t.prototype.Ta=function(t,e){return Wa(t).put(Ma.key,e)},t.prototype.Pa=function(t,e){return Ka(t).put(ha(this.serializer,e))},t.prototype.ga=function(t,e){var n=!1;return t.targetId>e.highestTargetId&&(e.highestTargetId=t.targetId,n=!0),t.sequenceNumber>e.highestListenSequenceNumber&&(e.highestListenSequenceNumber=t.sequenceNumber,n=!0),n},t.prototype.ba=function(t){return this.Ea(t).next((function(t){return t.targetCount}))},t.prototype.va=function(t,e){var n=Zr(e),r=IDBKeyRange.bound([n,Number.NEGATIVE_INFINITY],[n,Number.POSITIVE_INFINITY]),i=null;return Ka(t).rs({range:r,index:Ca.queryTargetsIndexName},(function(t,n,r){var o=ca(n);ti(e,o.target)&&(i=o,r.done())})).next((function(){return i}))},t.prototype.Sa=function(t,e,n){var r=this,i=[],o=Xa(t);return e.forEach((function(e){var s=Ju(e.path);i.push(o.put(new Va(n,s))),i.push(r.No.Da(t,n,e))})),ru.kn(i)},t.prototype.Ca=function(t,e,n){var r=this,i=Xa(t);return ru.forEach(e,(function(e){var o=Ju(e.path);return ru.kn([i.delete([n,o]),r.No.Na(t,n,e)])}))},t.prototype.pa=function(t,e){var n=Xa(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return n.delete(r)},t.prototype.xa=function(t,e){var n=IDBKeyRange.bound([e],[e+1],!1,!0),r=Xa(t),i=wi();return r.rs({range:n,ss:!0},(function(t,e,n){var r=ta(t[1]),o=new Wr(r);i=i.add(o)})).next((function(){return i}))},t.prototype.Ho=function(t,e){var n=Ju(e.path),r=IDBKeyRange.bound([n],[Or(n)],!1,!0),i=0;return Xa(t).rs({index:Va.documentTargetsIndex,ss:!0,range:r},(function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())})).next((function(){return i>0}))},t.prototype.Ue=function(t,e){return Ka(t).get(e).next((function(t){return t?ca(t):null}))},t}();function Ka(t){return Ja.Kn(t,Ca.store)}function Wa(t){return Ja.Kn(t,Ma.store)}function Xa(t){return Ja.Kn(t,Va.store)}var Ya="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",Qa=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).Wo=e,r.Fa=n,r}return i(e,t),e}(Gu),Ja=function(){function t(e,n,r,i,o,s,u,a,c,h){if(this.allowTabSynchronization=e,this.persistenceKey=n,this.clientId=r,this.fn=o,this.window=s,this.document=u,this.ka=c,this.Oa=h,this.Ma=null,this.$a=!1,this.isPrimary=!1,this.networkEnabled=!0,this.La=null,this.inForeground=!1,this.Ba=null,this.qa=null,this.Ua=Number.NEGATIVE_INFINITY,this.Ka=function(t){return Promise.resolve()}
2,!t.Ln())throw new vr(dr.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.No=new tc(this,i),this.Qa=n+"main",this.serializer=new ea(a),this.Wa=new iu(this.Qa,10,new Aa(this.serializer)),this.ja=new Ha(this.No,this.serializer),this.Dr=new Ga,this.vr=function(t,e){return new ga(t,e)}(this.serializer,this.Dr),this.window&&this.window.localStorage?this.Ga=this.window.localStorage:(this.Ga=null,!1===h&&br("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}return t.Kn=function(t,e){if(t instanceof Qa)return iu.Kn(t.Wo,e);throw Er()},t.prototype.start=function(){var t=this;return this.za().then((function(){if(!t.isPrimary&&!t.allowTabSynchronization)throw new vr(dr.FAILED_PRECONDITION,Ya);return t.Ha(),t.Ja(),t.Ya(),t.runTransaction("getHighestListenSequenceNumber","readonly",(function(e){return t.ja.ma(e)}))})).then((function(e){t.Ma=new Su(e,t.ka)})).then((function(){t.$a=!0})).catch((function(e){return t.Wa&&t.Wa.close(),Promise.reject(e)}))},t.prototype.Xa=function(t){var e=this;return this.Ka=function(n){return o(e,void 0,void 0,(function(){return s(this,(function(e){return this.Ii?[2,t(n)]:[2]}))}))},t(this.isPrimary)},t.prototype.Za=function(t){var e=this;this.Wa.jn((function(n){return o(e,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return null===n.newVersion?[4,t()]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}
2))}))}))},t.prototype.th=function(t){var e=this;this.networkEnabled!==t&&(this.networkEnabled=t,this.fn.ws((function(){return o(e,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this.Ii?[4,this.za()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))})))},t.prototype.za=function(){var t=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",(function(e){return Za(e).put(new Fa(t.clientId,Date.now(),t.networkEnabled,t.inForeground)).next((function(){if(t.isPrimary)return t.eh(e).next((function(e){e||(t.isPrimary=!1,t.fn.Cs((function(){return t.Ka(!1)})))}))})).next((function(){return t.nh(e)})).next((function(n){return t.isPrimary&&!n?t.sh(e).next((function(){return!1})):!!n&&t.ih(e).next((function(){return!0}))}))})).catch((function(e){if(uu(e))return mr("IndexedDbPersistence","Failed to extend owner lease: ",e),t.isPrimary;if(!t.allowTabSynchronization)throw e;return mr("IndexedDbPersistence","Releasing owner lease after error during lease refresh",e),!1})).then((function(e){t.isPrimary!==e&&t.fn.Cs((function(){return t.Ka(e)})),t.isPrimary=e}))},t.prototype.eh=function(t){var e=this;return $a(t).get(Sa.key).next((function(t){return ru.resolve(e.rh(t))}))},t.prototype.oh=function(t){return Za(t).delete(this.clientId)},t.prototype.ah=function(){return o(this,void 0,void 0,(function(){var e,n,r,i,o=this;return s(this,(function(s){switch(s.label){case 0:return!this.isPrimary||this.hh(this.Ua,18e5)?[3,2]:(this.Ua=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",(function(e){var n=t.Kn(e,Fa.store);return n.ts().next((function(t){var e=o.uh(t,18e5),r=t.filter((function(t){return-1===e.indexOf(t)}));return ru.forEach(r,(function(t){return n.delete(t.clientId)})).next((function(){return r}))}))})).catch((function(){return[]}))]);case 1:if(e=s.sent(),this.Ga)for(n=0,r=e;n<r.length;n++)i=r[n],this.Ga.removeItem(this.lh(i.clientId));s.label=2;case 2:return[2]}}
2))}))},t.prototype.Ya=function(){var t=this;this.qa=this.fn.Vn("client_metadata_refresh",4e3,(function(){return t.za().then((function(){return t.ah()})).then((function(){return t.Ya()}))}))},t.prototype.rh=function(t){return!!t&&t.ownerId===this.clientId},t.prototype.nh=function(t){var e=this;return this.Oa?ru.resolve(!0):$a(t).get(Sa.key).next((function(n){if(null!==n&&e.hh(n.leaseTimestampMs,5e3)&&!e._h(n.ownerId)){if(e.rh(n)&&e.networkEnabled)return!0;if(!e.rh(n)){if(!n.allowTabSynchronization)throw new vr(dr.FAILED_PRECONDITION,Ya);return!1}}return!(!e.networkEnabled||!e.inForeground)||Za(t).ts().next((function(t){return void 0===e.uh(t,5e3).find((function(t){if(e.clientId!==t.clientId){var n=!e.networkEnabled&&t.networkEnabled,r=!e.inForeground&&t.inForeground,i=e.networkEnabled===t.networkEnabled;if(n||r&&i)return!0}return!1}))}))})).next((function(t){return e.isPrimary!==t&&mr("IndexedDbPersistence","Client "+(t?"is":"is not")+" eligible for a primary lease."),t}))},t.prototype.Di=function(){return o(this,void 0,void 0,(function(){var t=this;return s(this,(function(e){switch(e.label){case 0:return this.$a=!1,this.fh(),this.qa&&(this.qa.cancel(),this.qa=null),this.dh(),this.wh(),[4,this.Wa.runTransaction("shutdown","readwrite",[Sa.store,Fa.store],(function(e){var n=new Qa(e,Su.ai);return t.sh(n).next((function(){return t.oh(n)}))}))];case 1:return e.sent(),this.Wa.close(),this.Eh(),[2]}}))}))},t.prototype.uh=function(t,e){var n=this;return t.filter((function(t){return n.hh(t.updateTimeMs,e)&&!n._h(t.clientId)}))},t.prototype.pi=function(){var t=this;return this.runTransaction("getActiveClients","readonly",(function(e){return Za(e).ts().next((function(e){return t.uh(e,18e5).map((function(t){return t.clientId}))}))}))},Object.defineProperty(t.prototype,"Ii",{get:function(){return this.$a},enumerable:!1,configurable:!0}),t.prototype.Th=function(t){return fa.Fo(t,this.serializer,this.Dr,this.No)},t.prototype.Ih=function(){return this.ja},t.prototype.mh=function(){return this.vr},t.prototype.Ah=function(){return this.Dr},t.prototype.runTransaction=function(t,e,n){var r=this;mr("IndexedDbPersistence","Starting transaction:",t);var i,o="readonly"===e?"readonly":"readwrite";return this.Wa.runTransaction(t,o,qa,(function(o){return i=new Qa(o,r.Ma?r.Ma.next():Su.ai),"readwrite-primary"===e?r.eh(i).next((function(t){return!!t||r.nh(i)})).next((function(e){if(!e)throw br("Failed to obtain primary lease for action '"+t+"'."),r.isPrimary=!1,r.fn.Cs((function(){return r.Ka(!1)})),new vr(dr.FAILED_PRECONDITION,qu);return n(i)})).next((function(t){return r.ih(i).next((function(){return t}))})):r.Rh(i).next((function(){return n(i)}))})).then((function(t){return i.br(),t}))},t.prototype.Rh=function(t){var e=this;return $a(t).get(Sa.key).next((function(t){if(null!==t&&e.hh(t.leaseTimestampMs,5e3)&&!e._h(t.ownerId)&&!e.rh(t)&&!(e.Oa||e.allowTabSynchronization&&t.allowTabSynchronization))throw new vr(dr.FAILED_PRECONDITION,Ya)}))},t.prototype.ih=function(t){var e=new Sa(this.clientId,this.allowTabSynchronization,Date.now());return $a(t).put(Sa.key,e)},t.Ln=function(){return iu.Ln()},t.prototype.sh=function(t){var e=this,n=$a(t);return n.get(Sa.key).next((function(t){return e.rh(t)?(mr("IndexedDbPersistence","Releasing primary lease."),n.delete(Sa.key)):ru.resolve()}))},t.prototype.hh=function(t,e){var n=Date.now();return!(t<n-e||t>n&&(br("Detected an update time that is in the future: "+t+" > "+n),1))},t.prototype.Ha=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.Ba=function(){t.fn.ws((function(){return t.inForeground="visible"===t.document.visibilityState,t.za()}))},this.document.addEventListener("visibilitychange",this.Ba),this.inForeground="visible"===this.document.visibilityState)},t.prototype.dh=function(){this.Ba&&(this.document.removeEventListener("visibilitychange",this.Ba),this.Ba=null)},t.prototype.Ja=function(){var t,e=this;"function"==typeof(null===(t=this.window)||void 0===t?void 0:t.addEventListener)&&(this.La=function(){e.fh(),e.fn.ws((function(){return e.Di()}))},this.window.addEventListener("unload",this.La))},t.prototype.wh=function(){this.La&&(this.window.removeEventListener("unload",this.La),this.La=null)},t.prototype._h=function(t){var e;try{var n=null!==(null===(e=this.Ga)||void 0===e?void 0:e.getItem(this.lh(t)));return mr("IndexedDbPersistence","Client '"+t+"' "+(n?"is":"is not")+" zombied in LocalStorage"),n}catch(t){return br("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},t.prototype.fh=function(){if(this.Ga)try{this.Ga.setItem(this.lh(this.clientId),String(Date.now()))}catch(t){br("Failed to set zombie client id.",t)}},t.prototype.Eh=function(){if(this.Ga)try{this.Ga.removeItem(this.lh(this.clientId))}catch(t){}},t.prototype.lh=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},t}();function $a(t){return Ja.Kn(t,Sa.store)}function Za(t){return Ja.Kn(t,Fa.store)}var tc=function(){function t(t,e){this.db=t,this.wo=new Qu(this,e)}return t.prototype.Po=function(t){var e=this.Ph(t);return this.db.Ih().ba(t).next((function(t){return e.next((function(e){return t+e}))}))},t.prototype.Ph=function(t){var e=0;return this.yo(t,(function(t){e++})).next((function(){return e}))},t.prototype.Ce=function(t,e){return this.db.Ih().Ce(t,e)},t.prototype.yo=function(t,e){return this.gh(t,(function(t,n){return e(n)}))},t.prototype.Da=function(t,e,n){return ec(t,n)},t.prototype.Na=function(t,e,n){return ec(t,n)},t.prototype.po=function(t,e,n){return this.db.Ih().po(t,e,n)},t.prototype.Go=function(t,e){return ec(t,e)},t.prototype.Vh=function(t,e){return function(t,e){var n=!1;return ya(t).os((function(r){return la(t,r,e).next((function(t){return t&&(n=!0),ru.resolve(!t)}))})).next((function(){return n}))}(t,e)},t.prototype.bo=function(t,e){var n=this,r=this.db.mh().ra(),i=[],o=0;return this.gh(t,(function(s,u){if(u<=e){var a=n.Vh(t,s).next((function(e){if(!e)return o++,r.Rr(t,s).next((function(){return r.Ar(s),Xa(t).delete([0,Ju(s.path)])}))}));i.push(a)}})).next((function(){return ru.kn(i)})).next((function(){return r.apply(t)})).next((function(){return o}
2))},t.prototype.removeTarget=function(t,e){var n=e.st(t.Fa);return this.db.Ih().Va(t,n)},t.prototype.yh=function(t,e){return ec(t,e)},t.prototype.gh=function(t,e){var n,r=Xa(t),i=Su.ai;return r.rs({index:Va.documentTargetsIndex},(function(t,r){var o=t[0],s=(t[1],r.path),u=r.sequenceNumber;0===o?(i!==Su.ai&&e(new Wr(ta(n)),i),i=u,n=s):i=Su.ai})).next((function(){i!==Su.ai&&e(new Wr(ta(n)),i)}))},t.prototype.So=function(t){return this.db.mh().aa(t)},t}();function ec(t,e){return Xa(t).put(function(t,e){return new Va(0,Ju(t.path),e)}(e,t.Fa))}function nc(t,e){var n=t.projectId;return t.I||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}var rc=function(){function t(t,e,n){this.persistence=t,this.ph=e,this.bh=new ai(Sr),this.Sh=new Fr((function(t){return Zr(t)}),ti),this.Dh=Gr.min(),this.Sr=t.Th(n),this.Ch=t.mh(),this.ja=t.Ih(),this.Nh=new Bu(this.Ch,this.Sr,this.persistence.Ah()),this.ph.xh(this.Nh)}return t.prototype.mo=function(t){var e=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",(function(n){return t.vo(n,e.bh)}))},t}();function ic(t,e){var n=Tr(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(function(t){var r=e.batch.keys(),i=n.Ch.ra({oa:!0});return function(t,e,n,r){var i=n.batch,o=i.keys(),s=ru.resolve();return o.forEach((function(t){s=s.next((function(){return r.Rr(e,t)})).next((function(e){var o=e,s=n.dr.get(t);_r(null!==s),(!o||o.version.h(s)<0)&&(o=i.hr(t,o,n))&&r.Ir(o,n._r)}))})),s.next((function(){return t.Sr.Qo(e,i)}))}(n,t,e,i).next((function(){return i.apply(t)})).next((function(){return n.Sr.zo(t)})).next((function(){return n.Nh.Or(t,r)}))}))}function oc(t){var e=Tr(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(function(t){return e.ja.Ia(t)}))}function sc(t,e){var n=Tr(t),r=e.nt,i=n.bh;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(function(t){var o=n.Ch.ra({oa:!0});i=n.bh;var s=[];e.zt.forEach((function(e,o){var u=i.get(o);if(u){s.push(n.ja.Ca(t,e.se,o).next((function(){return n.ja.Sa(t,e.ee,o)})));var a=e.resumeToken;if(a.o()>0){var c=u.it(a,r).st(t.Fa);i=i.ot(o,c),function(t,e,n){return _r(e.resumeToken.o()>0),0===t.resumeToken.o()||e.nt.p()-t.nt.p()>=3e8||n.ee.size+n.ne.size+n.se.size>0}(u,c,e)&&s.push(n.ja.Va(t,c))}}}));var u=di(),a=wi();if(e.Jt.forEach((function(t,e){a=a.add(t)})),s.push(o.getEntries(t,a).next((function(i){e.Jt.forEach((function(a,c){var h=i.get(a);c instanceof bs&&c.version.isEqual(Gr.min())?(o.Ar(a,r),u=u.ot(a,c)):null==h||c.version.h(h.version)>0||0===c.version.h(h.version)&&h.hasPendingWrites?(o.Ir(c,r),u=u.ot(a,c)):mr("LocalStore","Ignoring outdated watch update for ",a,". Current version:",h.version," Watch version:",c.version),e.Yt.has(a)&&s.push(n.persistence.No.yh(t,a))}))}))),!r.isEqual(Gr.min())){var c=n.ja.Ia(t).next((function(e){return n.ja.Aa(t,t.Fa,r)}));s.push(c)}return ru.kn(s).next((function(){return o.apply(t)})).next((function(){return n.Nh.Mr(t,u)}))})).then((function(t){return n.bh=i,t}))}function uc(t,e){var n=Tr(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(function(t){return void 0===e&&(e=-1),n.Sr.Bo(t,e)}))}function ac(t,e){var n=Tr(t);return n.persistence.runTransaction("Allocate target","readwrite",(function(t){var r;return n.ja.va(t,e).next((function(i){return i?(r=i,ru.resolve(r)):n.ja.wa(t).next((function(i){return r=new ii(e,i,0,t.Fa),n.ja.Ra(t,r).next((function(){return r}))}))}))})).then((function(t){var r=n.bh.get(t.targetId);return(null===r||t.nt.h(r.nt)>0)&&(n.bh=n.bh.ot(t.targetId,t),n.Sh.set(e,t.targetId)),t}))}function cc(t,e,n){return o(this,void 0,void 0,(function(){var r,i,o,u;return s(this,(function(s){switch(s.label){case 0:r=Tr(t),i=r.bh.get(e),o=n?"readwrite":"readwrite-primary",s.label=1;case 1:return s.trys.push([1,4,,5]),n?[3,3]:[4,r.persistence.runTransaction("Release target",o,(function(t){return r.persistence.No.removeTarget(t,i)}))];case 2:s.sent(),s.label=3;case 3:return[3,5];case 4:if(!uu(u=s.sent()))throw u;return mr("LocalStore","Failed to update sequence numbers for target "+e+": "+u),[3,5];case 5:return r.bh=r.bh.remove(e),r.Sh.delete(i.target),[2]}}))}))}function hc(t,e,n){var r=Tr(t),i=Gr.min(),o=wi();
2return r.persistence.runTransaction("Execute query","readonly",(function(t){return function(t,e,n){var r=Tr(t),i=r.Sh.get(n);return void 0!==i?ru.resolve(r.bh.get(i)):r.ja.va(e,n)}(r,t,xs(e)).next((function(e){if(e)return i=e.lastLimboFreeSnapshotVersion,r.ja.xa(t,e.targetId).next((function(t){o=t}))})).next((function(){return r.ph.Lr(t,e,n?i:Gr.min(),n?o:wi())})).next((function(t){return{documents:t,Fh:o}}))}))}function fc(t,e){var n=Tr(t),r=Tr(n.ja),i=n.bh.get(e);return i?Promise.resolve(i.target):n.persistence.runTransaction("Get target data","readonly",(function(t){return r.Ue(t,e).next((function(t){return t?t.target:null}))}))}function lc(t){var e=Tr(t);return e.persistence.runTransaction("Get new document changes","readonly",(function(t){return function(t,e,n){var r=Tr(t),i=di(),o=ia(n),s=wa(e),u=IDBKeyRange.lowerBound(o,!0);return s.rs({index:La.readTimeIndex,range:u},(function(t,e){var n=na(r.serializer,e);i=i.ot(n.key,n),o=e.readTime})).next((function(){return{kh:i,readTime:oa(o)}}))}(e.Ch,t,e.Dh)})).then((function(t){var n=t.kh,r=t.readTime;return e.Dh=r,n}))}function pc(t){return o(this,void 0,void 0,(function(){var e;return s(this,(function(n){return[2,(e=Tr(t)).persistence.runTransaction("Synchronize last document change read time","readonly",(function(t){return function(t){var e=wa(t),n=Gr.min();return e.rs({index:La.readTimeIndex,reverse:!0},(function(t,e,r){e.readTime&&(n=oa(e.readTime)),r.done()})).next((function(){return n}))}(t)})).then((function(t){e.Dh=t}))]}))}))}function dc(t){return o(this,void 0,void 0,(function(){return s(this,(function(e){if(t.code!==dr.FAILED_PRECONDITION||t.message!==qu)throw t;return mr("LocalStore","Unexpectedly lost primary lease"),[2]}))}))}var vc=function(){function t(){this.Oh=new fi(yc.Mh),this.$h=new fi(yc.Lh)}return t.prototype.P=function(){return this.Oh.P()},t.prototype.Da=function(t,e){var n=new yc(t,e);this.Oh=this.Oh.add(n),this.$h=this.$h.add(n)},t.prototype.Bh=function(t,e){var n=this;t.forEach((function(t){return n.Da(t,e)}))},t.prototype.Na=function(t,e){this.qh(new yc(t,e))},t.prototype.Uh=function(t,e){var n=this;t.forEach((function(t){return n.Na(t,e)}))},t.prototype.Kh=function(t){var e=this,n=new Wr(new zr([])),r=new yc(n,t),i=new yc(n,t+1),o=[];return this.$h.xt([r,i],(function(t){e.qh(t),o.push(t.key)})),o},t.prototype.Qh=function(){var t=this;this.Oh.forEach((function(e){return t.qh(e)}))},t.prototype.qh=function(t){this.Oh=this.Oh.delete(t),this.$h=this.$h.delete(t)},t.prototype.Wh=function(t){var e=new Wr(new zr([])),n=new yc(e,t),r=new yc(e,t+1),i=wi();return this.$h.xt([n,r],(function(t){i=i.add(t.key)})),i},t.prototype.Ho=function(t){var e=new yc(t,0),n=this.Oh.kt(e);return null!==n&&t.isEqual(n.key)},t}(),yc=function(){function t(t,e){this.key=t,this.jh=e}return t.Mh=function(t,e){return Wr.D(t.key,e.key)||Sr(t.jh,e.jh)},t.Lh=function(t,e){return Sr(t.jh,e.jh)||Wr.D(t.key,e.key)},t}(),gc=function(t,e){this.user=e,this.type="OAuth",this.Gh={},this.Gh.Authorization="Bearer "+t},mc=function(){function t(){this.zh=null}return t.prototype.getToken=function(){return Promise.resolve(null)},t.prototype.Hh=function(){},t.prototype.Jh=function(t){this.zh=t,t(Nu.UNAUTHENTICATED)},t.prototype.Yh=function(){this.zh=null},t}(),bc=function(){function t(t){var e=this;this.Xh=null,this.currentUser=Nu.UNAUTHENTICATED,this.Zh=!1,this.tc=0,this.zh=null,this.forceRefresh=!1,this.Xh=function(){e.tc++,e.currentUser=e.ec(),e.Zh=!0,e.zh&&e.zh(e.currentUser)},this.tc=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.Xh):(this.Xh(null),t.get().then((function(t){e.auth=t,e.Xh&&e.auth.addAuthTokenListener(e.Xh)}),(function(){})))}return t.prototype.getToken=function(){var t=this,e=this.tc,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then((function(n){return t.tc!==e?(mr("FirebaseCredentialsProvider","getToken aborted due to token change."),t.getToken()):n?(_r("string"==typeof n.accessToken),new gc(n.accessToken,t.currentUser)):null})):Promise.resolve(null)},t.prototype.Hh=function(){this.forceRefresh=!0},t.prototype.Jh=function(t){this.zh=t,this.Zh&&t(this.currentUser)},t.prototype.Yh=function(){this.auth&&this.auth.removeAuthTokenListener(this.
2Xh),this.Xh=null,this.zh=null},t.prototype.ec=function(){var t=this.auth&&this.auth.getUid();return _r(null===t||"string"==typeof t),new Nu(t)},t}(),wc=function(){function t(t,e){this.nc=t,this.sc=e,this.type="FirstParty",this.user=Nu.ni}return Object.defineProperty(t.prototype,"Gh",{get:function(){var t={"X-Goog-AuthUser":this.sc},e=this.nc.auth.getAuthHeaderValueForFirstParty([]);return e&&(t.Authorization=e),t},enumerable:!1,configurable:!0}),t}(),Ic=function(){function t(t,e){this.nc=t,this.sc=e}return t.prototype.getToken=function(){return Promise.resolve(new wc(this.nc,this.sc))},t.prototype.Jh=function(t){t(Nu.ni)},t.prototype.Yh=function(){},t.prototype.Hh=function(){},t}(),Ec=function(){function t(t,e,n,r,i,o){this.fn=t,this.ic=n,this.rc=r,this.oc=i,this.listener=o,this.state=0,this.ac=0,this.hc=null,this.stream=null,this.Vs=new nu(t,e)}return t.prototype.cc=function(){return 1===this.state||2===this.state||4===this.state},t.prototype.uc=function(){return 2===this.state},t.prototype.start=function(){3!==this.state?this.auth():this.lc()},t.prototype.stop=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this.cc()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}
2))}))},t.prototype._c=function(){this.state=0,this.Vs.reset()},t.prototype.fc=function(){var t=this;this.uc()&&null===this.hc&&(this.hc=this.fn.Vn(this.ic,6e4,(function(){return t.dc()})))},t.prototype.wc=function(t){this.Ec(),this.stream.send(t)},t.prototype.dc=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){return this.uc()?[2,this.close(0)]:[2]}))}))},t.prototype.Ec=function(){this.hc&&(this.hc.cancel(),this.hc=null)},t.prototype.close=function(t,e){return o(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return this.Ec(),this.Vs.cancel(),this.ac++,3!==t?this.Vs.reset():e&&e.code===dr.RESOURCE_EXHAUSTED?(br(e.toString()),br("Using maximum backoff delay to prevent overloading the backend."),this.Vs.Rn()):e&&e.code===dr.UNAUTHENTICATED&&this.oc.Hh(),null!==this.stream&&(this.Tc(),this.stream.close(),this.stream=null),this.state=t,[4,this.listener.Ic(e)];case 1:return n.sent(),[2]}}))}))},t.prototype.Tc=function(){},t.prototype.auth=function(){var t=this;this.state=1;var e=this.mc(this.ac),n=this.ac;this.oc.getToken().then((function(e){t.ac===n&&t.Ac(e)}),(function(n){e((function(){var e=new vr(dr.UNKNOWN,"Fetching auth token failed: "+n.message);return t.Rc(e)}))}))},t.prototype.Ac=function(t){var e=this,n=this.mc(this.ac);this.stream=this.Pc(t),this.stream.gc((function(){n((function(){return e.state=2,e.listener.gc()}))})),this.stream.Ic((function(t){n((function(){return e.Rc(t)}))})),this.stream.onMessage((function(t){n((function(){return e.onMessage(t)}))}))},t.prototype.lc=function(){var t=this;this.state=4,this.Vs.Pn((function(){return o(t,void 0,void 0,(function(){return s(this,(function(t){return this.state=0,this.start(),[2]}))}))}))},t.prototype.Rc=function(t){return mr("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},t.prototype.mc=function(t){var e=this;return function(n){e.fn.ws((function(){return e.ac===t?n():(mr("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())}))}},t}(),_c=function(t){function e(e,n,r,i,o){var s=this;return(s=t.call(this,e,"listen_stream_connection_backoff","listen_stream_idle",n,r,o)||this).serializer=i,s}return i(e,t),e.prototype.Pc=function(t){return this.rc.Vc("Listen",t)},e.prototype.onMessage=function(t){this.Vs.reset();var e=function(t,e){var n;if("targetChange"in e){e.targetChange;var r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Er()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],o=function(t,e){return t.Ke?(_r(void 0===e||"string"==typeof e),xr.fromBase64String(e||"")):(_r(void 0===e||e instanceof Uint8Array),xr.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),s=e.targetChange.cause,u=s&&function(t){var e=void 0===t.code?dr.UNKNOWN:ui(t.code);return new vr(e,t.message||"")}(s);n=new xi(r,i,o,u||null)}else if("documentChange"in e){e.documentChange;var a=e.documentChange;a.document,a.document.name,a.document.updateTime;var c=vo(t,a.document.name),h=ho(a.document.updateTime),f=new ds({mapValue:{fields:a.document.fields}}),l=new ms(c,h,f,{}),p=a.targetIds||[],d=a.removedTargetIds||[];n=new Di(p,d,l.key,l)}else if("documentDelete"in e){e.documentDelete;var v=e.documentDelete;v.document;var y=vo(t,v.document),g=v.readTime?ho(v.readTime):Gr.min(),m=new bs(y,g),b=v.removedTargetIds||[];n=new Di([],b,m.key,m)}else if("documentRemove"in e){e.documentRemove;var w=e.documentRemove;w.document;var I=vo(t,w.document),E=w.removedTargetIds||[];n=new Di([],E,I,null)}else{if(!("filter"in e))return Er();e.filter;var _=e.filter;_.targetId;var T=_.count||0,A=new oi(T),N=_.targetId;n=new Oi(N,A)}return n}(this.serializer,t),n=function(t){if(!("targetChange"in t))return Gr.min();var e=t.targetChange;return e.targetIds&&e.targetIds.length?Gr.min():e.readTime?ho(e.readTime):Gr.min()}(t);return this.listener.yc(e,n)},e.prototype.bc=function(t){var e={};e.database=mo(this.serializer),e.addTarget=function(t,e){var n,r=e.target;return(n=ei(r)?{documents:_o(t,r)}:{query:To(t,r)}).targetId=e.targetId,e.resumeToken.o()>0&&(n.resumeToken=ao(t,e.resumeToken)),n}(this.serializer,t);var n=function(t,e){var n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Er()}}(0,e.et);return null==n?null:{"goog-listen-tags":n}}(this.serializer,t);n&&(e.labels=n),this.wc(e)},e.prototype.vc=function(t){var e={};e.database=mo(this.serializer),e.removeTarget=t,this.wc(e)},e}(Ec),Tc=function(t){function e(e,n,r,i,o){var s=this;return(s=t.call(this,e,"write_stream_connection_backoff","write_stream_idle",n,r,o)||this).serializer
2=i,s.Sc=!1,s}return i(e,t),Object.defineProperty(e.prototype,"Dc",{get:function(){return this.Sc},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.Sc=!1,this.lastStreamToken=void 0,t.prototype.start.call(this)},e.prototype.Tc=function(){this.Sc&&this.Cc([])},e.prototype.Pc=function(t){return this.rc.Vc("Write",t)},e.prototype.onMessage=function(t){if(_r(!!t.streamToken),this.lastStreamToken=t.streamToken,this.Sc){this.Vs.reset();var e=function(t,e){return t&&t.length>0?(_r(void 0!==e),t.map((function(t){return function(t,e){var n=t.updateTime?ho(t.updateTime):ho(e);n.isEqual(Gr.min())&&(n=ho(e));var r=null;return t.transformResults&&t.transformResults.length>0&&(r=t.transformResults),new Jo(n,r)}(t,e)}))):[]}(t.writeResults,t.commitTime),n=ho(t.commitTime);return this.listener.Nc(n,e)}return _r(!t.writeResults||0===t.writeResults.length),this.Sc=!0,this.listener.xc()},e.prototype.Fc=function(){var t={};t.database=mo(this.serializer),this.wc(t)},e.prototype.Cc=function(t){var e=this,n={streamToken:this.lastStreamToken,writes:t.map((function(t){return Io(e.serializer,t)}))};this.wc(n)},e}(Ec),Ac=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).credentials=e,i.rc=n,i.serializer=r,i.kc=!1,i}return i(e,t),e.prototype.Oc=function(){if(this.kc)throw new vr(dr.FAILED_PRECONDITION,"The client has already been terminated.")},e.prototype.Mc=function(t,e,n){var r=this;return this.Oc(),this.credentials.getToken().then((function(i){return r.rc.Mc(t,e,n,i)})).catch((function(t){throw t.code===dr.UNAUTHENTICATED&&r.credentials.Hh(),t}))},e.prototype.$c=function(t,e,n){var r=this;return this.Oc(),this.credentials.getToken().then((function(i){return r.rc.$c(t,e,n,i)})).catch((function(t){throw t.code===dr.UNAUTHENTICATED&&r.credentials.Hh(),t}))},e.prototype.terminate=function(){this.kc=!1},e}((function(){})),Nc=function(){function t(t,e){this.hs=t,this.di=e,this.state="Unknown",this.Lc=0,this.Bc=null,this.qc=!0}return t.prototype.Uc=function(){var t=this;0===this.Lc&&(this.Kc("Unknown"),this.Bc=this.hs.Vn("online_state_timeout",1e4,(function(){return t.Bc=null,t.Qc("Backend didn't respond within 10 seconds."),t.Kc("Offline"),Promise.resolve()})))},t.prototype.Wc=function(t){"Online"===this.state?this.Kc("Unknown"):(this.Lc++,this.Lc>=1&&(this.jc(),this.Qc("Connection failed 1 times. Most recent error: "+t.toString()),this.Kc("Offline")))},t.prototype.set=function(t){this.jc(),this.Lc=0,"Online"===t&&(this.qc=!1),this.Kc(t)},t.prototype.Kc=function(t){t!==this.state&&(this.state=t,this.di(t))},t.prototype.Qc=function(t){var e="Could not reach Cloud Firestore backend. "+t+"\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.";this.qc?(br(e),this.qc=!1):mr("OnlineStateTracker",e)},t.prototype.jc=function(){null!==this.Bc&&(this.Bc.cancel(),this.Bc=null)},t}(),Sc=function(t,e,n,r,i){var u=this;this.Gc=t,this.zc=e,this.hs=n,this.Hc={},this.Jc=[],this.Yc=new Map,this.Xc=new Set,this.Zc=[],this.tu=i,this.tu.eu((function(t){n.ws((function(){return o(u,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return Mc(this)?(mr("RemoteStore","Restarting streams for network reachability change."),[4,function(t){return o(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return(e=Tr(t)).Xc.add(4),[4,Oc(e)];case 1:return n.sent(),e.nu.set("Unknown"),e.Xc.delete(4),[4,Dc(e)];case 2:return n.sent(),[2]}}))}))}(this)]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}
2))}))}))})),this.nu=new Nc(n,r)};function Dc(t){return o(this,void 0,void 0,(function(){var e,n;return s(this,(function(r){switch(r.label){case 0:if(!Mc(t))return[3,4];e=0,n=t.Zc,r.label=1;case 1:return e<n.length?[4,(0,n[e])(!0)]:[3,4];case 2:r.sent(),r.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))}function Oc(t){return o(this,void 0,void 0,(function(){var e,n;return s(this,(function(r){switch(r.label){case 0:e=0,n=t.Zc,r.label=1;case 1:return e<n.length?[4,(0,n[e])(!1)]:[3,4];case 2:r.sent(),r.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))}function xc(t){return o(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e=Tr(t),mr("RemoteStore","RemoteStore shutting down."),e.Xc.add(5),[4,Oc(e)];case 1:return n.sent(),e.tu.Di(),e.nu.set("Unknown"),[2]}}))}))}function kc(t,e){var n=Tr(t);n.Yc.has(e.targetId)||(n.Yc.set(e.targetId,e),Vc(n)?Cc(n):$c(n).uc()&&Lc(n,e))}function Pc(t,e){var n=Tr(t),r=$c(n);n.Yc.delete(e),r.uc()&&Rc(n,e),0===n.Yc.size&&(r.uc()?r.fc():Mc(n)&&n.nu.set("Unknown"))}function Lc(t,e){t.su.me(e.targetId),$c(t).bc(e)}function Rc(t,e){t.su.me(e),$c(t).vc(e)}function Cc(t){t.su=new Pi({qe:function(e){return t.Hc.qe(e)},Ue:function(e){return t.Yc.get(e)||null}}),$c(t).start(),t.nu.Uc()}function Vc(t){return Mc(t)&&!$c(t).cc()&&t.Yc.size>0}function Mc(t){return 0===Tr(t).Xc.size}function Uc(t){t.su=void 0}function jc(t){return o(this,void 0,void 0,(function(){return s(this,(function(e){return t.Yc.forEach((function(e,n){Lc(t,e)})),[2]}))}))}function Fc(t,e){return o(this,void 0,void 0,(function(){return s(this,(function(n){return Uc(t),Vc(t)?(t.nu.Wc(e),Cc(t)):t.nu.set("Unknown"),[2]}))}))}function qc(t,e,n){return o(this,void 0,void 0,(function(){var r,i,u;return s(this,(function(a){switch(a.label){case 0:if(t.nu.set("Online"),!(e instanceof xi&&2===e.state&&e.cause))return[3,6];a.label=1;case 1:return a.trys.push([1,3,,5]),[4,function(t,e){return o(this,void 0,void 0,(function(){var n,r,i,o;return s(this,(function(s){switch(s.label){case 0:n=e.cause,r=0,i=e.targetIds,s.label=1;case 1:return r<i.length?(o=i[r],t.Yc.has(o)?[4,t.Hc.iu(o,n)]:[3,3]):[3,5];case 2:s.sent(),t.Yc.delete(o),t.su.removeTarget(o),s.label=3;case 3:s.label=4;case 4:return r++,[3,1];case 5:return[2]}}
2))}))}(t,e)];case 2:return a.sent(),[3,5];case 3:return r=a.sent(),mr("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),r),[4,Gc(t,r)];case 4:return a.sent(),[3,5];case 5:return[3,13];case 6:if(e instanceof Di?t.su.be(e):e instanceof Oi?t.su.ke(e):t.su.De(e),n.isEqual(Gr.min()))return[3,13];a.label=7;case 7:return a.trys.push([7,11,,13]),[4,oc(t.Gc)];case 8:return i=a.sent(),n.h(i)>=0?[4,function(t,e){var n=t.su.$e(e);return n.zt.forEach((function(n,r){if(n.resumeToken.o()>0){var i=t.Yc.get(r);i&&t.Yc.set(r,i.it(n.resumeToken,e))}})),n.Ht.forEach((function(e){var n=t.Yc.get(e);if(n){t.Yc.set(e,n.it(xr.u,n.nt)),Rc(t,e);var r=new ii(n.target,e,1,n.sequenceNumber);Lc(t,r)}})),t.Hc.ru(n)}(t,n)]:[3,10];case 9:a.sent(),a.label=10;case 10:return[3,13];case 11:return mr("RemoteStore","Failed to raise snapshot:",u=a.sent()),[4,Gc(t,u)];case 12:return a.sent(),[3,13];case 13:return[2]}}))}))}function Gc(t,e,n){return o(this,void 0,void 0,(function(){var r=this;return s(this,(function(i){switch(i.label){case 0:if(!uu(e))throw e;return t.Xc.add(1),[4,Oc(t)];case 1:return i.sent(),t.nu.set("Offline"),n||(n=function(){return oc(t.Gc)}),t.hs.Cs((function(){return o(r,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return mr("RemoteStore","Retrying IndexedDB access"),[4,n()];case 1:return e.sent(),t.Xc.delete(1),[4,Dc(t)];case 2:return e.sent(),[2]}}))}))})),[2]}}))}))}function Bc(t,e){return e().catch((function(n){return Gc(t,n,e)}))}function zc(t){return o(this,void 0,void 0,(function(){var e,n,r,i,o;return s(this,(function(s){switch(s.label){case 0:e=Tr(t),n=Zc(e),r=e.Jc.length>0?e.Jc[e.Jc.length-1].batchId:-1,s.label=1;case 1:if(!function(t){return Mc(t)&&t.Jc.length<10}(e))return[3,7];s.label=2;case 2:return s.trys.push([2,4,,6]),[4,uc(e.Gc,r)];case 3:return null===(i=s.sent())?(0===e.Jc.length&&n.fc(),[3,7]):(r=i.batchId,function(t,e){t.Jc.push(e);var n=Zc(t);n.uc()&&n.Dc&&n.Cc(e.mutations)}(e,i),[3,6]);case 4:return o=s.sent(),[4,Gc(e,o)];case 5:return s.sent(),[3,6];case 6:return[3,1];case 7:return Hc(e)&&Kc(e),[2]}}))}))}function Hc(t){return Mc(t)&&!Zc(t).cc()&&t.Jc.length>0}function Kc(t){Zc(t).start()}function Wc(t){return o(this,void 0,void 0,(function(){return s(this,(function(e){return Zc(t).Fc(),[2]}))}))}function Xc(t){return o(this,void 0,void 0,(function(){var e,n,r,i;return s(this,(function(o){for(e=Zc(t),n=0,r=t.Jc;n<r.length;n++)i=r[n],e.Cc(i.mutations);return[2]}))}))}function Yc(t,e,n){return o(this,void 0,void 0,(function(){var r,i;return s(this,(function(o){switch(o.label){case 0:return r=t.Jc.shift(),i=ju.from(r,e,n),[4,Bc(t,(function(){return t.Hc.ou(i)}))];case 1:return o.sent(),[4,zc(t)];case 2:return o.sent(),[2]}}))}))}function Qc(t,e){return o(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return e&&Zc(t).Dc?[4,function(t,e){return o(this,void 0,void 0,(function(){var n,r;return s(this,(function(i){switch(i.label){case 0:return si(r=e.code)&&r!==dr.ABORTED?(n=t.Jc.shift(),Zc(t)._c(),[4,Bc(t,(function(){return t.Hc.au(n.batchId,e)}))]):[3,3];case 1:return i.sent(),[4,zc(t)];case 2:i.sent(),i.label=3;case 3:return[2]}}
2))}))}(t,e)]:[3,2];case 1:n.sent(),n.label=2;case 2:return Hc(t)&&Kc(t),[2]}}))}))}function Jc(t,e){return o(this,void 0,void 0,(function(){var n;return s(this,(function(r){switch(r.label){case 0:return n=Tr(t),e?(n.Xc.delete(2),[4,Dc(n)]):[3,2];case 1:return r.sent(),[3,5];case 2:return e?[3,4]:(n.Xc.add(2),[4,Oc(n)]);case 3:r.sent(),n.nu.set("Unknown"),r.label=4;case 4:r.label=5;case 5:return[2]}}))}))}function $c(t){var e=this;return t.hu||(t.hu=function(t,e,n){var r=Tr(t);return r.Oc(),new _c(e,r.rc,r.credentials,r.serializer,n)}(t.zc,t.hs,{gc:jc.bind(null,t),Ic:Fc.bind(null,t),yc:qc.bind(null,t)}),t.Zc.push((function(n){return o(e,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return n?(t.hu._c(),Vc(t)?Cc(t):t.nu.set("Unknown"),[3,3]):[3,1];case 1:return[4,t.hu.stop()];case 2:e.sent(),Uc(t),e.label=3;case 3:return[2]}}))}))}))),t.hu}function Zc(t){var e=this;return t.cu||(t.cu=function(t,e,n){var r=Tr(t);return r.Oc(),new Tc(e,r.rc,r.credentials,r.serializer,n)}(t.zc,t.hs,{gc:Wc.bind(null,t),Ic:Qc.bind(null,t),xc:Xc.bind(null,t),Nc:Yc.bind(null,t)}),t.Zc.push((function(n){return o(e,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return n?(t.cu._c(),[4,zc(t)]):[3,2];case 1:return e.sent(),[3,4];case 2:return[4,t.cu.stop()];case 3:e.sent(),t.Jc.length>0&&(mr("RemoteStore","Stopping write stream with "+t.Jc.length+" pending writes"),t.Jc=[]),e.label=4;case 4:return[2]}}
2))}))}))),t.cu}var th=function(t){this.key=t},eh=function(t){this.key=t},nh=function(){function t(t,e){this.query=t,this.uu=e,this.lu=null,this.te=!1,this._u=wi(),this.Qt=wi(),this.fu=Us(t),this.du=new _i(this.fu)}return Object.defineProperty(t.prototype,"wu",{get:function(){return this.uu},enumerable:!1,configurable:!0}),t.prototype.Eu=function(t,e){var n=this,r=e?e.Tu:new Ti,i=e?e.du:this.du,o=e?e.Qt:this.Qt,s=i,u=!1,a=Ts(this.query)&&i.size===this.query.limit?i.last():null,c=As(this.query)&&i.size===this.query.limit?i.first():null;if(t.ut((function(t,e){var h=i.get(t),f=e instanceof ms?e:null;f&&(f=Ms(n.query,f)?f:null);var l=!!h&&n.Qt.has(h.key),p=!!f&&(f.Ye||n.Qt.has(f.key)&&f.hasCommittedMutations),d=!1;h&&f?h.data().isEqual(f.data())?l!==p&&(r.track({type:3,doc:f}),d=!0):n.Iu(h,f)||(r.track({type:2,doc:f}),d=!0,(a&&n.fu(f,a)>0||c&&n.fu(f,c)<0)&&(u=!0)):!h&&f?(r.track({type:0,doc:f}),d=!0):h&&!f&&(r.track({type:1,doc:h}),d=!0,(a||c)&&(u=!0)),d&&(f?(s=s.add(f),o=p?o.add(t):o.delete(t)):(s=s.delete(t),o=o.delete(t)))})),Ts(this.query)||As(this.query))for(;s.size>this.query.limit;){var h=Ts(this.query)?s.last():s.first();s=s.delete(h.key),o=o.delete(h.key),r.track({type:1,doc:h})}return{du:s,Tu:r,mu:u,Qt:o}},t.prototype.Iu=function(t,e){return t.Ye&&e.hasCommittedMutations&&!e.Ye},t.prototype.Vr=function(t,e,n){var r=this,i=this.du;this.du=t.du,this.Qt=t.Qt;var o=t.Tu.Ut();o.sort((function(t,e){return function(t,e){var n=function(t){switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Er()}};return n(t)-n(e)}(t.type,e.type)||r.fu(t.doc,e.doc)})),this.Au(n);var s=e?this.Ru():[],u=0===this._u.size&&this.te?1:0,a=u!==this.lu;return this.lu=u,0!==o.length||a?{snapshot:new Ai(this.query,t.du,i,o,t.Qt,0===u,a,!1),Pu:s}:{Pu:s}},t.prototype.Ks=function(t){return this.te&&"Offline"===t?(this.te=!1,this.Vr({du:this.du,Tu:new Ti,Qt:this.Qt,mu:!1},!1)):{Pu:[]}},t.prototype.gu=function(t){return!this.uu.has(t)&&!!this.du.has(t)&&!this.du.get(t).Ye},t.prototype.Au=function(t){var e=this;t&&(t.ee.forEach((function(t){return e.uu=e.uu.add(t)})),t.ne.forEach((function(t){})),t.se.forEach((function(t){return e.uu=e.uu.delete(t)})),this.te=t.te)},t.prototype.Ru=function(){var t=this;if(!this.te)return[];var e=this._u;this._u=wi(),this.du.forEach((function(e){t.gu(e.key)&&(t._u=t._u.add(e.key))}));var n=[];return e.forEach((function(e){t._u.has(e)||n.push(new eh(e))})),this._u.forEach((function(t){e.has(t)||n.push(new th(t))})),n},t.prototype.Vu=function(t){this.uu=t.Fh,this._u=wi();var e=this.Eu(t.documents);return this.Vr(e,!0)},t.prototype.yu=function(){return Ai.Gt(this.query,this.du,this.Qt,0===this.lu)},t}(),rh=function(t,e,n){this.query=t,this.targetId=e,this.view=n},ih=function(t){this.key=t,this.pu=!1},oh=function(){function t(t,e,n,r,i,o){this.Gc=t,this.bu=e,this.vu=n,this.Su=r,this.currentUser=i,this.Du=o,this.Cu={},this.Nu=new Fr((function(t){return Cs(t)}),Rs),this.xu=new Map,this.Fu=[],this.ku=new ai(Wr.D),this.Ou=new Map,this.Mu=new vc,this.$u={},this.Lu=new Map,this.Bu=za.da(),this.onlineState="Unknown",this.qu=void 0}return Object.defineProperty(t.prototype,"Uu",{get:function(){return!0===this.qu},enumerable:!1,configurable:!0}),t}();function sh(t,e){return o(this,void 0,void 0,(function(){var n,r,i,o,u,a;return s(this,(function(s){switch(s.label){case 0:return n=Ph(t),(o=n.Nu.get(e))?(r=o.targetId,n.Su.$i(r),i=o.view.yu(),[3,4]):[3,1];case 1:return[4,ac(n.Gc,xs(e))];case 2:return u=s.sent(),a=n.Su.$i(u.targetId),r=u.targetId,[4,uh(n,e,r,"current"===a)];case 3:i=s.sent(),n.Uu&&kc(n.bu,u),s.label=4;case 4:return[2,i]}}))}))}function uh(t,e,n,r){return o(this,void 0,void 0,(function(){var i,u,a,c,h,f;return s(this,(function(l){switch(l.label){case 0:return t.Ku=function(e,n,r){return function(t,e,n,r){return o(this,void 0,void 0,(function(){var i,o,u;return s(this,(function(s){switch(s.label){case 0:return(i=e.view.Eu(n)).mu?[4,hc(t.Gc,e.query,!1).then((function(t){var n=t.documents;return e.view.Eu(n,i)}))]:[3,2];case 1:i=s.sent(),s.label=2;case 2:return o=r&&r.zt.get(e.targetId),u=e.view.Vr(i,t.Uu,o),[2,(mh(t,e.targetId,u.Pu),u.snapshot)]}}))}))}(t,e,n,r)},[4,hc(t.Gc,e,!0)];case 1:return i=l.sent(),u=new nh(e,i.Fh),a=u.Eu(i.documents),c=Si.Zt(n,r&&"Offline"!==t.onlineState),h=u.Vr(a,t.Uu,c),mh(t,n,h.Pu),f=new rh(e,n,u),[2,(t.Nu.set(e,f),t.xu.has(n)?t.xu.get(n).push(e):t.xu.set(n,[e]),h.snapshot)]}}))}))}function ah(t,e){return o(this,void 0,void 0,(function(){var n,r,i;return s(this,(function(o){switch(o.label){case 0:return n=Tr(t),r=n.Nu.get(e),(i=n.xu.get(r.targetId)).length>1?[2,(n.xu.set(r.targetId,i.filter((function(t){return!Rs(t,e)}))),void n.Nu.delete(e))]:n.Uu?(n.Su.Bi(r.targetId),n.Su.xi(r.targetId)?[3,2]:[4,cc(n.Gc,r.targetId,!1).then((function(){n.Su.Ui(r.targetId),Pc(n.bu,r.targetId),yh(n,r.targetId)})).catch(dc)]):[3,3];case 1:o.sent(),o.label=2;case 2:return[3,5];case 3:return yh(n,r.targetId),[4,cc(n.Gc,r.targetId,!0)];case 4:o.sent(),o.label=5;case 5:return[2]}}
2))}))}function ch(t,e){return o(this,void 0,void 0,(function(){var n,r;return s(this,(function(i){switch(i.label){case 0:n=Tr(t),i.label=1;case 1:return i.trys.push([1,4,,6]),[4,sc(n.Gc,e)];case 2:return r=i.sent(),e.zt.forEach((function(t,e){var r=n.Ou.get(e);r&&(_r(t.ee.size+t.ne.size+t.se.size<=1),t.ee.size>0?r.pu=!0:t.ne.size>0?_r(r.pu):t.se.size>0&&(_r(r.pu),r.pu=!1))})),[4,Ih(n,r,e)];case 3:return i.sent(),[3,6];case 4:return[4,dc(i.sent())];case 5:return i.sent(),[3,6];case 6:return[2]}}))}))}function hh(t,e,n){var r=Tr(t);if(r.Uu&&0===n||!r.Uu&&1===n){var i=[];r.Nu.forEach((function(t,n){var r=n.view.Ks(e);r.snapshot&&i.push(r.snapshot)})),function(t,e){var n=Tr(t);n.onlineState=e;var r=!1;n.Bs.forEach((function(t,n){for(var i=0,o=n.listeners;i<o.length;i++)o[i].Ks(e)&&(r=!0)})),r&&Tu(n)}(r.vu,e),i.length&&r.Cu.yc(i),r.onlineState=e,r.Uu&&r.Su.ji(e)}}function fh(t,e,n){return o(this,void 0,void 0,(function(){var r,i,o,u,a,c;return s(this,(function(s){switch(s.label){case 0:return(r=Tr(t)).Su.Ki(e,"rejected",n),i=r.Ou.get(e),(o=i&&i.key)?(u=(u=new ai(Wr.D)).ot(o,new bs(o,Gr.min())),a=wi().add(o),c=new Ni(Gr.min(),new Map,new fi(Sr),u,a),[4,ch(r,c)]):[3,2];case 1:return s.sent(),r.ku=r.ku.remove(o),r.Ou.delete(e),wh(r),[3,4];case 2:return[4,cc(r.Gc,e,!1).then((function(){return yh(r,e,n)})).catch(dc)];case 3:s.sent(),s.label=4;case 4:return[2]}}
2))}))}function lh(t,e){return o(this,void 0,void 0,(function(){var n,r,i;return s(this,(function(o){switch(o.label){case 0:n=Tr(t),r=e.batch.batchId,o.label=1;case 1:return o.trys.push([1,4,,6]),[4,ic(n.Gc,e)];case 2:return i=o.sent(),vh(n,r,null),dh(n,r),n.Su.Oi(r,"acknowledged"),[4,Ih(n,i)];case 3:return o.sent(),[3,6];case 4:return[4,dc(o.sent())];case 5:return o.sent(),[3,6];case 6:return[2]}}))}))}function ph(t,e,n){return o(this,void 0,void 0,(function(){var r,i;return s(this,(function(o){switch(o.label){case 0:r=Tr(t),o.label=1;case 1:return o.trys.push([1,4,,6]),[4,function(t,e){var n=Tr(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(function(t){var r;return n.Sr.$o(t,e).next((function(e){return _r(null!==e),r=e.keys(),n.Sr.Qo(t,e)})).next((function(){return n.Sr.zo(t)})).next((function(){return n.Nh.Or(t,r)}))}))}(r.Gc,e)];case 2:return i=o.sent(),vh(r,e,n),dh(r,e),r.Su.Oi(e,"rejected",n),[4,Ih(r,i)];case 3:return o.sent(),[3,6];case 4:return[4,dc(o.sent())];case 5:return o.sent(),[3,6];case 6:return[2]}}
2))}))}function dh(t,e){(t.Lu.get(e)||[]).forEach((function(t){t.resolve()})),t.Lu.delete(e)}function vh(t,e,n){var r=Tr(t),i=r.$u[r.currentUser.ti()];if(i){var o=i.get(e);o&&(n?o.reject(n):o.resolve(),i=i.remove(e)),r.$u[r.currentUser.ti()]=i}}function yh(t,e,n){void 0===n&&(n=null),t.Su.Bi(e);for(var r=0,i=t.xu.get(e);r<i.length;r++){var o=i[r];t.Nu.delete(o),n&&t.Cu.Qu(o,n)}t.xu.delete(e),t.Uu&&t.Mu.Kh(e).forEach((function(e){t.Mu.Ho(e)||gh(t,e)}))}function gh(t,e){var n=t.ku.get(e);null!==n&&(Pc(t.bu,n),t.ku=t.ku.remove(e),t.Ou.delete(n),wh(t))}function mh(t,e,n){for(var r=0,i=n;r<i.length;r++){var o=i[r];o instanceof th?(t.Mu.Da(o.key,e),bh(t,o)):o instanceof eh?(mr("SyncEngine","Document no longer in limbo: "+o.key),t.Mu.Na(o.key,e),t.Mu.Ho(o.key)||gh(t,o.key)):Er()}}function bh(t,e){var n=e.key;t.ku.get(n)||(mr("SyncEngine","New document in limbo: "+n),t.Fu.push(n),wh(t))}function wh(t){for(;t.Fu.length>0&&t.ku.size<t.Du;){var e=t.Fu.shift(),n=t.Bu.next();t.Ou.set(n,new ih(e)),t.ku=t.ku.ot(e,n),kc(t.bu,new ii(xs(_s(e.path)),n,2,Su.ai))}}function Ih(t,e,n){return o(this,void 0,void 0,(function(){var r,i,u,a;return s(this,(function(c){switch(c.label){case 0:return r=Tr(t),i=[],u=[],a=[],r.Nu.P()?[3,3]:(r.Nu.forEach((function(t,o){a.push(r.Ku(o,e,n).then((function(t){if(t){r.Uu&&r.Su.
2Ki(o.targetId,t.fromCache?"not-current":"current"),i.push(t);var e=zu.zr(o.targetId,t);u.push(e)}})))})),[4,Promise.all(a)]);case 1:return c.sent(),r.Cu.yc(i),[4,function(t,e){return o(this,void 0,void 0,(function(){var n,r,i,o,u,a,c,h,f;return s(this,(function(s){switch(s.label){case 0:n=Tr(t),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(function(t){return ru.forEach(e,(function(e){return ru.forEach(e.jr,(function(r){return n.persistence.No.Da(t,e.targetId,r)})).next((function(){return ru.forEach(e.Gr,(function(r){return n.persistence.No.Na(t,e.targetId,r)}))}))}))}))];case 2:return s.sent(),[3,4];case 3:if(!uu(r=s.sent()))throw r;return mr("LocalStore","Failed to update sequence numbers: "+r),[3,4];case 4:for(i=0,o=e;i<o.length;i++)u=o[i],a=u.targetId,u.fromCache||(c=n.bh.get(a),h=c.nt,f=c.rt(h),n.bh=n.bh.ot(a,f));return[2]}}))}))}(r.Gc,u)];case 2:c.sent(),c.label=3;case 3:return[2]}}))}))}function Eh(t,e){return o(this,void 0,void 0,(function(){var n,r;return s(this,(function(i){switch(i.label){case 0:return(n=Tr(t)).currentUser.isEqual(e)?[3,3]:(mr("SyncEngine","User change. New user:",e.ti()),[4,function(t,e){return o(this,void 0,void 0,(function(){var n,r,i,o;return s(this,(function(s){switch(s.label){case 0:return n=Tr(t),r=n.Sr,i=n.Nh,[4,n.persistence.runTransaction("Handle user change","readonly",(function(t){var o;return n.Sr.Uo(t).next((function(s){return o=s,r=n.persistence.Th(e),i=new Bu(n.Ch,r,n.persistence.Ah()),r.Uo(t)})).next((function(e){for(var n=[],r=[],s=wi(),u=0,a=o;u<a.length;u++){var c=a[u];n.push(c.batchId);for(var h=0,f=c.mutations;h<f.length;h++){var l=f[h];s=s.add(l.key)}}for(var p=0,d=e;p<d.length;p++){var v=d[p];r.push(v.batchId);for(var y=0,g=v.mutations;y<g.length;y++){var m=g[y];s=s.add(m.key)}}return i.Or(t,s).next((function(t){return{Wu:t,ju:n,Gu:r}}))}))}))];case 1:return o=s.sent(),[2,(n.Sr=r,n.Nh=i,n.ph.xh(n.Nh),o)]}}))}))}(n.Gc,e)]);case 1:return r=i.sent(),n.currentUser=e,function(t,e){t.Lu.forEach((function(t){t.forEach((function(t){t.reject(new vr(dr.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.Lu.clear()}(n),n.Su.Wi(e,r.ju,r.Gu),[4,Ih(n,r.Wu)];case 2:i.sent(),i.label=3;case 3:return[2]}}
2))}))}function _h(t,e){var n=Tr(t),r=n.Ou.get(e);if(r&&r.pu)return wi().add(r.key);var i=wi(),o=n.xu.get(e);if(!o)return i;for(var s=0,u=o;s<u.length;s++){var a=u[s],c=n.Nu.get(a);i=i.Ot(c.view.wu)}return i}function Th(t,e){return o(this,void 0,void 0,(function(){var n,r,i;return s(this,(function(o){switch(o.label){case 0:return[4,hc((n=Tr(t)).Gc,e.query,!0)];case 1:return r=o.sent(),i=e.view.Vu(r),[2,(n.Uu&&mh(n,e.targetId,i.Pu),i)]}}))}))}function Ah(t,e,n,r){return o(this,void 0,void 0,(function(){var i,o;return s(this,(function(s){switch(s.label){case 0:return[4,function(t,e){var n=Tr(t),r=Tr(n.Sr);return n.persistence.runTransaction("Lookup mutation documents","readonly",(function(t){return r.Lo(t,e).next((function(e){return e?n.Nh.Or(t,e):ru.resolve(null)}))}))}((i=Tr(t)).Gc,e)];case 1:return null===(o=s.sent())?[3,6]:"pending"!==n?[3,3]:[4,zc(i.bu)];case 2:return s.sent(),[3,4];case 3:"acknowledged"===n||"rejected"===n?(vh(i,e,r||null),dh(i,e),function(t,e){Tr(Tr(t).Sr).jo(e)}(i.Gc,e)):Er(),s.label=4;case 4:return[4,Ih(i,o)];case 5:return s.sent(),[3,7];case 6:mr("SyncEngine","Cannot apply mutation batch with id: "+e),s.label=7;case 7:return[2]}}
2))}))}function Nh(t,e){return o(this,void 0,void 0,(function(){var n,r,i,o,u,a,c,h;return s(this,(function(s){switch(s.label){case 0:return Ph(n=Tr(t)),Lh(n),!0!==e||!0===n.qu?[3,3]:(r=n.Su.Ci(),[4,Sh(n,r.L())]);case 1:return i=s.sent(),n.qu=!0,[4,Jc(n.bu,!0)];case 2:for(s.sent(),o=0,u=i;o<u.length;o++)a=u[o],kc(n.bu,a);return[3,7];case 3:return!1!==e||!1===n.qu?[3,7]:(c=[],h=Promise.resolve(),n.xu.forEach((function(t,e){n.Su.qi(e)?c.push(e):h=h.then((function(){return yh(n,e),cc(n.Gc,e,!0)})),Pc(n.bu,e)})),[4,h]);case 4:return s.sent(),[4,Sh(n,c)];case 5:return s.sent(),function(t){var e=Tr(t);e.Ou.forEach((function(t,n){Pc(e.bu,n)})),e.Mu.Qh(),e.Ou=new Map,e.ku=new ai(Wr.D)}(n),n.qu=!1,[4,Jc(n.bu,!1)];case 6:s.sent(),s.label=7;case 7:return[2]}}))}))}function Sh(t,e,n){return o(this,void 0,void 0,(function(){var n,r,i,o,u,a,c,h,f,l,p,d,v,y;return s(this,(function(s){switch(s.label){case 0:n=Tr(t),r=[],i=[],o=0,u=e,s.label=1;case 1:return o<u.length?(a=u[o],c=void 0,(h=n.xu.get(a))&&0!==h.length?[4,ac(n.Gc,xs(h[0]))]:[3,7]):[3,13];case 2:c=s.sent(),f=0,l=h,s.label=3;case 3:return f<l.length?(p=l[f],d=n.Nu.get(p),[4,Th(n,d)]):[3,6];case 4:(v=s.sent()).snapshot&&i.push(v.snapshot),s.label=5;case 5:return f++,[3,3];case 6:return[3,11];case 7:return[4,fc(n.Gc,a)];case 8:return y=s.sent(),[4,ac(n.Gc,y)];case 9:return c=s.sent(),[4,uh(n,Dh(y),a,!1)];case 10:s.sent(),s.label=11;case 11:r.push(c),s.label=12;case 12:return o++,[3,1];case 13:return[2,(n.Cu.yc(i),r)]}}))}))}function Dh(t){return Es(t.path,t.collectionGroup,t.orderBy,t.filters,t.limit,"F",t.startAt,t.endAt)}function Oh(t){var e=Tr(t);return Tr(Tr(e.Gc).persistence).pi()}function xh(t,e,n,r){return o(this,void 0,void 0,(function(){var i,o,u;return s(this,(function(s){switch(s.label){case 0:return(i=Tr(t)).qu?(mr("SyncEngine","Ignoring unexpected query state notification."),[3,8]):[3,1];case 1:if(!i.xu.has(e))return[3,8];switch(n){case"current":case"not-current":return[3,2];case"rejected":return[3,5]}return[3,7];case 2:return[4,lc(i.Gc)];case 3:return o=s.sent(),u=Ni.Xt(e,"current"===n),[4,Ih(i,o,u)];case 4:return s.sent(),[3,8];case 5:return[4,cc(i.Gc,e,!0)];case 6:return s.sent(),yh(i,e,r),[3,8];case 7:Er(),s.label=8;case 8:return[2]}}
2))}))}function kh(t,e,n){return o(this,void 0,void 0,(function(){var r,i,o,u,a,c,h,f,l,p;return s(this,(function(d){switch(d.label){case 0:if(!(r=Ph(t)).qu)return[3,10];i=0,o=e,d.label=1;case 1:return i<o.length?(u=o[i],r.xu.has(u)?(mr("SyncEngine","Adding an already active target "+u),[3,5]):[4,fc(r.Gc,u)]):[3,6];case 2:return a=d.sent(),[4,ac(r.Gc,a)];case 3:return c=d.sent(),[4,uh(r,Dh(a),c.targetId,!1)];case 4:d.sent(),kc(r.bu,c),d.label=5;case 5:return i++,[3,1];case 6:h=function(t){return s(this,(function(e){switch(e.label){case 0:return r.xu.has(t)?[4,cc(r.Gc,t,!1).then((function(){Pc(r.bu,t),yh(r,t)})).catch(dc)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))},f=0,l=n,d.label=7;case 7:return f<l.length?(p=l[f],[5,h(p)]):[3,10];case 8:d.sent(),d.label=9;case 9:return f++,[3,7];case 10:return[2]}}))}))}function Ph(t){var e=Tr(t);return e.bu.Hc.ru=ch.bind(null,e),e.bu.Hc.qe=_h.bind(null,e),e.bu.Hc.iu=fh.bind(null,e),e.Cu.yc=Eu.bind(null,e.vu),e.Cu.Qu=_u.bind(null,e.vu),e}function Lh(t){var e=Tr(t);return e.bu.Hc.ou=lh.bind(null,e),e.bu.Hc.au=ph.bind(null,e),e}var Rh=function(){function t(){}return t.prototype.xh=function(t){this.zu=t},t.prototype.Lr=function(t,e,n,r){var i=this;return function(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.on.length||1===t.on.length&&t.on[0].field.W())}(e)||n.isEqual(Gr.min())?this.Hu(t,e):this.zu.Or(t,r).next((function(o){var s=i.Ju(e,o);return(Ts(e)||As(e))&&i.mu(e.an,s,r,n)?i.Hu(t,e):(gr()<=c.in.DEBUG&&mr("IndexFreeQueryEngine","Re-using previous result from %s to execute query: %s",n.toString(),Vs(e)),i.zu.Lr(t,e,n).next((function(t){return s.forEach((function(e){t=t.ot(e.key,e)})),t})))}))},t.prototype.Ju=function(t,e){var n=new fi(Us(t));return e.forEach((function(e,r){r instanceof ms&&Ms(t,r)&&(n=n.add(r))})),n},t.prototype.mu=function(t,e,n,r){if(n.size!==e.size)return!0;var i="F"===t?e.last():e.first();return!!i&&(i.hasPendingWrites||i.version.h(r)>0)},t.prototype.Hu=function(t,e){return gr()<=c.in.DEBUG&&mr("IndexFreeQueryEngine","Using full collection scan to execute query:",Vs(e)),this.zu.Lr(t,e,Gr.min())},t}(),Ch=function(){function t(t,e){this.Dr=t,this.No=e,this.Sr=[],this.Yu=1,this.Xu=new fi(yc.Mh)}return t.prototype.ko=function(t){return ru.resolve(0===this.Sr.length)},t.prototype.Oo=function(t,e,n,r){var i=this.Yu;this.Yu++,this.Sr.length>0&&this.Sr[this.Sr.length-1];var o=new Uu(i,e,n,r);this.Sr.push(o);for(var s=0,u=r;s<u.length;s++){var a=u[s];this.Xu=this.Xu.add(new yc(a.key,i)),this.Dr.Mo(t,a.key.path.F())}return ru.resolve(o)},t.prototype.$o=function(t,e){return ru.resolve(this.Zu(e))},t.prototype.Bo=function(t,e){var n=e+1,r=this.tl(n),i=r<0?0:r;return ru.resolve(this.Sr.length>i?this.Sr[i]:null)},t.prototype.qo=function(){return ru.resolve(0===this.Sr.length?-1:this.Yu-1)},t.prototype.Uo=function(t){return ru.resolve(this.Sr.slice())},t.prototype.Nr=function(t,e){var n=this,r=new yc(e,0),i=new yc(e,Number.POSITIVE_INFINITY),o=[];return this.Xu.xt([r,i],(function(t){var e=n.Zu(t.jh);o.push(e)})),ru.resolve(o)},t.prototype.$r=function(t,e){var n=this,r=new fi(Sr);return e.forEach((function(t){var e=new yc(t,0),i=new yc(t,Number.POSITIVE_INFINITY);n.Xu.xt([e,i],(function(t){r=r.add(t.jh)}))})),ru.resolve(this.el(r))},t.prototype.Qr=function(t,e){var n=e.path,r=n.length+1,i=n;Wr.X(i)||(i=i.child(""));var o=new yc(new Wr(i),0),s=new fi(Sr);return this.Xu.Ft((function(t){var e=t.key.path;return!!n.M(e)&&(e.length===r&&(s=s.add(t.jh)),!0)}),o),ru.resolve(this.el(s))},t.prototype.el=function(t){var e=this,n=[];return t.forEach((function(t){var r=e.Zu(t);null!==r&&n.push(r)})),n},t.prototype.Qo=function(t,e){var n=this;_r(0===this.nl(e.batchId,"removed")),this.Sr.shift();var r=this.Xu;return ru.forEach(e.mutations,(function(i){var o=new yc(i.key,e.batchId);return r=r.delete(o),n.No.Go(t,i.key)})).next((function(){n.Xu=r}))},t.prototype.jo=function(t){},t.prototype.Ho=function(t,e){var n=new yc(e,0),r=this.Xu.kt(n);return ru.resolve(e.isEqual(r&&r.key))},t.prototype.zo=function(t){return this.Sr.length,ru.resolve()},t.prototype.nl=function(t,e){return this.tl(t)},t.prototype.tl=function(t){return 0===this.Sr.length?0:t-this.Sr[0].batchId},t.prototype.Zu=function(t){var e=this.tl(t);return e<0||e>=this.Sr.length?null:this.Sr[e]},t}(),Vh=function(){function t(t,e){this.Dr=t,this.sl=e,this.docs=new ai(Wr.D),this.size=0}return t.prototype.Ir=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,s=this.sl(e);return this.docs=this.docs.ot(r,{ta:e,size:s,readTime:n}),this.size+=s-o,this.Dr.Mo(t,r.path.F())},t.prototype.Ar=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},t.prototype.Rr=function(t,e){var n=this.docs.get(e);return ru.resolve(n?n.ta:null)},t.prototype.getEntries=function(t,e){var n=this,r=vi();return e.forEach((function(t){var e=n.docs.get(t);r=r.ot(t,e?e.ta:null)})),ru.resolve(r)},t.prototype.Lr=function(t,e,n){for(var r=gi(),i=new Wr(e.path.child("")),o=this.docs.ft(i);o.At();){var s=o.It(),u=s.key,a=s.value,c=a.ta,h=a.readTime;if(!e.path.M(u.path))break;h.h(n)<=0||c instanceof ms&&Ms(e,c)&&(r=r.ot(c.key,c))}return ru.resolve(r)},t.prototype.il=function(t,e){return ru.forEach(this.docs,(function(t){return e(t)}))},t.prototype.ra=function(t){return new Mh(this)},t.prototype.aa=function(t){return ru.resolve(this.size)},t}(),Mh=function(t){function e(e){var n=this;return(n=t.call(this)||this).ha=e,n}return i(e,t),e.prototype.Vr=function(t){var e=this,n=[];return this.wr.forEach((function(r,i){i?n.push(e.ha.Ir(t,i,e.readTime)):e.ha.Ar(r)})),ru.kn(n)},e.prototype.Pr=function(t,e){return this.ha.Rr(t,e)},e.prototype.gr=function(t,e){return this.ha.getEntries(t,e)},e}
2(Fu),Uh=function(){function t(t){this.persistence=t,this.rl=new Fr((function(t){return Zr(t)}),ti),this.lastRemoteSnapshotVersion=Gr.min(),this.highestTargetId=0,this.ol=0,this.al=new vc,this.targetCount=0,this.hl=za.fa()}return t.prototype.Ce=function(t,e){return this.rl.forEach((function(t,n){return e(n)})),ru.resolve()},t.prototype.Ia=function(t){return ru.resolve(this.lastRemoteSnapshotVersion)},t.prototype.ma=function(t){return ru.resolve(this.ol)},t.prototype.wa=function(t){return this.highestTargetId=this.hl.next(),ru.resolve(this.highestTargetId)},t.prototype.Aa=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.ol&&(this.ol=e),ru.resolve()},t.prototype.Pa=function(t){this.rl.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.hl=new za(e),this.highestTargetId=e),t.sequenceNumber>this.ol&&(this.ol=t.sequenceNumber)},t.prototype.Ra=function(t,e){return this.Pa(e),this.targetCount+=1,ru.resolve()},t.prototype.Va=function(t,e){return this.Pa(e),ru.resolve()},t.prototype.ya=function(t,e){return this.rl.delete(e.target),this.al.Kh(e.targetId),this.targetCount-=1,ru.resolve()},t.prototype.po=function(t,e,n){var r=this,i=0,o=[];return this.rl.forEach((function(s,u){u.sequenceNumber<=e&&null===n.get(u.targetId)&&(r.rl.delete(s),o.push(r.pa(t,u.targetId)),i++)})),ru.kn(o).next((function(){return i}))},t.prototype.ba=function(t){return ru.resolve(this.targetCount)},t.prototype.va=function(t,e){var n=this.rl.get(e)||null;return ru.resolve(n)},t.prototype.Sa=function(t,e,n){return this.al.Bh(e,n),ru.resolve()},t.prototype.Ca=function(t,e,n){this.al.Uh(e,n);var r=this.persistence.No,i=[];return r&&e.forEach((function(e){i.push(r.Go(t,e))})),ru.kn(i)},t.prototype.pa=function(t,e){return this.al.Kh(e),ru.resolve()},t.prototype.xa=function(t,e){var n=this.al.Wh(e);return ru.resolve(n)},t.prototype.Ho=function(t,e){return ru.resolve(this.al.Ho(e))},t}(),jh=function(){function t(t){var e=this;this.cl={},this.Ma=new Su(0),this.$a=!1,this.$a=!0,this.No=t(this),this.ja=new Uh(this),this.Dr=new _a,this.vr=function(t,n){return new Vh(t,(function(t){return e.No.ul(t)}))}(this.Dr)}return t.prototype.start=function(){return Promise.resolve()},t.prototype.Di=function(){return this.$a=!1,Promise.resolve()},Object.defineProperty(t.prototype,"Ii",{get:function(){return this.$a},enumerable:!1,configurable:!0}),t.prototype.Za=function(){},t.prototype.th=function(){},t.prototype.Ah=function(){return this.Dr},t.prototype.Th=function(t){var e=this.cl[t.ti()];return e||(e=new Ch(this.Dr,this.No),this.cl[t.ti()]=e),e},t.prototype.Ih=function(){return this.ja},t.prototype.mh=function(){return this.vr},t.prototype.runTransaction=function(t,e,n){var r=this;mr("MemoryPersistence","Starting transaction:",t);var i=new Fh(this.Ma.next());return this.No.ll(),n(i).next((function(t){return r.No._l(i).next((function(){return t}))})).xn().then((function(t){return i.br(),t}))},t.prototype.fl=function(t,e){return ru.On(Object.values(this.cl).map((function(n){return function(){return n.Ho(t,e)}})))},t}(),Fh=function(t){function e(e){var n=this;return(n=t.call(this)||this).Fa=e,n}return i(e,t),e}(Gu),qh=function(){function t(t){this.persistence=t,this.dl=new vc,this.wl=null}return t.El=function(e){return new t(e)},Object.defineProperty(t.prototype,"Tl",{get:function(){if(this.wl)return this.wl;throw Er()},enumerable:!1,configurable:!0}),t.prototype.Da=function(t,e,n){return this.dl.Da(n,e),this.Tl.delete(n.toString()),ru.resolve()},t.prototype.Na=function(t,e,n){return this.dl.Na(n,e),this.Tl.add(n.toString()),ru.resolve()},t.prototype.Go=function(t,e){return this.Tl.add(e.toString()),ru.resolve()},t.prototype.removeTarget=function(t,e){var n=this;this.dl.Kh(e.targetId).forEach((function(t){return n.Tl.add(t.toString())}));var r=this.persistence.Ih();return r.xa(t,e.targetId).next((function(t){t.forEach((function(t){return n.Tl.add(t.toString())}))})).next((function(){return r.ya(t,e)}))},t.prototype.ll=function(){this.wl=new Set},t.prototype._l=function(t){var e=this,n=this.persistence.mh().ra();return ru.forEach(this.Tl,(function(r){var i=Wr.H(r);return e.Il(t,i).next((function(t){t||n.Ar(i)}))})).next((function(){return e.wl=null,n.apply(t)}))},t.prototype.yh=function(t,e){var n=this;return this.Il(t,e).next((function(t){t?n.Tl.delete(e.toString()):n.Tl.add(e.toString())}))},t.prototype.ul=function(t){return 0},t.prototype.Il=function(t,e){var n=this;return ru.On([function(){return ru.resolve(n.dl.Ho(e))},function(){return n.persistence.Ih().Ho(t,e)},function(){return n.persistence.fl(t,e)}])},t}(),Gh=function(){function t(t){this.ml=t.ml,this.Al=t.Al}return t.prototype.gc=function(t){this.Rl=t},t.prototype.Ic=function(t){this.Pl=t},t.prototype.onMessage=function(t){this.gl=t},t.prototype.close=function(){this.Al()},t.prototype.send=function(t){this.ml(t)},t.prototype.Vl=function(){this.Rl()},t.prototype.yl=function(t){this.Pl(t)},t.prototype.pl=function(t){this.gl(t)},t}(),Bh={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery"},zh=function(t){function e(e){var n=this;return(n=t.call(this,e)||this).forceLongPolling=e.forceLongPolling,n.T=e.T,n}return i(e,t),e.prototype.Nl=function(t,e,n,r){return new Promise((function(i,o){var s=new lr;
2s.listenOnce(hr.COMPLETE,(function(){try{switch(s.getLastErrorCode()){case cr.NO_ERROR:var e=s.getResponseJson();mr("Connection","XHR received:",JSON.stringify(e)),i(e);break;case cr.TIMEOUT:mr("Connection",'RPC "'+t+'" timed out'),o(new vr(dr.DEADLINE_EXCEEDED,"Request time out"));break;case cr.HTTP_ERROR:var n=s.getStatus();if(mr("Connection",'RPC "'+t+'" failed with status:',n,"response text:",s.getResponseText()),n>0){var r=s.getResponseJson().error;if(r&&r.status&&r.message){var u=function(t){var e=t.toLowerCase().replace("_","-");return Object.values(dr).indexOf(e)>=0?e:dr.UNKNOWN}(r.status);o(new vr(u,r.message))}else o(new vr(dr.UNKNOWN,"Server responded with status "+s.getStatus()))}else o(new vr(dr.UNAVAILABLE,"Connection failed."));break;default:Er()}}finally{mr("Connection",'RPC "'+t+'" completed.')}}));var u=JSON.stringify(r);s.send(e,"POST",u,n,15)}))},e.prototype.Vc=function(t,e){var n=[this.vl,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=new ir,i={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this._.projectId+"/databases/"+this._.database},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.T};this.Cl(i.initMessageHeaders,e),(0,h.uI)()||(0,h.b$)()||(0,h.d)()||(0,h.w1)()||(0,h.Mn)()||(0,h.ru)()||(i.httpHeadersOverwriteParam="$httpHeaders");var o=n.join("");mr("Connection","Creating WebChannel: "+o,i);var s=r.createWebChannel(o,i),u=!1,a=!1,c=new Gh({ml:function(t){a?mr("Connection","Not sending because WebChannel is closed:",t):(u||(mr("Connection","Opening WebChannel transport."),s.open(),u=!0),mr("Connection","WebChannel sending:",t),s.send(t))},Al:function(){return s.close()}}),f=function(t,e){s.listen(t,(function(t){try{e(t)}catch(t){setTimeout((function(){throw t}),0)}}))};return f(fr.EventType.OPEN,(function(){a||mr("Connection","WebChannel transport opened.")})),f(fr.EventType.CLOSE,(function(){a||(a=!0,mr("Connection","WebChannel transport closed"),c.yl())})),f(fr.EventType.ERROR,(function(t){a||(a=!0,wr("Connection","WebChannel transport errored:",t),c.yl(new vr(dr.UNAVAILABLE,"The operation could not be completed")))})),f(fr.EventType.MESSAGE,(function(t){var e;if(!a){var n=t.data[0];_r(!!n);var r=n,i=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(i){mr("Connection","WebChannel received error:",i);var o=i.status,u=function(t){var e=ni[t];if(void 0!==e)return ui(e)}(o),h=i.message;void 0===u&&(u=dr.INTERNAL,h="Unknown error status: "+o+" with message "+i.message),a=!0,c.yl(new vr(u,h)),s.close()}else mr("Connection","WebChannel received:",n),c.pl(n)}})),setTimeout((function(){c.Vl()}),0),c},e}(function(){function t(t){this.bl=t,this._=t._;var e=t.ssl?"https":"http";this.vl=e+"://"+t.host,this.Sl="projects/"+this._.projectId+"/databases/"+this._.database+"/documents"}return t.prototype.Mc=function(t,e,n,r){var i=this.Dl(t,e);mr("RestConnection","Sending: ",i,n);var o={};return this.Cl(o,r),this.Nl(t,i,o,n).then((function(t){return mr("RestConnection","Received: ",t),t}),(function(e){throw wr("RestConnection",t+" failed with error: ",e,"url: ",i,"request:",n),e}))},t.prototype.$c=function(t,e,n,r){return this.Mc(t,e,n,r)},t.prototype.Cl=function(t,e){if(t["X-Goog-Api-Client"]="gl-js/ fire/8.0.0",t["Content-Type"]="text/plain",e)for(var n in e.Gh)e.Gh.hasOwnProperty(n)&&(t[n]=e.Gh[n])},t.prototype.Dl=function(t,e){var n=Bh[t];return this.vl+"/v1/"+e+":"+n},t}()),Hh=function(){function t(){var t=this;this.xl=function(){return t.Fl()},this.kl=function(){return t.Ol()},this.Ml=[],this.$l()}return t.prototype.eu=function(t){this.Ml.push(t)},t.prototype.Di=function(){window.removeEventListener("online",this.xl),window.removeEventListener("offline",this.kl)},t.prototype.$l=function(){window.addEventListener("online",this.xl),window.addEventListener("offline",this.kl)},t.prototype.Fl=function(){mr("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.Ml;t<e.length;t++)(0,e[t])(0)},t.prototype.Ol=function(){mr("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(var t=0,e=this.Ml;t<e.length;t++)(0,e[t])(1)},t.Ln=function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener},t}(),Kh=function(){function t(){}return t.prototype.eu=function(t){},t.prototype.Di=function(){},t}();function Wh(t){return new ro(t,!0)}var Xh=function(){function t(){this.synchronizeTabs=!1}return t.prototype.initialize=function(t){return o(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return this.Su=this.Ll(t),this.persistence=this.Bl(t),[4,this.persistence.start()];case 1:return e.sent(),this.ql=this.Ul(t),this.Gc=this.Kl(t),[2]}}))}))},t.prototype.Ul=function(t){return null},t.prototype.Kl=function(t){return e=this.persistence,n=new Rh,r=t.Ql,new rc(e,n,r);var e,n,r},t.prototype.Bl=function(t){return new jh(qh.El)},t.prototype.Ll=function(t){return new Mu},t.prototype.terminate=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this.ql&&this.ql.stop(),[4,this.Su.Di()];case 1:return t.sent(),[4,this.persistence.Di()];case 2:return t.sent(),[2]}}))}))},t}(),Yh=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).Wl=e,i.cacheSizeBytes=n,i.forceOwnership=r,i.synchronizeTabs=!1,i}return i(e,t),e.prototype.initialize=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,t.prototype.initialize.call(this,e)];case 1:return n.sent(),[4,pc(this.Gc)];case 2:return n.sent(),[4,this.Wl.initialize(this,e)];case 3:return n.sent(),[4,Lh(this.Wl.fi)];case 4:return n.sent(),[4,zc(this.Wl.bu)];case 5:return n.sent(),[2]}}))}))},e.prototype.Ul=function(t){var e=this.persistence.No.wo;return new Yu(e,t.hs)},e.prototype.Bl=function(t){var e=nc(t.bl._,t.bl.persistenceKey),n=void 0!==this.cacheSizeBytes?Xu.ao(this.cacheSizeBytes):Xu.fo,r=Wh(t.bl._);return new Ja(this.synchronizeTabs,e,t.clientId,n,t.hs,pu(),du(),r,this.Su,!!this.forceOwnership)},e.prototype.Ll=function(t){return new Mu},e}(Xh),Qh=function(t){function e(e,n){var r=this;return(r=t.call(this,e,n,!1)||this).Wl=e,r.cacheSizeBytes=n,r.synchronizeTabs=!0,r}return i(e,t),e.prototype.initialize=function(e){return o(this,void 0,void 0,(function(){var n,r=this;return s(this,(function(i){switch(i.label){case 0:return[4,t.prototype.initialize.call(this,e)];case 1:return i.sent(),n=this.Wl.fi,this.Su instanceof Vu?(this.Su.fi={er:Ah.bind(null,n),nr:xh.bind(null,n),sr:kh.bind(null,n),pi:Oh.bind(null,n)},[4,this.Su.start()]):[3,3];case 2:i.sent(),i.label=3;case 3:return[4,this.persistence.Xa((function(t){return o(r,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,Nh(this.Wl.fi,t)];case 1:return e.sent(),this.ql&&(t&&!this.ql.Ii?this.ql.start(this.Gc):t||this.ql.stop()),[2]}}))}))}))];case 4:return i.sent(),[2]}}))}))},e.prototype.Ll=function(t){var e=pu();
2if(!Vu.Ln(e))throw new vr(dr.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var n=nc(t.bl._,t.bl.persistenceKey);return new Vu(e,t.hs,n,t.clientId,t.Ql)},e}(Yh),Jh=function(){function t(){}return t.prototype.initialize=function(t,e){return o(this,void 0,void 0,(function(){var n=this;return s(this,(function(r){switch(r.label){case 0:return this.Gc?[3,2]:(this.Gc=t.Gc,this.Su=t.Su,this.zc=this.jl(e),this.bu=this.Gl(e),this.vu=this.zl(e),this.fi=this.Hl(e,!t.synchronizeTabs),this.Su.di=function(t){return hh(n.fi,t,1)},this.bu.Hc.Jl=Eh.bind(null,this.fi),[4,Jc(this.bu,this.fi.Uu)]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.zl=function(t){return new bu},t.prototype.jl=function(t){var e,n=Wh(t.bl._),r=(e=t.bl,new zh(e));return function(t,e,n){return new Ac(t,e,n)}(t.credentials,r,n)},t.prototype.Gl=function(t){var e,n,r,i,o,s=this;return e=this.Gc,n=this.zc,r=t.hs,i=function(t){return hh(s.fi,t,0)},o=Hh.Ln()?new Hh:new Kh,new Sc(e,n,r,i,o)},t.prototype.Hl=function(t,e){return function(t,e,n,r,i,o,s){var u=new oh(t,e,n,r,i,o);return s&&(u.qu=!0),u}(this.Gc,this.bu,this.vu,this.Su,t.Ql,t.Du,e)},t.prototype.terminate=function(){return xc(this.bu)},t}(),$h=function(){function t(t){this.observer=t,this.muted=!1}return t.prototype.next=function(t){this.observer.next&&this.Yl(this.observer.next,t)},t.prototype.error=function(t){this.observer.error?this.Yl(this.observer.error,t):console.error("Uncaught Error in snapshot listener:",t)},t.prototype.Xl=function(){this.muted=!0},t.prototype.Yl=function(t,e){var n=this;this.muted||setTimeout((function(){n.muted||t(e)}),0)},t}();function Zh(t,e,n){if(!n)throw new vr(dr.INVALID_ARGUMENT,"Function "+t+"() cannot be called with an empty "+e+".")}function tf(t,e){if(void 0===e)return{merge:!1};if(void 0!==e.mergeFields&&void 0!==e.merge)throw new vr(dr.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');return e}function ef(t,e,n,r){if(!0===e&&!0===r)throw new vr(dr.INVALID_ARGUMENT,t+" and "+n+" cannot be used together.")}function nf(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=t.substring(0,20)+"..."),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";var e=function(t){if(t.constructor){var e=/function\s+([^\s(]+)\s*\(/.exec(t.constructor.toString());if(e&&e.length>1)return e[1]}return null}(t);return e?"a custom "+e+" object":"an object"}return"function"==typeof t?"a function":Er()}function rf(t,e){if(e<=0)throw new vr(dr.INVALID_ARGUMENT,"Function "+t+"() requires a positive number, but it was: "+e+".")}var of=function(t){for(var e=0;e<t.length;++e)if(0===t[e].length)throw new vr(dr.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this.Zl=new Kr(t)},sf=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.call(this,e)||this}return i(e,t),e.documentId=function(){return new e(Kr.j().B())},e.prototype.isEqual=function(t){return t instanceof e&&this.Zl.isEqual(t.Zl)},e}(of),uf=new RegExp("[~\\*/\\[\\]]"),af=function(t){this.t_=t},cf=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.e_=function(t){if(2!==t.n_)throw 1===t.n_?t.s_(this.t_+"() can only appear at the top level of your update data"):t.s_(this.t_+"() cannot be used with set() unless you pass {merge:true}");return t.Qe.push(t.path),null},e.prototype.isEqual=function(t){return t instanceof e},e}(af);function hf(t,e,n){return new Ef({n_:3,i_:e.settings.i_,methodName:t.t_,r_:n},e._,e.serializer,e.ignoreUndefinedProperties)}var ff=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.e_=function(t){return new Qo(t.path,new qo)},e.prototype.isEqual=function(t){return t instanceof e},e}(af),lf=function(t){function e(e,n){var r=this;return(r=t.call(this,e)||this).o_=n,r}return i(e,t),e.prototype.e_=function(t){var e=hf(this,t,!0),n=this.o_.map((function(t){return Df(t,e)})),r=new Go(n);return new Qo(t.path,r)},e.prototype.isEqual=function(t){return this===t},e}(af),pf=function(t){function e(e,n){var r=this;return(r=t.call(this,e)||this).o_=n,r}return i(e,t),e.prototype.e_=function(t){var e=hf(this,t,!0),n=this.o_.map((function(t){return Df(t,e)})),r=new zo(n);return new Qo(t.path,r)},e.prototype.isEqual=function(t){return this===t},e}(af),df=function(t){function e(e,n){var r=this;return(r=t.call(this,e)||this).a_=n,r}return i(e,t),e.prototype.e_=function(t){var e=new Ko(t.serializer,so(t.serializer,this.a_));return new Qo(t.path,e)},e.prototype.isEqual=function(t){return this===t},e}(af),vf=function(){function t(t,e){if(!isFinite(t)||t<-90||t>90)throw new vr(dr.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new vr(dr.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this.h_=t,this.c_=e}return Object.defineProperty(t.prototype,"latitude",{get:function(){return this.h_}
2,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"longitude",{get:function(){return this.c_},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(t){return this.h_===t.h_&&this.c_===t.c_},t.prototype.toJSON=function(){return{latitude:this.h_,longitude:this.c_}},t.prototype.g=function(t){return Sr(this.h_,t.h_)||Sr(this.c_,t.c_)},t}(),yf=function(t){this.u_=t},gf=/^__.*__$/,mf=function(t,e,n){this.l_=t,this.__=e,this.f_=n},bf=function(){function t(t,e,n){this.data=t,this.Qe=e,this.fieldTransforms=n}return t.prototype.d_=function(t,e){var n=[];return null!==this.Qe?n.push(new us(t,this.data,this.Qe,e)):n.push(new ss(t,this.data,e)),this.fieldTransforms.length>0&&n.push(new cs(t,this.fieldTransforms)),n},t}(),wf=function(){function t(t,e,n){this.data=t,this.Qe=e,this.fieldTransforms=n}return t.prototype.d_=function(t,e){var n=[new us(t,this.data,this.Qe,e)];return this.fieldTransforms.length>0&&n.push(new cs(t,this.fieldTransforms)),n},t}();function If(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Er()}}var Ef=function(){function t(t,e,n,r,i,o){this.settings=t,this._=e,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===i&&this.w_(),this.fieldTransforms=i||[],this.Qe=o||[]}return Object.defineProperty(t.prototype,"path",{get:function(){return this.settings.path},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"n_",{get:function(){return this.settings.n_},enumerable:!1,configurable:!0}),t.prototype.E_=function(e){return new t(Object.assign(Object.assign({},this.settings),e),this._,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.Qe)},t.prototype.T_=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.E_({path:n,r_:!1});return r.I_(t),r},t.prototype.m_=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.E_({path:n,r_:!1});return r.w_(),r},t.prototype.A_=function(t){return this.E_({path:void 0,r_:!0})},t.prototype.s_=function(t){return Rf(t,this.settings.methodName,this.settings.R_||!1,this.path,this.settings.i_)},t.prototype.contains=function(t){return void 0!==this.Qe.find((function(e){return t.M(e)}))||void 0!==this.fieldTransforms.find((function(e){return t.M(e.field)}))},t.prototype.w_=function(){if(this.path)for(var t=0;t<this.path.length;t++)this.I_(this.path.get(t))},t.prototype.I_=function(t){if(0===t.length)throw this.s_("Document fields must not be empty");if(If(this.n_)&&gf.test(t))throw this.s_('Document fields cannot begin and end with "__"')},t}(),_f=function(){function t(t,e,n){this._=t,this.ignoreUndefinedProperties=e,this.serializer=n||Wh(t)}return t.prototype.P_=function(t,e,n,r){return void 0===r&&(r=!1),new Ef({n_:t,methodName:e,i_:n,path:Kr.U(),r_:!1,R_:r},this._,this.serializer,this.ignoreUndefinedProperties)},t}();function Tf(t,e,n,r,i,o){void 0===o&&(o={});var s=t.P_(o.merge||o.mergeFields?2:0,e,n,i);kf("Data must be an object, but it was:",s,r);var u,a,c=Of(r,s);if(o.merge)u=new Yo(s.Qe),a=s.fieldTransforms;else if(o.mergeFields){for(var h=[],f=0,l=o.mergeFields;f<l.length;f++){var p=l[f],d=void 0;if(p instanceof of)d=p.Zl;else{if("string"!=typeof p)throw Er();d=Lf(e,p,n)}if(!s.contains(d))throw new vr(dr.INVALID_ARGUMENT,"Field '"+d+"' is specified in your field mask but missing from your input data.");Cf(h,d)||h.push(d)}u=new Yo(h),a=s.fieldTransforms.filter((function(t){return u.Je(t.field)}))}else u=null,a=s.fieldTransforms;return new bf(new ds(c),u,a)}function Af(t,e,n,r){var i=t.P_(1,e,n);kf("Data must be an object, but it was:",i,r);var o=[],s=new vs;Ur(r,(function(t,r){var u=Lf(e,t,n),a=i.m_(u);if(r instanceof cf||r instanceof yf&&r.u_ instanceof cf)o.push(u);else{var c=Df(r,a);null!=c&&(o.push(u),s.set(u,c))}}));var u=new Yo(o);return new wf(s.Xe(),u,i.fieldTransforms)}function Nf(t,e,n,r,i,o){var s=t.P_(1,e,n),u=[Pf(e,r,n)],a=[i];if(o.length%2!=0)throw new vr(dr.INVALID_ARGUMENT,"Function "+e+"() needs to be called with an even number of arguments that alternate between field names and values.");for(var c=0;c<o.length;c+=2)u.push(Pf(e,o[c])),a.push(o[c+1]);for(var h=[],f=new vs,l=u.length-1;l>=0;--l)if(!Cf(h,u[l])){var p=u[l],d=a[l],v=s.m_(p);if(d instanceof cf||d instanceof yf&&d.u_ instanceof cf)h.push(p);else{var y=Df(d,v);null!=y&&(h.push(p),f.set(p,y))}}var g=new Yo(h);return new wf(f.Xe(),g,s.fieldTransforms)}
2function Sf(t,e,n,r){return void 0===r&&(r=!1),Df(n,t.P_(r?4:3,e))}function Df(t,e){if(t instanceof yf&&(t=t.u_),xf(t))return kf("Unsupported field value:",e,t),Of(t,e);if(t instanceof af)return function(t,e){if(!If(e.n_))throw e.s_(t.t_+"() can only be used with update() and set()");if(!e.path)throw e.s_(t.t_+"() is not currently supported inside arrays");var n=t.e_(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(e.path&&e.Qe.push(e.path),t instanceof Array){if(e.settings.r_&&4!==e.n_)throw e.s_("Nested arrays are not supported");return function(t,e){for(var n=[],r=0,i=0,o=t;i<o.length;i++){var s=Df(o[i],e.A_(r));null==s&&(s={nullValue:"NULL_VALUE"}),n.push(s),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===t)return{nullValue:"NULL_VALUE"};if("number"==typeof t)return so(e.serializer,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){var n=qr.fromDate(t);return{timestampValue:uo(e.serializer,n)}}if(t instanceof qr){var r=new qr(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:uo(e.serializer,r)}}if(t instanceof vf)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof kr)return{bytesValue:ao(e.serializer,t.l)};if(t instanceof mf){var i=e._,o=t.l_;if(!o.isEqual(i))throw e.s_("Document reference is for database "+o.projectId+"/"+o.database+" but should be for database "+i.projectId+"/"+i.database);return{referenceValue:fo(t.l_||e._,t.__.path)}}if(void 0===t&&e.ignoreUndefinedProperties)return null;throw e.s_("Unsupported field value: "+nf(t))}(t,e)}function Of(t,e){var n={};return jr(t)?e.path&&e.path.length>0&&e.Qe.push(e.path):Ur(t,(function(t,r){var i=Df(r,e.T_(t));null!=i&&(n[t]=i)})),{mapValue:{fields:n}}}function xf(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof qr||t instanceof vf||t instanceof kr||t instanceof mf||t instanceof af)}function kf(t,e,n){if(!xf(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){var r=nf(n);throw"an object"===r?e.s_(t+" a custom object"):e.s_(t+" "+r)}}function Pf(t,e,n){if(e instanceof of)return e.Zl;if("string"==typeof e)return Lf(t,e);throw Rf("Field path arguments must be of type string or FieldPath.",t,!1,void 0,n)}function Lf(t,e,n){try{return function(t){if(t.search(uf)>=0)throw new vr(dr.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not contain '~', '*', '/', '[', or ']'");try{return new(sf.bind.apply(sf,u([void 0],t.split("."))))}catch(e){throw new vr(dr.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'")}}(e).Zl}catch(e){throw Rf((r=e)instanceof Error?r.message:r.toString(),t,!1,void 0,n)}var r}function Rf(t,e,n,r,i){var o=r&&!r.P(),s=void 0!==i,u="Function "+e+"() called with invalid data";n&&(u+=" (via `toFirestore()`)");var a="";return(o||s)&&(a+=" (found",o&&(a+=" in field "+r),s&&(a+=" in document "+i),a+=")"),new vr(dr.INVALID_ARGUMENT,(u+=". ")+t+a)}function Cf(t,e){return t.some((function(t){return t.isEqual(e)}))}var Vf=function(){function t(t){this.zc=t,this.g_=new Map,this.mutations=[],this.V_=!1,this.y_=null,this.p_=new Set}return t.prototype.b_=function(t){return o(this,void 0,void 0,(function(){var e,n=this;return s(this,(function(r){switch(r.label){case 0:if(this.v_(),this.mutations.length>0)throw new vr(dr.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(t,e){return o(this,void 0,void 0,(function(){var n,r,i,o,u,a;return s(this,(function(s){switch(s.label){case 0:return n=Tr(t),r=mo(n.serializer)+"/documents",i={documents:e.map((function(t){return po(n.serializer,t)}))},[4,n.$c("BatchGetDocuments",r,i)];case 1:return o=s.sent(),u=new Map,o.forEach((function(t){var e=function(t,e){return"found"in e?function(t,e){_r(!!e.found),e.found.name,e.found.updateTime;var n=vo(t,e.found.name),r=ho(e.found.updateTime),i=new ds({mapValue:{fields:e.found.fields}});return new ms(n,r,i,{})}(t,e):"missing"in e?function(t,e){_r(!!e.missing),_r(!!e.readTime);var n=vo(t,e.missing),r=ho(e.readTime);return new bs(n,r)}(t,e):Er()}(n.serializer,t);u.set(e.key.toString(),e)})),a=[],[2,(e.forEach((function(t){var e=u.get(t.toString());_r(!!e),a.push(e)})),a)]}}))}))}(this.zc,t)];
2case 1:return[2,((e=r.sent()).forEach((function(t){t instanceof bs||t instanceof ms?n.S_(t):Er()})),e)]}}))}))},t.prototype.set=function(t,e){this.write(e.d_(t,this.Ge(t))),this.p_.add(t.toString())},t.prototype.update=function(t,e){try{this.write(e.d_(t,this.D_(t)))}catch(t){this.y_=t}this.p_.add(t.toString())},t.prototype.delete=function(t){this.write([new ls(t,this.Ge(t))]),this.p_.add(t.toString())},t.prototype.commit=function(){return o(this,void 0,void 0,(function(){var t,e=this;return s(this,(function(n){switch(n.label){case 0:if(this.v_(),this.y_)throw this.y_;return t=this.g_,this.mutations.forEach((function(e){t.delete(e.key.toString())})),t.forEach((function(t,n){var r=Wr.H(n);e.mutations.push(new ps(r,e.Ge(r)))})),[4,function(t,e){return o(this,void 0,void 0,(function(){var n,r,i;return s(this,(function(o){switch(o.label){case 0:return n=Tr(t),r=mo(n.serializer)+"/documents",i={writes:e.map((function(t){return Io(n.serializer,t)}))},[4,n.Mc("Commit",r,i)];case 1:return o.sent(),[2]}}))}))}(this.zc,this.mutations)];case 1:return n.sent(),this.V_=!0,[2]}}))}))},t.prototype.S_=function(t){var e;if(t instanceof ms)e=t.version;else{if(!(t instanceof bs))throw Er();e=Gr.min()}var n=this.g_.get(t.key.toString());if(n){if(!e.isEqual(n))throw new vr(dr.ABORTED,"Document version changed between two reads.")}else this.g_.set(t.key.toString(),e)},t.prototype.Ge=function(t){var e=this.g_.get(t.toString());return!this.p_.has(t.toString())&&e?$o.updateTime(e):$o.ze()},t.prototype.D_=function(t){var e=this.g_.get(t.toString());if(!this.p_.has(t.toString())&&e){if(e.isEqual(Gr.min()))throw new vr(dr.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return $o.updateTime(e)}return $o.exists(!0)},t.prototype.write=function(t){this.v_(),this.mutations=this.mutations.concat(t)},t.prototype.v_=function(){},t}(),Mf=function(){function t(t,e,n,r){this.hs=t,this.zc=e,this.updateFunction=n,this.ls=r,this.C_=5,this.Vs=new nu(this.hs,"transaction_retry")}return t.prototype.run=function(){this.N_()},t.prototype.N_=function(){var t=this;this.Vs.Pn((function(){return o(t,void 0,void 0,(function(){var t,e,n=this;return s(this,(function(r){return t=new Vf(this.zc),(e=this.x_(t))&&e.then((function(e){n.hs.ws((function(){return t.commit().then((function(){n.ls.resolve(e)})).catch((function(t){n.F_(t)}))}))})).catch((function(t){n.F_(t)})),[2]}))}))}))},t.prototype.x_=function(t){try{var e=this.updateFunction(t);return!Xr(e)&&e.catch&&e.then?e:(this.ls.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.ls.reject(t),null}},t.prototype.F_=function(t){var e=this;this.C_>0&&this.k_(t)?(this.C_-=1,this.hs.ws((function(){return e.N_(),Promise.resolve()}))):this.ls.reject(t)},t.prototype.k_=function(t){if("FirebaseError"===t.name){var e=t.code;return"aborted"===e||"failed-precondition"===e||!si(e)}return!1},t}(),Uf=function(){function t(t,e){this.credentials=t,this.hs=e,this.clientId=Nr.t(),this.O_=new eu}return t.prototype.start=function(t,e,n){var r=this;this.M_(),this.bl=t;var i=new eu,u=!1;return this.credentials.Jh((function(t){if(!u)return u=!0,mr("FirestoreClient","Initializing. user=",t.uid),r.L_(e,n,t,i).then(r.O_.resolve,r.O_.reject);r.hs.Cs((function(){return function(t,e){return o(this,void 0,void 0,(function(){var n,r;return s(this,(function(i){switch(i.label){case 0:return(n=Tr(t)).hs.Fs(),mr("RemoteStore","RemoteStore received new credentials"),r=Mc(n),n.Xc.add(3),[4,Oc(n)];case 1:return i.sent(),r&&n.nu.set("Unknown"),[4,n.Hc.Jl(e)];case 2:return i.sent(),n.Xc.delete(3),[4,Dc(n)];case 3:return i.sent(),[2]}}))}))}(r.bu,t)}))})),this.hs.ws((function(){return r.O_.promise})),i.promise},t.prototype.enableNetwork=function(){var t=this;return this.M_(),this.hs.enqueue((function(){return t.persistence.th(!0),function(t){var e=Tr(t);return e.Xc.delete(0),Dc(e)}(t.bu)}))},t.prototype.L_=function(t,e,n,r){return o(this,void 0,void 0,(function(){var i,u,a=this;return s(this,(function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),i={hs:this.hs,bl:this.bl,clientId:this.clientId,credentials:this.credentials,Ql:n,Du:100}
2,[4,t.initialize(i)];case 1:return c.sent(),[4,e.initialize(t,i)];case 2:return c.sent(),this.persistence=t.persistence,this.Su=t.Su,this.Gc=t.Gc,this.ql=t.ql,this.zc=e.zc,this.bu=e.bu,this.fi=e.fi,this.B_=e.vu,this.B_.Us=sh.bind(null,this.fi),this.B_.Ws=ah.bind(null,this.fi),this.persistence.Za((function(){return o(a,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.terminate()];case 1:return t.sent(),[2]}}))}))})),r.resolve(),[3,4];case 3:if(u=c.sent(),r.reject(u),!function(t){return"FirebaseError"===t.name?t.code===dr.FAILED_PRECONDITION||t.code===dr.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code}(u))throw u;return[2,(console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+u),this.L_(new Xh,new Jh,n,r))];case 4:return[2]}}))}))},t.prototype.M_=function(){if(this.hs.ps)throw new vr(dr.FAILED_PRECONDITION,"The client has already been terminated.")},t.prototype.disableNetwork=function(){var t=this;return this.M_(),this.hs.enqueue((function(){return t.persistence.th(!1),function(t){return o(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return(e=Tr(t)).Xc.add(0),[4,Oc(e)];case 1:return n.sent(),e.nu.set("Offline"),[2]}}))}))}(t.bu)}))},t.prototype.terminate=function(){var t=this;this.hs.Ds();var e=new eu;return this.hs.bs((function(){return o(t,void 0,void 0,(function(){var t,n;return s(this,(function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),this.ql&&this.ql.stop(),[4,xc(this.bu)];case 1:return r.sent(),[4,this.Su.Di()];case 2:return r.sent(),[4,this.persistence.Di()];case 3:return r.sent(),this.credentials.Yh(),e.resolve(),[3,5];case 4:return t=r.sent(),n=gu(t,"Failed to shutdown persistence"),e.reject(n),[3,5];case 5:return[2]}}
2))}))})),e.promise},t.prototype.waitForPendingWrites=function(){var t=this;this.M_();var e=new eu;return this.hs.ws((function(){return function(t,e){return o(this,void 0,void 0,(function(){var n,r,i,o,u;return s(this,(function(s){switch(s.label){case 0:Mc((n=Tr(t)).bu)||mr("SyncEngine","The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled."),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,function(t){var e=Tr(t);return e.persistence.runTransaction("Get highest unacknowledged batch id","readonly",(function(t){return e.Sr.qo(t)}))}(n.Gc)];case 2:return-1===(r=s.sent())?[2,void e.resolve()]:((i=n.Lu.get(r)||[]).push(e),n.Lu.set(r,i),[3,4]);case 3:return o=s.sent(),u=gu(o,"Initialization of waitForPendingWrites() operation failed"),e.reject(u),[3,4];case 4:return[2]}}))}))}(t.fi,e)})),e.promise},t.prototype.listen=function(t,e,n){var r=this;this.M_();var i=new $h(n),o=new Au(t,i,e);return this.hs.ws((function(){return wu(r.B_,o)})),function(){i.Xl(),r.hs.ws((function(){return Iu(r.B_,o)}))}},t.prototype.q_=function(t){return o(this,void 0,void 0,(function(){var e,n=this;return s(this,(function(r){switch(r.label){case 0:return this.M_(),[4,this.O_.promise];case 1:return r.sent(),e=new eu,[2,(this.hs.ws((function(){return function(t,e,n){return o(this,void 0,void 0,(function(){var r,i,o;return s(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,function(t,e){var n=Tr(t);return n.persistence.runTransaction("read document","readonly",(function(t){return n.Nh.Cr(t,e)}))}(t,e)];case 1:return(r=s.sent())instanceof ms?n.resolve(r):r instanceof bs?n.resolve(null):n.reject(new vr(dr.UNAVAILABLE,"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)")),[3,3];case 2:return i=s.sent(),o=gu(i,"Failed to get document '"+e+" from cache"),n.reject(o),[3,3];case 3:return[2]}}
2))}))}(n.Gc,t,e)})),e.promise)]}}))}))},t.prototype.U_=function(t,e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){var n,r=this;return s(this,(function(i){switch(i.label){case 0:return this.M_(),[4,this.O_.promise];case 1:return i.sent(),n=new eu,[2,(this.hs.ws((function(){return function(t,e,n,r,i){var o=new $h({next:function(o){e.ws((function(){return Iu(t,s)}));var u=o.docs.has(n);!u&&o.fromCache?i.reject(new vr(dr.UNAVAILABLE,"Failed to get document because the client is offline.")):u&&o.fromCache&&r&&"server"===r.source?i.reject(new vr(dr.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):i.resolve(o)},error:function(t){return i.reject(t)}}),s=new Au(_s(n.path),o,{includeMetadataChanges:!0,Xs:!0});return wu(t,s)}(r.B_,r.hs,t,e,n)})),n.promise)]}}))}))},t.prototype.K_=function(t){return o(this,void 0,void 0,(function(){var e,n=this;return s(this,(function(r){switch(r.label){case 0:return this.M_(),[4,this.O_.promise];case 1:return r.sent(),e=new eu,[2,(this.hs.ws((function(){return function(t,e,n){return o(this,void 0,void 0,(function(){var r,i,o,u,a,c;return s(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,hc(t,e,!0)];case 1:return r=s.sent(),i=new nh(e,r.Fh),o=i.Eu(r.documents),u=i.Vr(o,!1),n.resolve(u.snapshot),[3,3];case 2:return a=s.sent(),c=gu(a,"Failed to execute query '"+e+" against cache"),n.reject(c),[3,3];case 3:return[2]}}
2))}))}(n.Gc,t,e)})),e.promise)]}}))}))},t.prototype.Q_=function(t,e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){var n,r=this;return s(this,(function(i){switch(i.label){case 0:return this.M_(),[4,this.O_.promise];case 1:return i.sent(),n=new eu,[2,(this.hs.ws((function(){return function(t,e,n,r,i){var o=new $h({next:function(n){e.ws((function(){return Iu(t,s)})),n.fromCache&&"server"===r.source?i.reject(new vr(dr.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):i.resolve(n)},error:function(t){return i.reject(t)}}),s=new Au(n,o,{includeMetadataChanges:!0,Xs:!0});return wu(t,s)}(r.B_,r.hs,t,e,n)})),n.promise)]}}))}))},t.prototype.write=function(t){var e=this;this.M_();var n=new eu;return this.hs.ws((function(){return function(t,e,n){return o(this,void 0,void 0,(function(){var r,i,o,u;return s(this,(function(s){switch(s.label){case 0:r=Lh(t),s.label=1;case 1:return s.trys.push([1,5,,6]),[4,function(t,e){var n,r=Tr(t),i=qr.now(),o=e.reduce((function(t,e){return t.add(e.key)}),wi());return r.persistence.runTransaction("Locally write mutations","readwrite",(function(t){return r.Nh.Or(t,o).next((function(o){n=o;for(var s=[],u=0,a=e;u<a.length;u++){var c=a[u],h=rs(c,n.get(c.key));null!=h&&s.push(new us(c.key,h,ys(h.proto.mapValue),$o.exists(!0)))}return r.Sr.Oo(t,i,s,e)}))})).then((function(t){var e=t.lr(n);return{batchId:t.batchId,wr:e}}))}(r.Gc,e)];case 2:return i=s.sent(),r.Su.Fi(i.batchId),function(t,e,n){var r=t.$u[t.currentUser.ti()];r||(r=new ai(Sr)),r=r.ot(e,n),t.$u[t.currentUser.ti()]=r}(r,i.batchId,n),[4,Ih(r,i.wr)];case 3:return s.sent(),[4,zc(r.bu)];case 4:return s.sent(),[3,6];case 5:return o=s.sent(),u=gu(o,"Failed to persist write"),n.reject(u),[3,6];case 6:return[2]}}
2))}))}(e.fi,t,n)})),n.promise},t.prototype._=function(){return this.bl._},t.prototype.W_=function(t){var e=this;this.M_();var n=new $h(t);return this.hs.ws((function(){return o(e,void 0,void 0,(function(){return s(this,(function(t){return[2,function(t,e){Tr(t).qs.add(e),e.next()}(this.B_,n)]}))}))})),function(){n.Xl(),e.hs.ws((function(){return o(e,void 0,void 0,(function(){return s(this,(function(t){return[2,function(t,e){Tr(t).qs.delete(e)}(this.B_,n)]}))}))}))}},Object.defineProperty(t.prototype,"j_",{get:function(){return this.hs.ps},enumerable:!1,configurable:!0}),t.prototype.transaction=function(t){var e=this;this.M_();var n=new eu;return this.hs.ws((function(){return new Mf(e.hs,e.zc,t,n).run(),Promise.resolve()})),n.promise},t}();function jf(t){return function(t,e){if("object"!=typeof t||null===t)return!1;for(var n=t,r=0,i=["next","error","complete"];r<i.length;r++){var o=i[r];if(o in n&&"function"==typeof n[o])return!0}return!1}(t)}var Ff=function(){function t(t,e,n,r){this._=t,this.G_=e,this.z_=n,this.H_=r}return t.prototype.J_=function(t){switch(ji(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Wi(t.integerValue||t.doubleValue);case 3:return this.Y_(t.timestampValue);case 4:return this.X_(t);case 5:return t.stringValue;case 6:return this.H_(Xi(t.bytesValue));case 7:return this.Z_(t.referenceValue);case 8:return this.tf(t.geoPointValue);case 9:return this.ef(t.arrayValue);case 10:return this.nf(t.mapValue);default:throw Er()}},t.prototype.nf=function(t){var e=this,n={};return Ur(t.fields||{},(function(t,r){n[t]=e.J_(r)})),n},t.prototype.tf=function(t){return new vf(Wi(t.latitude),Wi(t.longitude))},t.prototype.ef=function(t){var e=this;return(t.values||[]).map((function(t){return e.J_(t)}))},t.prototype.X_=function(t){switch(this.G_){case"previous":var e=Vi(t);return null==e?null:this.J_(e);case"estimate":return this.Y_(Mi(t));default:return null}},t.prototype.Y_=function(t){var e=Ki(t);return new qr(e.seconds,e.nanos)},t.prototype.Z_=function(t){var e=zr.q(t);_r(Vo(e));var n=new Vr(e.get(1),e.get(3)),r=new Wr(e.N(5));return n.isEqual(this._)||br("Document "+r+" contains a document reference within a different database ("+n.projectId+"/"+n.database+") which is not supported. It will be treated as a reference in the current database ("+this._.projectId+"/"+this._.database+") instead."),this.z_(r)},t}(),qf=Xu.uo,Gf=function(){function t(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new vr(dr.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=Xu._o;else{if(t.cacheSizeBytes!==qf&&t.cacheSizeBytes<Xu.lo)throw new vr(dr.INVALID_ARGUMENT,"cacheSizeBytes must be at least "+Xu.lo);this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,ef("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}return t.prototype.isEqual=function(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties},t}(),Bf="You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.",zf=function(){function t(){}return t.prototype.enableIndexedDbPersistence=function(t,e){throw new vr(dr.FAILED_PRECONDITION,Bf)},t.prototype.enableMultiTabIndexedDbPersistence=function(t){throw new vr(dr.FAILED_PRECONDITION,Bf)},t.prototype.clearIndexedDbPersistence=function(t){throw new vr(dr.FAILED_PRECONDITION,Bf)},t}(),Hf=function(){function t(){}return t.prototype.enableIndexedDbPersistence=function(t,e){var n=new Jh,r=new Yh(n,t.sf().cacheSizeBytes,e);return t.if(r,n)},t.prototype.enableMultiTabIndexedDbPersistence=function(t){var e=new Jh,n=new Qh(e,t.sf().cacheSizeBytes);return t.if(n,e)},t.prototype.clearIndexedDbPersistence=function(t){var e=this,n=new eu;return t.rf.bs((function(){return o(e,void 0,void 0,(function(){var e;return s(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,function(t){return o(this,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return iu.Ln()?(e=t+"main",[4,iu.delete(e)]):[2,Promise.resolve()];case 1:return n.sent(),[2]}}))}))}(nc(t.l_,t.af))];case 1:return r.sent(),n.resolve(),[3,3];case 2:return e=r.sent(),n.reject(e),[3,3];case 3:return[2]}}
2))}))})),n.promise},t}(),Kf=function(){function t(e,n,r){var i=this;if(void 0===r&&(r=new zf),this.hf=r,this.cf=null,this.rf=new yu,this.INTERNAL={delete:function(){return o(i,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this.uf(),[4,this.lf.terminate()];case 1:return t.sent(),[2]}}))}))}},"object"==typeof e.options){var u=e;this.cf=u,this.l_=t._f(u),this.af=u.name,this.ff=new bc(n)}else{var a=e;if(!a.projectId)throw new vr(dr.INVALID_ARGUMENT,"Must provide projectId");this.l_=new Vr(a.projectId,a.database),this.af="[DEFAULT]",this.ff=new mc}this.df=new Gf({})}return Object.defineProperty(t.prototype,"wf",{get:function(){return this.Ef||(this.Ef=new _f(this.l_,this.df.ignoreUndefinedProperties)),this.Ef},enumerable:!1,configurable:!0}),t.prototype.settings=function(t){t.merge&&delete(t=Object.assign(Object.assign({},this.df),t)).merge;var e=new Gf(t);if(this.lf&&!this.df.isEqual(e))throw new vr(dr.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.df=e,void 0!==e.credentials&&(this.ff=function(t){if(!t)return new mc;switch(t.type){case"gapi":var e=t.client;return _r(!("object"!=typeof e||null===e||!e.auth||!e.auth.getAuthHeaderValueForFirstParty)),new Ic(e,t.sessionIndex||"0");case"provider":return t.client;default:throw new vr(dr.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(e.credentials))},t.prototype.useEmulator=function(t,e){"firestore.googleapis.com"!==this.df.host&&wr("Host has been set in both settings() and useEmulator(), emulator host will be used"),this.settings({host:t+":"+e,ssl:!1,merge:!0})},t.prototype.enableNetwork=function(){return this.uf(),this.lf.enableNetwork()},t.prototype.disableNetwork=function(){return this.uf(),this.lf.disableNetwork()},t.prototype.enablePersistence=function(t){if(this.lf)throw new vr(dr.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only call enablePersistence() before calling any other methods on a Firestore object.");var e=!1,n=!1;return t&&ef("synchronizeTabs",e=!!t.synchronizeTabs,"experimentalForceOwningTab",n=!!t.experimentalForceOwningTab),e?this.hf.enableMultiTabIndexedDbPersistence(this):this.hf.enableIndexedDbPersistence(this,n)},t.prototype.clearPersistence=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){if(void 0!==this.lf&&!this.lf.j_)throw new vr(dr.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");return[2,this.hf.clearIndexedDbPersistence(this)]}))}))},t.prototype.terminate=function(){return this.app._removeServiceInstance("firestore"),this.INTERNAL.delete()},Object.defineProperty(t.prototype,"Tf",{get:function(){return this.uf(),this.lf.j_},enumerable:!1,configurable:!0}),t.prototype.waitForPendingWrites=function(){return this.uf(),this.lf.waitForPendingWrites()},t.prototype.onSnapshotsInSync=function(t){if(this.uf(),jf(t))return this.lf.W_(t);var e={next:t};return this.lf.W_(e)},t.prototype.uf=function(){return this.lf||this.if(new Xh,new Jh),this.lf},t.prototype.If=function(){return new Cr(this.l_,this.af,this.df.host,this.df.ssl,this.df.experimentalForceLongPolling,this.df.experimentalAutoDetectLongPolling)},t.prototype.if=function(t,e){var n=this.If();return this.lf=new Uf(this.ff,this.rf),this.lf.start(n,t,e)},t._f=function(t){if(e=t.options,!Object.prototype.hasOwnProperty.call(e,"projectId"))throw new vr(dr.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');var e,n=t.options.projectId;if(!n||"string"!=typeof n)throw new vr(dr.INVALID_ARGUMENT,"projectId must be a string in FirebaseApp.options");return new Vr(n)},Object.defineProperty(t.prototype,"app",{get:function(){if(!this.cf)throw new vr(dr.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.cf},enumerable:!1,configurable:!0}),t.prototype.collection=function(t){return Zh("Firestore.collection","path",t),this.uf(),new ol(zr.q(t),this,null)},t.prototype.doc=function(t){return Zh("Firestore.doc","path",t),this.uf(),Yf.mf(zr.q(t),this,null)},t.prototype.collectionGroup=function(t){if(Zh("Firestore.collectionGroup","collectionId",t),t.indexOf("/")>=0)throw new vr(dr.INVALID_ARGUMENT,"Invalid collection ID '"+t+"' passed to function Firestore.collectionGroup(). Collection IDs must not contain '/'.");return this.uf(),new rl(function(t){return new Is(zr.U(),t)}(t),this,null)},t.prototype.runTransaction=function(t){var e=this;return this.uf().transaction((function(n){return t(new Wf(e,n))}))},t.prototype.batch=function(){return this.uf(),new Xf(this)},t.prototype.sf=function(){return this.df},t}(),Wf=function(){function t(t,e){this.Af=t,this.Rf=e}return t.prototype.get=function(t){var e=this,n=sl(0,t,this.Af);return this.Rf.b_([n.__]).then((function(t){if(!t||1!==t.length)return Er();var r=t[0];if(r instanceof bs)return new Jf(e.Af,n.__,null,!1,!1,n.f_);if(r instanceof ms)return new Jf(e.Af,n.__,r,!1,!1,n.f_);throw Er()}))},t.prototype.set=function(t,e,n){var r=sl(0,t,this.Af);n=tf("Transaction.set",n);var i=al(r.f_,e,n),o=Tf(this.Af.wf,"Transaction.set",r.__,i,null!==r.f_,n);return this.Rf.set(r.__,o),this},t.prototype.update=function(t,e,n){for(var r,i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return"string"==typeof e||e instanceof sf?(r=sl(0,t,this.Af),i=Nf(this.Af.wf,"Transaction.update",r.__,e,n,o)):(r=sl(0,t,this.Af),i=Af(this.Af.wf,"Transaction.update",r.__,e)),this.Rf.update(r.__,i),this},t.prototype.delete=function(t){var e=sl(0,t,this.Af);return this.Rf.delete(e.__),this},t}(),Xf=function(){function t(t){this.Af=t,this.Pf=[],this.gf=!1}
2return t.prototype.set=function(t,e,n){this.Vf();var r=sl(0,t,this.Af);n=tf("WriteBatch.set",n);var i=al(r.f_,e,n),o=Tf(this.Af.wf,"WriteBatch.set",r.__,i,null!==r.f_,n);return this.Pf=this.Pf.concat(o.d_(r.__,$o.ze())),this},t.prototype.update=function(t,e,n){for(var r,i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return this.Vf(),"string"==typeof e||e instanceof sf?(r=sl(0,t,this.Af),i=Nf(this.Af.wf,"WriteBatch.update",r.__,e,n,o)):(r=sl(0,t,this.Af),i=Af(this.Af.wf,"WriteBatch.update",r.__,e)),this.Pf=this.Pf.concat(i.d_(r.__,$o.exists(!0))),this},t.prototype.delete=function(t){this.Vf();var e=sl(0,t,this.Af);return this.Pf=this.Pf.concat(new ls(e.__,$o.ze())),this},t.prototype.commit=function(){return this.Vf(),this.gf=!0,this.Pf.length>0?this.Af.uf().write(this.Pf):Promise.resolve()},t.prototype.Vf=function(){if(this.gf)throw new vr(dr.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},t}(),Yf=function(t){function e(e,n,r){var i=this;return(i=t.call(this,n.l_,e,r)||this).__=e,i.firestore=n,i.f_=r,i.lf=i.firestore.uf(),i}return i(e,t),e.mf=function(t,n,r){if(t.length%2!=0)throw new vr(dr.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.B()+" has "+t.length);return new e(new Wr(t),n,r)},Object.defineProperty(e.prototype,"id",{get:function(){return this.__.path.O()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return new ol(this.__.path.F(),this.firestore,this.f_)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this.__.path.B()},enumerable:!1,configurable:!0}),e.prototype.collection=function(t){if(Zh("DocumentReference.collection","path",t),!t)throw new vr(dr.INVALID_ARGUMENT,"Must provide a non-empty collection name to collection()");var e=zr.q(t);return new ol(this.__.path.child(e),this.firestore,null)},e.prototype.isEqual=function(t){return t instanceof e&&this.firestore===t.firestore&&this.__.isEqual(t.__)&&this.f_===t.f_},e.prototype.set=function(t,e){e=tf("DocumentReference.set",e);var n=al(this.f_,t,e),r=Tf(this.firestore.wf,"DocumentReference.set",this.__,n,null!==this.f_,e);return this.lf.write(r.d_(this.__,$o.ze()))},e.prototype.update=function(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return n="string"==typeof t||t instanceof sf?Nf(this.firestore.wf,"DocumentReference.update",this.__,t,e,r):Af(this.firestore.wf,"DocumentReference.update",this.__,t),this.lf.write(n.d_(this.__,$o.exists(!0)))},e.prototype.delete=function(){return this.lf.write([new ls(this.__,$o.ze())])},e.prototype.onSnapshot=function(){for(var t,e,n,r=this,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var s={includeMetadataChanges:!1},u=0;"object"!=typeof i[u]||jf(i[u])||(s=i[u],u++);var a={includeMetadataChanges:s.includeMetadataChanges};if(jf(i[u])){var c=i[u];i[u]=null===(t=c.next)||void 0===t?void 0:t.bind(c),i[u+1]=null===(e=c.error)||void 0===e?void 0:e.bind(c),i[u+2]=null===(n=c.complete)||void 0===n?void 0:n.bind(c)}var h={next:function(t){i[u]&&i[u](r.yf(t))},error:i[u+1],complete:i[u+2]};return this.lf.listen(_s(this.__.path),a,h)},e.prototype.get=function(t){var e=this,n=this.firestore.uf();return t&&"cache"===t.source?n.q_(this.__).then((function(t){return new Jf(e.firestore,e.__,t,!0,t instanceof ms&&t.Ye,e.f_)})):n.U_(this.__,t).then((function(t){return e.yf(t)}))},e.prototype.withConverter=function(t){return new e(this.__,this.firestore,t)},e.prototype.yf=function(t){var e=t.docs.get(this.__);return new Jf(this.firestore,this.__,e,t.fromCache,t.hasPendingWrites,this.f_)},e}(mf),Qf=function(){function t(t,e){this.hasPendingWrites=t,this.fromCache=e}return t.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},t}(),Jf=function(){function t(t,e,n,r,i,o){this.Af=t,this.__=e,this.pf=n,this.bf=r,this.vf=i,this.f_=o}return t.prototype.data=function(t){var e=this;if(void 0===t&&(t={}),this.pf){if(this.f_){var n=new $f(this.Af,this.__,this.pf,this.bf,this.vf,null);return this.f_.fromFirestore(n,t)}return new Ff(this.Af.l_,t.serverTimestamps||"none",(function(t){return new Yf(t,e.Af,null)}),(function(t){return new Rr(t)})).J_(this.pf.rn())}},t.prototype.get=function(t,e){var n=this;if(void 0===e&&(e={}),this.pf){var r=this.pf.data().field(Pf("DocumentSnapshot.get",t,this.__));if(null!==r)return new Ff(this.Af.l_,e.serverTimestamps||"none",(function(t){return new Yf(t,n.Af,n.f_)}),(function(t){return new Rr(t)})).J_(r)}},Object.defineProperty(t.prototype,"id",{get:function(){return this.__.path.O()}
2,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ref",{get:function(){return new Yf(this.__,this.Af,this.f_)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"exists",{get:function(){return null!==this.pf},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"metadata",{get:function(){return new Qf(this.vf,this.bf)},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(e){return e instanceof t&&this.Af===e.Af&&this.bf===e.bf&&this.__.isEqual(e.__)&&(null===this.pf?null===e.pf:this.pf.isEqual(e.pf))&&this.f_===e.f_},t}(),$f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.data=function(e){return t.prototype.data.call(this,e)},e}(Jf);function Zf(t,e,n){if("string"==typeof n){if(""===n)throw new vr(dr.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!Ds(e)&&-1!==n.indexOf("/"))throw new vr(dr.INVALID_ARGUMENT,"Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '"+n+"' contains a '/' character.");var r=e.path.child(zr.q(n));if(!Wr.X(r))throw new vr(dr.INVALID_ARGUMENT,"Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '"+r+"' is not because it has an odd number of segments ("+r.length+").");return Yi(t,new Wr(r))}if(n instanceof mf)return Yi(t,n.__);throw new vr(dr.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+nf(n)+".")}function tl(t,e){if(!Array.isArray(t)||0===t.length)throw new vr(dr.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+e.toString()+"' filters.");if(t.length>10)throw new vr(dr.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters support a maximum of 10 elements in the value array.")}function el(t,e,n){if(!n.isEqual(e))throw new vr(dr.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+e.toString()+"' and so you must also use '"+e.toString()+"' as your first orderBy(), but your first orderBy() is on field '"+n.toString()+"' instead.")}function nl(t){if(As(t)&&0===t.on.length)throw new vr(dr.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var rl=function(){function t(t,e,n){this.Sf=t,this.firestore=e,this.f_=n}return t.prototype.where=function(e,n,r){var i=Pf("Query.where",e),o=function(t,e,n,r,i,o,s){var u;if(i.W()){if("array-contains"===o||"array-contains-any"===o)throw new vr(dr.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+o+"' queries on FieldPath.documentId().");if("in"===o||"not-in"===o){tl(s,o);for(var a=[],c=0,h=s;c<h.length;c++){var f=h[c];a.push(Zf(r,t,f))}u={arrayValue:{values:a}}}else u=Zf(r,t,s)}else"in"!==o&&"not-in"!==o&&"array-contains-any"!==o||tl(s,o),u=Sf(n,"Query.where",s,"in"===o||"not-in"===o);var l=js.create(i,o,u);return function(t,e){if(e.un()){var n=Ss(t);if(null!==n&&!n.isEqual(e.field))throw new vr(dr.INVALID_ARGUMENT,"Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on '"+n.toString()+"' and '"+e.field.toString()+"'");var r=Ns(t);null!==r&&el(0,e.field,r)}var i=function(t,e){for(var n=0,r=t.filters;n<r.length;n++){var i=r[n];if(e.indexOf(i.op)>=0)return i.op}return null}(t,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==i)throw i===e.op?new vr(dr.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+e.op.toString()+"' filter."):new vr(dr.INVALID_ARGUMENT,"Invalid query. You cannot use '"+e.op.toString()+"' filters with '"+i.toString()+"' filters.")}(t,l),l}(this.Sf,0,this.firestore.wf,this.firestore.l_,i,n,r);return new t(function(t,e){var n=t.filters.concat([e]);return new Is(t.path,t.collectionGroup,t.on.slice(),n,t.limit,t.an,t.startAt,t.endAt)}(this.Sf,o),this.firestore,this.f_)},t.prototype.orderBy=function(e,n){var r;if(void 0===n||"asc"===n)r="asc";else{if("desc"!==n)throw new vr(dr.INVALID_ARGUMENT,"Function Query.orderBy() has unknown direction '"+n+"', expected 'asc' or 'desc'.");r="desc"}var i=Pf("Query.orderBy",e),o=function(t,e,n){if(null!==t.startAt)throw new vr(dr.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==t.endAt)throw new vr(dr.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");var r=new $s(e,n);return function(t,e){if(null===Ns(t)){var n=Ss(t);null!==n&&el(0,n,e.field)}}(t,r),r}(this.Sf,i,r);return new t(function(t,e){var n=t.on.concat([e]);return new Is(t.path,t.collectionGroup,n,t.filters.slice(),t.limit,t.an,t.startAt,t.endAt)}(this.Sf,o),this.firestore,this.f_)},t.prototype.limit=function(e){return rf("Query.limit",e),new t(ks(this.Sf,e,"F"),this.firestore,this.f_)},t.prototype.limitToLast=function(e){return rf("Query.limitToLast",e),new t(ks(this.Sf,e,"L"),this.firestore,this.f_)},t.prototype.startAt=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=this.Df("Query.startAt",e,n,!0);return new t(Ps(this.Sf,i),this.firestore,this.f_)},t.prototype.startAfter=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=this.Df("Query.startAfter",e,n,!1);return new t(Ps(this.Sf,i),this.firestore,this.f_)},t.prototype.endBefore=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=this.Df("Query.endBefore",e,n,!0);return new t(Ls(this.Sf,i),this.firestore,this.f_)},t.prototype.endAt=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=this.Df("Query.endAt",e,n,!1);return new t(Ls(this.Sf,i),this.firestore,this.f_)},t.prototype.isEqual=function(e){return e instanceof t&&this.firestore===e.firestore&&Rs(this.Sf,e.Sf)&&this.f_===e.f_},t.prototype.withConverter=function(e){return new t(this.Sf,this.firestore,e)},t.prototype.Df=function(t,e,n,r){if(e instanceof Jf)return function(t,e,n,r,i){if(!r)throw new vr(dr.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+n+"().");for(var o=[],s=0,u=Os(t);s<u.length;s++){var a=u[s];if(a.field.W())o.push(Yi(e,r.key));else{var c=r.field(a.field);if(Ci(c))throw new vr(dr.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+a.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===c){var h=a.field.B();throw new vr(dr.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '"+h+"' (used as the orderBy) does not exist.")}o.push(c)}}return new Xs(o,i)}(this.Sf,this.firestore.l_,t,e.pf,r);var i=[e].concat(n);return function(t,e,n,r,i,o){var s=t.on;if(i.length>s.length)throw new vr(dr.INVALID_ARGUMENT,"Too many arguments provided to "+r+"(). The number of arguments must be less than or equal to the number of orderBy() clauses");for(var u=[],a=0;a<i.length;a++){var c=i[a];if(s[a].field.W()){if("string"!=typeof c)throw new vr(dr.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+r+"(), but got a "+typeof c);if(!Ds(t)&&-1!==c.indexOf("/"))throw new vr(dr.INVALID_ARGUMENT,"Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to "+r+"() must be a plain document ID, but '"+c+"' contains a slash.");var h=t.path.child(zr.q(c));if(!Wr.X(h))throw new vr(dr.INVALID_ARGUMENT,"Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to "+r+"() must result in a valid document path, but '"+h+"' is not because it c
2ontains an odd number of segments.");var f=new Wr(h);u.push(Yi(e,f))}else{var l=Sf(n,r,c);u.push(l)}}return new Xs(u,o)}(this.Sf,this.firestore.l_,this.firestore.wf,t,i,r)},t.prototype.onSnapshot=function(){for(var t,e,n,r=this,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var s={},u=0;if("object"!=typeof i[u]||jf(i[u])||(s=i[u],u++),jf(i[u])){var a=i[u];i[u]=null===(t=a.next)||void 0===t?void 0:t.bind(a),i[u+1]=null===(e=a.error)||void 0===e?void 0:e.bind(a),i[u+2]=null===(n=a.complete)||void 0===n?void 0:n.bind(a)}var c={next:function(t){i[u]&&i[u](new il(r.firestore,r.Sf,t,r.f_))},error:i[u+1],complete:i[u+2]};return nl(this.Sf),this.firestore.uf().listen(this.Sf,s,c)},t.prototype.get=function(t){var e=this;nl(this.Sf);var n=this.firestore.uf();return(t&&"cache"===t.source?n.K_(this.Sf):n.Q_(this.Sf,t)).then((function(t){return new il(e.firestore,e.Sf,t,e.f_)}))},t}(),il=function(){function t(t,e,n,r){this.Af=t,this.Cf=e,this.Nf=n,this.f_=r,this.xf=null,this.Ff=null,this.metadata=new Qf(n.hasPendingWrites,n.fromCache)}return Object.defineProperty(t.prototype,"docs",{get:function(){var t=[];return this.forEach((function(e){return t.push(e)})),t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"empty",{get:function(){return this.Nf.docs.P()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.Nf.docs.size},enumerable:!1,configurable:!0}),t.prototype.forEach=function(t,e){var n=this;this.Nf.docs.forEach((function(r){t.call(e,n.kf(r,n.metadata.fromCache,n.Nf.Qt.has(r.key)))}))},Object.defineProperty(t.prototype,"query",{get:function(){return new rl(this.Cf,this.Af,this.f_)},enumerable:!1,configurable:!0}),t.prototype.docChanges=function(t){var e=!(!t||!t.includeMetadataChanges);if(e&&this.Nf.jt)throw new vr(dr.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this.xf&&this.Ff===e||(this.xf=function(t,e,n){if(t.Kt.P()){var r=0;return t.docChanges.map((function(e){var i=n(e.doc,t.fromCache,t.Qt.has(e.doc.key));return e.doc,{type:"added",doc:i,oldIndex:-1,newIndex:r++}}))}var i=t.Kt;return t.docChanges.filter((function(t){return e||3!==t.type})).map((function(e){var r=n(e.doc,t.fromCache,t.Qt.has(e.doc.key)),o=-1,s=-1;return 0!==e.type&&(o=i.indexOf(e.doc.key),i=i.delete(e.doc.key)),1!==e.type&&(s=(i=i.add(e.doc)).indexOf(e.doc.key)),{type:ul(e.type),doc:r,oldIndex:o,newIndex:s}}))}(this.Nf,e,this.kf.bind(this)),this.Ff=e),this.xf},t.prototype.isEqual=function(e){return e instanceof t&&this.Af===e.Af&&Rs(this.Cf,e.Cf)&&this.Nf.isEqual(e.Nf)&&this.f_===e.f_},t.prototype.kf=function(t,e,n){return new $f(this.Af,t.key,t,e,n,this.f_)},t}(),ol=function(t){function e(e,n,r){var i=this;if((i=t.call(this,_s(e),n,r)||this).Of=e,e.length%2!=1)throw new vr(dr.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+e.B()+" has "+e.length);return i}return i(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this.Sf.path.O()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){var t=this.Sf.path.F();return t.P()?null:new Yf(new Wr(t),this.firestore,null)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this.Sf.path.B()},enumerable:!1,configurable:!0}),e.prototype.doc=function(t){0===arguments.length&&(t=Nr.t()),Zh("CollectionReference.doc","path",t);var e=zr.q(t);return Yf.mf(this.Sf.path.child(e),this.firestore,this.f_)},e.prototype.add=function(t){var e=this.f_?this.f_.toFirestore(t):t,n=this.doc();return new Yf(n.__,this.firestore,null).set(e).then((function(){return n}))},e.prototype.withConverter=function(t){return new e(this.Of,this.firestore,t)},e}(rl);function sl(t,e,n){var r=function(t,e){if(!(t instanceof e)){if(e.name===t.constructor.name)throw new vr(dr.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");var n=nf(t);throw new vr(dr.INVALID_ARGUMENT,"Expected type '"+e.name+"', but it was: "+n)}return t}(e,Yf);if(r.firestore!==n)throw new vr(dr.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return r}function ul(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Er()}}function al(t,e,n){return t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e}var cl,hl=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.serverTimestamp=function(){var t=new ff("serverTimestamp");return t.t_="FieldValue.serverTimestamp",new e(t)},e.delete=function(){var t=new cf("deleteField");return t.t_="FieldValue.delete",new e(t)},e.arrayUnion=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new lf("arrayUnion",t)}.apply(void 0,t);return r.t_="FieldValue.arrayUnion",new e(r)},e.arrayRemove=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new pf("arrayRemove",t)}.apply(void 0,t);return r.t_="FieldValue.arrayRemove",new e(r)},e.increment=function(t){var n=function(t){return new df("increment",t)}(t);return n.t_="FieldValue.increment",new e(n)},e.prototype.isEqual=function(t){return this.u_.isEqual(t.u_)},e}(yf),fl={Firestore:Kf,GeoPoint:vf,Timestamp:qr,Blob:Rr,Transaction:Wf,WriteBatch:Xf,DocumentReference:Yf,DocumentSnapshot:Jf,Query:rl,QueryDocumentSnapshot:$f,QuerySnapsh
2ot:il,CollectionReference:ol,FieldPath:sf,FieldValue:hl,setLogLevel:function(t){var e;e=t,yr.setLogLevel(e)},CACHE_SIZE_UNLIMITED:qf};(function(t,e){t.INTERNAL.registerComponent(new pr.wA("firestore",(function(t){return function(t,e){return new Kf(t,e,new Hf)}(t.getProvider("app").getImmediate(),t.getProvider("auth-internal"))}),"PUBLIC").setServiceProps(Object.assign({},fl)))})(cl=a.Z),cl.registerVersion("@firebase/firestore","2.0.0")}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.