1/*! For license information please see d6a94a9f-54fb89e432f2d45cf8b1.js.LICENSE.txt */ 2"use strict";(self.webpackChunkhusky_site=self.webpackChunkhusky_site||[]).push([[7567],{74150:function(e,t,n){n.r(t),n.d(t,{DefaultLdsService:function(){return Cu},Events:function(){return Iu},FieldCategory:function(){return wu},FirebaseUserAuthService:function(){return vm},InputType:function(){return _u},LdsSystem:function(){return bu},OobMode:function(){return Eu},ShopifyService:function(){return Au},ThirdPartyProvider:function(){return Su},UserIdentifierType:function(){return Tu},default:function(){return NE},isErrorResult:function(){return AE}});var r=n(88943),i=n(93441),a=n(72149),s=n(96384),o=n(36564),u=n(45281);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function h(e,t,n,r){return new(n||(n=Promise))(function(i,a){function s(e){try{u(r.next(e))}catch(t){a(t)}}function o(e){try{u(r.throw(e))}catch(t){a(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,o)}u((r=r.apply(e,t||[])).next())})}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function d(){return d="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=f(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},d.apply(this,arguments)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e,t){return v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},v(e,t)}function g(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function y(e,t){if(t&&("object"===c(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return p(e)}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function k(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],s=!0,o=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);s=!0);}catch(u){o=!0,i=u}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}}(e,t)||k(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t,n,r,i,a,s){try{var o=e[a](s),u=o.value}catch(c){return void n(c)}o.done?t(u):Promise.resolve(u).then(r,i)}function _(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function s(e){b(a,r,i,s,o,"next",e)}function o(e){b(a,r,i,s,o,"throw",e)}s(void 0)})}}function E(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function S(e,t,n){return t&&I(e.prototype,t),n&&I(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function T(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||k(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},C={exports:{}};!function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(R){u=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var i=t&&t.prototype instanceof y?t:y,a=Object.create(i.prototype),s=new C(r||[]);return a._invoke=function(e,t,n){var r=f;return function(i,a){if(r===p)throw new Error("Generator is already running");if(r===v){if("throw"===i)throw a;return O()}
vendor: 5,258 bytes, line 2
2for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var o=T(s,n);if(o){if(o===g)continue;return o}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===f)throw r=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var u=h(e,t,n);if("normal"===u.type){if(r=n.done?v:d,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=v,n.method="throw",n.arg=u.arg)}}}(e,n,s),a}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(R){return{type:"throw",arg:R}}}e.wrap=l;var f="suspendedStart",d="suspendedYield",p="executing",v="completed",g={};function y(){}function m(){}function k(){}var w={};u(w,a,function(){return this});var b=Object.getPrototypeOf,_=b&&b(b(P([])));_&&_!==n&&r.call(_,a)&&(w=_);var E=k.prototype=y.prototype=Object.create(w);function I(e){["next","throw","return"].forEach(function(t){u(e,t,function(e){return this._invoke(t,e)})})}function S(e,t){function n(i,a,s,o){var u=h(e[i],e,a);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"===c(f)&&r.call(f,"__await")?t.resolve(f.__await).then(function(e){n("next",e,s,o)},function(e){n("throw",e,s,o)}):t.resolve(f).then(function(e){l.value=e,s(l)},function(e){return n("throw",e,s,o)})}o(u.arg)}var i;this._invoke=function(e,r){function a(){return new t(function(t,i){n(e,r,t,i)})}return i=i?i.then(a,a):a()}}function T(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,T(e,n),"throw"===n.method))return g;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var i=h(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function P(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,s=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return s.next=s}}return{next:O}}function O(){return{value:t,done:!0}}return m.prototype=k,u(E,"constructor",k),u(k,"constructor",m),m.displayName=u(k,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,u(e,o,"GeneratorFunction")),e.prototype=Object.create(E),e},e.awrap=function(e){return{__await:e}},I(S.prototype),u(S.prototype,s,function(){return this}),e.AsyncIterator=S,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var s=new S(l(t,n,r,i),a);return e.isGeneratorFunction(n)?s:s.next().then(function(e){return e.done?e.value:s.next()})},I(E),u(E,o,"Generator"),u(E,a,function(){return this}),u(E,"toString",function(){return"[object Generator]"}),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=P,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return o.type="throw",o.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],o=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=e,s.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];
2if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;A(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:P(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}(e.exports);try{regeneratorRuntime=t}catch(n){"object"===("undefined"==typeof globalThis?"undefined":c(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(C);var P=C.exports;function O(e,t,n){return O=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&v(i,n.prototype),i},O.apply(null,arguments)}function R(e){var t="function"==typeof Map?new Map:void 0;return R=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return O(e,arguments,f(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),v(r,e)},R(e)}function N(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return D(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return D(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function L(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=f(e);if(t){var i=f(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return y(this,n)}}var M=function(e){for(var t=[],n=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):55296==(64512&i)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},U={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray:function(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i<e.length;i+=3){var a=e[i],s=i+1<e.length,o=s?e[i+1]:0,u=i+2<e.length,c=u?e[i+2]:0,l=a>>2,h=(3&a)<<4|o>>4,f=(15&o)<<2|c>>6,d=63&c;u||(d=64,s||(f=64)),r.push(n[l],n[h],n[f],n[d])}return r.join("")},encodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(M(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){for(var t=[],n=0,r=0;n<e.length;){var i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){var a=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&a)}else if(i>239&&i<365){var s=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(s>>10)),t[r++]=String.fromCharCode(56320+(1023&s))}else{var o=e[n++],u=e[n++];
2t[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&u)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.init_();for(var n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i<e.length;){var a=n[e.charAt(i++)],s=i<e.length?n[e.charAt(i)]:0,o=++i<e.length?n[e.charAt(i)]:64,u=++i<e.length?n[e.charAt(i)]:64;if(++i,null==a||null==s||null==o||null==u)throw new F;var c=a<<2|s>>4;if(r.push(c),64!==o){var l=s<<4&240|o>>2;if(r.push(l),64!==u){var h=o<<6&192|u;r.push(h)}}}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},F=function(e){g(n,e);var t=L(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments)).name="DecodeBase64StringError",e}return S(n)}(R(Error)),j=function(e){return function(e){var t=M(e);return U.encodeByteArray(t,!0)}(e).replace(/\./g,"")},V=function(e){try{return U.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};function B(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("Unable to locate global object.")}var q=function(){try{return B().__FIREBASE_DEFAULTS__||function(){if("undefined"!=typeof process){var e={}.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0}}()||function(){if("undefined"!=typeof document){var e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(n){return}var t=e&&V(e[1]);return t&&JSON.parse(t)}}()}catch(e){return void console.info("Unable to get __FIREBASE_DEFAULTS__ due to: ".concat(e))}},z=function(){var e;return null===(e=q())||void 0===e?void 0:e.config},H=function(e){var t;return null===(t=q())||void 0===t?void 0:t["_".concat(e)]},K=function(){function e(){var t=this;E(this,e),this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(e,n){t.resolve=e,t.reject=n})}return S(e,[{key:"wrapCallback",value:function(e){var t=this;return function(n,r){n?t.reject(n):t.resolve(r),"function"==typeof e&&(t.promise.catch(function(){}),1===e.length?e(n):e(n,r))}}}]),e}();function G(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function W(){return!function(){var e,t=null===(e=q())||void 0===e?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(n.g.process)}catch(r){return!1}}()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function Q(){try{return"object"===("undefined"==typeof indexedDB?"undefined":c(indexedDB))}catch(e){return!1}}function Y(){return new Promise(function(e,t){try{var n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=function(){i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=function(){n=!1},i.onerror=function(){var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(a){t(a)}})}var X=function(e){g(n,e);var t=L(n);function n(e,r,i){var a;return E(this,n),(a=t.call(this,r)).code=e,a.customData=i,a.name="FirebaseError",Object.setPrototypeOf(p(a),n.prototype),Error.captureStackTrace&&Error.captureStackTrace(p(a),J.prototype.create),a}return S(n)}(R(Error)),J=function(){function e(t,n,r){E(this,e),this.service=t,this.serviceName=n,this.errors=r}return S(e,[{key:"create",value:function(e){var t=(arguments.length<=1?void 0:arguments[1])||{},n="".concat(this.service,"/").concat(e),r=this.errors[e],i=r?function(e,t){return e.replace($,function(e,n){var r=t[n];return null!=r?String(r):"<".concat(n,"?>")})}(r,t):"Error",a="".concat(this.serviceName,": ").concat(i," (").concat(n,").");return new X(n,a,t)}}]),e}();var $=/\{\$([^}]+)}/g;function Z(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function ee(e,t){if(e===t)return!0;for(var n=Object.keys(e),r=Object.keys(t),i=0,a=n;i<a.length;i++){var s=a[i];if(!r.includes(s))return!1;var o=e[s],u=t[s];if(te(o)&&te(u)){if(!ee(o,u))return!1}else if(o!==u)return!1}for(var c=0,l=r;c<l.length;c++){var h=l[c];if(!n.includes(h))return!1}return!0}function te(e){return null!==e&&"object"===c(e)}function ne(e){for(var t=[],n=function(){var e=w(i[r],2),n=e[0],a=e[1];Array.isArray(a)?a.forEach(function(e){t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(a))},r=0,i=Object.entries(e);r<i.length;r++)n();return t.length?"&"+t.join("&"):""}function re(e){var t={};return e.replace(/^\?/,"").split("&").forEach(function(e){if(e){var n=w(e.split("="),2),r=n[0],i=n[1];
2t[decodeURIComponent(r)]=decodeURIComponent(i)}}),t}function ie(e){var t=e.indexOf("?");if(!t)return"";var n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}var ae=function(){function e(t,n){var r=this;E(this,e),this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(function(){t(r)}).catch(function(e){r.error(e)})}return S(e,[{key:"next",value:function(e){this.forEachObserver(function(t){t.next(e)})}},{key:"error",value:function(e){this.forEachObserver(function(t){t.error(e)}),this.close(e)}},{key:"complete",value:function(){this.forEachObserver(function(e){e.complete()}),this.close()}},{key:"subscribe",value:function(e,t,n){var r,i=this;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(e,t){if("object"!==c(e)||null===e)return!1;var n,r=N(t);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i in e&&"function"==typeof e[i])return!0}}catch(a){r.e(a)}finally{r.f()}return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n}).next&&(r.next=se),void 0===r.error&&(r.error=se),void 0===r.complete&&(r.complete=se);var a=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?r.error(i.finalError):r.complete()}catch(e){}}),this.observers.push(r),a}},{key:"unsubscribeOne",value:function(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}},{key:"forEachObserver",value:function(e){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,e)}},{key:"sendOne",value:function(e,t){var n=this;this.task.then(function(){if(void 0!==n.observers&&void 0!==n.observers[e])try{t(n.observers[e])}catch(r){"undefined"!=typeof console&&console.error&&console.error(r)}})}},{key:"close",value:function(e){var t=this;this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(function(){t.observers=void 0,t.onNoObservers=void 0}))}}]),e}();function se(){}var oe=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})};function ue(e){return e&&e._delegate?e._delegate:e}function ce(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return le(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return le(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var he=function(){function e(t,n,r){E(this,e),this.name=t,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}return S(e,[{key:"setInstantiationMode",value:function(e){return this.instantiationMode=e,this}},{key:"setMultipleInstances",value:function(e){return this.multipleInstances=e,this}},{key:"setServiceProps",value:function(e){return this.serviceProps=e,this}},{key:"setInstanceCreatedCallback",value:function(e){return this.onInstanceCreated=e,this}}]),e}(),fe="[DEFAULT]",de=function(){function e(t,n){E(this,e),this.name=t,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}var t;return S(e,[{key:"get",value:function(e){var t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){var n=new K;if(this.instancesDeferred.set(t,n),this.isInitialized(t)||this.shouldAutoInitialize())try{var r=this.getOrInitializeService({instanceIdentifier:t});r&&n.resolve(r)}catch(i){}}return this.instancesDeferred.get(t).promise}},{key:"getImmediate",value:function(e){var t,n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error("Service ".concat(this.name," is not available"))}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}}},{key:"getComponent",value:function(){return this.component}},{key:"setComponent",value:function(e){if(e.name!==this.name)throw Error("Mismatching Component ".concat(e.name," for Provider ").concat(this.name,"."));if(this.component)throw Error("Component for ".concat(this.name," has already been provided"));if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:fe})}catch(u){}var t,n=ce(this.instancesDeferred.entries());try{for(n.s();!(t=n.n()).done;){var r=w(t.value,2),i=r[0],a=r[1],s=this.normalizeInstanceIdentifier(i);try{var o=this.getOrInitializeService({instanceIdentifier:s});a.resolve(o)}catch(u){}}}catch(c){n.e(c)}finally{n.f()}}}},{key:"clearInstance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fe;this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}},{key:"delete",value:(t=_(P.mark(function e(){var t;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=Array.from(this.instances.values()),e.next=3,Promise.all([].
2concat(T(t.filter(function(e){return"INTERNAL"in e}).map(function(e){return e.INTERNAL.delete()})),T(t.filter(function(e){return"_delete"in e}).map(function(e){return e._delete()}))));case 3:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})},{key:"isComponentSet",value:function(){return null!=this.component}},{key:"isInitialized",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fe;return this.instances.has(e)}},{key:"getOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fe;return this.instancesOptions.get(e)||{}}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.options,n=void 0===t?{}:t,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error("".concat(this.name,"(").concat(r,") has already been initialized"));if(!this.isComponentSet())throw Error("Component ".concat(this.name," has not been registered yet"));var i,a=this.getOrInitializeService({instanceIdentifier:r,options:n}),s=ce(this.instancesDeferred.entries());try{for(s.s();!(i=s.n()).done;){var o=w(i.value,2),u=o[0],c=o[1];r===this.normalizeInstanceIdentifier(u)&&c.resolve(a)}}catch(l){s.e(l)}finally{s.f()}return a}},{key:"onInit",value:function(e,t){var n,r=this.normalizeInstanceIdentifier(t),i=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;i.add(e),this.onInitCallbacks.set(r,i);var a=this.instances.get(r);return a&&e(a,r),function(){i.delete(e)}}},{key:"invokeOnInitCallbacks",value:function(e,t){var n=this.onInitCallbacks.get(t);if(n){var r,i=ce(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;try{a(e,t)}catch(s){}}}catch(o){i.e(o)}finally{i.f()}}}},{key:"getOrInitializeService",value:function(e){var t,n=e.instanceIdentifier,r=e.options,i=void 0===r?{}:r,a=this.instances.get(n);if(!a&&this.component&&(a=this.component.instanceFactory(this.container,{instanceIdentifier:(t=n,t===fe?void 0:t),options:i}),this.instances.set(n,a),this.instancesOptions.set(n,i),this.invokeOnInitCallbacks(a,n),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,n,a)}catch(s){}return a||null}},{key:"normalizeInstanceIdentifier",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fe;return this.component?this.component.multipleInstances?e:fe:e}},{key:"shouldAutoInitialize",value:function(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}]),e}();var pe,ve,ge=function(){function e(t){E(this,e),this.name=t,this.providers=new Map}return S(e,[{key:"addComponent",value:function(e){var t=this.getProvider(e.name);if(t.isComponentSet())throw new Error("Component ".concat(e.name," has already been registered with ").concat(this.name));t.setComponent(e)}},{key:"addOrOverwriteComponent",value:function(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}},{key:"getProvider",value:function(e){if(this.providers.has(e))return this.providers.get(e);var t=new de(e,this);return this.providers.set(e,t),t}},{key:"getProviders",value:function(){return Array.from(this.providers.values())}}]),e}();!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(ve||(ve={}));var ye,me,ke={debug:ve.DEBUG,verbose:ve.VERBOSE,info:ve.INFO,warn:ve.WARN,error:ve.ERROR,silent:ve.SILENT},we=ve.INFO,be=(x(pe={},ve.DEBUG,"log"),x(pe,ve.VERBOSE,"log"),x(pe,ve.INFO,"info"),x(pe,ve.WARN,"warn"),x(pe,ve.ERROR,"error"),pe),_e=function(e,t){if(!(t<e.logLevel)){var n=(new Date).toISOString(),r=be[t];if(!r)throw new Error("Attempted to log a message with an invalid logType (value: ".concat(t,")"));for(var i,a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];(i=console)[r].apply(i,["[".concat(n,"] ").concat(e.name,":")].concat(s))}},Ee=function(){function e(t){E(this,e),this.name=t,this._logLevel=we,this._logHandler=_e,this._userLogHandler=null}return S(e,[{key:"logLevel",get:function(){return this._logLevel},set:function(e){if(!(e in ve))throw new TypeError('Invalid value "'.concat(e,'" assigned to `logLevel`'));this._logLevel=e}},{key:"setLogLevel",value:function(e){this._logLevel="string"==typeof e?ke[e]:e}},{key:"logHandler",get:function(){return this._logHandler},set:function(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}},{key:"userLogHandler",get:function(){return this._userLogHandler},set:function(e){this._userLogHandler=e}},{key:"debug",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,ve.DEBUG].concat(t)),this._logHandler.apply(this,[this,ve.DEBUG].concat(t))}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,ve.VERBOSE].concat(t)),this._logHandler.apply(this,[this,ve.VERBOSE].concat(t))}},{key:"info",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,ve.INFO].concat(t)),this._logHandler.apply(this,[this,ve.INFO].concat(t))}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,ve.WARN].concat(t)),this._logHandler.apply(this,[this,ve.WARN].concat(t))}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,ve.ERROR].concat(t)),this._logHandler.apply(this,[this,ve.ERROR].concat(t))}}]),e}();var Ie=new WeakMap,Se=new WeakMap,Te=new WeakMap,xe=new WeakMap,Ae=new WeakMap;var Ce={get:function(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return Se.get(e);if("objectStoreNames"===t)return e.objectStoreNames||Te.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Re(e[t])},set:function(e,t,n){return e[t]=n,!0},has:function(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function Pe(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(me||(me=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(Ne(this),n),Re(Ie.get(this))}:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];
2return Re(e.apply(Ne(this),n))}:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var a=e.call.apply(e,[Ne(this),t].concat(r));return Te.set(a,t.sort?t.sort():[t]),Re(a)}}function Oe(e){return"function"==typeof e?Pe(e):(e instanceof IDBTransaction&&function(e){if(!Se.has(e)){var t=new Promise(function(t,n){var r=function(){e.removeEventListener("complete",i),e.removeEventListener("error",a),e.removeEventListener("abort",a)},i=function(){t(),r()},a=function(){n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",a),e.addEventListener("abort",a)});Se.set(e,t)}}(e),t=e,(ye||(ye=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(function(e){return t instanceof e})?new Proxy(e,Ce):e);var t}function Re(e){if(e instanceof IDBRequest)return t=e,(n=new Promise(function(e,n){var r=function(){t.removeEventListener("success",i),t.removeEventListener("error",a)},i=function(){e(Re(t.result)),r()},a=function(){n(t.error),r()};t.addEventListener("success",i),t.addEventListener("error",a)})).then(function(e){e instanceof IDBCursor&&Ie.set(e,t)}).catch(function(){}),Ae.set(n,t),n;var t,n;if(xe.has(e))return xe.get(e);var r=Oe(e);return r!==e&&(xe.set(e,r),Ae.set(r,e)),r}var Ne=function(e){return Ae.get(e)};function De(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?De(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Me,Ue,Fe=["get","getKey","getAll","getAllKeys","count"],je=["put","add","delete","clear"],Ve=new Map;function Be(e,t){if(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t){if(Ve.get(t))return Ve.get(t);var n=t.replace(/FromIndex$/,""),r=t!==n,i=je.includes(n);if(n in(r?IDBIndex:IDBObjectStore).prototype&&(i||Fe.includes(n))){var a=function(){var e=_(P.mark(function e(t){var a,s,o,u,c,l,h=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:for(s=this.transaction(t,i?"readwrite":"readonly"),o=s.store,u=h.length,c=new Array(u>1?u-1:0),l=1;l<u;l++)c[l-1]=h[l];return r&&(o=o.index(c.shift())),e.next=6,Promise.all([(a=o)[n].apply(a,c),i&&s.done]);case 6:return e.abrupt("return",e.sent[0]);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}();return Ve.set(t,a),a}}}function qe(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ze(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ze(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function ze(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Ce=function(e){return Le(Le({},e),{},{get:function(t,n,r){return Be(t,n)||e.get(t,n,r)},has:function(t,n){return!!Be(t,n)||e.has(t,n)}})}(Ce);var He=function(){function e(t){E(this,e),this.container=t}return S(e,[{key:"getPlatformInfoString",value:function(){return this.container.getProviders().map(function(e){if(function(e){var t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){var t=e.getImmediate();return"".concat(t.library,"/").concat(t.version)}return null}).filter(function(e){return e}).join(" ")}}]),e}();var Ke="@firebase/app",Ge="0.10.5",We=new Ee("@firebase/app"),Qe="[DEFAULT]",Ye=(x(Me={},Ke,"fire-core"),x(Me,"@firebase/app-compat","fire-core-compat"),x(Me,"@firebase/analytics","fire-analytics"),x(Me,"@firebase/analytics-compat","fire-analytics-compat"),x(Me,"@firebase/app-check","fire-app-check"),x(Me,"@firebase/app-check-compat","fire-app-check-compat"),x(Me,"@firebase/auth","fire-auth"),x(Me,"@firebase/auth-compat","fire-auth-compat"),x(Me,"@firebase/database","fire-rtdb"),x(Me,"@firebase/database-compat","fire-rtdb-compat"),x(Me,"@firebase/functions","fire-fn"),x(Me,"@firebase/functions-compat","fire-fn-compat"),x(Me,"@firebase/installations","fire-iid"),x(Me,"@firebase/installations-compat","fire-iid-compat"),x(Me,"@firebase/messaging","fire-fcm"),x(Me,"@firebase/messaging-compat","fire-fcm-compat"),x(Me,"@firebase/performance","fire-perf"),x(Me,"@firebase/performance-compat","fire-perf-compat"),x(Me,"@firebase/remote-config","fire-rc"),x(Me,"@firebase/remote-config-compat","fire-rc-compat"),x(Me,"@firebase/storage","fire-gcs"),x(Me,"@firebase/storage-compat","fire-gcs-compat"),x(Me,"@firebase/firestore","fire-fst"),x(Me,"@firebase/firestore-compat","fire-fst-compat"),x(Me,"@firebase/vertexai-preview","fire-vertex"),x(Me,"fire-js","fire-js"),x(Me,"firebase","fire-js-all"),Me),Xe=new Map,Je=new Map,$e=new Map;function Ze(e,t){try{e.container.addComponent(t)}catch(n){We.debug("Component ".concat(t.name," failed to register with FirebaseApp ").concat(e.name),n)}}function et(e){var t=e.name;if($e.has(t))return We.debug("There were multiple attempts to register component ".concat(t,".")),!1;$e.set(t,e);var n,r=qe(Xe.values());try{for(r.s();!(n=r.n()).done;){Ze(n.value,e)}}catch(s){r.e(s)}finally{r.f()}var i,a=qe(Je.values());try{for(a.s();!(i=a.n()).done;){Ze(i.value,e)}}catch(s){a.e(s)}finally{a.f()}return!0}function tt(e,t){var n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function nt(e){return void 0!==e.settings}var rt=(x(Ue={},"no-app","No Firebase App '{$appName}' has been created - call initializeApp() first"),x(Ue,"bad-app-name","Illegal App name: '{$appName}'"),x(Ue,"duplicate-app","Firebase App named '{$appName}' already exists with different options or config"),x(Ue,"app-deleted","Firebase App named '{$appName}' already deleted"),x(Ue,"server-app-deleted","Firebase Server App has been deleted"),x(Ue,"no-options","Need to provide options, when not being deployed to hosting via source."),x(Ue,"invali
2d-app-argument","firebase.{$appName}() takes either no argument or a Firebase App instance."),x(Ue,"invalid-log-argument","First argument to `onLog` must be null or a function."),x(Ue,"idb-open","Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}."),x(Ue,"idb-get","Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}."),x(Ue,"idb-set","Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}."),x(Ue,"idb-delete","Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."),x(Ue,"finalization-registry-not-supported","FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry."),x(Ue,"invalid-server-app-environment","FirebaseServerApp is not for use in browser environments."),Ue),it=new J("app","Firebase",rt),at=function(){function e(t,n,r){var i=this;E(this,e),this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new he("app",function(){return i},"PUBLIC"))}return S(e,[{key:"automaticDataCollectionEnabled",get:function(){return this.checkDestroyed(),this._automaticDataCollectionEnabled},set:function(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}},{key:"name",get:function(){return this.checkDestroyed(),this._name}},{key:"options",get:function(){return this.checkDestroyed(),this._options}},{key:"config",get:function(){return this.checkDestroyed(),this._config}},{key:"container",get:function(){return this._container}},{key:"isDeleted",get:function(){return this._isDeleted},set:function(e){this._isDeleted=e}},{key:"checkDestroyed",value:function(){if(this.isDeleted)throw it.create("app-deleted",{appName:this._name})}}]),e}(),st="10.12.2";function ot(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e;"object"!==c(t)&&(t={name:t});var r=Object.assign({name:Qe,automaticDataCollectionEnabled:!1},t),i=r.name;if("string"!=typeof i||!i)throw it.create("bad-app-name",{appName:String(i)});if(n||(n=z()),!n)throw it.create("no-options");var a=Xe.get(i);if(a){if(ee(n,a.options)&&ee(r,a.config))return a;throw it.create("duplicate-app",{appName:i})}var s,o=new ge(i),u=qe($e.values());try{for(u.s();!(s=u.n()).done;){var l=s.value;o.addComponent(l)}}catch(f){u.e(f)}finally{u.f()}var h=new at(n,r,o);return Xe.set(i,h),h}function ut(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Qe,t=Xe.get(e);if(!t&&e===Qe&&z())return ot();if(!t)throw it.create("no-app",{appName:e});return t}function ct(e,t,n){var r,i=null!==(r=Ye[e])&&void 0!==r?r:e;n&&(i+="-".concat(n));var a=i.match(/\s|\//),s=t.match(/\s|\//);if(a||s){var o=['Unable to register library "'.concat(i,'" with version "').concat(t,'":')];return a&&o.push('library name "'.concat(i,'" contains illegal characters (whitespace or "/")')),a&&s&&o.push("and"),s&&o.push('version name "'.concat(t,'" contains illegal characters (whitespace or "/")')),void We.warn(o.join(" "))}et(new he("".concat(i,"-version"),function(){return{library:i,version:t}},"VERSION"))}var lt="firebase-heartbeat-store",ht=null;function ft(){return ht||(ht=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.blocked,i=n.upgrade,a=n.blocking,s=n.terminated,o=indexedDB.open(e,t),u=Re(o);return i&&o.addEventListener("upgradeneeded",function(e){i(Re(o.result),e.oldVersion,e.newVersion,Re(o.transaction),e)}),r&&o.addEventListener("blocked",function(e){return r(e.oldVersion,e.newVersion,e)}),u.then(function(e){s&&e.addEventListener("close",function(){return s()}),a&&e.addEventListener("versionchange",function(e){return a(e.oldVersion,e.newVersion,e)})}).catch(function(){}),u}("firebase-heartbeat-database",1,{upgrade:function(e,t){if(0===t)try{e.createObjectStore(lt)}catch(n){console.warn(n)}}}).catch(function(e){throw it.create("idb-open",{originalErrorMessage:e.message})})),ht}function dt(e){return pt.apply(this,arguments)}function pt(){return(pt=_(P.mark(function e(t){var n,r,i,a;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,ft();case 3:return n=e.sent,r=n.transaction(lt),e.next=7,r.objectStore(lt).get(yt(t));case 7:return i=e.sent,e.next=10,r.done;case 10:return e.abrupt("return",i);case 13:e.prev=13,e.t0=e.catch(0),e.t0 instanceof X?We.warn(e.t0.message):(a=it.create("idb-get",{originalErrorMessage:null===e.t0||void 0===e.t0?void 0:e.t0.message}),We.warn(a.message));case 16:case"end":return e.stop()}},e,null,[[0,13]])}))).apply(this,arguments)}function vt(e,t){return gt.apply(this,arguments)}function gt(){return(gt=_(P.mark(function e(t,n){var r,i,a,s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,ft();case 3:return r=e.sent,i=r.transaction(lt,"readwrite"),a=i.objectStore(lt),e.next=8,a.put(n,yt(t));case 8:return e.next=10,i.done;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),e.t0 instanceof X?We.warn(e.t0.message):(s=it.create("idb-set",{originalErrorMessage:null===e.t0||void 0===e.t0?void 0:e.t0.message}),We.warn(s.message));case 15:case"end":return e.stop()}},e,null,[[0,12]])}))).apply(this,arguments)}function yt(e){return"".concat(e.name,"!").concat(e.options.appId)}var mt=function(){function e(t){var n=this;E(this,e),this.container=t,this._heartbeatsCache=null;var r=this.container.getProvider("app").getImmediate();this._storage=new Et(r),this._heartbeatsCachePromise=this._storage.read().then(function(e){return n._heartbeatsCache=e,e})}var t,n;return S(e,[{key:"triggerHeartbeat",value:(n=_(P.mark(function e(){var t,n,r,i,a;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.container.getProvider("platform-logger").getImmediate(),i=r.getPlatformInfoString(),a=kt(),null!=(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)){e.next=9;break}return e.next=6,this._heartbeatsCachePromise;case 6:if(this._heartbeatsCache=e.sent,null!=(null===(n=this._heartbeatsCache)||void 0===n?void 0:n.heartbeats)){e.next=9;break}return e.abrupt("return");case 9:if(this._heartbeatsCache.lastSentHeartbeatDate!==a&&!this._heartbeatsCache.heartbeats.some(function(e){return e.date===a})){e.next=13;break}return e.abrupt("return");case 13:this._heartbeatsCache.heartbeats.push({date:a,agent:i});case 14:return this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(function(e){var t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),e.abrupt("return",this._storage.overwrite(this._heartbeatsCache));case 16:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"getHeartbeatsHeader",value:(t=_(P.mark(function e(){var t,n,r,i,a,s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==this._heartbeatsCache){e.next=3;break}return e.next=3,this._heartbeatsCachePromise;case 3:if(null!=(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)&&0!==this._heartbeatsCache.heartbeats.length){e.next=5;break}return e.abrupt("return","");case 5:if(n=kt(),r=wt(this._heartbeatsCache.heartbeats),i=r.heartbeatsToSend,a=r.unsentEntries,s=j(JSON.stringify({version:2,heartbeats:i})),this._heartbeatsCache.lastSentHeartbeatDate=n,!(a.length>0)){e.next=15;break}return this._heartbeatsCache.heartbeats=a,e.next=13,this._storage.overwrite(this._heartbeatsCache);case 13:e.next=17;break;case 15:this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache);case 17:return e.abrupt("return",s);case 18:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})}]),e}();function kt(){return(new Date).toISOString().substring(0,10)}function wt(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024,r=[],i=e.slice(),a=qe(e);try{var s=function(){var e=t.value,a=r.find(function(t){return t.agent===e.agent});if(a){if(a.dates.push(e.date),It(r)>n)return a.dates.pop(),"break"}else if(r.push({agent:e.agent,dates:[e.date]}),It(r)>n)return r.pop(),"break";i=i.slice(1)};for(a.s();!(t=a.n()).done;){if("break"===s())break}}catch(o){a.e(o)}finally{a.f()}return{heartbeatsToSend:r,unsentEntries:i}}var bt,_t,Et=function(){function e(t){E(this,e),this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}var t,n,r;return S(e,[{key:"runIndexedDBEnvironmentCheck",value:(r=_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Q()){e.next=4;break}return e.abrupt("return",!1);case 4:return e.abrupt("return",Y().then(function(){return!0}).catch(function(){return!1}));case 5:case"end":return e.stop()}},e)})),function(){return r.apply(this,arguments)})},{key:"read",value:function(){var e=_(P.mark(function e(){var t;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._canUseIndexedDBPromise;case 2:if(e.sent){e.next=7;break}return e.abrupt("return",{heartbeats:[]});case 7:return e.next=9,dt(this.app);case 9:if(!(null==(t=e.sent)?void 0:t.heartbeats)){e.next=14;break}return e.abrupt("return",t);case 14:return e.abrupt("return",{heartbeats:[]});case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}
2,{key:"overwrite",value:(n=_(P.mark(function e(t){var n,r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._canUseIndexedDBPromise;case 2:if(e.sent){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this.read();case 9:return r=e.sent,e.abrupt("return",vt(this.app,{lastSentHeartbeatDate:null!==(n=t.lastSentHeartbeatDate)&&void 0!==n?n:r.lastSentHeartbeatDate,heartbeats:t.heartbeats}));case 11:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"add",value:(t=_(P.mark(function e(t){var n,r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._canUseIndexedDBPromise;case 2:if(e.sent){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this.read();case 9:return r=e.sent,e.abrupt("return",vt(this.app,{lastSentHeartbeatDate:null!==(n=t.lastSentHeartbeatDate)&&void 0!==n?n:r.lastSentHeartbeatDate,heartbeats:[].concat(T(r.heartbeats),T(t.heartbeats))}));case 11:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})}]),e}();function It(e){return j(JSON.stringify({version:2,heartbeats:e})).length}function St(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=f(e);if(t){var i=f(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return y(this,n)}}function Tt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return xt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function xt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}bt="",et(new he("platform-logger",function(e){return new He(e)},"PRIVATE")),et(new he("heartbeat",function(e){return new mt(e)},"PRIVATE")),ct(Ke,Ge,bt),ct(Ke,Ge,"esm2017"),ct("fire-js","");var At="facebook.com",Ct="google.com",Pt="password";function Ot(){return x({},"dependent-sdk-initialized-before-auth","Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK.")}var Rt=Ot,Nt=new J("auth","Firebase",Ot()),Dt={ADMIN_ONLY_OPERATION:"auth/admin-restricted-operation",ARGUMENT_ERROR:"auth/argument-error",APP_NOT_AUTHORIZED:"auth/app-not-authorized",APP_NOT_INSTALLED:"auth/app-not-installed",CAPTCHA_CHECK_FAILED:"auth/captcha-check-failed",CODE_EXPIRED:"auth/code-expired",CORDOVA_NOT_READY:"auth/cordova-not-ready",CORS_UNSUPPORTED:"auth/cors-unsupported",CREDENTIAL_ALREADY_IN_USE:"auth/credential-already-in-use",CREDENTIAL_MISMATCH:"auth/custom-token-mismatch",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"auth/requires-recent-login",DEPENDENT_SDK_INIT_BEFORE_AUTH:"auth/dependent-sdk-initialized-before-auth",DYNAMIC_LINK_NOT_ACTIVATED:"auth/dynamic-link-not-activated",EMAIL_CHANGE_NEEDS_VERIFICATION:"auth/email-change-needs-verification",EMAIL_EXISTS:"auth/email-already-in-use",EMULATOR_CONFIG_FAILED:"auth/emulator-config-failed",EXPIRED_OOB_CODE:"auth/expired-action-code",EXPIRED_POPUP_REQUEST:"auth/cancelled-popup-request",INTERNAL_ERROR:"auth/internal-error",INVA
2LID_API_KEY:"auth/invalid-api-key",INVALID_APP_CREDENTIAL:"auth/invalid-app-credential",INVALID_APP_ID:"auth/invalid-app-id",INVALID_AUTH:"auth/invalid-user-token",INVALID_AUTH_EVENT:"auth/invalid-auth-event",INVALID_CERT_HASH:"auth/invalid-cert-hash",INVALID_CODE:"auth/invalid-verification-code",INVALID_CONTINUE_URI:"auth/invalid-continue-uri",INVALID_CORDOVA_CONFIGURATION:"auth/invalid-cordova-configuration",INVALID_CUSTOM_TOKEN:"auth/invalid-custom-token",INVALID_DYNAMIC_LINK_DOMAIN:"auth/invalid-dynamic-link-domain",INVALID_EMAIL:"auth/invalid-email",INVALID_EMULATOR_SCHEME:"auth/invalid-emulator-scheme",INVALID_IDP_RESPONSE:"auth/invalid-credential",INVALID_LOGIN_CREDENTIALS:"auth/invalid-credential",INVALID_MESSAGE_PAYLOAD:"auth/invalid-message-payload",INVALID_MFA_SESSION:"auth/invalid-multi-factor-session",INVALID_OAUTH_CLIENT_ID:"auth/invalid-oauth-client-id",INVALID_OAUTH_PROVIDER:"auth/invalid-oauth-provider",INVALID_OOB_CODE:"auth/invalid-action-code",INVALID_ORIGIN:"auth/unauthorized-domain",INVALID_PASSWORD:"auth/wrong-password",INVALID_PERSISTENCE:"auth/invalid-persistence-type",INVALID_PHONE_NUMBER:"auth/invalid-phone-number",INVALID_PROVIDER_ID:"auth/invalid-provider-id",INVALID_RECIPIENT_EMAIL:"auth/invalid-recipient-email",INVALID_SENDER:"auth/invalid-sender",INVALID_SESSION_INFO:"auth/invalid-verification-id",INVALID_TENANT_ID:"auth/invalid-tenant-id",MFA_INFO_NOT_FOUND:"auth/multi-factor-info-not-found",MFA_REQUIRED:"auth/multi-factor-auth-required",MISSING_ANDROID_PACKAGE_NAME:"auth/missing-android-pkg-name",MISSING_APP_CREDENTIAL:"auth/missing-app-credential",MISSING_AUTH_DOMAIN:"auth/auth-domain-config-required",MISSING_CODE:"auth/missing-verification-code",MISSING_CONTINUE_URI:"auth/missing-continue-uri",MISSING_IFRAME_START:"auth/missing-iframe-start",MISSING_IOS_BUNDLE_ID:"auth/missing-ios-bundle-id",MISSING_OR_INVALID_
2NONCE:"auth/missing-or-invalid-nonce",MISSING_MFA_INFO:"auth/missing-multi-factor-info",MISSING_MFA_SESSION:"auth/missing-multi-factor-session",MISSING_PHONE_NUMBER:"auth/missing-phone-number",MISSING_SESSION_INFO:"auth/missing-verification-id",MODULE_DESTROYED:"auth/app-deleted",NEED_CONFIRMATION:"auth/account-exists-with-different-credential",NETWORK_REQUEST_FAILED:"auth/network-request-failed",NULL_USER:"auth/null-user",NO_AUTH_EVENT:"auth/no-auth-event",NO_SUCH_PROVIDER:"auth/no-such-provider",OPERATION_NOT_ALLOWED:"auth/operation-not-allowed",OPERATION_NOT_SUPPORTED:"auth/operation-not-supported-in-this-environment",POPUP_BLOCKED:"auth/popup-blocked",POPUP_CLOSED_BY_USER:"auth/popup-closed-by-user",PROVIDER_ALREADY_LINKED:"auth/provider-already-linked",QUOTA_EXCEEDED:"auth/quota-exceeded",REDIRECT_CANCELLED_BY_USER:"auth/redirect-cancelled-by-user",REDIRECT_OPERATION_PENDING:"auth/redirect-operation-pending",REJECTED_CREDENTIAL:"auth/rejected-credential",SECOND_FACTOR_ALREADY_ENROLLED:"auth/second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"auth/maximum-second-factor-count-exceeded",TENANT_ID_MISMATCH:"auth/tenant-id-mismatch",TIMEOUT:"auth/timeout",TOKEN_EXPIRED:"auth/user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"auth/too-many-requests",UNAUTHORIZED_DOMAIN:"auth/unauthorized-continue-uri",UNSUPPORTED_FIRST_FACTOR:"auth/unsupported-first-factor",UNSUPPORTED_PERSISTENCE:"auth/unsupported-persistence-type",UNSUPPORTED_TENANT_OPERATION:"auth/unsupported-tenant-operation",UNVERIFIED_EMAIL:"auth/unverified-email",USER_CANCELLED:"auth/user-cancelled",USER_DELETED:"auth/user-not-found",USER_DISABLED:"auth/user-disabled",USER_MISMATCH:"auth/user-mismatch",USER_SIGNED_OUT:"auth/user-signed-out",WEAK_PASSWORD:"auth/weak-password",WEB_STORAGE_UNSUPPORTED:"auth/web-storage-unsupported",ALREADY_INITIALIZED:"auth/already-initialized",RECAPTCHA_NOT_ENABLED:"auth/recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"auth/missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"auth/invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"auth/invalid-recaptcha-action",MISSING_CLIENT_TYPE:"auth/missing-client-type",MISSING_RECAPTCHA_VERSION:"auth/missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"auth/invalid-recaptcha-version",INVALID_REQ_TYPE:"auth/invalid-req-type"},Lt=new Ee("@firebase/auth");function Mt(e){if(Lt.logLevel<=ve.WARN){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];Lt.warn.apply(Lt,["Auth (".concat(st,"): ").concat(e)].concat(n))}}function Ut(e){if(Lt.logLevel<=ve.ERROR){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];Lt.error.apply(Lt,["Auth (".concat(st,"): ").concat(e)].concat(n))}}function Ft(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw zt.apply(void 0,[e].concat(n))}function jt(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return zt.apply(void 0,[e].concat(n))}function Vt(e,t,n){var r=Object.assign(Object.assign({},Rt()),x({},t,n));return new J("auth","Firebase",r).create(t,{appName:e.name})}function Bt(e){return Vt(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function qt(e,t,n){if(!(t instanceof n))throw n.name!==t.constructor.name&&Ft(e,"argument-error"),Vt(e,"argument-error","Type of ".concat(t.constructor.name," does not match expected instance.")+"Did you pass a reference from a different Auth SDK?")}function zt(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if("string"!=typeof e){var i,a=n[0],s=T(n.slice(1));return s[0]&&(s[0].appName=e.name),(i=e._errorFactory).create.apply(i,[a].concat(T(s)))}return Nt.create.apply(Nt,[e].concat(n))}function Ht(e,t){if(!e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];throw zt.apply(void 0,[t].concat(r))}}function Kt(e){var t="INTERNAL ASSERTION FAILED: "+e;throw Ut(t),new Error(t)}function Gt(e,t){e||Kt(t)}function Wt(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function Qt(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}function Yt(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Qt()&&"https:"!==Qt()&&!function(){var e="object"===("undefined"==typeof chrome?"undefined":c(chrome))?chrome.runtime:"object"===("undefined"==typeof browser?"undefined":c(browser))?browser.runtime:void 0;return"object"===c(e)&&void 0!==e.id}()&&!("connection"in navigator)||navigator.onLine}var Xt=function(){function e(t,n){E(this,e),this.shortDelay=t,this.longDelay=n,Gt(n>
2t,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(G())||"object"===("undefined"==typeof navigator?"undefined":c(navigator))&&"ReactNative"===navigator.product}return S(e,[{key:"get",value:function(){return Yt()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}]),e}();function Jt(e,t){Gt(e.emulator,"Emulator should always be set here");var n=e.emulator.url;return t?"".concat(n).concat(t.startsWith("/")?t.slice(1):t):n}var $t=function(){function e(){E(this,e)}return S(e,null,[{key:"initialize",value:function(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}},{key:"fetch",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void Kt("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")})},{key:"headers",value:function(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void Kt("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}},{key:"response",value:function(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void Kt("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}]),e}(),Zt=(x(_t={},"CREDENTIAL_MISMATCH","custom-token-mismatch"),x(_t,"MISSING_CUSTOM_TOKEN","internal-error"),x(_t,"INVALID_IDENTIFIER","invalid-email"),x(_t,"MISSING_CONTINUE_URI","internal-error"),x(_t,"INVALID_PASSWORD","wrong-password"),x(_t,"MISSING_PASSWORD","missing-password"),x(_t,"INVALID_LOGIN_CREDENTIALS","invalid-credential"),x(_t,"EMAIL_EXISTS","email-already-in-use"),x(_t,"PASSWORD_LOGIN_DISABLED","operation-not-allowed"),x(_t,"INVALID_IDP_RESPONSE","invalid-credential"),x(_t,"INVALID_PENDING_TOKEN","invalid-credential"),x(_t,"FEDERATED_USER_ID_ALREADY_LINKED","credential-already-in-use"),x(_t,"MISSING_REQ_TYPE","internal-error"),x(_t,"EMAIL_NOT_FOUND","user-not-found"),x(_t,"RESET_PASSWORD_EXCEED_LIMIT","too-many-requests"),x(_t,"EXPIRED_OOB_CODE","expired-action-code"),x(_t,"INVALID_OOB_CODE","invalid-action-code"),x(_t,"MISSING_OOB_CODE","internal-error"),x(_t,"CREDENTIAL_TOO_OLD_LOGIN_AGAIN","requires-recent-login"),x(_t,"INVALID_ID_TOKEN","invalid-user-token"),x(_t,"TOKEN_EXPIRED","user-token-expired"),x(_t,"USER_NOT_FOUND","user-token-expired"),x(_t,"TOO_MANY_ATTEMPTS_TRY_LATER","too-many-requests"),x(_t,"PASSWORD_DOES_NOT_MEET_REQUIREMENTS","password-does-not-meet-requirements"),x(_t,"INVALID_CODE","invalid-verification-code"),x(_t,"INVALID_SESSION_INFO","invalid-verification-id"),x(_t,"INVALID_TEMPORARY_PROOF","invalid-credential"),x(_t,"MISSING_SESSION_INFO","missing-verification-id"),x(_t,"SESSION_EXPIRED","code-expired"),x(_t,"MISSING_ANDROID_PACKAGE_NAME","missing-android-pkg-name"),x(_t,"UNAUTHORIZED_DOMAIN","unauthorized-continue-uri"),x(_t,"INVALID_OAUTH_CLIENT_ID","invalid-oauth-client-id"),x(_t,"ADMIN_ONLY_OPERATION","admin-restricted-operation"),x(_t,"INVALID_MFA_PENDING_CREDENTIAL","invalid-multi-factor-session"),x(_t,"MFA_ENROLLMENT_NOT_FOUND","multi-factor-info-not-found"),x(_t,"MISSING_MFA_ENROLLMENT_ID","missing-multi-factor-info"),x(_t,"MISSING_MFA_PENDING_CREDENTIAL","missing-multi-factor-session"),x(_t,"SECOND_FACTOR_EXISTS","second-factor-already-in-use"),x(_t,"SECOND_FACTOR_LIMIT_EXCEEDED","maximum-second-factor-count-exceeded"),x(_t,"BLOCKING_FUNCTION_ERROR_RESPONSE","internal-error"),x(_t,"RECAPTCHA_NOT_ENABLED","recaptcha-not-enabled"),x(_t,"MISSING_RECAPTCHA_TOKEN","missing-rec
2aptcha-token"),x(_t,"INVALID_RECAPTCHA_TOKEN","invalid-recaptcha-token"),x(_t,"INVALID_RECAPTCHA_ACTION","invalid-recaptcha-action"),x(_t,"MISSING_CLIENT_TYPE","missing-client-type"),x(_t,"MISSING_RECAPTCHA_VERSION","missing-recaptcha-version"),x(_t,"INVALID_RECAPTCHA_VERSION","invalid-recaptcha-version"),x(_t,"INVALID_REQ_TYPE","invalid-req-type"),_t),en=new Xt(3e4,6e4);function tn(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}function nn(e,t,n,r){return rn.apply(this,arguments)}function rn(){return rn=_(P.mark(function e(t,n,r,i){var a,s=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=s.length>4&&void 0!==s[4]?s[4]:{},e.abrupt("return",an(t,a,_(P.mark(function e(){var a,s,o,u;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a={},s={},i&&("GET"===n?s=i:a={body:JSON.stringify(i)}),o=ne(Object.assign({key:t.config.apiKey},s)).slice(1),e.next=6,t._getAdditionalHeaders();case 6:return(u=e.sent)["Content-Type"]="application/json",t.languageCode&&(u["X-Firebase-Locale"]=t.languageCode),e.abrupt("return",$t.fetch()(cn(t,t.config.apiHost,r,o),Object.assign({method:n,headers:u,referrerPolicy:"no-referrer"},a)));case 10:case"end":return e.stop()}},e)}))));case 2:case"end":return e.stop()}},e)})),rn.apply(this,arguments)}function an(e,t,n){return sn.apply(this,arguments)}function sn(){return(sn=_(P.mark(function e(t,n,r){var i,a,s,o,u,c,l,h,f,d;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t._canInitEmulator=!1,i=Object.assign(Object.assign({},Zt),n),e.prev=2,a=new hn(t),e.next=6,Promise.race([r(),a.promise]);case 6:return s=e.sent,a.clearNetworkTimeout(),e.next=10,s.json();case 10:if(!("needConfirmation"in(o=e.sent))){e.next=13;break}throw fn(t,"account-exists-with-different-credential",o);case 13:if(!s.ok||"errorMessage"in o){e.next=17;break}return e.abrupt("return",o);case 17:if(u=s.ok?o.errorMessage:o.error.message,c=u.split(" : "),l=w(c,2),h=l[0],f=l[1],"FEDERATED_USER_ID_ALREADY_LINKED"!==h){e.next=23;break}throw fn(t,"credential-already-in-use",o);case 23:if("EMAIL_EXISTS"!==h){e.next=27;break}throw fn(t,"email-already-in-use",o);case 27:if("USER_DISABLED"!==h){e.next=29;break}throw fn(t,"user-disabled",o);case 29:if(d=i[h]||h.toLowerCase().replace(/[_\s]+/g,"-"),!f){e.next=34;break}throw Vt(t,d,f);case 34:Ft(t,d);case 35:e.next=42;break;case 37:if(e.prev=37,e.t0=e.catch(2),!(e.t0 instanceof X)){e.next=41;break}throw e.t0;case 41:Ft(t,"network-request-failed",{message:String(e.t0)});case 42:case"end":return e.stop()}},e,null,[[2,37]])}))).apply(this,arguments)}function on(e,t,n,r){return un.apply(this,arguments)}function un(){return un=_(P.mark(function e(t,n,r,i){var a,s,o=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.length>4&&void 0!==o[4]?o[4]:{},e.next=3,nn(t,n,r,i,a);case 3:return"mfaPendingCredential"in(s=e.sent)&&Ft(t,"multi-factor-auth-required",{_serverResponse:s}),e.abrupt("return",s);case 6:case"end":return e.stop()}},e)})),un.apply(this,arguments)}function cn(e,t,n,r){var i="".concat(t).concat(n,"?").concat(r);return e.config.emulator?Jt(e.config,i):"".concat(e.config.apiScheme,"://").concat(i)}function ln(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}var hn=function(){function e(t){var n=this;E(this,e),this.auth=t,this.timer=null,this.promise=new Promise(function(e,t){n.timer=setTimeout(function(){return t(jt(n.auth,"network-request-failed"))},en.get())})}return S(e,[{key:"clearNetworkTimeout",value:function(){clearTimeout(this.timer)}}]),e}();function fn(e,t,n){var r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);var i=jt(e,t,r);return i.customData._tokenResponse=n,i}function dn(e){return void 0!==e&&void 0!==e.enterprise}var pn=function(){function e(t){if(E(this,e),this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}return S(e,[{key:"getProviderEnforcementState",value:function(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;var t,n=Tt(this.recaptchaEnforcementState);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.provider&&r.provider===e)return ln(r.enforcementState)}}catch(i){n.e(i)}finally{n.f()}return null}},{key:"isProviderEnabled",value:function(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}}]),e}();function vn(e,t){return gn.apply(this,arguments)}function gn(){return(gn=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",nn(t,"GET","/v2/recaptchaConfig",tn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function yn(e,t){return mn.apply(this,arguments)}function mn(){return(mn=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",nn(t,"POST","/v1/accounts:delete",n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function kn(e,t){return wn.apply(this,arguments)}function wn(){return(wn=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",nn(t,"POST","/v1/accounts:lookup",n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function bn(e){if(e)try{var t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(n){}}function _n(){return _n=_(P.mark(function e(t){var n,r,i,a,s,o,u=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=u.length>1&&void 0!==u[1]&&u[1],r=ue(t),e.next=4,r.getIdToken(n);case 4:return i=e.sent,Ht((a=In(i))&&a.exp&&a.auth_time&&a.iat,r.auth,"internal-error"),s="object"===c(a.firebase)?a.firebase:void 0,o=null==s?void 0:s.sign_in_provider,e.abrupt("return",{claims:a,token:i,authTime:bn(En(a.auth_time)),issuedAtTime:bn(En(a.iat)),expirationTime:bn(En(a.exp)),signInProvider:o||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null});case 10:case"end":return e.stop()}},e)})),_n.apply(this,arguments)}function En(e){return 1e3*Number(e)}function In(e){var t=w(e.split("."),3),n=t[0],r=t[1],i=t[2];if(void 0===n||void 0===r||void 0===i)return Ut("JWT malformed, contained fewer than 3 sections"),null;try{var a=V(r);return a?JSON.parse(a):(Ut("Failed to decode base64 JWT payload"),null)}catch(s){return Ut("Caught error parsing JWT payload as JSON",null==s?void 0:s.toString()),null}}function Sn(e){var t=In(e);return Ht(t,"internal-error"),Ht(void 0!==t.exp,"internal-error"),Ht(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}function Tn(e,t){return xn.apply(this,arguments)}function xn(){return xn=_(P.mark(function e(t,n){var r=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.length>
22&&void 0!==r[2]&&r[2])){e.next=3;break}return e.abrupt("return",n);case 3:return e.prev=3,e.next=6,n;case 6:return e.abrupt("return",e.sent);case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof X&&An(e.t0))){e.next=15;break}if(t.auth.currentUser!==t){e.next=15;break}return e.next=15,t.auth.signOut();case 15:throw e.t0;case 16:case"end":return e.stop()}},e,null,[[3,9]])})),xn.apply(this,arguments)}function An(e){var t=e.code;return t==="auth/".concat("user-disabled")||t==="auth/".concat("user-token-expired")}var Cn=function(){function e(t){E(this,e),this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}var t;return S(e,[{key:"_start",value:function(){this.isRunning||(this.isRunning=!0,this.schedule())}},{key:"_stop",value:function(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}},{key:"getInterval",value:function(e){var t;if(e){var n=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),n}this.errorBackoff=3e4;var r=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,r)}},{key:"schedule",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isRunning){var n=this.getInterval(t);this.timerId=setTimeout(_(P.mark(function t(){return P.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.iteration();case 2:case"end":return t.stop()}},t)})),n)}}},{key:"iteration",value:(t=_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.user.getIdToken(!0);case 3:e.next=9;break;case 5:return e.prev=5,e.t0=e.catch(0),(null===e.t0||void 0===e.t0?void 0:e.t0.code)==="auth/".concat("network-request-failed")&&this.schedule(!0),e.abrupt("return");case 9:this.schedule();case 10:case"end":return e.stop()}},e,this,[[0,5]])})),function(){return t.apply(this,arguments)})}]),e}(),Pn=function(){function e(t,n){E(this,e),this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}return S(e,[{key:"_initializeTime",value:function(){this.lastSignInTime=bn(this.lastLoginAt),this.creationTime=bn(this.createdAt)}},{key:"_copy",value:function(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}},{key:"toJSON",value:function(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}]),e}();function On(e){return Rn.apply(this,arguments)}function Rn(){return(Rn=_(P.mark(function e(t){var n,r,i,a,s,o,u,c,l,h,f;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.auth,e.next=3,t.getIdToken();case 3:return i=e.sent,e.next=6,Tn(t,kn(r,{idToken:i}));case 6:Ht(null==(a=e.sent)?void 0:a.users.length,r,"internal-error"),s=a.users[0],t._notifyReloadListener(s),o=(null===(n=s.providerUserInfo)||void 0===n?void 0:n.length)?Ln(s.providerUserInfo):[],u=Dn(t.providerData,o),c=t.isAnonymous,l=!(t.email&&s.passwordHash||(null==u?void 0:u.length)),h=!!c&&l,f={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:u,metadata:new Pn(s.createdAt,s.lastLoginAt),isAnonymous:h},Object.assign(t,f);case 17:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Nn(){return(Nn=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=ue(t),e.next=3,On(n);case 3:return e.next=5,n.auth._persistUserIfCurrent(n);case 5:n.auth._notifyListenersIfCurrent(n);case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Dn(e,t){var n=e.filter(function(e){return!t.some(function(t){return t.providerId===e.providerId})});return[].concat(T(n),T(t))}function Ln(e){return e.map(function(e){var t=e.providerId,n=l(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})}function Mn(e,t){return Un.apply(this,arguments)}function Un(){return(Un=_(P.mark(function e(t,n){var r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,an(t,{},_(P.mark(function e(){var r,i,a,s,o,u;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=ne({grant_type:"refresh_token",refresh_token:n}).slice(1),i=t.config,a=i.tokenApiHost,s=i.apiKey,o=cn(t,a,"/v1/token","key=".concat(s)),e.next=5,t._getAdditionalHeaders();case 5:return(u=e.sent)["Content-Type"]="application/x-www-form-urlencoded",e.abrupt("return",$t.fetch()(o,{method:"POST",headers:u,body:r}));case 8:case"end":return e.stop()}},e)})));case 2:return r=e.sent,e.abrupt("return",{accessToken:r.access_token,expiresIn:r.expires_in,refreshToken:r.refresh_token});case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Fn(e,t){return jn.apply(this,arguments)}function jn(){return(jn=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",nn(t,"POST","/v2/accounts:revokeToken",tn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Vn=function(){function e(){E(this,e),this.refreshToken=null,this.accessToken=null,this.expirationTime=null}var t,n;return S(e,[{key:"isExpired",get:function(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}},{key:"updateFromServerResponse",value:function(e){Ht(e.idToken,"internal-error"),Ht(void 0!==e.idToken,"internal-error"),Ht(void 0!==e.refreshToken,"internal-error");
2var t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):Sn(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}},{key:"updateFromIdToken",value:function(e){Ht(0!==e.length,"internal-error");var t=Sn(e);this.updateTokensAndExpiration(e,null,t)}},{key:"getToken",value:(n=_(P.mark(function e(t){var n=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n.length>1&&void 0!==n[1]&&n[1]||!this.accessToken||this.isExpired){e.next=3;break}return e.abrupt("return",this.accessToken);case 3:if(Ht(this.refreshToken,t,"user-token-expired"),!this.refreshToken){e.next=8;break}return e.next=7,this.refresh(t,this.refreshToken);case 7:return e.abrupt("return",this.accessToken);case 8:return e.abrupt("return",null);case 9:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"clearRefreshToken",value:function(){this.refreshToken=null}},{key:"refresh",value:(t=_(P.mark(function e(t,n){var r,i,a,s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Mn(t,n);case 2:r=e.sent,i=r.accessToken,a=r.refreshToken,s=r.expiresIn,this.updateTokensAndExpiration(i,a,Number(s));case 7:case"end":return e.stop()}},e,this)})),function(e,n){return t.apply(this,arguments)})},{key:"updateTokensAndExpiration",value:function(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}},{key:"toJSON",value:function(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}},{key:"_assign",value:function(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}},{key:"_clone",value:function(){return Object.assign(new e,this.toJSON())}},{key:"_performRefresh",value:function(){return Kt("not implemented")}}],[{key:"fromJSON",value:function(t,n){var r=n.refreshToken,i=n.accessToken,a=n.expirationTime,s=new e;return r&&(Ht("string"==typeof r,"internal-error",{appName:t}),s.refreshToken=r),i&&(Ht("string"==typeof i,"internal-error",{appName:t}),s.accessToken=i),a&&(Ht("number"==typeof a,"internal-error",{appName:t}),s.expirationTime=a),s}}]),e}();function Bn(e,t){Ht("string"==typeof e||void 0===e,"internal-error",{appName:t})}var qn=function(){function e(t){E(this,e);var n=t.uid,r=t.auth,i=t.stsTokenManager,a=l(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Cn(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=r,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=a.displayName||null,this.email=a.email||null,this.emailVerified=a.emailVerified||!1,this.phoneNumber=a.phoneNumber||null,this.photoURL=a.photoURL||null,this.isAnonymous=a.isAnonymous||!1,this.tenantId=a.tenantId||null,this.providerData=a.providerData?T(a.providerData):[],this.metadata=new Pn(a.createdAt||void 0,a.lastLoginAt||void 0)}var t,n,r,i,a;return S(e,[{key:"getIdToken",value:(a=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Tn(this,this.stsTokenManager.getToken(this.auth,t));case 2:if(Ht(n=e.sent,this.auth,"internal-error"),this.accessToken===n){e.next=9;break}return this.accessToken=n,e.next=8,this.auth._persistUserIfCurrent(this);case 8:this.auth._notifyListenersIfCurrent(this);case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}},e,this)})),function(e){return a.apply(this,arguments)})},{key:"getIdTokenResult",value:function(e){return function(e){return _n.apply(this,arguments)}(this,e)}},{key:"reload",value:function(){return function(e){return Nn.apply(this,arguments)}(this)}},{key:"_assign",value:function(e){this!==e&&(Ht(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(function(e){return Object.assign({},e)}),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}},{key:"_clone",value:function(t){var n=new e(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}},{key:"_onReload",value:function(e){Ht(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}},{key:"_notifyReloadListener",value:function(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}},{key:"_startProactiveRefresh",value:function(){this.proactiveRefresh._start()}},{key:"_stopProactiveRefresh",value:function(){this.proactiveRefresh._stop()}},{key:"_updateTokensIfNecessary",value:(i=_(P.mark(function e(t){var n,r,i=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.length>1&&void 0!==i[1]&&i[1],r=!1,t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),r=!0),!n){e.next=6;break}return e.next=6,On(this);case 6:return e.next=8,this.auth._persistUserIfCurrent(this);case 8:r&&this.auth._notifyListenersIfCurrent(this);case 9:case"end":return e.stop()}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"delete",value:(r=_(P.mark(function e(){var t;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!nt(this.auth.app)){e.next=2;break}return e.abrupt("return",Promise.reject(Bt(this.auth)));case 2:return e.next=4,this.getIdToken();case 4:return t=e.sent,e.next=7,Tn(this,yn(this.auth,{idToken:t}));case 7:return this.stsTokenManager.clearRefreshToken(),e.abrupt("return",this.auth.signOut());case 9:case"end":return e.stop()}},e,this)})),function(){return r.apply(this,arguments)})},{key:"toJSON",value:function(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isA
2nonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(function(e){return Object.assign({},e)}),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}},{key:"refreshToken",get:function(){return this.stsTokenManager.refreshToken||""}}],[{key:"_fromJSON",value:function(t,n){var r,i,a,s,o,u,c,l,h=null!==(r=n.displayName)&&void 0!==r?r:void 0,f=null!==(i=n.email)&&void 0!==i?i:void 0,d=null!==(a=n.phoneNumber)&&void 0!==a?a:void 0,p=null!==(s=n.photoURL)&&void 0!==s?s:void 0,v=null!==(o=n.tenantId)&&void 0!==o?o:void 0,g=null!==(u=n._redirectEventId)&&void 0!==u?u:void 0,y=null!==(c=n.createdAt)&&void 0!==c?c:void 0,m=null!==(l=n.lastLoginAt)&&void 0!==l?l:void 0,k=n.uid,w=n.emailVerified,b=n.isAnonymous,_=n.providerData,E=n.stsTokenManager;Ht(k&&E,t,"internal-error");var I=Vn.fromJSON(this.name,E);Ht("string"==typeof k,t,"internal-error"),Bn(h,t.name),Bn(f,t.name),Ht("boolean"==typeof w,t,"internal-error"),Ht("boolean"==typeof b,t,"internal-error"),Bn(d,t.name),Bn(p,t.name),Bn(v,t.name),Bn(g,t.name),Bn(y,t.name),Bn(m,t.name);var S=new e({uid:k,auth:t,email:f,emailVerified:w,displayName:h,isAnonymous:b,photoURL:p,phoneNumber:d,tenantId:v,stsTokenManager:I,createdAt:y,lastLoginAt:m});return _&&Array.isArray(_)&&(S.providerData=_.map(function(e){return Object.assign({},e)})),g&&(S._redirectEventId=g),S}},{key:"_fromIdTokenResponse",value:(n=_(P.mark(function t(n,r){var i,a,s,o=arguments;return P.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=o.length>2&&void 0!==o[2]&&o[2],(a=new Vn).updateFromServerResponse(r),s=new e({uid:r.localId,auth:n,stsTokenManager:a,isAnonymous:i}),t.next=6,On(s);case 6:return t.abrupt("return",s);case 7:case"end":return t.stop()}},t)})),function(e,t){return n.apply(this,arguments)})},{key:"_fromGetAccountInfoResponse",value:(t=_(P.mark(function t(n,r,i){var a,s,o,u,c,l;return P.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return Ht(void 0!==(a=r.users[0]).localId,"internal-error"),s=void 0!==a.providerUserInfo?Ln(a.providerUserInfo):[],o=!(a.email&&a.passwordHash||(null==s?void 0:s.length)),(u=new Vn).updateFromIdToken(i),c=new e({uid:a.localId,auth:n,stsTokenManager:u,isAnonymous:o}),l={uid:a.localId,displayName:a.displayName||null,photoURL:a.photoUrl||null,email:a.email||null,emailVerified:a.emailVerified||!1,phoneNumber:a.phoneNumber||null,tenantId:a.tenantId||null,providerData:s,metadata:new Pn(a.createdAt,a.lastLoginAt),isAnonymous:!(a.email&&a.passwordHash||(null==s?void 0:s.length))},Object.assign(c,l),t.abrupt("return",c);case 10:case"end":return t.stop()}},t)})),function(e,n,r){return t.apply(this,arguments)})}]),e}(),zn=new Map;function Hn(e){Gt(e instanceof Function,"Expected a class definition");var t=zn.get(e);return t?(Gt(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,zn.set(e,t),t)}var Kn=function(){function e(){E(this,e),this.type="NONE",this.storage={}}var t,n,r,i;return S(e,[{key:"_isAvailable",value:(i=_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",!0);case 1:case"end":return e.stop()}},e)})),function(){return i.apply(this,arguments)})},{key:"_set",value:(r=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.storage[t]=n;case 1:case"end":return e.stop()}},e,this)})),function(e,t){return r.apply(this,arguments)})},{key:"_get",value:(n=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.storage[t],e.abrupt("return",void 0===n?null:n);case 2:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"_remove",value:(t=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:delete this.storage[t];case 1:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"_addListener",value:function(e,t){}},{key:"_removeListener",value:function(e,t){}}]),e}();Kn.type="NONE";var Gn=Kn;function Wn(e,t,n){return"firebase".concat(":",e,":").concat(t,":").concat(n)}var Qn=function(){function e(t,n,r){E(this,e),this.persistence=t,this.auth=n,this.userKey=r;var i=this.auth,a=i.config,s=i.name;this.fullUserKey=Wn(this.userKey,a.apiKey,s),this.fullPersistenceKey=Wn("persistence",a.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}var t,n,r;return S(e,[{key:"setCurrentUser",value:function(e){return this.persistence._set(this.fullUserKey,e.toJSON())}},{key:"getCurrentUser",value:(r=_(P.mark(function e(){var t;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.persistence._get(this.fullUserKey);case 2:return t=e.sent,e.abrupt("return",t?qn._fromJSON(this.auth,t):null);case 4:case"end":return e.stop()}},e,this)})),function(){return r.apply(this,arguments)})},{key:"removeCurrentUser",value:function(){return this.persistence._remove(this.fullUserKey)}},{key:"savePersistenceForRedirect",value:function(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}},{key:"setPersistence",value:(n=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.persistence!==t){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.getCurrentUser();case 4:return n=e.sent,e.next=7,this.removeCurrentUser();case 7:if(this.persistence=t,!n){e.next=10;break}return e.abrupt("return",this.setCurrentUser(n));case 10:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"delete",value:function(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}}],[{key:"create",value:(t=_(P.mark(function t(n,r){var i,a,s,o,u,c,l,h,f,d,p,v=arguments;return P.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i=v.length>2&&void 0!==v[2]?v[2]:"authUser",r.length){t.next=3;break}return t.abrupt("return",new e(Hn(Gn),n,i));case 3:return t.next=5,Promise.all(r.map(function(){var e=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t._isAvailable();case 2:if(!e.sent){e.next=4;break}return e.abrupt("return",t);case 4:return e.abrupt("return",void 0);case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 5:a=t.sent.filter(function(e){return e}),s=a[0]||Hn(Gn),o=Wn(i,n.config.apiKey,n.name),u=null,c=Tt(r),t.prev=10,
2c.s();case 12:if((l=c.n()).done){t.next=29;break}return h=l.value,t.prev=14,t.next=17,h._get(o);case 17:if(!(f=t.sent)){t.next=23;break}return d=qn._fromJSON(n,f),h!==s&&(u=d),s=h,t.abrupt("break",29);case 23:t.next=27;break;case 25:t.prev=25,t.t0=t.catch(14);case 27:t.next=12;break;case 29:t.next=34;break;case 31:t.prev=31,t.t1=t.catch(10),c.e(t.t1);case 34:return t.prev=34,c.f(),t.finish(34);case 37:if(p=a.filter(function(e){return e._shouldAllowMigration}),s._shouldAllowMigration&&p.length){t.next=40;break}return t.abrupt("return",new e(s,n,i));case 40:if(s=p[0],!u){t.next=44;break}return t.next=44,s._set(o,u.toJSON());case 44:return t.next=46,Promise.all(r.map(function(){var e=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t===s){e.next=8;break}return e.prev=1,e.next=4,t._remove(o);case 4:e.next=8;break;case 6:e.prev=6,e.t0=e.catch(1);case 8:case"end":return e.stop()}},e,null,[[1,6]])}));return function(t){return e.apply(this,arguments)}}()));case 46:return t.abrupt("return",new e(s,n,i));case 47:case"end":return t.stop()}},t,null,[[10,31,34,37],[14,25]])})),function(e,n){return t.apply(this,arguments)})}]),e}();function Yn(e){var t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Zn(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Xn(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(tr(t))return"Blackberry";if(nr(t))return"Webos";if(Jn(t))return"Safari";if((t.includes("chrome/")||$n(t))&&!t.includes("edge/"))return"Chrome";if(er(t))return"Android";var n=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);return 2===(null==n?void 0:n.length)?n[1]:"Other"}function Xn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G();return/firefox\//i.test(e)}function Jn(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:G()).toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function $n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G();return/crios\//i.test(e)}function Zn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G();return/iemobile/i.test(e)}function er(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G();return/android/i.test(e)}function tr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G();return/blackberry/i.test(e)}function nr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G();return/webos/i.test(e)}function rr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G();return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function ir(){return((e=G()).indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0)&&10===document.documentMode;var e}function ar(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G();return rr(e)||er(e)||nr(e)||tr(e)||/windows phone/i.test(e)||Zn(e)}function sr(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];switch(e){case"Browser":t=Yn(G());break;case"Worker":t="".concat(Yn(G()),"-").concat(e);break;default:t=e}var r=n.length?n.join(","):"FirebaseCore-web";return"".concat(t,"/","JsCore","/").concat(st,"/").concat(r)}var or=function(){function e(t){E(this,e),this.auth=t,this.queue=[]}var t;return S(e,[{key:"pushCallback",value:function(e,t){var n=this,r=function(t){return new Promise(function(n,r){try{n(e(t))}catch(i){r(i)}})};r.onAbort=t,this.queue.push(r);var i=this.queue.length-1;return function(){n.queue[i]=function(){return Promise.resolve()}}}},{key:"runMiddleware",value:(t=_(P.mark(function e(t){var n,r,i,a,s,o,u;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.auth.currentUser!==t){e.next=2;break}return e.abrupt("return");case 2:n=[],e.prev=3,r=Tt(this.queue),e.prev=5,r.s();case 7:if((i=r.n()).done){e.next=14;break}return a=i.value,e.next=11,a(t);case 11:a.onAbort&&n.push(a.onAbort);case 12:e.next=7;break;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(5),r.e(e.t0);case 19:return e.prev=19,r.f(),e.finish(19);case 22:e.next=30;break;case 24:e.prev=24,e.t1=e.catch(3),n.reverse(),s=Tt(n);try{for(s.s();!(o=s.n()).done;){u=o.value;try{u()}catch(c){}}}catch(l){s.e(l)}finally{s.f()}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null===e.t1||void 0===e.t1?void 0:e.t1.message});case 30:case"end":return e.stop()}},e,this,[[3,24],[5,16,19,22]])})),function(e){return t.apply(this,arguments)})}]),e}();function ur(e){return cr.apply(this,arguments)}function cr(){return cr=_(P.mark(function e(t){var n,r=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},e.abrupt("return",nn(t,"GET","/v2/passwordPolicy",tn(t,n)));case 2:case"end":return e.stop()}},e)})),cr.apply(this,arguments)}var lr=function(){function e(t){var n,r,i,a;E(this,e);var s=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(n=s.minPasswordLength)&&void 0!==n?n:6,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),void 0!==s.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),void 0!==s.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),void 0!==s.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),void 0!==s.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(i=null===(r=t.allowedNonAlphanumericCharacters)||void 0===r?void 0:r.join(""))&&void 0!==i?i:"",this.forceUpgradeOnSignin=null!==(a=t.forceUpgradeOnSignin)&&void 0!==a&&a,this.schemaVersion=t.schemaVersion}return S(e,[{key:"validatePassword",value:function(e){var t,n,r,i,a,s,o={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,o),this.validatePasswordCharacterOptions(e,o),o.isValid&&
2(o.isValid=null===(t=o.meetsMinPasswordLength)||void 0===t||t),o.isValid&&(o.isValid=null===(n=o.meetsMaxPasswordLength)||void 0===n||n),o.isValid&&(o.isValid=null===(r=o.containsLowercaseLetter)||void 0===r||r),o.isValid&&(o.isValid=null===(i=o.containsUppercaseLetter)||void 0===i||i),o.isValid&&(o.isValid=null===(a=o.containsNumericCharacter)||void 0===a||a),o.isValid&&(o.isValid=null===(s=o.containsNonAlphanumericCharacter)||void 0===s||s),o}},{key:"validatePasswordLengthOptions",value:function(e,t){var n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),r&&(t.meetsMaxPasswordLength=e.length<=r)}},{key:"validatePasswordCharacterOptions",value:function(e,t){var n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(var r=0;r<e.length;r++)n=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}},{key:"updatePasswordCharacterOptionsStatuses",value:function(e,t,n,r,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}]),e}(),hr=function(){function e(t,n,r,i){E(this,e),this.app=t,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new dr(this),this.idTokenSubscription=new dr(this),this.beforeStateQueue=new or(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Nt,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=i.sdkClientVersion}var t,n,r,i,a,s,o,u,c,l,h,f,d,p,v,g,y,m,k;return S(e,[{key:"_initializeWithPersistence",value:function(e,t){var n=this;return t&&(this._popupRedirectResolver=Hn(t)),this._initializationPromise=this.queue(_(P.mark(function r(){var i,a;return P.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._deleted){r.next=2;break}return r.abrupt("return");case 2:return r.next=4,Qn.create(n,e);case 4:if(n.persistenceManager=r.sent,!n._deleted){r.next=7;break}return r.abrupt("return");case 7:if(!(null===(i=n._popupRedirectResolver)||void 0===i?void 0:i._shouldInitProactively)){r.next=15;break}return r.prev=8,r.next=11,n._popupRedirectResolver._initialize(n);case 11:r.next=15;break;case 13:r.prev=13,r.t0=r.catch(8);case 15:return r.next=17,n.initializeCurrentUser(t);case 17:if(n.lastNotifiedUid=(null===(a=n.currentUser)||void 0===a?void 0:a.uid)||null,!n._deleted){r.next=20;break}return r.abrupt("return");case 20:n._isInitialized=!0;case 21:case"end":return r.stop()}},r,null,[[8,13]])}))),this._initializationPromise}},{key:"_onStorageEvent",value:(k=_(P.mark(function e(){var t;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._deleted){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.assertedPersistence.getCurrentUser();case 4:if(t=e.sent,this.currentUser||t){e.next=7;break}return e.abrupt("return");case 7:if(!this.currentUser||!t||this.currentUser.uid!==t.uid){e.next=12;break}return this._currentUser._assign(t),e.next=11,this.currentUser.getIdToken();case 11:return e.abrupt("return");case 12:return e.next=14,this._updateCurrentUser(t,!0);case 14:case"end":return e.stop()}},e,this)})),function(){return k.apply(this,arguments)})},{key:"initializeCurrentUserFromIdToken",value:(m=_(P.mark(function e(t){var n,r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,kn(this,{idToken:t});case 3:return n=e.sent,e.next=6,qn._fromGetAccountInfoResponse(this,n,t);case 6:return r=e.sent,e.next=9,this.directlySetCurrentUser(r);case 9:e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(0),console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e.t0),e.next=16,this.directlySetCurrentUser(null);case 16:case"end":return e.stop()}},e,this,[[0,11]])})),function(e){return m.apply(this,arguments)})},{key:"initializeCurrentUser",value:(y=_(P.mark(function e(t){var n,r,i,a,s,o,u,c,l=this;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!nt(this.app)){e.next=7;break}if(!(r=this.app.settings.authIdToken)){e.next=6;break}return e.abrupt("return",new Promise(function(e){setTimeout(function(){return l.initializeCurrentUserFromIdToken(r).then(e,e)})}));case 6:return e.abrupt("return",this.directlySetCurrentUser(null));case 7:return e.next=9,this.assertedPersistence.getCurrentUser();case 9:if(i=e.sent,a=i,s=!1,!t||!this.config.authDomain){e.next=21;break}return e.next=15,this.getOrInitRedirectPersistenceManager();case 15:return o=null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId,u=null==a?void 0:a._redirectEventId,e.next=19,this.tryRedirectSignIn(t);case 19:c=e.sent,o&&o!==u||!(null==c?void 0:c.user)||(a=c.user,s=!0);case 21:if(a){e.next=23;break}return e.abrupt("return",this.directlySetCurrentUser(null));
2case 23:if(a._redirectEventId){e.next=39;break}if(!s){e.next=34;break}return e.prev=25,e.next=28,this.beforeStateQueue.runMiddleware(a);case 28:e.next=34;break;case 30:e.prev=30,e.t0=e.catch(25),a=i,this._popupRedirectResolver._overrideRedirectResult(this,function(){return Promise.reject(e.t0)});case 34:if(!a){e.next=38;break}return e.abrupt("return",this.reloadAndSetCurrentUserOrClear(a));case 38:return e.abrupt("return",this.directlySetCurrentUser(null));case 39:return Ht(this._popupRedirectResolver,this,"argument-error"),e.next=42,this.getOrInitRedirectPersistenceManager();case 42:if(!this.redirectUser||this.redirectUser._redirectEventId!==a._redirectEventId){e.next=44;break}return e.abrupt("return",this.directlySetCurrentUser(a));case 44:return e.abrupt("return",this.reloadAndSetCurrentUserOrClear(a));case 45:case"end":return e.stop()}},e,this,[[25,30]])})),function(e){return y.apply(this,arguments)})},{key:"tryRedirectSignIn",value:(g=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=null,e.prev=1,e.next=4,this._popupRedirectResolver._completeRedirectFn(this,t,!0);case 4:n=e.sent,e.next=11;break;case 7:return e.prev=7,e.t0=e.catch(1),e.next=11,this._setRedirectUser(null);case 11:return e.abrupt("return",n);case 12:case"end":return e.stop()}},e,this,[[1,7]])})),function(e){return g.apply(this,arguments)})},{key:"reloadAndSetCurrentUserOrClear",value:(v=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,On(t);case 3:e.next=9;break;case 5:if(e.prev=5,e.t0=e.catch(0),(null===e.t0||void 0===e.t0?void 0:e.t0.code)==="auth/".concat("network-request-failed")){e.next=9;break}return e.abrupt("return",this.directlySetCurrentUser(null));case 9:return e.abrupt("return",this.directlySetCurrentUser(t));case 10:case"end":return e.stop()}},e,this,[[0,5]])})),function(e){return v.apply(this,arguments)})},{key:"useDeviceLanguage",value:function(){this.languageCode=function(){if("undefined"==typeof navigator)return null;var e=navigator;return e.languages&&e.languages[0]||e.language||null}()}},{key:"_delete",value:(p=_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this._deleted=!0;case 1:case"end":return e.stop()}},e,this)})),function(){return p.apply(this,arguments)})},{key:"updateCurrentUser",value:(d=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!nt(this.app)){e.next=2;break}return e.abrupt("return",Promise.reject(Bt(this)));case 2:return(n=t?ue(t):null)&&Ht(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),e.abrupt("return",this._updateCurrentUser(n&&n._clone(this)));case 5:case"end":return e.stop()}},e,this)})),function(e){return d.apply(this,arguments)})},{key:"_updateCurrentUser",value:(f=_(P.mark(function e(t){var n,r=this,i=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.length>1&&void 0!==i[1]&&i[1],!this._deleted){e.next=3;break}return e.abrupt("return");case 3:if(t&&Ht(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),n){e.next=7;break}return e.next=7,this.beforeStateQueue.runMiddleware(t);case 7:return e.abrupt("return",this.queue(_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.directlySetCurrentUser(t);case 2:r.notifyAuthListeners();case 3:case"end":return e.stop()}},e)}))));case 8:case"end":return e.stop()}},e,this)})),function(e){return f.apply(this,arguments)})},{key:"signOut",value:(h=_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!nt(this.app)){e.next=2;break}return e.abrupt("return",Promise.reject(Bt(this)));case 2:return e.next=4,this.beforeStateQueue.runMiddleware(null);case 4:if(!this.redirectPersistenceManager&&!this._popupRedirectResolver){e.next=7;break}return e.next=7,this._setRedirectUser(null);case 7:return e.abrupt("return",this._updateCurrentUser(null,!0));case 8:case"end":return e.stop()}},e,this)})),function(){return h.apply(this,arguments)})},{key:"setPersistence",value:function(e){var t=this;return nt(this.app)?Promise.reject(Bt(this)):this.queue(_(P.mark(function n(){return P.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.assertedPersistence.setPersistence(Hn(e));case 2:case"end":return n.stop()}},n)})))}},{key:"_getRecaptchaConfig",value:function(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}},{key:"validatePassword",value:(l=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._getPasswordPolicyInternal()){e.next=3;break}return e.next=3,this._updatePasswordPolicy();case 3:if((n=this._getPasswordPolicyInternal()).schemaVersion===this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION){e.
2next=6;break}return e.abrupt("return",Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})));case 6:return e.abrupt("return",n.validatePassword(t));case 7:case"end":return e.stop()}},e,this)})),function(e){return l.apply(this,arguments)})},{key:"_getPasswordPolicyInternal",value:function(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}},{key:"_updatePasswordPolicy",value:(c=_(P.mark(function e(){var t,n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ur(this);case 2:t=e.sent,n=new lr(t),null===this.tenantId?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n;case 5:case"end":return e.stop()}},e,this)})),function(){return c.apply(this,arguments)})},{key:"_getPersistence",value:function(){return this.assertedPersistence.persistence.type}},{key:"_updateErrorMap",value:function(e){this._errorFactory=new J("auth","Firebase",e())}},{key:"onAuthStateChanged",value:function(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}},{key:"beforeAuthStateChanged",value:function(e,t){return this.beforeStateQueue.pushCallback(e,t)}},{key:"onIdTokenChanged",value:function(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}},{key:"authStateReady",value:function(){var e=this;return new Promise(function(t,n){if(e.currentUser)t();else var r=e.onAuthStateChanged(function(){r(),t()},n)})}},{key:"revokeAccessToken",value:(u=_(P.mark(function e(t){var n,r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.currentUser){e.next=8;break}return e.next=3,this.currentUser.getIdToken();case 3:return n=e.sent,r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:n},null!=this.tenantId&&(r.tenantId=this.tenantId),e.next=8,Fn(this,r);case 8:case"end":return e.stop()}},e,this)})),function(e){return u.apply(this,arguments)})},{key:"toJSON",value:function(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}},{key:"_setRedirectUser",value:(o=_(P.mark(function e(t,n){var r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getOrInitRedirectPersistenceManager(n);case 2:return r=e.sent,e.abrupt("return",null===t?r.removeCurrentUser():r.setCurrentUser(t));case 4:case"end":return e.stop()}},e,this)})),function(e,t){return o.apply(this,arguments)})},{key:"getOrInitRedirectPersistenceManager",value:(s=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.redirectPersistenceManager){e.next=9;break}return Ht(n=t&&Hn(t)||this._popupRedirectResolver,this,"argument-error"),e.next=5,Qn.create(this,[Hn(n._redirectPersistence)],"redirectUser");case 5:return this.redirectPersistenceManager=e.sent,e.next=8,this.redirectPersistenceManager.getCurrentUser();case 8:this.redirectUser=e.sent;case 9:return e.abrupt("return",this.redirectPersistenceManager);case 10:case"end":return e.stop()}},e,this)})),function(e){return s.apply(this,arguments)})},{key:"_redirectUserForId",value:(a=_(P.mark(function e(t){var n,r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isInitialized){e.next=3;break}return e.next=3,this.queue(_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}},e)})));case 3:if((null===(n=this._currentUser)||void 0===n?void 0:n._redirectEventId)!==t){e.next=5;break}return e.abrupt("return",this._currentUser);case 5:if((null===(r=this.redirectUser)||void 0===r?void 0:r._redirectEventId)!==t){e.next=7;break}return e.abrupt("return",this.redirectUser);case 7:return e.abrupt("return",null);case 8:case"end":return e.stop()}},e,this)})),function(e){return a.apply(this,arguments)})},{key:"_persistUserIfCurrent",value:(i=_(P.mark(function e(t){var n=this;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t!==this.currentUser){e.next=2;break}return e.abrupt("return",this.queue(_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.directlySetCurrentUser(t));case 1:case"end":return e.stop()}},e)}))));case 2:case"end":return e.stop()}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"_notifyListenersIfCurrent",value:function(e){e===this.currentUser&&this.notifyAuthListeners()}},{key:"_key",value:function(){return"".concat(this.config.authDomain,":").concat(this.config.apiKey,":").concat(this.name)}},{key:"_startProactiveRefresh",value:function(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}},{key:"_stopProactiveRefresh",value:function(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}},{key:"_currentUser",get:function(){return this.currentUser}},{key:"notifyAuthListeners",value:function(){var e,t;if(this._isInitialized){this.idTokenSubscription.next(this.currentUser);var n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}}},{key:"registerStateListener",value:function(e,t,n,r){var i=this;if(this._deleted)return function(){};var a="function"==typeof t?t:t.next.bind(t),s=!1,o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Ht(o,this,"internal-error"),o.then(function(){s||a(i.currentUser)}),"function"==typeof t){var u=e.addObserver(t,n,r);return function(){s=!0,u()}}var c=e.addObserver(t);return function(){s=!0,c()}}},{key:"directlySetCurrentUser",value:(r=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,!t){e.next=8;break}return e.next=6,this.assertedPersistence.setCurrentUser(t);case 6:e.next=10;break;case 8:return e.next=10,this.assertedPersistence.removeCurrentUser();case 10:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"queue",value:function(e){return this.operations=this.operations.then(e,e),this.operations}},{key:"assertedPersistence",get:function(){return Ht(this.persistenceManager,this,"internal-error"),this.persistenceManager}},{key:"_logFramework",value:function(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=sr(this.config.clientPlatform,this._getFrameworks()))}},{key:"_getFrameworks",value:function(){return this.frameworks}},{key:"_getAdditionalHeaders",value:(n=_(P.mark(function e(){var t,n,r,i;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=x({},"X-Client-Version",this.clientVersion),this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId),e.next=4,null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader();case 4:return(r=e.sent)&&(n["X-Firebase-Client"]=r),e.next=8,this._getAppCheckToken();case 8:return(i=e.sent)&&(n["X-Firebase-AppCheck"]=i),e.abrupt("return",n);case 11:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"_getAppCheckToken",value:(t=_(P.mark(function e(){var t,n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken();case 2:return(null==(n=e.sent)?void 0:n.error)&&Mt("Error while retrieving App Check token: ".concat(n.error)),e.abrupt("return",null==n?void 0:n.token);case 5:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})}]),e}();function fr(e){return ue(e)}var dr=function(){function e(t){var n,r,i=this;
2E(this,e),this.auth=t,this.observer=null,this.addObserver=(r=new ae(function(e){return i.observer=e},n)).subscribe.bind(r)}return S(e,[{key:"next",get:function(){return Ht(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}]),e}(),pr={loadJS:function(){return _(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("Unable to load external scripts");case 1:case"end":return e.stop()}},e)}))()},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function vr(e){return pr.loadJS(e)}var gr=function(){function e(t){E(this,e),this.type="recaptcha-enterprise",this.auth=fr(t)}var t;return S(e,[{key:"verify",value:(t=_(P.mark(function e(){var t,n,r,i,a,s=this,o=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=function(e,n,r){var i=window.grecaptcha;dn(i)?i.enterprise.ready(function(){i.enterprise.execute(e,{action:t}).then(function(e){n(e)}).catch(function(){n("NO_RECAPTCHA")})}):r(Error("No reCAPTCHA enterprise script loaded."))},i=function(){return i=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n){e.next=5;break}if(null!=t.tenantId||null==t._agentRecaptchaConfig){e.next=3;break}return e.abrupt("return",t._agentRecaptchaConfig.siteKey);case 3:if(null==t.tenantId||void 0===t._tenantRecaptchaConfigs[t.tenantId]){e.next=5;break}return e.abrupt("return",t._tenantRecaptchaConfigs[t.tenantId].siteKey);case 5:return e.abrupt("return",new Promise(function(){var e=_(P.mark(function e(n,r){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:vn(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(function(e){if(void 0!==e.recaptchaKey){var i=new pn(e);return null==t.tenantId?t._agentRecaptchaConfig=i:t._tenantRecaptchaConfigs[t.tenantId]=i,n(i.siteKey)}r(new Error("recaptcha Enterprise site key undefined"))}).catch(function(e){r(e)});case 1:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}()));case 6:case"end":return e.stop()}},e)})),i.apply(this,arguments)},r=function(e){return i.apply(this,arguments)},t=o.length>0&&void 0!==o[0]?o[0]:"verify",n=o.length>1&&void 0!==o[1]&&o[1],e.abrupt("return",new Promise(function(e,t){r(s.auth).then(function(r){if(!n&&dn(window.grecaptcha))a(r,e,t);else{if("undefined"==typeof window)return void t(new Error("RecaptchaVerifier is only supported in browser"));var i=pr.recaptchaEnterpriseScript;0!==i.length&&(i+=r),vr(i).then(function(){a(r,e,t)}).catch(function(e){t(e)})}}).catch(function(e){t(e)})}));case 6:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)})}]),e}();function yr(e,t,n){return mr.apply(this,arguments)}function mr(){return mr=_(P.mark(function e(t,n,r){var i,a,s,o,u=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=u.length>3&&void 0!==u[3]&&u[3],a=new gr(t),e.prev=2,e.next=5,a.verify(r);case 5:s=e.sent,e.next=13;break;case 8:return e.prev=8,e.t0=e.catch(2),e.next=12,a.verify(r,!0);case 12:s=e.sent;case 13:return o=Object.assign({},n),i?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),e.abrupt("return",o);case 18:case"end":return e.stop()}},e,null,[[2,8]])})),mr.apply(this,arguments)}function kr(e,t,n,r){return wr.apply(this,arguments)}function wr(){return wr=_(P.mark(function e(t,n,r,i){var a,s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null===(a=t._getRecaptchaConfig())||void 0===a?void 0:a.isProviderEnabled("EMAIL_PASSWORD_PROVIDER"))){e.
2next=7;break}return e.next=3,yr(t,n,r,"getOobCode"===r);case 3:return s=e.sent,e.abrupt("return",i(t,s));case 7:return e.abrupt("return",i(t,n).catch(function(){var e=_(P.mark(function e(a){var s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a.code!=="auth/".concat("missing-recaptcha-token")){e.next=8;break}return console.log("".concat(r," is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.")),e.next=4,yr(t,n,r,"getOobCode"===r);case 4:return s=e.sent,e.abrupt("return",i(t,s));case 8:return e.abrupt("return",Promise.reject(a));case 9:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 8:case"end":return e.stop()}},e)})),wr.apply(this,arguments)}function br(e,t,n){var r=fr(e);Ht(r._canInitEmulator,r,"emulator-config-failed"),Ht(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");var i=!!(null==n?void 0:n.disableWarnings),a=_r(t),s=function(e){var t=_r(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};var r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){var a=i[1];return{host:a,port:Er(r.substr(a.length+1))}}var s=w(r.split(":"),2);return{host:s[0],port:Er(s[1])}}(t),o=s.host,u=s.port,c=null===u?"":":".concat(u);r.config.emulator={url:"".concat(a,"//").concat(o).concat(c,"/")},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:u,protocol:a.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||function(){function e(){var e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function _r(e){var t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function Er(e){if(!e)return null;var t=Number(e);return isNaN(t)?null:t}var Ir=function(){function e(t,n){E(this,e),this.providerId=t,this.signInMethod=n}return S(e,[{key:"toJSON",value:function(){return Kt("not implemented")}},{key:"_getIdTokenResponse",value:function(e){return Kt("not implemented")}},{key:"_linkToIdToken",value:function(e,t){return Kt("not implemented")}},{key:"_getReauthenticationResolver",value:function(e){return Kt("not implemented")}}]),e}();function Sr(e,t){return Tr.apply(this,arguments)}function Tr(){return(Tr=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",nn(t,"POST","/v1/accounts:resetPassword",tn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function xr(e,t){return Ar.apply(this,arguments)}function Ar(){return(Ar=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",nn(t,"POST","/v1/accounts:update",n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Cr(e,t){return Pr.apply(this,arguments)}function Pr(){return(Pr=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",nn(t,"POST","/v1/accounts:signUp",n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Or(e,t){return Rr.apply(this,arguments)}function Rr(){return(Rr=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",nn(t,"POST","/v1/accounts:update",tn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Nr(e,t){return Dr.apply(this,arguments)}function Dr(){return(Dr=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",on(t,"POST","/v1/accounts:signInWithPassword",tn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Lr(e,t){return Mr.apply(this,arguments)}function Mr(){return(Mr=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",nn(t,"POST","/v1/accounts:sendOobCode",tn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ur(e,t){return Fr.apply(this,arguments)}function Fr(){return(Fr=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Lr(t,n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function jr(e,t){return Vr.apply(this,arguments)}function Vr(){return(Vr=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Lr(t,n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Br(e,t){return qr.apply(this,arguments)}function qr(){return(qr=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Lr(t,n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function zr(e,t){return Hr.apply(this,arguments)}function Hr(){return(Hr=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",on(t,"POST","/v1/accounts:signInWithEmailLink",tn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Kr(e,t){return Gr.apply(this,arguments)}function Gr(){return(Gr=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",on(t,"POST","/v1/accounts:signInWithEmailLink",tn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Wr=function(e){g(i,e);var t,n,r=St(i);function i(e,t,n){var a,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return E(this,i),(a=r.call(this,"password",n))._email=e,a._password=t,a._tenantId=s,a}return S(i,[{key:"toJSON",value:function(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}},{key:"_getIdTokenResponse",value:(n=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=this.signInMethod,e.next="password"===e.t0?3:"emailLink"===e.t0?5:6;break;case 3:return n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},e.abrupt("return",kr(t,n,"signInWithPassword",Nr));case 5:return e.abrupt("return",zr(t,{email:this._email,oobCode:this._password}));case 6:Ft(t,"internal-error");case 7:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"_linkToIdToken",value:(t=_(P.mark(function e(t,n){var r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=this.signInMethod,e.next="password"===e.t0?3:"emailLink"===e.t0?5:6;break;case 3:return r={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},e.abrupt("return",kr(t,r,"signUpPassword",Cr));case 5:return e.abrupt("return",Kr(t,{idToken:n,email:this._email,oobCode:this._password}));case 6:Ft(t,"internal-error");case 7:case"end":return e.stop()}},e,this)})),function(e,n){return t.apply(this,arguments)})},{key:"_getReauthenticationResolver",value:function(e){return this._getIdTokenResponse(e)}}],[{key:"_fromEmailAndPassword",value:function(e,t){return new i(e,t,"password")}},{key:"_fromEmailAndCode",value:function(e,t){return new i(e,t,"emailLink",arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}},{key:"fromJSON",value:function(e){var t="string"==typeof e?JSON.parse(e):e;if((null==t?void 0:t.email)&&(null==t?void 0:t.password)){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}}]),i}(Ir);function Qr(e,t){return Yr.apply(this,arguments)}function Yr(){return(Yr=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",on(t,"POST","/v1/accounts:signInWithIdp",tn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Xr=function(e){g(n,e);var t=St(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments)).pendingToken=null,e}return S(n,[{key:"toJSON",value:function(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
2once:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}},{key:"_getIdTokenResponse",value:function(e){return Qr(e,this.buildRequest())}},{key:"_linkToIdToken",value:function(e,t){var n=this.buildRequest();return n.idToken=t,Qr(e,n)}},{key:"_getReauthenticationResolver",value:function(e){var t=this.buildRequest();return t.autoCreate=!1,Qr(e,t)}},{key:"buildRequest",value:function(){var e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{var t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=ne(t)}return e}}],[{key:"_fromParams",value:function(e){var t=new n(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):Ft("argument-error"),t}},{key:"fromJSON",value:function(e){var t="string"==typeof e?JSON.parse(e):e,r=t.providerId,i=t.signInMethod,a=l(t,["providerId","signInMethod"]);if(!r||!i)return null;var s=new n(r,i);return s.idToken=a.idToken||void 0,s.accessToken=a.accessToken||void 0,s.secret=a.secret,s.nonce=a.nonce,s.pendingToken=a.pendingToken||null,s}}]),n}(Ir);x({},"USER_NOT_FOUND","user-not-found");var Jr=function(){function e(t){var n,r,i,a,s,o;E(this,e);var u=re(ie(t)),c=null!==(n=u.apiKey)&&void 0!==n?n:null,l=null!==(r=u.oobCode)&&void 0!==r?r:null,h=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(i=u.mode)&&void 0!==i?i:null);Ht(c&&l&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=l,this.continueUrl=null!==(a=u.continueUrl)&&void 0!==a?a:null,this.languageCode=null!==(s=u.languageCode)&&void 0!==s?s:null,this.tenantId=null!==(o=u.tenantId)&&void 0!==o?o:null}return S(e,null,[{key:"parseLink",value:function(t){var n=function(e){var t=re(ie(e)).link,n=t?re(ie(t)).deep_link_id:null,r=re(ie(e)).deep_link_id;return(r?re(ie(r)).link:null)||r||n||t||e}(t);try{return new e(n)}catch(r){return null}}}]),e}(),$r=function(){function e(){E(this,e),this.providerId=e.PROVIDER_ID}return S(e,null,[{key:"credential",value:function(e,t){return Wr._fromEmailAndPassword(e,t)}},{key:"credentialWithLink",value:function(e,t){var n=Jr.parseLink(t);return Ht(n,"argument-error"),Wr._fromEmailAndCode(e,n.code,n.tenantId)}}]),e}();$r.PROVIDER_ID="password",$r.EMAIL_PASSWORD_SIGN_IN_METHOD="password",$r.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var Zr=function(){function e(t){E(this,e),this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}return S(e,[{key:"setDefaultLanguage",value:function(e){this.defaultLanguageCode=e}},{key:"setCustomParameters",value:function(e){return this.customParameters=e,this}},{key:"getCustomParameters",value:function(){return this.customParameters}}]),e}(),ei=function(e){g(n,e);var t=St(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments)).scopes=[],e}return S(n,[{key:"addScope",value:function(e){return this.scopes.includes(e)||this.scopes.push(e),this}},{key:"getScopes",value:function(){return T(this.scopes)}}]),n}(Zr),ti=function(e){g(n,e);var t=St(n);function n(){return E(this,n),t.call(this,"facebook.com")}return S(n,null,[{key:"credential",value:function(e){return Xr._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}},{key:"credentialFromResult",value:function(e){return n.credentialFromTaggedObject(e)}},{key:"credentialFromError",value:function(e){return n.credentialFromTaggedObject(e.customData||{})}},{key:"credentialFromTaggedObject",value:function(e){var t=e._tokenResponse;if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return n.credential(t.oauthAccessToken)}catch(r){return null}}}]),n}(ei);ti.FACEBOOK_SIGN_IN_METHOD="facebook.com",ti.PROVIDER_ID="facebook.com";var ni=function(e){g(n,e);var t=St(n);function n(){var e;return E(this,n),(e=t.call(this,"google.com")).addScope("profile"),e}return S(n,null,[{key:"credential",value:function(e,t){return Xr._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}},{key:"credentialFromResult",value:function(e){return n.credentialFromTaggedObject(e)}},{key:"credentialFromError",value:function(e){return n.credentialFromTaggedObject(e.customData||{})}},{key:"credentialFromTaggedObject",value:function(e){var t=e._tokenResponse;if(!t)return null;var r=t.oauthIdToken,i=t.oauthAccessToken;if(!r&&!i)return null;try{return n.credential(r,i)}catch(a){return null}}}]),n}(ei);function ri(e,t){return ii.apply(this,arguments)}function ii(){return(ii=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",on(t,"POST","/v1/accounts:signUp",tn(t,n)));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}ni.GOOGLE_SIGN_IN_METHOD="google.com",ni.PROVIDER_ID="google.com";var ai=function(){function e(t){E(this,e),this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._token
2Response,this.operationType=t.operationType}var t,n;return S(e,null,[{key:"_fromIdTokenResponse",value:(n=_(P.mark(function t(n,r,i){var a,s,o,u,c=arguments;return P.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=c.length>3&&void 0!==c[3]&&c[3],t.next=3,qn._fromIdTokenResponse(n,i,a);case 3:return s=t.sent,o=si(i),u=new e({user:s,providerId:o,_tokenResponse:i,operationType:r}),t.abrupt("return",u);case 7:case"end":return t.stop()}},t)})),function(e,t,r){return n.apply(this,arguments)})},{key:"_forOperation",value:(t=_(P.mark(function t(n,r,i){var a;return P.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n._updateTokensIfNecessary(i,!0);case 2:return a=si(i),t.abrupt("return",new e({user:n,providerId:a,_tokenResponse:i,operationType:r}));case 4:case"end":return t.stop()}},t)})),function(e,n,r){return t.apply(this,arguments)})}]),e}();function si(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}var oi=function(e){g(n,e);var t=St(n);function n(e,r,i,a){var s,o;return E(this,n),(s=t.call(this,r.code,r.message)).operationType=i,s.user=a,Object.setPrototypeOf(p(s),n.prototype),s.customData={appName:e.name,tenantId:null!==(o=e.tenantId)&&void 0!==o?o:void 0,_serverResponse:r.customData._serverResponse,operationType:i},s}return S(n,null,[{key:"_fromErrorAndOperation",value:function(e,t,r,i){return new n(e,t,r,i)}}]),n}(X);function ui(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(function(n){if(n.code==="auth/".concat("multi-factor-auth-required"))throw oi._fromErrorAndOperation(e,n,t,r);throw n})}function ci(e,t){return li.apply(this,arguments)}function li(){return li=_(P.mark(function e(t,n){var r,i,a=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>2&&void 0!==a[2]&&a[2],e.t0=Tn,e.t1=t,e.t2=n,e.t3=t.auth,e.next=7,t.getIdToken();case 7:return e.t4=e.sent,e.t5=e.t2._linkToIdToken.call(e.t2,e.t3,e.t4),e.t6=r,e.next=12,(0,e.t0)(e.t1,e.t5,e.t6);case 12:return i=e.sent,e.abrupt("return",ai._forOperation(t,"link",i));case 14:case"end":return e.stop()}},e)})),li.apply(this,arguments)}function hi(e,t){return fi.apply(this,arguments)}function fi(){return fi=_(P.mark(function e(t,n){var r,i,a,s,o,u,c=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=c.length>2&&void 0!==c[2]&&c[2],!nt((i=t.auth).app)){e.next=4;break}return e.abrupt("return",Promise.reject(Bt(i)));case 4:return a="reauthenticate",e.prev=5,e.next=8,Tn(t,ui(i,a,n,t),r);case 8:return Ht((s=e.sent).idToken,i,"internal-error"),Ht(o=In(s.idToken),i,"internal-error"),u=o.sub,Ht(t.uid===u,i,"user-mismatch"),e.abrupt("return",ai._forOperation(t,a,s));case 17:throw e.prev=17,e.t0=e.catch(5),(null===e.t0||void 0===e.t0?void 0:e.t0.code)==="auth/".concat("user-not-found")&&Ft(i,"user-mismatch"),e.t0;case 21:case"end":return e.stop()}},e,null,[[5,17]])})),fi.apply(this,arguments)}function di(e,t){return pi.apply(this,arguments)}function pi(){return pi=_(P.mark(function e(t,n){var r,i,a,s,o=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=o.length>2&&void 0!==o[2]&&o[2],!nt(t.app)){e.next=3;break}return e.abrupt("return",Promise.reject(Bt(t)));case 3:return i="signIn",e.next=6,ui(t,i,n);case 6:return a=e.sent,e.next=9,ai._fromIdTokenResponse(t,i,a);case 9:if(s=e.sent,r){e.next=13;break}return e.next=13,t._updateCurrentUser(s.user);case 13:return e.abrupt("return",s);case 14:case"end":return e.stop()}},e)})),pi.apply(this,arguments)}function vi(){return(vi=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",di(fr(t),n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function gi(){return(gi=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",hi(ue(t),n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function yi(e,t,n){var r;Ht((null===(r=n.url)||void 0===r?void 0:r.length)>0,e,"invalid-continue-uri"),Ht(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>
20,e,"invalid-dynamic-link-domain"),t.continueUrl=n.url,t.dynamicLinkDomain=n.dynamicLinkDomain,t.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(Ht(n.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(Ht(n.android.packageName.length>0,e,"missing-android-pkg-name"),t.androidInstallApp=n.android.installApp,t.androidMinimumVersionCode=n.android.minimumVersion,t.androidPackageName=n.android.packageName)}function mi(e){return ki.apply(this,arguments)}function ki(){return(ki=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=fr(t))._getPasswordPolicyInternal()){e.next=4;break}return e.next=4,n._updatePasswordPolicy();case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}function wi(){return(wi=_(P.mark(function e(t,n,r){var i,a;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=fr(t),a={requestType:"PASSWORD_RESET",email:n,clientType:"CLIENT_TYPE_WEB"},r&&yi(i,a,r),e.next=5,kr(i,a,"getOobCode",jr);case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function bi(){return bi=_(P.mark(function e(t,n,r){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Sr(ue(t),{oobCode:n,newPassword:r}).catch(function(){var e=_(P.mark(function e(n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:throw n.code==="auth/".concat("password-does-not-meet-requirements")&&mi(t),n;case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}},e)})),bi.apply(this,arguments)}function _i(e,t){return Ei.apply(this,arguments)}function Ei(){return(Ei=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Or(ue(t),{oobCode:n});case 2:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ii(){return(Ii=_(P.mark(function e(t,n,r){var i,a,s,o;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!nt(t.app)){e.next=2;break}return e.abrupt("return",Promise.reject(Bt(t)));case 2:return i=fr(t),a=kr(i,{returnSecureToken:!0,email:n,password:r,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",ri),e.next=7,a.catch(function(e){throw e.code==="auth/".concat("password-does-not-meet-requirements")&&mi(t),e});case 7:return s=e.sent,e.next=10,ai._fromIdTokenResponse(i,"signIn",s);case 10:return o=e.sent,e.next=13,i._updateCurrentUser(o.user);case 13:return e.abrupt("return",o);case 14:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Si(e,t,n){return nt(e.app)?Promise.reject(Bt(e)):function(e,t){return vi.apply(this,arguments)}(ue(e),$r.credential(t,n)).catch(function(){var t=_(P.mark(function t(n){return P.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:throw n.code==="auth/".concat("password-does-not-meet-requirements")&&mi(e),n;case 2:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())}function Ti(e,t){return xi.apply(this,arguments)}function xi(){return(xi=_(P.mark(function e(t,n){var r,i,a,s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=ue(t),e.next=3,t.getIdToken();case 3:return i=e.sent,a={requestType:"VERIFY_EMAIL",idToken:i},n&&yi(r.auth,a,n),e.next=8,Ur(r.auth,a);case 8:if(s=e.sent,s.email===t.email){e.next=13;break}return e.next=13,t.reload();case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ai(){return(Ai=_(P.mark(function e(t,n,r){var i,a,s,o;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=ue(t),e.next=3,t.getIdToken();case 3:return a=e.sent,s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:a,newEmail:n},r&&yi(i.auth,s,r),e.next=8,Br(i.auth,s);case 8:if(o=e.sent,o.email===t.email){e.next=13;break}return e.next=13,t.reload();case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ci(e,t){return Pi.apply(this,arguments)}function Pi(){return(Pi=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",nn(t,"POST","/v1/accounts:update",n));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Oi(){return(Oi=_(P.mark(function e(t,n){var r,i,a,s,o,u,c;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.displayName,i=n.photoURL,void 0!==r||void 0!==i){e.next=3;break}return e.abrupt("return");case 3:return a=ue(t),e.next=6,a.getIdToken();case 6:return s=e.sent,o={idToken:s,displayName:r,photoUrl:i,returnSecureToken:!0},e.next=10,Tn(a,Ci(a.auth,o));
2case 10:return u=e.sent,a.displayName=u.displayName||null,a.photoURL=u.photoUrl||null,(c=a.providerData.find(function(e){return"password"===e.providerId}))&&(c.displayName=a.displayName,c.photoURL=a.photoURL),e.next=17,a._updateTokensIfNecessary(u);case 17:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ri(e,t){return function(e,t,n){return Ni.apply(this,arguments)}(ue(e),null,t)}function Ni(){return(Ni=_(P.mark(function e(t,n,r){var i,a,s,o;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.auth,e.next=3,t.getIdToken();case 3:return a=e.sent,s={idToken:a,returnSecureToken:!0},n&&(s.email=n),r&&(s.password=r),e.next=9,Tn(t,xr(i,s));case 9:return o=e.sent,e.next=12,t._updateTokensIfNecessary(o,!0);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Di=S(function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};E(this,e),this.isNewUser=t,this.providerId=n,this.profile=r}),Li=function(e){g(n,e);var t=St(n);function n(e,r,i,a){var s;return E(this,n),(s=t.call(this,e,r,i)).username=a,s}return S(n)}(Di),Mi=function(e){g(n,e);var t=St(n);function n(e,r){return E(this,n),t.call(this,e,"facebook.com",r)}return S(n)}(Di),Ui=function(e){g(n,e);var t=St(n);function n(e,r){return E(this,n),t.call(this,e,"github.com",r,"string"==typeof(null==r?void 0:r.login)?null==r?void 0:r.login:null)}return S(n)}(Li),Fi=function(e){g(n,e);var t=St(n);function n(e,r){return E(this,n),t.call(this,e,"google.com",r)}return S(n)}(Di),ji=function(e){g(n,e);var t=St(n);function n(e,r,i){return E(this,n),t.call(this,e,"twitter.com",r,i)}return S(n)}(Li);function Vi(e){var t=e.user,n=e._tokenResponse;return t.isAnonymous&&!n?{providerId:null,isNewUser:!1,profile:null}:function(e){var t,n;if(!e)return null;var r=e.providerId,i=e.rawUserInfo?JSON.parse(e.rawUserInfo):{},a=e.isNewUser||"identitytoolkit#SignupNewUserResponse"===e.kind;if(!r&&(null==e?void 0:e.idToken)){var s=null===(n=null===(t=In(e.idToken))||void 0===t?void 0:t.firebase)||void 0===n?void 0:n.sign_in_provider;if(s)return new Di(a,"anonymous"!==s&&"custom"!==s?s:null)}if(!r)return null;switch(r){case"facebook.com":return new Mi(a,i);case"github.com":return new Ui(a,i);case"google.com":return new Fi(a,i);case"twitter.com":return new ji(a,i,e.screenName||null);case"custom":case"anonymous":return new Di(a,null);default:return new Di(a,r,i)}}(n)}var Bi="__sak",qi=function(){function e(t,n){E(this,e),this.storageRetriever=t,this.type=n}return S(e,[{key:"_isAvailable",value:function(){try{return this.storage?(this.storage.setItem(Bi,"1"),this.storage.removeItem(Bi),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}},{key:"_set",value:function(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}},{key:"_get",value:function(e){var t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}},{key:"_remove",value:function(e){return this.storage.removeItem(e),Promise.resolve()}},{key:"storage",get:function(){return this.storageRetriever()}}]),e}();var zi=function(e){g(a,e);var t,n,r,i=St(a);function a(){var e,t;return E(this,a),(e=i.call(this,function(){return window.localStorage},"LOCAL")).boundEventHandler=function(t,n){return e.onStorageEvent(t,n)},e.listeners={},e.localCache={},e.pollTimer=null,e.safariLocalStorageNotSynced=(Jn(t=G())||rr(t))&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),e.fallbackToPolling=ar(),e._shouldAllowMigration=!0,e}return S(a,[{key:"forAllChangedKeys",value:function(e){for(var t=0,n=Object.keys(this.listeners);t<n.length;t++){var r=n[t],i=this.storage.getItem(r),a=this.localCache[r];i!==a&&e(r,a,i)}}},{key:"onStorageEvent",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.key){var r=e.key;if(n?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){var i=this.storage.getItem(r);if(e.newValue!==i)null!==e.newValue?this.storage.setItem(r,e.newValue):this.storage.removeItem(r);else if(this.localCache[r]===e.newValue&&!n)return}var a=function(){var e=t.storage.getItem(r);(n||t.localCache[r]!==e)&&t.notifyListeners(r,e)},s=this.storage.getItem(r);
2ir()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(a,10):a()}else this.forAllChangedKeys(function(e,n,r){t.notifyListeners(e,r)})}},{key:"notifyListeners",value:function(e,t){this.localCache[e]=t;var n=this.listeners[e];if(n)for(var r=0,i=Array.from(n);r<i.length;r++){(0,i[r])(t?JSON.parse(t):t)}}},{key:"startPolling",value:function(){var e=this;this.stopPolling(),this.pollTimer=setInterval(function(){e.forAllChangedKeys(function(t,n,r){e.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:n,newValue:r}),!0)})},1e3)}},{key:"stopPolling",value:function(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}},{key:"attachListener",value:function(){window.addEventListener("storage",this.boundEventHandler)}},{key:"detachListener",value:function(){window.removeEventListener("storage",this.boundEventHandler)}},{key:"_addListener",value:function(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}},{key:"_removeListener",value:function(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}},{key:"_set",value:(r=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d(f(a.prototype),"_set",this).call(this,t,n);case 2:this.localCache[t]=JSON.stringify(n);case 3:case"end":return e.stop()}},e,this)})),function(e,t){return r.apply(this,arguments)})},{key:"_get",value:(n=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d(f(a.prototype),"_get",this).call(this,t);case 2:return n=e.sent,this.localCache[t]=JSON.stringify(n),e.abrupt("return",n);case 5:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"_remove",value:(t=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d(f(a.prototype),"_remove",this).call(this,t);case 2:delete this.localCache[t];case 3:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})}]),a}(qi);zi.type="LOCAL";var Hi=zi,Ki=function(e){g(n,e);var t=St(n);function n(){return E(this,n),t.call(this,function(){return window.sessionStorage},"SESSION")}return S(n,[{key:"_addListener",value:function(e,t){}},{key:"_removeListener",value:function(e,t){}}]),n}(qi);Ki.type="SESSION";var Gi=Ki;function Wi(e){return Promise.all(e.map(function(){var e=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t;case 3:return n=e.sent,e.abrupt("return",{fulfilled:!0,value:n});case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",{fulfilled:!1,reason:e.t0});case 10:case"end":return e.stop()}},e,null,[[0,7]])}));return function(t){return e.apply(this,arguments)}}()))}var Qi=function(){function e(t){E(this,e),this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}var t;return S(e,[{key:"isListeningto",value:function(e){return this.eventTarget===e}},{key:"handleEvent",value:(t=_(P.mark(function e(t){var n,r,i,a,s,o,u,c;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(n=t).data,i=r.eventId,a=r.eventType,s=r.data,null==(o=this.handlersMap[a])?void 0:o.size){e.next=5;break}return e.abrupt("return");case 5:return n.ports[0].postMessage({status:"ack",eventId:i,eventType:a}),u=Array.from(o).map(function(){var e=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(n.origin,s));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=9,Wi(u);case 9:c=e.sent,n.ports[0].postMessage({status:"done",eventId:i,eventType:a,response:c});case 11:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"_subscribe",value:function(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}},{key:"_unsubscribe",value:function(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}],[{key:"_getInstance",value:function(t){var n=this.receivers.find(function(e){return e.isListeningto(t)});if(n)return n;var r=new e(t);return this.receivers.push(r),r}}]),e}();function Yi(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n="",r=0;r<t;r++)n+=Math.floor(10*Math.random());return e+n}Qi.receivers=[];var Xi=function(){function e(t){E(this,e),this.target=t,this.handlers=new Set}var t;return S(e,[{key:"removeMessageHandler",value:function(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}},{key:"_send",value:(t=_(P.mark(function e(t,n){var r,i,a,s,o=this,u=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>2&&void 0!==u[2]?u[2]:50,i="undefined"!=typeof MessageChannel?new MessageChannel:null){e.next=4;break}throw new Error("connection_unavailable");case 4:return e.abrupt("return",new Promise(function(e,u){var c=Yi("",20);i.port1.start();var l=setTimeout(function(){u(new Error("unsupported_event"))},r);s={messageChannel:i,onMessage:function(t){var n=t;if(n.data.eventId===c)switch(n.data.status){case"ack":clearTimeout(l),a=setTimeout(function(){u(new Error("timeout"))},3e3);break;case"done":clearTimeout(a),e(n.data.response);break;default:clearTimeout(l),clearTimeout(a),u(new Error("invalid_response"))}}},o.handlers.add(s),i.port1.addEventListener("message",s.onMessage),o.target.postMessage({eventType:t,eventId:c,data:n},[i.port2])}).finally(function(){s&&o.removeMessageHandler(s)}));case 5:case"end":return e.stop()}},e)})),function(e,n){return t.apply(this,arguments)})}]),e}();function Ji(){return window}
2function $i(e){Ji().location.href=e}function Zi(){return void 0!==Ji().WorkerGlobalScope&&"function"==typeof Ji().importScripts}function ea(){return ta.apply(this,arguments)}function ta(){return(ta=_(P.mark(function e(){var t;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===navigator||void 0===navigator?void 0:navigator.serviceWorker){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,navigator.serviceWorker.ready;case 5:return t=e.sent,e.abrupt("return",t.active);case 9:return e.prev=9,e.t0=e.catch(2),e.abrupt("return",null);case 12:case"end":return e.stop()}},e,null,[[2,9]])}))).apply(this,arguments)}function na(){var e;return(null===(e=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===e?void 0:e.controller)||null}function ra(){return Zi()?self:null}var ia="firebaseLocalStorageDb",aa="firebaseLocalStorage",sa="fbase_key",oa=function(){function e(t){E(this,e),this.request=t}return S(e,[{key:"toPromise",value:function(){var e=this;return new Promise(function(t,n){e.request.addEventListener("success",function(){t(e.request.result)}),e.request.addEventListener("error",function(){n(e.request.error)})})}}]),e}();function ua(e,t){return e.transaction([aa],t?"readwrite":"readonly").objectStore(aa)}function ca(){var e=indexedDB.deleteDatabase(ia);return new oa(e).toPromise()}function la(){var e=indexedDB.open(ia,1);return new Promise(function(t,n){e.addEventListener("error",function(){n(e.error)}),e.addEventListener("upgradeneeded",function(){var t=e.result;try{t.createObjectStore(aa,{keyPath:sa})}catch(r){n(r)}}),e.addEventListener("success",_(P.mark(function n(){var r;return P.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if((r=e.result).objectStoreNames.contains(aa)){n.next=12;break}return r.close(),n.next=5,ca();case 5:return n.t0=t,n.next=8,la();case 8:n.t1=n.sent,(0,n.t0)(n.t1),n.next=13;break;case 12:t(r);case 13:case"end":return n.stop()}},n)})))})}function ha(e,t,n){return fa.apply(this,arguments)}function fa(){return(fa=_(P.mark(function e(t,n,r){var i,a;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=ua(t,!0).put((x(i={},sa,n),x(i,"value",r),i)),e.abrupt("return",new oa(a).toPromise());case 2:case"end":return e.stop()}},e)}))).apply(this,arguments)}function da(e,t){return pa.apply(this,arguments)}function pa(){return(pa=_(P.mark(function e(t,n){var r,i;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=ua(t,!1).get(n),e.next=3,new oa(r).toPromise();case 3:return i=e.sent,e.abrupt("return",void 0===i?null:i.value);case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function va(e,t){var n=ua(e,!0).delete(t);return new oa(n).toPromise()}var ga=function(){function e(){E(this,e),this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(function(){},function(){})}var t,n,r,i,a,s,o,u,c,l,h,f;return S(e,[{key:"_openDb",value:(f=_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.db){e.next=2;break}return e.abrupt("return",this.db);case 2:return e.next=4,la();case 4:return this.db=e.sent,e.abrupt("return",this.db);case 6:case"end":return e.stop()}},e,this)})),function(){return f.apply(this,arguments)})},{key:"_withRetries",value:(h=_(P.mark(function e(t){var n,r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:return e.prev=2,e.next=5,this._openDb();case 5:return r=e.sent,e.next=8,t(r);case 8:return e.abrupt("return",e.sent);case 11:if(e.prev=11,e.t0=e.catch(2),!(n++>3)){e.next=15;break}throw e.t0;case 15:this.db&&(this.db.close(),this.db=void 0);case 16:e.next=1;break;case 18:case"end":return e.stop()}},e,this,[[2,11]])})),function(e){return h.apply(this,arguments)})},{key:"initializeServiceWorkerMessaging",value:(l=_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Zi()?this.initializeReceiver():this.initializeSender());case 1:case"end":return e.stop()}},e,this)})),function(){return l.apply(this,arguments)})},{key:"initializeReceiver",value:(c=_(P.mark(function e(){var t=this;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.receiver=Qi._getInstance(ra()),this.receiver._subscribe("keyChanged",function(){var e=_(P.mark(function e(n,r){var i;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t._poll();case 2:return i=e.sent,e.abrupt("return",{keyProcessed:i.includes(r.key)});case 4:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}()),this.receiver._subscribe("ping",function(){var e=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",["keyChanged"]);case 1:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}},e,this)})),function(){return c.apply(this,arguments)})},{key:"initializeSender",value:(u=_(P.mark(function e(){var t,n,r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ea();case 2:if(this.activeServiceWorker=e.sent,this.activeServiceWorker){e.next=5;break}return e.abrupt("return");case 5:return this.sender=new Xi(this.activeServiceWorker),e.next=8,this.sender._send("ping",{},800);case 8:if(r=e.sent){e.next=11;break}return e.abrupt("return");case 11:(null===(t=r[0])||void 0===t?void 0:t.fulfilled)&&(null===(n=r[0])||void 0===n?void 0:n.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0);case 12:case"end":return e.stop()}},e,this)})),function(){return u.apply(this,arguments)})},{key:"notifyServiceWorker",value:(o=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.sender&&this.activeServiceWorker&&na()===this.activeServiceWorker){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:case"end":return e.stop()}},e,this,[[2,7]])})),function(e){return o.apply(this,arguments)})},{key:"_isAvailable",value:(s=_(P.mark(function e(){var t;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,indexedDB){e.next=3;break}return e.abrupt("return",!1);case 3:return e.next=5,la();case 5:return t=e.sent,e.next=8,ha(t,Bi,"1");case 8:return e.next=10,va(t,Bi);case 10:return e.abrupt("return",!0);case 13:e.prev=13,e.t0=e.catch(0);case 15:return e.abrupt("return",!1);case 16:case"end":return e.stop()}},e,null,[[0,13]])})),function(){return s.apply(this,arguments)})},{key:"_withPendingWrite",value:(a=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.pendingWrites++,e.prev=1,e.next=4,t();case 4:return e.prev=4,this.pendingWrites--,e.finish(4);case 7:case"end":return e.stop()}},e,this,[[1,,4,7]])})),function(e){return a.apply(this,arguments)})},{key:"_set",value:(i=_(P.mark(function e(t,n){var r=this;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._withPendingWrite(_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r._withRetries(function(e){return ha(e,t,n
2)});case 2:return r.localCache[t]=n,e.abrupt("return",r.notifyServiceWorker(t));case 4:case"end":return e.stop()}},e)}))));case 1:case"end":return e.stop()}},e,this)})),function(e,t){return i.apply(this,arguments)})},{key:"_get",value:(r=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._withRetries(function(e){return da(e,t)});case 2:return n=e.sent,this.localCache[t]=n,e.abrupt("return",n);case 5:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"_remove",value:(n=_(P.mark(function e(t){var n=this;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._withPendingWrite(_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n._withRetries(function(e){return va(e,t)});case 2:return delete n.localCache[t],e.abrupt("return",n.notifyServiceWorker(t));case 4:case"end":return e.stop()}},e)}))));case 1:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"_poll",value:(t=_(P.mark(function e(){var t,n,r,i,a,s,o,u,c,l,h;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._withRetries(function(e){var t=ua(e,!1).getAll();return new oa(t).toPromise()});case 2:if(t=e.sent){e.next=5;break}return e.abrupt("return",[]);case 5:if(0===this.pendingWrites){e.next=7;break}return e.abrupt("return",[]);case 7:if(n=[],r=new Set,0!==t.length){i=Tt(t);try{for(i.s();!(a=i.n()).done;)s=a.value,o=s.fbase_key,u=s.value,r.add(o),JSON.stringify(this.localCache[o])!==JSON.stringify(u)&&(this.notifyListeners(o,u),n.push(o))}catch(f){i.e(f)}finally{i.f()}}for(c=0,l=Object.keys(this.localCache);c<l.length;c++)h=l[c],this.localCache[h]&&!r.has(h)&&(this.notifyListeners(h,null),n.push(h));return e.abrupt("return",n);case 12:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})},{key:"notifyListeners",value:function(e,t){this.localCache[e]=t;var n=this.listeners[e];if(n)for(var r=0,i=Array.from(n);r<i.length;r++){(0,i[r])(t)}}},{key:"startPolling",value:function(){var e=this;this.stopPolling(),this.pollTimer=setInterval(_(P.mark(function t(){return P.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e._poll());case 1:case"end":return t.stop()}},t)})),800)}},{key:"stopPolling",value:function(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}},{key:"_addListener",value:function(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}},{key:"_removeListener",value:function(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}]),e}();ga.type="LOCAL";var ya=ga;function ma(e,t){return t?Hn(t):(Ht(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}new Xt(3e4,6e4);var ka=function(e){g(n,e);var t=St(n);function n(e){var r;return E(this,n),(r=t.call(this,"custom","custom")).params=e,r}return S(n,[{key:"_getIdTokenResponse",value:function(e){return Qr(e,this._buildIdpRequest())}},{key:"_linkToIdToken",value:function(e,t){return Qr(e,this._buildIdpRequest(t))}},{key:"_getReauthenticationResolver",value:function(e){return Qr(e,this._buildIdpRequest())}},{key:"_buildIdpRequest",value:function(e){var t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}]),n}(Ir);function wa(e){return di(e.auth,new ka(e),e.bypassAuthState)}function ba(e){var t=e.auth,n=e.user;return Ht(n,t,"internal-error"),hi(n,new ka(e),e.bypassAuthState)}function _a(e){return Ea.apply(this,arguments)}function Ea(){return(Ea=_(P.mark(function e(t){var n,r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.auth,Ht(r=t.user,n,"internal-error"),e.abrupt("return",ci(r,new ka(t),t.bypassAuthState));case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Ia=function(){function e(t,n,r,i){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];
2E(this,e),this.auth=t,this.resolver=r,this.user=i,this.bypassAuthState=a,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}var t;return S(e,[{key:"execute",value:function(){var e=this;return new Promise(function(){var t=_(P.mark(function t(n,r){return P.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e.pendingPromise={resolve:n,reject:r},t.prev=1,t.next=4,e.resolver._initialize(e.auth);case 4:return e.eventManager=t.sent,t.next=7,e.onExecution();case 7:e.eventManager.registerConsumer(e),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(1),e.reject(t.t0);case 13:case"end":return t.stop()}},t,null,[[1,10]])}));return function(e,n){return t.apply(this,arguments)}}())}},{key:"onAuthEvent",value:(t=_(P.mark(function e(t){var n,r,i,a,s,o,u;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.urlResponse,r=t.sessionId,i=t.postBody,a=t.tenantId,s=t.error,o=t.type,!s){e.next=4;break}return this.reject(s),e.abrupt("return");case 4:return u={auth:this.auth,requestUri:n,sessionId:r,tenantId:a||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState},e.prev=5,e.t0=this,e.next=9,this.getIdpTask(o)(u);case 9:e.t1=e.sent,e.t0.resolve.call(e.t0,e.t1),e.next=16;break;case 13:e.prev=13,e.t2=e.catch(5),this.reject(e.t2);case 16:case"end":return e.stop()}},e,this,[[5,13]])})),function(e){return t.apply(this,arguments)})},{key:"onError",value:function(e){this.reject(e)}},{key:"getIdpTask",value:function(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return wa;case"linkViaPopup":case"linkViaRedirect":return _a;case"reauthViaPopup":case"reauthViaRedirect":return ba;default:Ft(this.auth,"internal-error")}}},{key:"resolve",value:function(e){Gt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}},{key:"reject",value:function(e){Gt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}},{key:"unregisterAndCleanUp",value:function(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}]),e}(),Sa=new Xt(2e3,1e4);function Ta(){return(Ta=_(P.mark(function e(t,n,r){var i,a,s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!nt(t.app)){e.next=2;break}return e.abrupt("return",Promise.reject(jt(t,"operation-not-supported-in-this-environment")));case 2:return i=fr(t),qt(t,n,Zr),a=ma(i,r),s=new Aa(i,"signInViaPopup",n,a),e.abrupt("return",s.executeNotNull());case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function xa(){return(xa=_(P.mark(function e(t,n,r){var i,a,s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!nt((i=ue(t)).auth.app)){e.next=3;break}return e.abrupt("return",Promise.reject(jt(i.auth,"operation-not-supported-in-this-environment")));case 3:return qt(i.auth,n,Zr),a=ma(i.auth,r),s=new Aa(i.auth,"reauthViaPopup",n,a,i),e.abrupt("return",s.executeNotNull());case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Aa=function(e){g(i,e);var t,n,r=St(i);function i(e,t,n,a,s){var o;return E(this,i),(o=r.call(this,e,t,a,s)).provider=n,o.authWindow=null,o.pollId=null,i.currentPopupAction&&i.currentPopupAction.cancel(),i.currentPopupAction=p(o),o}return S(i,[{key:"executeNotNull",value:(n=_(P.mark(function e(){var t;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.execute();case 2:return Ht(t=e.sent,this.auth,"internal-error"),e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"onExecution",value:(t=_(P.mark(function e(){var t,n=this;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Gt(1===this.filter.length,"Popup operations only handle one event"),t=Yi(),e.next=4,this.resolver._openPopup(this.auth,this.provider,this.filter[0],t);case 4:this.authWindow=e.sent,this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch(function(e){n.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,function(e){e||n.reject(jt(n.auth,"web-storage-unsupported"))}),this.pollUserCancellation();case 9:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})},{key:"eventId",get:function(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}},{key:"cancel",value:function(){this.reject(jt(this.auth,"cancelled-popup-request"))}},{key:"cleanUp",value:function(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,i.currentPopupAction=null}},{key:"pollUserCancellation",value:function(){var e=this;!function t(){var n,r;(null===(r=null===(n=e.authWindow)||void 0===n?void 0:n.window)||void 0===r?void 0:r.closed)?e.pollId=window.setTimeout(function(){e.pollId=null,e.reject(jt(e.auth,"popup-closed-by-user"))},8e3):e.pollId=window.setTimeout(t,Sa.get())}()}}]),i}(Ia);Aa.currentPopupAction=null;var Ca=new Map,Pa=function(e){g(a,e);var t,n,r,i=St(a);function a(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return E(this,a),(n=i.call(this,e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r)).eventId=null,n}return S(a,[{key:"execute",value:(r=_(P.mark(function e(){var t,n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Ca.get(this.auth._key())){e.next=21;break}return e.prev=2,e.next=5,Oa(this.resolver,this.auth);case 5:if(!e.sent){e.next=12;break}return e.next=9,d(f(a.prototype),"execute",this).call(this);case 9:e.t0=e.sent,e.next=13;break;case 12:e.t0=null;case 13:n=e.t0,t=function(){return Promise.resolve(n)},e.next=20;break;case 17:e.prev=17,e.t1=e.catch(2),t=function(){return Promise.reject(e.t1)};case 20:Ca.set(this.auth._key(),t);case 21:return this.bypassAuthState||Ca.set(this.auth._key(),function(){return Promise.resolve(null)}),e.abrupt("return",t());case 23:case"end":return e.stop()}},e,this,[[2,17]])})),function(){return r.apply(this,arguments)})},{key:"onAuthEvent",value:(n=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("signInViaRedirect"!==t.type){e.next=4;break}return e.abrupt("return",d(f(a.prototype),"onAuthEvent",this).call(this,t));case 4:if("unknown"!==t.type){e.next=7;break}return this.resolve(null),e.abrupt("return");
2case 7:if(!t.eventId){e.next=17;break}return e.next=10,this.auth._redirectUserForId(t.eventId);case 10:if(!(n=e.sent)){e.next=16;break}return this.user=n,e.abrupt("return",d(f(a.prototype),"onAuthEvent",this).call(this,t));case 16:this.resolve(null);case 17:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"onExecution",value:(t=_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}},e)})),function(){return t.apply(this,arguments)})},{key:"cleanUp",value:function(){}}]),a}(Ia);function Oa(e,t){return Ra.apply(this,arguments)}function Ra(){return(Ra=_(P.mark(function e(t,n){var r,i,a;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=La(n),i=Da(t),e.next=4,i._isAvailable();case 4:if(e.sent){e.next=6;break}return e.abrupt("return",!1);case 6:return e.next=8,i._get(r);case 8:return e.t0=e.sent,a="true"===e.t0,e.next=12,i._remove(r);case 12:return e.abrupt("return",a);case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Na(e,t){Ca.set(e._key(),t)}function Da(e){return Hn(e._redirectPersistence)}function La(e){return Wn("pendingRedirect",e.config.apiKey,e.name)}function Ma(e,t){return Ua.apply(this,arguments)}function Ua(){return Ua=_(P.mark(function e(t,n){var r,i,a,s,o,u=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>2&&void 0!==u[2]&&u[2],!nt(t.app)){e.next=3;break}return e.abrupt("return",Promise.reject(Bt(t)));case 3:return i=fr(t),a=ma(i,n),s=new Pa(i,a,r),e.next=8,s.execute();case 8:if(!(o=e.sent)||r){e.next=15;break}return delete o.user._redirectEventId,e.next=13,i._persistUserIfCurrent(o.user);case 13:return e.next=15,i._setRedirectUser(null,n);case 15:return e.abrupt("return",o);case 16:case"end":return e.stop()}},e)})),Ua.apply(this,arguments)}var Fa=function(){function e(t){E(this,e),this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}return S(e,[{key:"registerConsumer",value:function(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}},{key:"unregisterConsumer",value:function(e){this.consumers.delete(e)}},{key:"onEvent",value:function(e){var t=this;if(this.hasEventBeenHandled(e))return!1;var n=!1;return this.consumers.forEach(function(r){t.isEventForConsumer(e,r)&&(n=!0,t.sendToConsumer(e,r),t.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Va(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}},{key:"sendToConsumer",value:function(e,t){var n;if(e.error&&!Va(e)){var r=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(jt(this.auth,r))}else t.onAuthEvent(e)}},{key:"isEventForConsumer",value:function(e,t){var n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}},{key:"hasEventBeenHandled",value:function(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(ja(e))}},{key:"saveEventToCache",value:function(e){this.cachedEventUids.add(ja(e)),this.lastProcessedEventTime=Date.now()}}]),e}();function ja(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(function(e){return e}).join("-")}function Va(e){var t=e.type,n=e.error;return"unknown"===t&&(null==n?void 0:n.code)==="auth/".concat("no-auth-event")}function Ba(e){return qa.apply(this,arguments)}function qa(){return qa=_(P.mark(function e(t){var n,r=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},e.abrupt("return",nn(t,"GET","/v1/projects",n));case 2:case"end":return e.stop()}},e)})),qa.apply(this,arguments)}var za=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ha=/^https?/;function Ka(){return(Ka=_(P.mark(function e(t){var n,r,i,a,s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.config.emulator){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,Ba(t);case 4:n=e.sent,r=n.authorizedDomains,i=Tt(r),e.prev=7,i.s();case 9:if((a=i.n()).done){e.next=20;break}if(s=a.value,e.prev=11,!Ga(s)){e.next=14;break}return e.abrupt("return");case 14:e.next=18;break;case 16:e.prev=16,e.t0=e.catch(11);case 18:e.next=9;break;case 20:e.next=25;break;case 22:e.prev=22,e.t1=e.catch(7),i.e(e.t1);case 25:return e.prev=25,i.f(),e.finish(25);case 28:Ft(t,"unauthorized-domain");case 29:case"end":return e.stop()}},e,null,[[7,22,25,28],[11,16]])}))).apply(this,arguments)}function Ga(e){var t=Wt(),n=new URL(t),r=n.protocol,i=n.hostname;if(e.startsWith("chrome-extension://")){var a=new URL(e);return""===a.hostname&&""===i?"chrome-extension:"===r&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===r&&a.hostname===i}if(!Ha.test(r))return!1;if(za.test(e))return i===e;var s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(i)}var Wa=new Xt(3e4,6e4);function Qa(){var e=Ji().___jsl;if(null==e?void 0:e.H)for(var t=0,n=Object.keys(e.H);t<n.length;t++){var r=n[t];if(e.H[r].r=e.H[r].r||[],e.H[r].L=e.H[r].L||[],e.H[r].r=T(e.H[r].L),e.CP)for(var i=0;i<e.CP.length;i++)e.CP[i]=null}}function Ya(e){return new Promise(function(t,n){var r,i,a;function s(){Qa(),gapi.load("gapi.iframes",{callback:function(){t(gapi.iframes.getContext())},ontimeout:function(){Qa(),n(jt(e,"network-request-failed"))},timeout:Wa.get()})}if(null===(i=null===(r=Ji().gapi)||void 0===r?void 0:r.iframes)||void 0===i?void 0:i.Iframe)t(gapi.iframes.getContext());else{if(!(null===(a=Ji().gapi)||void 0===a?void 0:a.load)){var o="__".concat("iframefcb").concat(Math.floor(1e6*Math.random()));return Ji()[o]=function(){gapi.load?s():n(jt(e,"network-request-failed"))},vr("".concat(pr.gapiScript,"?onload=").concat(o)).catch(function(e){return n(e)})}s()}}).catch(function(e){throw Xa=null,e})}var Xa=null;function Ja(e){return Xa=Xa||Ya(e)}var $a=new Xt(5e3,15e3),Za={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},es=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function ts(e){var t=e.config;Ht(t.authDomain,e,"auth-domain-config-required");var n=t.emulator?Jt(t,"emulator/auth/iframe"):"https://".concat(e.config.authDomain,"/").concat("__/auth/iframe"),r={apiKey:t.apiKey,appName:e.n
2ame,v:st},i=es.get(e.config.apiHost);i&&(r.eid=i);var a=e._getFrameworks();return a.length&&(r.fw=a.join(",")),"".concat(n,"?").concat(ne(r).slice(1))}function ns(e){return rs.apply(this,arguments)}function rs(){return rs=_(P.mark(function e(t){var n,r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ja(t);case 2:return n=e.sent,Ht(r=Ji().gapi,t,"internal-error"),e.abrupt("return",n.open({where:document.body,url:ts(t),messageHandlersFilter:r.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Za,dontclear:!0},function(e){return new Promise(function(){var n=_(P.mark(function n(r,i){var a,s,o;return P.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return o=function(){Ji().clearTimeout(s),r(e)},n.next=3,e.restyle({setHideOnLeave:!1});case 3:a=jt(t,"network-request-failed"),s=Ji().setTimeout(function(){i(a)},$a.get()),e.ping(o).then(o,function(){i(a)});case 6:case"end":return n.stop()}},n)}));return function(e,t){return n.apply(this,arguments)}}())}));case 6:case"end":return e.stop()}},e)})),rs.apply(this,arguments)}var is={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},as=function(){function e(t){E(this,e),this.window=t,this.associatedEvent=null}return S(e,[{key:"close",value:function(){if(this.window)try{this.window.close()}catch(e){}}}]),e}();function ss(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:500,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:600,a=Math.max((window.screen.availHeight-i)/2,0).toString(),s=Math.max((window.screen.availWidth-r)/2,0).toString(),o="",u=Object.assign(Object.assign({},is),{width:r.toString(),height:i.toString(),top:a,left:s}),c=G().toLowerCase();n&&(o=$n(c)?"_blank":n),Xn(c)&&(t=t||"http://localhost",u.scrollbars="yes");var l=Object.entries(u).reduce(function(e,t){var n=w(t,2),r=n[0],i=n[1];return"".concat(e).concat(r,"=").concat(i,",")},"");if(function(){var e;return rr(arguments.length>0&&void 0!==arguments[0]?arguments[0]:G())&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(c)&&"_self"!==o)return function(e,t){var n=document.createElement("a");n.href=e,n.target=t;var r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}(t||"",o),new as(null);var h=window.open(t||"",o,l);Ht(h,e,"popup-blocked");try{h.focus()}catch(f){}return new as(h)}var os=encodeURIComponent("fac");function us(e,t,n,r,i,a){return cs.apply(this,arguments)}function cs(){return(cs=_(P.mark(function e(t,n,r,i,a,s){var o,u,c,l,h,f,d,p,v,g,y,m,k;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Ht(t.config.authDomain,t,"auth-domain-config-required"),Ht(t.config.apiKey,t,"invalid-api-key"),o={apiKey:t.config.apiKey,appName:t.name,authType:r,redirectUrl:i,v:st,eventId:a},n instanceof Zr)for(n.setDefaultLanguage(t.languageCode),o.providerId=n.providerId||"",Z(n.getCustomParameters())||(o.customParameters=JSON.stringify(n.getCustomParameters())),u=0,c=Object.entries(s||{});u<c.length;u++)l=w(c[u],2),h=l[0],f=l[1],o[h]=f;for(n instanceof ei&&(d=n.getScopes().filter(function(e){return""!==e})).length>0&&(o.scopes=d.join(",")),t.tenantId&&(o.tid=t.tenantId),p=o,v=0,g=Object.keys(p);v<g.length;v++)y=g[v],void 0===p[y]&&delete p[y];return e.next=10,t._getAppCheckToken();case 10:return m=e.sent,k=m?"#".concat(os,"=").concat(encodeURIComponent(m)):"",e.abrupt("return","".concat(ls(t),"?").concat(ne(p).slice(1)).concat(k));case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ls(e){var t=e.config;return t.emulator?Jt(t,"emulator/auth/handler"):"https://".concat(t.authDomain,"/").concat("__/auth/handler")}var hs="webStorageSupport",fs=function(){function e(){E(this,e),this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Gi,this._completeRedirectFn=Ma,this._overrideRedirectResult=Na}var t,n,r;return S(e,[{key:"_openPopup",value:(r=_(P.mark(function e(t,n,r,i){var a,s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Gt(null===(a=this.eventManagers[t._key()])||void 0===a?void 0:a.manager,"_initialize() not called before _openPopup()"),e.next=3,us(t,n,r,Wt(),i);case 3:return s=e.sent,e.abrupt("return",ss(t,s,Yi()));case 5:case"end":return e.stop()}},e,this)})),function(e,t,n,i){return r.apply(this,arguments)})},{key:"_openRedirect",value:(n=_(P.mark(function e(t,n,r,i){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._originValidation(t);case 2:return e.next=4,us(t,n,r,Wt(),i);case 4:return $i(e.sent),e.abrupt("return",new Promise(function(){}));case 7:case"end":return e.stop()}},e,this)})),function(e,t,r,i){return n.apply(this,arguments)})},{key:"_initialize",value:function(e){var t=this,n=e._key();if(this.eventManagers[n]){var r=this.eventManagers[n],i=r.manager,a=r.promise;return i?Promise.resolve(i):(Gt(a,"If manager is not set, promise should be"),a)}var s=this.initAndGetManager(e);return this.eventManagers[n]={promise:s},s.catch(function(){delete t.eventManagers[n]}),s}},{key:"initAndGetManager",value:(t=_(P.mark(function e(t){var n,r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ns(t);case 2:return n=e.sent,r=new Fa(t),n.register("authEvent",function(e){return Ht(null==e?void 0:e.authEvent,t,"invali
2d-auth-event"),{status:r.onEvent(e.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:r},this.iframes[t._key()]=n,e.abrupt("return",r);case 8:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"_isIframeWebStorageSupported",value:function(e,t){this.iframes[e._key()].send(hs,{type:hs},function(n){var r,i=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[hs];void 0!==i&&t(!!i),Ft(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}},{key:"_originValidation",value:function(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=function(e){return Ka.apply(this,arguments)}(e)),this.originValidationPromises[t]}},{key:"_shouldInitProactively",get:function(){return ar()||Jn()||rr()}}]),e}(),ds=fs,ps="@firebase/auth",vs="1.7.4",gs=function(){function e(t){E(this,e),this.auth=t,this.internalListeners=new Map}var t;return S(e,[{key:"getUid",value:function(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}},{key:"getToken",value:(t=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertAuthConfigured(),e.next=3,this.auth._initializationPromise;case 3:if(this.auth.currentUser){e.next=5;break}return e.abrupt("return",null);case 5:return e.next=7,this.auth.currentUser.getIdToken(t);case 7:return n=e.sent,e.abrupt("return",{accessToken:n});case 9:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"addAuthTokenListener",value:function(e){if(this.assertAuthConfigured(),!this.internalListeners.has(e)){var t=this.auth.onIdTokenChanged(function(t){e((null==t?void 0:t.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}}},{key:"removeAuthTokenListener",value:function(e){this.assertAuthConfigured();var t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}},{key:"assertAuthConfigured",value:function(){Ht(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}},{key:"updateProactiveRefresh",value:function(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}]),e}();var ys,ms=H("authIdTokenMaxAge")||300,ks=null;function ws(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ut(),t=tt(e,"auth");if(t.isInitialized())return t.getImmediate();var n,r=function(e,t){var n=tt(e,"auth");if(n.isInitialized()){var r=n.getImmediate();if(ee(n.getOptions(),null!=t?t:{}))return r;Ft(r,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:ds,persistence:[ya,Hi,Gi]}),i=H("authTokenSyncURL");if(i&&"boolean"==typeof isSecureContext&&isSecureContext){var a=new URL(i,location.origin);if(location.origin===a.origin){var s=(n=a.toString(),function(){var e=_(P.mark(function e(t){var r,i,a;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=t,!e.t0){e.next=5;break}return e.next=4,t.getIdTokenResult();case 4:e.t0=e.sent;case 5:if(r=e.t0,!((i=r&&((new Date).getTime()-Date.parse(r.issuedAtTime))/1e3)&&i>ms)){e.next=9;break}return e.abrupt("return");case 9:if(a=null==r?void 0:r.token,ks!==a){e.next=12;break}return e.abrupt("return");case 12:return ks=a,e.next=15,fetch(n,{method:a?"POST":"DELETE",headers:a?{Authorization:"Bearer ".concat(a)}:{}});case 15:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());!function(e,t,n){ue(e).beforeAuthStateChanged(t,n)}(r,s,function(){return s(r.currentUser)}),function(e,t,n,r){ue(e).onIdTokenChanged(t,n,r)}(r,function(e){return s(e)})}}var o,u,c,l=(o="auth",null===(c=null===(u=q())||void 0===u?void 0:u.emulatorHosts)||void 0===c?void 0:c[o]);return l&&br(r,"http://".concat(l)),r}pr={loadJS:function(e){return new Promise(function(t,n){var r,i,a=document.createElement("script");a.setAttribute("src",e),a.onload=t,a.onerror=function(e){var t=jt("internal-error");t.customData=e,n(t)},a.type="text/javascript",a.charset="UTF-8",(null!==(i=null===(r=document.getElementsByTagName("head"))||void 0===r?void 0:r[0])&&void 0!==i?i:document).appendChild(a)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="},ys="Browser",et(new he("auth",function(e,t){var n=t.options,r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),a=e.getProvider("app-check-internal"),s=r.options,o=s.apiKey,u=s.authDomain;Ht(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});var c={apiKey:o,authDomain:u,clientPlatform:ys,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:sr(ys)},l=new hr(r,i,a,c);return function(e,t){var n=(null==t?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Hn);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null==t?void 0:t.popupRedirectResolver)}(l,n),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(function(e,t,n){e.getProvider("auth-internal").initialize()})),et(new he("auth-internal",function(e){return function(e){return new gs(e)}(fr(e.getProvider("auth").getImmediate()))},"PRIVATE").setInstantiationMode("EXPLICIT")),ct(ps,vs,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(ys)),ct(ps,vs,"esm2017");var bs=Object.prototype;var _s=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||bs)};var Es=function(e,t){return function(n){return e(t(n))}},Is=Es(Object.keys,Object),Ss=_s,Ts=Is,xs=Object.prototype.hasOwnProperty;var As=function(e){if(!Ss(e))return Ts(e);var t=[];for(var n in Object(e))xs.call(e,n)&&"constructor"!=n&&t.push(n);return t},Cs="object"==c(A)&&A&&A.Object===Object&&A,Ps=Cs,Os="object"==("undefined"==typeof self?"undefined":c(self))&&self&&self.Object===Object&&self,Rs=Ps||Os||Function("return this")(),Ns=Rs.Symbol,Ds=Ns,Ls=Object.prototype,Ms=Ls.hasOwnProperty,Us=Ls.toString,Fs=Ds?Ds.toStringTag:void 0;var js=function(e){var t=Ms.call(e,Fs),n=e[Fs];try{e[Fs]=void 0;var r=!0}catch(a){}var i=Us.call(e);return r&&(t?e[Fs]=n:delete e[Fs]),i},Vs=Object.prototype.toString;var Bs=js,qs=function(e){return Vs.call(e)},zs=Ns?Ns.toStringTag:void 0;
vendor: 2,385 bytes, line 2
2var Hs=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":zs&&zs in Object(e)?Bs(e):qs(e)};var Ks=function(e){var t=c(e);return null!=e&&("object"==t||"function"==t)},Gs=Hs,Ws=Ks;var Qs,Ys=function(e){if(!Ws(e))return!1;var t=Gs(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Xs=Rs["__core-js_shared__"],Js=(Qs=/[^.]+$/.exec(Xs&&Xs.keys&&Xs.keys.IE_PROTO||""))?"Symbol(src)_1."+Qs:"";var $s=function(e){return!!Js&&Js in e},Zs=Function.prototype.toString;var eo=function(e){if(null!=e){try{return Zs.call(e)}catch(t){}try{return e+""}catch(t){}}return""},to=Ys,no=$s,ro=Ks,io=eo,ao=/^\[object .+?Constructor\]$/,so=Function.prototype,oo=Object.prototype,uo=so.toString,co=oo.hasOwnProperty,lo=RegExp("^"+uo.call(co).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ho=function(e){return!(!ro(e)||no(e))&&(to(e)?lo:ao).test(io(e))},fo=function(e,t){return null==e?void 0:e[t]};var po=function(e,t){var n=fo(e,t);return ho(n)?n:void 0},vo=po(Rs,"DataView"),go=po(Rs,"Map"),yo=vo,mo=go,ko=po(Rs,"Promise"),wo=po(Rs,"Set"),bo=po(Rs,"WeakMap"),_o=Hs,Eo=eo,Io="[object Map]",So="[object Promise]",To="[object Set]",xo="[object WeakMap]",Ao="[object DataView]",Co=Eo(yo),Po=Eo(mo),Oo=Eo(ko),Ro=Eo(wo),No=Eo(bo),Do=_o;(yo&&Do(new yo(new ArrayBuffer(1)))!=Ao||mo&&Do(new mo)!=Io||ko&&Do(ko.resolve())!=So||wo&&Do(new wo)!=To||bo&&Do(new bo)!=xo)&&(Do=function(e){var t=_o(e),n="[object Object]"==t?e.constructor:void 0,r=n?Eo(n):"";if(r)switch(r){case Co:return Ao;case Po:return Io;case Oo:return So;case Ro:return To;case No:return xo}return t});var Lo=Do;var Mo=function(e){return null!=e&&"object"==c(e)},Uo=Hs,Fo=Mo;var jo=function(e){return Fo(e)&&"[object Arguments]"==Uo(e)},Vo=Mo,Bo=Object.prototype,qo=Bo.hasOwnProperty,zo=Bo.propertyIsEnumerable,Ho=jo(function(){return arguments}())?jo:function(e){return Vo(e)&&qo.call(e,"callee")&&!zo.call(e,"callee")},Ko=Ho,Go=Array.isArray;var Wo=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Qo=Ys,Yo=Wo;var Xo=function(e){return null!=e&&Yo(e.length)&&!Qo(e)},Jo={exports:{}};var $o=function(){return!1};!function(e,t){var n=Rs,r=$o,i=t&&!t.nodeType&&t,a=i&&e&&!e.nodeType&&e,s=a&&a.exports===i?n.Buffer:void 0,o=(s?s.isBuffer:void 0)||r;e.exports=o}
2(Jo,Jo.exports);var Zo=Hs,eu=Wo,tu=Mo,nu={};nu["[object Float32Array]"]=nu["[object Float64Array]"]=nu["[object Int8Array]"]=nu["[object Int16Array]"]=nu["[object Int32Array]"]=nu["[object Uint8Array]"]=nu["[object Uint8ClampedArray]"]=nu["[object Uint16Array]"]=nu["[object Uint32Array]"]=!0,nu["[object Arguments]"]=nu["[object Array]"]=nu["[object ArrayBuffer]"]=nu["[object Boolean]"]=nu["[object DataView]"]=nu["[object Date]"]=nu["[object Error]"]=nu["[object Function]"]=nu["[object Map]"]=nu["[object Number]"]=nu["[object Object]"]=nu["[object RegExp]"]=nu["[object Set]"]=nu["[object String]"]=nu["[object WeakMap]"]=!1;var ru=function(e){return tu(e)&&eu(e.length)&&!!nu[Zo(e)]};var iu=function(e){return function(t){return e(t)}},au={exports:{}};!function(e,t){var n=Cs,r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,a=i&&i.exports===r&&n.process,s=function(){try{var e=i&&i.require&&i.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(t){}}();e.exports=s}(au,au.exports);var su=ru,ou=iu,uu=au.exports,cu=uu&&uu.isTypedArray,lu=cu?ou(cu):su,hu=As,fu=Lo,du=Ko,pu=Go,vu=Xo,gu=Jo.exports,yu=_s,mu=lu,ku=Object.prototype.hasOwnProperty;var wu,bu,_u,Eu,Iu,Su,Tu,xu=function(e){if(null==e)return!0;if(vu(e)&&(pu(e)||"string"==typeof e||"function"==typeof e.splice||gu(e)||mu(e)||du(e)))return!e.length;var t=fu(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(yu(e))return!hu(e).length;for(var n in e)if(ku.call(e,n))return!1;return!0};class Au{constructor(e){this.isMultipassEnabled=()=>this.config.hasMultipass,this.generateMultipassLink=e=>h(this,void 0,void 0,function*(){try{if(!this.isMultipassEnabled())return{success:!1,message:"Multipass disabled",code:"405"};if(!this.config.multipassAuthReturnTo)return{success:!1,message:"multipassAuthReturnTo parameter is missing",code:"multipassAuthReturnToMissing"};if(!window)return{success:!1,message:"Problem with client session occured - no window detected",code:"500"};const t={email:e,return_to:this.config.multipassAuthReturnTo},n=yield(0,a.A)("/api/shopify/multipass",{method:"POST",data:t});return n.data.success?{success:!0,url:n.data.url}:n.data}catch(t){return{success:!1,message:t.message,code:t.code}}}),this.signIn=e=>{window.location.href=e},this.getUserIdByEmail=({clientEmail:e})=>h(this,void 0,void 0,function*(){try{const t=`email:${e}`,n={data:{apiPath:`/customers/search.json?query=${t}`,method:"GET"}};return(yield a.A.post("/api/shopify/admin-api",n)).data}catch(t){return{success:!1,message:t.message,code:t.code}}}),this.getUserData=({clientId:e,scope:t})=>h(this,void 0,void 0,function*(){var n;try{const r=`/customers/${e}`,i={data:{apiPath:t?`${r}/${t}.json`:r,method:"GET"}},s=yield a.A.post("/api/shopify/admin-api",i);return{orders:s.data.data.orders,success:s.data.success,code:null===(n=s.data.code)||void 0===n?void 0:n.toString()}}catch(r){return{success:!1,message:r.message,code:r.code}}}),this.config=e}}!function(e){e.Technical="technical",e.DeliveryAddresses="deliveryAddresses",e.UserDetails="userDetails",e.Security="security",e.OrderHistory="orderHistory",e.AdditionalDeliveryAddresses="additionalDeliveryAddresses"}(wu||(wu={})),function(e){e.Health="Health",e.Hyho="Hyho"}(bu||(bu={})),function(e){e.textbox="textbox",e.password="password",e.date="date",e.checkbox="checkbox",e.radio="radio",e.textarea="textarea",e.phone="phone",e.select="select",e.custom="custom"}(_u||(_u={})),function(e){e.verifyEmail="verifyEmail",e.recoverEmail="recoverEmail",e.resetPassword="resetPassword",e.verifyAndChangeEmail="verifyAndChangeEmail"}(Eu||(Eu={})),function(e){e.onConfirmSignUp="onConfirmSignUp ",e.onAuthStateChange="onAuthStateChange",e.onTermsChanged="onTermsChanged",e.onLdsConfirmation="onLdsConfirmation",e.onDeleteAccount="onDeleteAccount",e.onDeniedSignIn="onDeniedSignIn"}(Iu||(Iu={})),function(e){e.Google="Google",e.Facebook="Facebook"}(Su||(Su={})),function(e){e[e.Email=0]="Email"}(Tu||(Tu={}));class Cu{constructor(e){this.ldsConfig=e,this.getSocialLds=()=>h(this,void 0,void 0,function*(){const e=(yield this.getLds()).filter(({socialTerm:e})=>e).map(({businessId:e})=>e);return this.createLdsFields(e)}),this.createLdsFields=e=>h(this,void 0,void 0,function*(){var t;if(!Array.isArray(e))return[];return null!==(t=(yield this.getLds()).filter(({businessId:t})=>e.includes(t)).map(({businessId:e,isRequired:t,description:n,validFrom:r,validTo:i,versionId:a})=>({system:this.ldsConfig.system.toString(),acceptanceDate:(new Date).toISOString(),businessId:e,versionId:a,validFrom:null==r?void 0:r.toISOString(),val
2idTo:null==i?void 0:i.toISOString(),description:n,isRequired:t,accepted:!0})))&&void 0!==t?t:[]}),this.getLds=()=>this.getLdsPromise,this.getLdsByBusinessId=e=>h(this,void 0,void 0,function*(){return(yield this.getLdsPromise).find(({businessId:t})=>t===e)}),this.dispatchEventIfLegalsUpdated=(e,t)=>h(this,void 0,void 0,function*(){const n=yield this.getUpdatedLds(e,t);(null==n?void 0:n.length)&&window.dispatchEvent(new CustomEvent(Iu.onTermsChanged,{detail:{updatedLds:n,visible:!0}}))}),this.getMissingLegalsForProfileEdit=e=>h(this,void 0,void 0,function*(){const t=yield this.getLds(),n=e?this.getAcceptedLegals(e):{};return t.filter(e=>!e.socialTerm&&e.isRequired&&(!(e.businessId in n)||n[e.businessId]!==e.versionId))}),this.getAcceptedLegals=e=>{var t;return(null!==(t=null==e?void 0:e.lds)&&void 0!==t?t:[]).filter(({accepted:e})=>e).reduce((e,{businessId:t,versionId:n})=>{const r=Object.assign(e,{});return r[t]=n,r},{})},this.getUpdatedLds=(e,t)=>h(this,void 0,void 0,function*(){return(yield this.getLdsPromise).filter(n=>{const{businessId:r,versionId:i,isRequired:a,socialTerm:s}=n,o=e.find(e=>e.businessId===r),u=!o&&a&&(t?s:!s);return o&&o.versionId!==i||u})}),this.getLdsData=()=>Promise.resolve(this.ldsConfig.legals.map(e=>Object.assign(Object.assign({},e),{system:this.ldsConfig.system}))),this.getLdsPromise=this.getLdsData()}}var Pu;function Ou(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ru(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ru(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function Ru(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}ct("firebase","10.12.2","app");var Nu=new Map,Du={activated:!1,tokenObservers:[]},Lu={initialized:!1,enabled:!1};function Mu(e){return Nu.get(e)||Object.assign({},Du)}function Uu(){return Lu}var Fu="https://content-firebaseappcheck.googleapis.com/v1",ju=3e4,Vu=96e4,Bu=function(){function e(t,n,r,i,a){if(E(this,e),this.operation=t,this.retryPolicy=n,this.getWaitDuration=r,this.lowerBound=i,this.upperBound=a,this.pending=null,this.nextErrorWaitInterval=i,i>a)throw new Error("Proactive refresh lower bound greater than upper bound!")}var t;return S(e,[{key:"start",value:function(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(function(){})}},{key:"stop",value:function(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}},{key:"isRunning",value:function(){return!!this.pending}},{key:"process",value:(t=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.stop(),e.prev=1,this.pending=new K,this.pending.promise.catch(function(e){}),e.next=6,qu(this.getNextRun(t));case 6:return this.pending.resolve(),e.next=9,this.pending.promise;case 9:return this.pending=new K,this.pending.promise.catch(function(e){}),e.next=13,this.operation();case 13:return this.pending.resolve(),e.next=16,this.pending.promise;case 16:this.process(!0).catch(function(){}),e.next=22;break;case 19:e.prev=19,e.t0=e.catch(1),this.retryPolicy(e.t0)?this.process(!1).catch(function(){}):this.stop();case 22:case"end":return e.stop()}},e,this,[[1,19]])})),function(e){return t.apply(this,arguments)})},{key:"getNextRun",value:function(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();var t=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),t}}]),e}();function qu(e){return new Promise(function(t){setTimeout(t,e)})}var zu=(x(Pu={}
2,"already-initialized","You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance."),x(Pu,"use-before-activation","App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services."),x(Pu,"fetch-network-error","Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}."),x(Pu,"fetch-parse-error","Fetch client could not parse response. Original error: {$originalErrorMessage}."),x(Pu,"fetch-status-error","Fetch server returned an HTTP error status. HTTP status: {$httpStatus}."),x(Pu,"storage-open","Error thrown when opening storage. Original error: {$originalErrorMessage}."),x(Pu,"storage-get","Error thrown when reading from storage. Original error: {$originalErrorMessage}."),x(Pu,"storage-set","Error thrown when writing to storage. Original error: {$originalErrorMessage}."),x(Pu,"recaptcha-error","ReCAPTCHA error."),x(Pu,"throttled","Requests throttled due to {$httpStatus} error. Attempts allowed again after {$time}"),Pu),Hu=new J("appCheck","AppCheck",zu);function Ku(){var e;return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?null===(e=self.grecaptcha)||void 0===e?void 0:e.enterprise:self.grecaptcha}function Gu(e){if(!Mu(e).activated)throw Hu.create("use-before-activation",{appName:e.name})}function Wu(e){var t=Math.round(e/1e3),n=Math.floor(t/86400),r=Math.floor((t-3600*n*24)/3600),i=Math.floor((t-3600*n*24-3600*r)/60),a=t-3600*n*24-3600*r-60*i,s="";return n&&(s+=Qu(n)+"d:"),r&&(s+=Qu(r)+"h:"),s+=Qu(i)+"m:"+Qu(a)+"s"}function Qu(e){return 0===e?"00":e>=10?e.toString():"0"+e}function Yu(e,t){return Xu.apply(this,arguments)}function Xu(){return(Xu=_(P.mark(function e(t,n){var r,i,a,s,o,u,c,l,h,f,d;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.url,i=t.body,a={"Content-Type":"application/json"},!(s=n.getImmediate({optional:!0}))){e.next=8;break}return e.next=6,s.getHeartbeatsHeader();case 6:(o=e.sent)&&(a["X-Firebase-Client"]=o);case 8:return u={method:"POST",body:JSON.stringify(i),headers:a},e.prev=9,e.next=12,fetch(r,u);case 12:c=e.sent,e.next=18;break;case 15:throw e.prev=15,e.t0=e.catch(9),Hu.create("fetch-network-error",{originalErrorMessage:null===e.t0||void 0===e.t0?void 0:e.t0.message});case 18:if(200===c.status){e.next=20;break}throw Hu.create("fetch-status-error",{httpStatus:c.status});case 20:return e.prev=20,e.next=23,c.json();case 23:l=e.sent,e.next=29;break;case 26:throw e.prev=26,e.t1=e.catch(20),Hu.create("fetch-parse-error",{originalErrorMessage:null===e.t1||void 0===e.t1?void 0:e.t1.message});case 29:if((h=l.ttl.match(/^([\d.]+)(s)$/))&&h[2]&&!isNaN(Number(h[1]))){e.next=32;break}throw Hu.create("fetch-parse-error",{originalErrorMessage:"ttl field (timeToLive) is not in standard Protobuf Duration "+"format: ".concat(l.ttl)});case 32:return f=1e3*Number(h[1]),d=Date.now(),e.abrupt("return",{token:l.token,expireTimeMillis:d+f,issuedAtTimeMillis:d});case 35:case"end":return e.stop()}},e,null,[[9,15],[20,26]])}))).apply(this,arguments)}function Ju(e,t){var n=e.options,r=n.projectId,i=n.appId,a=n.apiKey;return{url:"".concat(Fu,"/projects/").concat(r,"/apps/").concat(i,":").concat("exchangeRecaptchaV3Token","?key=").concat(a),body:{recaptcha_v3_token:t}}}function $u(e,t){var n=e.options,r=n.projectId,i=n.appId,a=n.apiKey;return{url:"".concat(Fu,"/projects/").concat(r,"/apps/").concat(i,":").concat("exchangeDebugToken","?key=").concat(a),body:{debug_token:t}}}var Zu="firebase-app-check-store",ec="debug-token",tc=null;function nc(){return tc||(tc=new Promise(function(e,t){try{var n=indexedDB.open("firebase-app-check-database",1);n.onsuccess=function(t){e(t.target.result)},n.onerror=function(e){var n;t(Hu.create("storage-open",{originalErrorMessage:null===(n=e.target.error)||void 0===n?void 0:n.message}))},n.onupgradeneeded=function(e){var t=e.target.result;if(0===e.oldVersion)t.createObjectStore(Zu,{keyPath:"compositeKey"})}}catch(r){t(Hu.create("storage-open",{originalErrorMessage:null==r?void 0:r.message}))}}))}function rc(e){return uc(lc(e))}function ic(e){return sc(ec,e)}function ac(){return uc(ec)}function sc(e,t){return oc.apply(this,arguments)}function oc(){return(oc=_(P.mark(function e(t,n){var r,i,a,s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,nc();case 2:return r=e.sent,i=r.transaction(Zu,"readwrite"),a=i.objectStore(Zu),s=a.put({compositeKey:t,value:n}),e.abrupt("return",new Promise(function(e,t){s.onsuccess=function(t){e()},i.onerror=function(e){var n;t(Hu.create("storage-set",{originalErrorMessage:null===(n=e.target.error)||void 0===n?void 0:n.message}))}}));case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function uc(e){return cc.apply(this,arguments)}function cc(){return(cc=_(P.mark(function e(t){var n,r,i,a;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,nc();case 2:return n=e.sent,r=n.transaction(Zu,"readonly"),i=r.objectStore(Zu),a=i.get(t),e.abrupt("return",new Promise(function(e,t){a.onsuccess=function(t){var n=t.target.result;e(n?n.value:void 0)},r.onerror=function(e){var n;t(Hu.create("storage-get",{originalErrorMessage:null===(n=e.target.error)||void 0===n?void 0:n.message}))}}));case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function lc(e){return"".concat(e.options.appId,"-").concat(e.name)}
2var hc=new Ee("@firebase/app-check");function fc(){return(fc=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!Q()){e.next=12;break}return n=void 0,e.prev=2,e.next=5,rc(t);case 5:n=e.sent,e.next=11;break;case 8:e.prev=8,e.t0=e.catch(2),hc.warn("Failed to read token from IndexedDB. Error: ".concat(e.t0));case 11:return e.abrupt("return",n);case 12:return e.abrupt("return",void 0);case 13:case"end":return e.stop()}},e,null,[[2,8]])}))).apply(this,arguments)}function dc(e,t){return Q()?function(e,t){return sc(lc(e),t)}(e,t).catch(function(e){hc.warn("Failed to write token to IndexedDB. Error: ".concat(e))}):Promise.resolve()}function pc(){return(pc=_(P.mark(function e(){var t,n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=void 0,e.prev=1,e.next=4,ac();case 4:t=e.sent,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(1);case 9:if(t){e.next=15;break}return ic(n=oe()).catch(function(e){return hc.warn("Failed to persist debug token to IndexedDB. Error: ".concat(e))}),e.abrupt("return",n);case 15:return e.abrupt("return",t);case 16:case"end":return e.stop()}},e,null,[[1,7]])}))).apply(this,arguments)}function vc(){return Uu().enabled}function gc(){return yc.apply(this,arguments)}function yc(){return(yc=_(P.mark(function e(){var t;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t=Uu()).enabled||!t.token){e.next=5;break}return e.abrupt("return",t.token.promise);case 5:throw Error("\n Can't get debug token in production mode.\n ");case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}function mc(){var e=B(),t=Uu();if(t.initialized=!0,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN||!0===e.FIREBASE_APPCHECK_DEBUG_TOKEN){t.enabled=!0;var n=new K;t.token=n,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN?n.resolve(e.FIREBASE_APPCHECK_DEBUG_TOKEN):n.resolve(function(){return pc.apply(this,arguments)}())}}var kc={error:"UNKNOWN_ERROR"};function wc(e){return bc.apply(this,arguments)}function bc(){return bc=_(P.mark(function e(t){var n,r,i,a,s,o,u,c,l,h=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=h.length>1&&void 0!==h[1]&&h[1],Gu(r=t.app),i=Mu(r),a=i.token,s=void 0,a&&!xc(a)&&(i.token=void 0,a=void 0),a){e.next=18;break}return e.next=10,i.cachedTokenPromise;case 10:if(!(o=e.sent)){e.next=18;break}if(!xc(o)){e.next=16;break}a=o,e.next=18;break;case 16:return e.next=18,dc(r,void 0);case 18:if(n||!a||!xc(a)){e.next=20;break}return e.abrupt("return",{token:a.token});case 20:if(u=!1,!vc()){e.next=40;break}if(i.exchangeTokenPromise){e.next=33;break}return e.t0=Yu,e.t1=$u,e.t2=r,e.next=28,gc();case 28:e.t3=e.sent,e.t4=(0,e.t1)(e.t2,e.t3),e.t5=t.heartbeatServiceProvider,i.exchangeTokenPromise=(0,e.t0)(e.t4,e.t5).finally(function(){i.exchangeTokenPromise=void 0}),u=!0;case 33:return e.next=35,i.exchangeTokenPromise;case 35:return c=e.sent,e.next=38,dc(r,c);case 38:return i.token=c,e.abrupt("return",{token:c.token});case 40:return e.prev=40,i.exchangeTokenPromise||(i.exchangeTokenPromise=i.provider.getToken().finally(function(){i.exchangeTokenPromise=void 0}),u=!0),e.next=44,Mu(r).exchangeTokenPromise;case 44:a=e.sent,e.next=51;break;case 47:e.prev=47,e.t6=e.catch(40),e.t6.code==="appCheck/".concat("throttled")?hc.warn(e.t6.message):hc.error(e.t6),s=e.t6;case 51:if(a){e.next=55;break}l=Ac(s),e.next=63;break;case 55:if(!s){e.next=59;break}l=xc(a)?{token:a.token,internalError:s}:Ac(s),e.next=63;break;case 59:return l={token:a.token},i.token=a,e.next=63,dc(r,a);case 63:return u&&Tc(r,l),e.abrupt("return",l);case 65:case"end":return e.stop()}},e,null,[[40,47]])})),bc.apply(this,arguments)}function _c(){return(_c=_(P.mark(function e(t){var n,r,i,a,s,o,u,c;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Gu(n=t.app),r=Mu(n),i=r.provider,!vc()){e.next=14;break}return e.next=6,gc();case 6:return a=e.sent,e.next=9,Yu($u(n,a),t.heartbeatServiceProvider);case 9:return s=e.sent,o=s.token,e.abrupt("return",{token:o});case 14:return e.next=16,i.getToken();case 16:return u=e.sent,c=u.token,e.abrupt("return",{token:c});case 19:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ec(e,t,n,r){var i=Mu(e.app),a={next:n,error:r,type:t};if(i.tokenObservers=[].concat(T(i.tokenObservers),[a]),i.token&&xc(i.token)){var s=i.token;Promise.resolve().then(function(){n({token:s.token}),Sc(e)}).catch(function(){})}i.cachedTokenPromise.then(function(){return Sc(e)})}function Ic(e,t){var n=Mu(e),r=n.tokenObservers.filter(function(e){return e.next!==t});0===r.length&&n.tokenRefresher&&n.tokenRefresher.isRunning()&&n.tokenRefresher.stop(),n.tokenObservers=r}function Sc(e){var t=Mu(e.app),n=t.tokenRefresher;n||(n=function(e){var t=e.app;return new Bu(_(P.mark(function n(){var r;return P.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(Mu(t).token){n.next=7;break}return n.next=4,wc(e);case 4:r=n.sent,n.next=10;break;case 7:return n.next=9,wc(e,!0);case 9:r=n.sent;case 10:if(!r.error){n.next=12;break}throw r.error;case 12:if(!r.internalError){n.next=14;break}throw r.internalError;case 14:case"end":return n.stop()}},n)})),function(){return!0},function(){var e=Mu(t);if(e.token){var n=e.token.issuedAtTimeMillis+.5*(e.token.expireTimeMillis-e.token.issuedAtTimeMillis)+3e5,r=e.token.expireTimeMillis-3e5;return n=Math.min(n,r),Math.max(0,n-Date.now())}return 0},ju,Vu)}(e),t.tokenRefresher=n),!n.isRunning()&&t.isTokenAutoRefreshEnabled&&n.start()}function Tc(e,t){var n,r=Ou(Mu(e).tokenObservers);try{for(r.s();!(n=r.n()).done;){var i=n.value;try{"EXTERNAL"===i.type&&null!=t.error?i.error(t.error):i.next(t)}catch(a){}}}catch(s){r.e(s)}finally{r.f()}}function xc(e){return e.expireTimeMillis-Date.now()>0}function Ac(e){return{token:(t=kc,U.encodeString(JSON.stringify(t),!1)),error:e};var t}var Cc=function(){function e(t,n){E(this,e),this.app=t,this.heartbeatServiceProvider=n}return S(e,[{key:"_delete",value:function(){var e,t=Ou(Mu(this.app).tokenObservers);try{for(t.s();!(e=t.n()).done;){var n=e.value;Ic(this.app,n.next)}}catch(r){t.e(r)}finally{t.f()}return Promise.resolve()}}]),e}();function Pc(e){return{getToken:function(t){return wc(e,t)},getLimitedUseToken:function(){return function(e){return _c.apply(this,arguments)}(e)},addTokenListener:function(t){return Ec(e,"INTERNAL",t)},removeTokenListener:function(t){return Ic(e.app,t)}}}var Oc="https://www.google.com/recaptcha/api.js";function Rc(e,t){var n=new K;Mu(e).reCAPTCHAState={initialized:n};var r,i,a=function(e){var t="fire_app_check_".concat(e.name),n=document.createElement("div");return n.id=t,n.style.display="none",document.body.appendChild(n),t}(e),s=Ku(!1);return s?Nc(e,t,s,a,n):(r=function(){var r=Ku(!1);if(!r)throw new Error("no recaptcha");Nc(e,t,r,a,n)},(i=document.createElement("script")).src=Oc,i.onload=r,document.head.appendChild(i)),n.promise}function Nc(e,t,n,r,i){n.ready(function(){!function(e,t,n,r){var i=n.render(r,{sitekey:t,size:"invisible",callback:function(){Mu(e).reCAPTCHAState.succeeded=!0},"error-callback":function(){Mu(e).reCAPTCHAState.succeeded=!1}}),a=Mu(e);a.reCAPTCHAState=Object.assign(Object.assign({},a.reCAPTCHAState),{widgetId:i})}(e,t,n,r),i.resolve(n)})}function Dc(e){return Lc.apply(this,arguments)}function Lc(){return(Lc=_(P.mark(function e(t){var n,r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Gu(t),n=Mu(t).reCAPTCHAState,e.next=4,n.initialized.promise;case 4:return r=e.sent,e.abrupt("return",new Promise(function(e,n){var i=Mu(t).reCAPTCHAState;r.ready(function(){e(r.execute(i.widgetId,{action:"fire_app_check"}))})}));case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Mc=function(){function e(t){E(this,e),this._siteKey=t,this._throttleData=null}var t;return S(e,[{key:"getToken",value:(t=_(P.mark(function e(){var t,n,r,i,a;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Fc(this._throttleData),e.next=3,Dc(this._app).catch(function(e){throw Hu.create("recaptcha-error")});case 3:if(i=e.sent,null===(t=Mu(this._app).reCAPTCHAState)||void 0===t?void 0:t.succeeded){e.next=6;break}throw Hu.create("recaptcha-error");case 6:return e.prev=6,e.next=9,Yu(Ju(this._app,i),this._heartbeatServiceProvider);case 9:a=e.sent,e.next=20;break;case 12:if(e.prev=12,e.t0=e.catch(6),!(null===(n=e.t0.code)||void 0===n?void 0:n.includes("fetch-status-error"))){e.next=19;break}throw this._throttleData=Uc(Number(null===(r=e.t0.customData)||void 0===r?void 0:r.httpStatus),this._throttleData),Hu.create("throttled",{time:Wu(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus});case 19:throw e.t0;case 20:return this._throttleData=null,e.abrupt("return",a);case 22:case"end":return e.stop()}},e,this,[[6,12]])})),function(){return t.apply(this,arguments)})},{key:"initialize",value:function(e){this._app=e,this._heartbeatServiceProvider=tt(e,"heartbeat"),Rc(e,this._siteKey).catch(function(){})}},{key:"isEqual",value:function(t){return t instanceof e&&this._siteKey===t._siteKey}}]),e}();function Uc(e,t){if(404===e||403===e)return{backoffCount:1,allowRequestsAfter:Date.now()+864e5,httpStatus:e};var n=t?t.backoffCount:0,r=function(e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3)*Math.pow(t,e),r=Math.round(.5*n*(Math.random()-.5)*2);return Math.min(144e5,n+r)}(n,1e3,2);return{backoffCount:n+1,allowRequestsAfter:Date.now()+r,httpStatus:e}}function Fc(e){if(e&&Date.now()-e.allowRequestsAfter<=0)throw Hu.create("throttled",{time:Wu(e.allowRequestsAfter-Date.now()),httpStatus:e.httpStatus})}function jc(){var e=arguments.length>
20&&void 0!==arguments[0]?arguments[0]:ut(),t=arguments.length>1?arguments[1]:void 0,n=tt(e=ue(e),"app-check");if(Uu().initialized||mc(),vc()&&gc().then(function(e){return console.log("App Check debug token: ".concat(e,". You will need to add it to your app's App Check settings in the Firebase console for it to work."))}),n.isInitialized()){var r=n.getImmediate(),i=n.getOptions();if(i.isTokenAutoRefreshEnabled===t.isTokenAutoRefreshEnabled&&i.provider.isEqual(t.provider))return r;throw Hu.create("already-initialized",{appName:e.name})}var a=n.initialize({options:t});return function(e,t,n){var r=function(e,t){return Nu.set(e,t),Nu.get(e)}(e,Object.assign({},Du));r.activated=!0,r.provider=t,r.cachedTokenPromise=function(e){return fc.apply(this,arguments)}(e).then(function(t){return t&&xc(t)&&(r.token=t,Tc(e,{token:t.token})),t}),r.isTokenAutoRefreshEnabled=void 0===n?e.automaticDataCollectionEnabled:n,r.provider.initialize(e)}(e,t.provider,t.isTokenAutoRefreshEnabled),Mu(e).isTokenAutoRefreshEnabled&&Ec(a,"INTERNAL",function(){}),a}var Vc="app-check-internal";et(new he("app-check",function(e){return function(e,t){return new Cc(e,t)}(e.getProvider("app").getImmediate(),e.getProvider("heartbeat"))},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(function(e,t,n){e.getProvider(Vc).initialize()})),et(new he(Vc,function(e){return Pc(e.getProvider("app-check").getImmediate())},"PUBLIC").setInstantiationMode("EXPLICIT")),ct("@firebase/app-check","0.8.4");var Bc,qc,zc="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function Hc(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Kc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Kc(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function Kc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Gc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=f(e);if(t){var i=f(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return y(this,n)}}(function(){var e;function t(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}function n(e,t,n){n||(n=0);var r=Array(16);if("string"==typeof t)for(var i=0;16>i;++i)r[i]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(i=0;16>i;++i)r[i]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],i=e.g[2];var a=e.g[3],s=t+(a^n&(i^a))+r[0]+3614090360&4294967295;s=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=n+(s<<7&4294967295|s>>>25))+((s=a+(i^t&(n^i))+r[1]+3905402710&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^a&(t^n))+r[2]+606105819&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(a^t))+r[3]+3250441966&4294967295)<<22&4294967295|s>>>10))+((s=t+(a^n&(i^a))+r[4]+4118548399&4294967295)<<7&4294967295|s>>>25))+((s=a+(i^t&(n^i))+r[5]+1200080426&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^a&(t^n))+r[6]+2821735955&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(a^t))+r[7]+4249261313&4294967295)<<22&4294967295|s>>>10))+((s=t+(a^n&(i^a))+r[8]+1770035416&4294967295)<<7&4294967295|s>>>25))+((s=a+(i^t&(n^i))+r[9]+2336552879&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^a&(t^n))+r[10]+4294925233&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(a^t))+r[11]+2304563134&4294967295)<<22&4294967295|s>>>10))+((s=t+(a^n&(i^a))+r[12]+1804603682&4294967295)<<7&4294967295|s>>>25))+((s=a+(i^t&(n^i))+r[13]+4254626195&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^a&(t^n))+r[14]+2792965006&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(a^t))+r[15]+1236535329&4294967295)<<22&4294967295|s>>>10))+((s=t+(i^a&(n^i))+r[1]+4129170786&4294967295)<<5&4294967295|s>>>27))+((s=a+(n^i&(t^n))+r[6]+3225465664&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(a^t))+r[11]+643717713&4294967295)<<14&4294967295|s>>>18))+((s=n+(a^t&(i^a))+r[0]+3921069994&4294967295)<<20&4294967295|s>>>12))+((s=t+(i^a&(n^i))+r[5]+3593408605&4294967295)<<5&4294967295|s>>>27))+((s=a+(n^i&(t^n))+r[10]+38016083&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(a^t))+r[15]+3634488961&4294967295)<<14&4294967295|s>>>18))+((s=n+(a^t&(i^a))+r[4]+3889429448&4294967295)<<20&4294967295|s>>>12))+((s=t+(i^a&(n^i))+r[9]+568446438&4294967295)<<5&4294967295|s>>>27))+((s=a+(n^i&(t^n))+r[14]+3275163606&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(a^t))+r[3]+4107603335&4294967295)<<14&4294967295|s>>>18))+((s=n+(a^t&(i^a))+r[8]+1163531501&4294967295)<<20&4294967295|s>>>12))+((s=t+(i^a&(n^i))+r[13]+2850285829&4294967295)<<5&4294967295|s>>>27))+((s=a+(n^i&(t^n))+r[2]+4243563512&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(a^t))+r[7]+1735328473&4294967295)<<14&4294967295|s>>>18))+((s=n+(a^t&(i^a))+r[12]+2368359562&4294967295)<<20&4294967295|s>>>12))+((s=t+(n^i^a)+r[5]+4294588738&4294967295)<<4&4294967295|s>>>28))+((s=a+(t^n^i)+r[8]+2272392833&4294967295)<<11&4294967295|s>>>21))+((s=i+(a^t^n)+r[11]+1839030562&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^a^t)+r[14]+4259657740&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^i^a)+r[1]+2763975236&4294967295)<<4&4294967295|s>>>28))+((s=a+(t^n^i)+r[4]+1272893353&4294967295)<<11&4294967295|s>>>21))+((s=i+(a^t^n)+r[7]+4139469664&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^a^t)+r[10]+3200236656&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^i^a)+r[13]+681279174&4294967295)<<4&4294967295|s>>>28))+((s=a+(t^n^i)+r[0]+3936430074&4294967295)<<11&4294967295|s>>>21))+((s=i+(a^t^n)+r[3]+3572445317&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^a^t)+r[6]+76029189&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^i^a)+r[9]+3654602809&4294967295)<<4&4294967295|s>>>28))+((s=a+(t^n^i)+r[12]+3873151461&4294967295)<<11&4294967295|s>>>21))+((s=i+(a^t^n)+r[15]+530742520&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^a^t)+r[2]+3299628645&4294967295)<<23&4294967295|s>>>9))+((s=t+(i^(n|~a))+r[0]+4096336452&4294967295)<<6&4294967295|s>>>26))+((s=a+(n^(t|~i))+r[7]+1126891415&4294967295)<<10&4294967295|s>>>22))+((s=i+(t^(a|~n))+r[14]+2878612391&4294967295)<<15&4294967295|s>>>17))+((s=n+(a^(i|~t))+r[5]+4237533241&4294967295)<<21&4294967295|s>>>11))+((s=t+(i^(n|~a))+r[12]+1700485571&4294967295)<<6&4294967295|s>>>26))+((s=a+(n^(t|~i))+r[3]+2399980690&4294967295)<<10&4294967295|s>>>22))+((s=i+(t^(a|~n))+r[10]+4293915773&4294967295)<<15&4294967295|s>>>17))+((s=n+(a^(i|~t))+r[1]+2240044497&4294967295)<<21&4294967295|s>>>11))+((s=t+(i^(n|~a))+r[8]+1873313359&4294967295)<<6&4294967295|s>>>26))+((s=a+(n^(t|~i))+r[15]+4264355552&4294967295)<<10&4294967295|s>>>22))+((s=i+(t^(a|~n))+r[6]+2734768916&4294967295)<<15&4294967295|s>>>17))+((s=n+(a^(i|~t))+r[13]+1309151649&4294967295)<<21&4294967295|s>>>11))+((a=(t=n+((s=t+(i^(n|~a))+r[4]+4149444226&4294967295)<<6&4294967295|s>>>
226))+((s=a+(n^(t|~i))+r[11]+3174756917&4294967295)<<10&4294967295|s>>>22))^((i=a+((s=i+(t^(a|~n))+r[2]+718787259&4294967295)<<15&4294967295|s>>>17))|~t))+r[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(s<<21&4294967295|s>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+a&4294967295}function r(e,t){this.h=t;for(var n=[],r=!0,i=e.length-1;0<=i;i--){var a=0|e[i];r&&a==t||(n[i]=a,r=!1)}this.g=n}!function(e,t){function n(){}n.prototype=t.prototype,e.D=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.C=function(e,n,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return t.prototype[n].apply(e,i)}}(t,function(){this.blockSize=-1}),t.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},t.prototype.u=function(e,t){void 0===t&&(t=e.length);for(var r=t-this.blockSize,i=this.B,a=this.h,s=0;s<t;){if(0==a)for(;s<=r;)n(this,e,s),s+=this.blockSize;if("string"==typeof e){for(;s<t;)if(i[a++]=e.charCodeAt(s++),a==this.blockSize){n(this,i),a=0;break}}else for(;s<t;)if(i[a++]=e[s++],a==this.blockSize){n(this,i),a=0;break}}this.h=a,this.o+=t},t.prototype.v=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.o;for(t=e.length-8;t<e.length;++t)e[t]=255&n,n/=256;for(this.u(e),e=Array(16),t=n=0;4>t;++t)for(var r=0;32>r;r+=8)e[n++]=this.g[t]>>>r&255;return e};var i={};function a(e){return-128<=e&&128>e?function(e,t){var n=i;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,function(e){return new r([0|e],0>e?-1:0)}):new r([0|e],0>e?-1:0)}function s(e){if(isNaN(e)||!isFinite(e))return o;if(0>e)return f(s(-e));for(var t=[],n=1,i=0;e>=n;i++)t[i]=e/n|0,n*=4294967296;return new r(t,0)}var o=a(0),u=a(1),c=a(16777216);function l(e){if(0!=e.h)return!1;for(var t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function h(e){return-1==e.h}function f(e){for(var t=e.g.length,n=[],i=0;i<t;i++)n[i]=~e.g[i];return new r(n,~e.h).add(u)}function d(e,t){return e.add(f(t))}function p(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function v(e,t){this.g=e,this.h=t}function g(e,t){if(l(t))throw Error("division by zero");if(l(e))return new v(o,o);if(h(e))return t=g(f(e),t),new v(f(t.g),f(t.h));if(h(t))return t=g(e,f(t)),new v(f(t.g),t.h);if(30<e.g.length){if(h(e)||h(t))throw Error("slowDivide_ only works with positive integers.");for(var n=u,r=t;0>=r.l(e);)n=y(n),r=y(r);var i=m(n,1),a=m(r,1);for(r=m(r,2),n=m(n,2);!l(r);){var c=a.add(r);0>=c.l(e)&&(i=i.add(n),a=c),r=m(r,1),n=m(n,1)}return t=d(e,i.j(t)),new v(i,t)}for(i=o;0<=e.l(t);){for(n=Math.max(1,Math.floor(e.m()/t.m())),r=48>=(r=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,r-48),c=(a=s(n)).j(t);h(c)||0<c.l(e);)c=(a=s(n-=r)).j(t);l(a)&&(a=u),i=i.add(a),e=d(e,c)}return new v(i,e)}function y(e){for(var t=e.g.length+1,n=[],i=0;i<t;i++)n[i]=e.i(i)<<1|e.i(i-1)>>>31;return new r(n,e.h)}function m(e,t){var n=t>>5;t%=32;for(var i=e.g.length-n,a=[],s=0;s<i;s++)a[s]=0<t?e.i(s+n)>>>t|e.i(s+n+1)<<32-t:e.i(s+n);return new r(a,e.h)}(e=r.prototype).m=function(){if(h(this))return-f(this).m();for(var e=0,t=1,n=0;n<this.g.length;n++){var r=this.i(n);e+=(0<=r?r:4294967296+r)*t,t*=4294967296}return e},e.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(l(this))return"0";if(h(this))return"-"+f(this).toString(e);for(var t=s(Math.pow(e,6)),n=this,r="";;){var i=g(n,t).g,a=((0<(n=d(n,i.j(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(l(n=i))return a+r;for(;6>a.length;)a="0"+a;r=a+r}},e.i=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},e.l=function(e){return h(e=d(this,e))?-1:l(e)?0:1},e.abs=function(){return h(this)?f(this):this},e.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0,a=0;a<=t;a++){var s=i+(65535&this.i(a))+(65535&e.i(a)),o=(s>>>16)+(this.i(a)>>>16)+(e.i(a)>>>16);i=o>>>16,s&=65535,o&=65535,n[a]=o<<16|s}return new r(n,-2147483648&n[n.length-1]?-1:0)},e.j=function(e){if(l(this)||l(e))return o;if(h(this))return h(e)?f(this).j(f(e)):f(f(this).j(e));if(h(e))return f(this.j(f(e)));if(0>this.l(c)&&0>e.l(c))return s(this.m()*e.m());for(var t=this.g.length+e.g.length,n=[],i=0;i<2*t;i++)n[i]=0;for(i=0;i<this.g.length;i++)for(var a=0;a<e.g.length;a++){var u=this.i(i)>>>16,d=65535&this.i(i),v=e.i(a)>>>16,g=65535&e.i(a);n[2*i+2*a]+=d*g,p(n,2*i+2*a),n[2*i+2*a+1]+=u*g,p(n,2*i+2*a+1),n[2*i+2*a+1]+=d*v,p(n,2*i+2*a+1),n[2*i+2*a+2]+=u*v,p(n,2*i+2*a+2)}for(i=0;i<t;i++)n[i]=n[2*i+1]<<16|n[2*i];for(i=t;i<2*t;i++)n[i]=0;return new r(n,0)},e.A=function(e){return g(this,e).h},e.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.i(i)&e.i(i);return new r(n,this.h&e.h)},e.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.i(i)|e.i(i);return new r(n,this.h|e.h)},e.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.i(i)^e.i(i);return new r(n,this.h^e.h)},t.prototype.digest=t.prototype.v,t.prototype.reset=t.prototype.s,t.prototype.update=t.prototype.u,qc=t,r.prototype.add=r.prototype.add,r.prototype.multiply=r.prototype.j,r.prototype.modulo=r.prototype.A,r.prototype.compare=r.prototype.l,r.prototype.toNumber=r.prototype.m,r.prototype.toString=r.prototype.toString,r.prototype.getBits=r.prototype.i,r.fromNumber=s,r.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if(2>(n=n||10)||36<n)throw Error("radix out of range: "+n);
2if("-"==t.charAt(0))return f(e(t.substring(1),n));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var r=s(Math.pow(n,8)),i=o,a=0;a<t.length;a+=8){var u=Math.min(8,t.length-a),c=parseInt(t.substring(a,a+u),n);8>u?(u=s(Math.pow(n,u)),i=i.j(u).add(s(c))):i=(i=i.j(r)).add(s(c))}return i},Bc=r}).apply(void 0!==zc?zc:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Wc,Qc,Yc,Xc,Jc,$c,Zc,el,tl,nl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function rl(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return il(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return il(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function il(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function al(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=f(e);if(t){var i=f(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return y(this,n)}}(function(){var e,t="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){return e==Array.prototype||e==Object.prototype||(e[t]=n.value),e};var n=function(e){e=["object"==("undefined"==typeof globalThis?"undefined":c(globalThis))&&globalThis,e,"object"==("undefined"==typeof window?"undefined":c(window))&&window,"object"==("undefined"==typeof self?"undefined":c(self))&&self,"object"==c(nl)&&nl];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);!function(e,r){if(r)e:{var i=n;e=e.split(".");for(var a=0;a<e.length-1;a++){var s=e[a];if(!(s in i))break e;i=i[s]}(r=r(a=i[e=e[e.length-1]]))!=a&&null!=r&&t(i,e,{configurable:!0,writable:!0,value:r})}}("Array.prototype.values",function(e){return e||function(){return function(e,t){e instanceof String&&(e+="");var n=0,r=!1,i={next:function(){if(!r&&n<e.length){var i=n++;return{value:t(i,e[i]),done:!1}}return r=!0,{done:!0,value:void 0}}};return i[Symbol.iterator]=function(){return i},i}(this,function(e,t){return t})}});var r=r||{},i=this||self;function a(e){var t=c(e);return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function s(e){var t=c(e);return"object"==t&&null!=e||"function"==t}function o(e,t,n){return e.call.apply(e.bind,arguments)}function u(e,t,n){if(!e)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),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function l(e,t,n){return(l=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?o:u).apply(null,arguments)}function h(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function p(e,t){function n(){}n.prototype=t.prototype,e.aa=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Qb=function(e,n,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return t.prototype[n].apply(e,i)}}function v(e){var t=e.length;if(0<t){for(var n=Array(t),r=0;r<t;r++)n[r]=e[r];return n}return[]}function y(e,t){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(a(r)){var i=e.length||0,s=r.length||0;e.length=i+s;for(var o=0;o<s;o++)e[i+o]=r[o]}else e.push(r)}}var m=function(){function e(t,n){E(this,e),this.i=t,this.j=n,this.h=0,this.g=null}return S(e,[{key:"get",value:function(){var e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}]),e}();function k(e){return/^[\s\xa0]*$/.test(e)}function b(){var e=i.navigator;return e&&(e=e.userAgent)?e:""}function _(e){return _[" "](e),e}_[" "]=function(){};var I=!(-1==b().indexOf("Gecko")||-1!=b().toLowerCase().indexOf("webkit")&&-1==b().indexOf("Edge")||-1!=b().indexOf("Trident")||-1!=b().indexOf("MSIE")||-1!=b().indexOf("Edge"));function T(e,t,n){for(var r in e)t.call(n,e[r],r,e)}function x(e){var t={};for(var n in e)t[n]=e[n];return t}var A="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleStr
2ing toString valueOf".split(" ");function C(e,t){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])e[n]=r[n];for(var a=0;a<A.length;a++)n=A[a],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function P(e){var t=1;e=e.split(":");for(var n=[];0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function O(e){i.setTimeout(function(){throw e},0)}function R(){var e=F,t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var N,D=function(){function e(){E(this,e),this.h=this.g=null}return S(e,[{key:"add",value:function(e,t){var n=L.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}}]),e}(),L=new m(function(){return new M},function(e){return e.reset()}),M=function(){function e(){E(this,e),this.next=this.g=this.h=null}return S(e,[{key:"set",value:function(e,t){this.h=e,this.g=t,this.next=null}},{key:"reset",value:function(){this.next=this.g=this.h=null}}]),e}(),U=!1,F=new D,j=function(){var e=i.Promise.resolve(void 0);N=function(){e.then(V)}},V=function(){for(var e;e=R();){try{e.h.call(e.g)}catch(n){O(n)}var t=L;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}U=!1};function B(){this.s=this.s,this.C=this.C}function q(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}B.prototype.s=!1,B.prototype.ma=function(){this.s||(this.s=!0,this.N())},B.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},q.prototype.h=function(){this.defaultPrevented=!0};var z=function(){if(!i.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{var n=function(){};i.addEventListener("test",n,t),i.removeEventListener("test",n,t)}catch(n){}return e}();function H(e,t){if(q.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(I){e:{try{_(t.nodeName);var i=!0;break e}catch(a){}i=!1}i||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,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!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:K[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&H.aa.h.call(this)}}p(H,q);var K={2:"touch",3:"pen",4:"mouse"};H.prototype.h=function(){H.aa.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var G="closure_listenable_"+(1e6*Math.random()|0),W=0;function Q(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ha=i,this.key=++W,this.da=this.fa=!1}function Y(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function X(e){this.src=e,this.g={},this.h=0}function J(e,t){var n=t.type;if(n in e.g){var r,i=e.g[n],a=Array.prototype.indexOf.call(i,t,void 0);(r=0<=a)&&Array.prototype.splice.call(i,a,1),r&&(Y(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function $(e,t,n,r){for(var i=0;i<e.length;++i){var a=e[i];if(!a.da&&a.listener==t&&a.capture==!!n&&a.ha==r)return i}return-1}X.prototype.add=function(e,t,n,r,i){var a=e.toString();(e=this.g[a])||(e=this.g[a]=[],this.h++);var s=$(e,t,r,i);return-1<s?(t=e[s],n||(t.fa=!1)):((t=new Q(t,this.src,a,!!r,i)).fa=n,e.push(t)),t};var Z="closure_lm_"+(1e6*Math.random()|0),ee={};function te(e,t,n,r,i){if(r&&r.once)return re(e,t,n,r,i);if(Array.isArray(t)){for(var a=0;a<t.length;a++)te(e,t[a],n,r,i);return null}return n=le(n),e&&e[G]?e.K(t,n,s(r)?!!r.capture:!!r,i):ne(e,t,n,!1,r,i)}function ne(e,t,n,r,i,a){if(!t)throw Error("Invalid event type");var o=s(i)?!!i.capture:!!i,u=ue(e);
2if(u||(e[Z]=u=new X(e)),(n=u.add(t,n,r,o,a)).proxy)return n;if(r=function(){function e(n){return t.call(e.src,e.listener,n)}var t=oe;return e}(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)z||(i=o),void 0===i&&(i=!1),e.addEventListener(t.toString(),r,i);else if(e.attachEvent)e.attachEvent(se(t.toString()),r);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(r)}return n}function re(e,t,n,r,i){if(Array.isArray(t)){for(var a=0;a<t.length;a++)re(e,t[a],n,r,i);return null}return n=le(n),e&&e[G]?e.L(t,n,s(r)?!!r.capture:!!r,i):ne(e,t,n,!0,r,i)}function ie(e,t,n,r,i){if(Array.isArray(t))for(var a=0;a<t.length;a++)ie(e,t[a],n,r,i);else r=s(r)?!!r.capture:!!r,n=le(n),e&&e[G]?(e=e.i,(t=String(t).toString())in e.g&&(-1<(n=$(a=e.g[t],n,r,i))&&(Y(a[n]),Array.prototype.splice.call(a,n,1),0==a.length&&(delete e.g[t],e.h--)))):e&&(e=ue(e))&&(t=e.g[t.toString()],e=-1,t&&(e=$(t,n,r,i)),(n=-1<e?t[e]:null)&&ae(n))}function ae(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[G])J(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(se(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=ue(t))?(J(n,e),0==n.h&&(n.src=null,t[Z]=null)):Y(e)}}}function se(e){return e in ee?ee[e]:ee[e]="on"+e}function oe(e,t){if(e.da)e=!0;else{t=new H(t,this);var n=e.listener,r=e.ha||e.src;e.fa&&ae(e),e=n.call(r,t)}return e}function ue(e){return(e=e[Z])instanceof X?e:null}var ce="__closure_events_fn_"+(1e9*Math.random()>>>0);function le(e){return"function"==typeof e?e:(e[ce]||(e[ce]=function(t){return e.handleEvent(t)}),e[ce])}function he(){B.call(this),this.i=new X(this),this.M=this,this.F=null}function fe(e,t){var n,r=e.F;if(r)for(n=[];r;r=r.F)n.push(r);if(e=e.M,r=t.type||t,"string"==typeof t)t=new q(t,e);else if(t instanceof q)t.target=t.target||e;else{var i=t;C(t=new q(r,e),i)}if(i=!0,n)for(var a=n.length-1;0<=a;a--){var s=t.g=n[a];i=de(s,r,!0,t)&&i}if(i=de(s=t.g=e,r,!0,t)&&i,i=de(s,r,!1,t)&&i,n)for(a=0;a<n.length;a++)i=de(s=t.g=n[a],r,!1,t)&&i}function de(e,t,n,r){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var i=!0,a=0;a<t.length;++a){var s=t[a];if(s&&!s.da&&s.capture==n){var o=s.listener,u=s.ha||s.src;s.fa&&J(e.i,s),i=!1!==o.call(u,r)&&i}}return i&&!r.defaultPrevented}function pe(e,t,n){if("function"==typeof e)n&&(e=l(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=l(e.handleEvent,e)}return 2147483647<Number(t)?-1:i.setTimeout(e,t||0)}function ve(e){e.g=pe(function(){e.g=null,e.i&&(e.i=!1,ve(e))},e.l);var t=e.h;e.h=null,e.m.apply(null,t)}p(he,B),he.prototype[G]=!0,he.prototype.removeEventListener=function(e,t,n,r){ie(this,e,t,n,r)},he.prototype.N=function(){if(he.aa.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],r=0;r<n.length;r++)Y(n[r]);delete t.g[e],t.h--}}this.F=null},he.prototype.K=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},he.prototype.L=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};var ge=function(e){g(n,e);var t=Gc(n);function n(e,r){var i;return E(this,n),(i=t.call(this)).m=e,i.l=r,i.h=null,i.i=!1,i.g=null,i}return S(n,[{key:"j",value:function(e){this.h=arguments,this.g?this.i=!0:ve(this)}},{key:"N",value:function(){d(f(n.prototype),"N",this).call(this),this.g&&(i.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}]),n}(B);function ye(e){B.call(this),this.h=e,this.g={}}p(ye,B);var me=[];function ke(e){T(e.g,function(e,t){this.g.hasOwnProperty(t)&&ae(e)},e),e.g={}}ye.prototype.N=function(){ye.aa.N.call(this),ke(this)},ye.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var we=i.JSON.stringify,be=i.JSON.parse,_e=function(){function e(){E(this,e)}return S(e,[{key:"stringify",value:function(e){return i.JSON.stringify(e,void 0)}},{key:"parse",value:function(e){return i.JSON.parse(e,void 0)}}]),e}();function Ee(){}function Ie(e){return e.h||(e.h=e.i())}function Se(){}Ee.prototype.h=null;var Te={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function xe(){q.call(this,"d")}function Ae(){q.call(this,"c")}p(xe,q),p(Ae,q);var Ce={},Pe=null;function Oe(){return Pe=Pe||new he}function Re(e){q.call(this,Ce.La,e)}function Ne(e){var t=Oe();fe(t,new Re(t))}function De(e,t){q.call(this,Ce.STAT_EVENT,e),this.stat=t}function Le(e){var t=Oe();fe(t,new De(t,e))}function Me(e,t){q.call(this,Ce.Ma,e),this.size=t}function Ue(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return i.setTimeout(function(){e()},t)}function Fe(){this.g=!0}function je(e,t,n,r){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n)for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var r=n[e];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var a=i[0];if("noop"!=a&&"stop"!=a&&"close"!=a)for(var s=1;s<i.length;s++)i[s]=""}}}return we(n)}catch(o){return t}}(e,n)+(r?" "+r:"")})}Ce.La="serverreachability",p(Re,q),Ce.STAT_EVENT="statevent",p(De,q),Ce.Ma="timingevent",p(Me,q),Fe.prototype.xa=function(){this.g=!1},Fe.prototype.info=function(){};var Ve,Be={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},qe={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"};function ze(){}function He(e,t,n,r){this.j=e,this.i=t,this.l=n,this.R=r||1,this.U=new ye(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new Ke}function Ke(){this.i=null,this.g="",this.h=!1}p(ze,Ee),ze.prototype.g=function(){return new XMLHttpRequest},ze.prototype.i=function(){return{}},Ve=new ze;var Ge={},We={};function Qe(e,t,n){e.L=1,e.v=wt(vt(t)),e.m=n,e.P=!0,Ye(e,null)}function Ye(e,t){e.F=Date.now(),$e(e),e.A=vt(e.v);var n=e.A,r=e.R;Array.isArray(r)||(r=[String(r)]),Dt(n.i,"t",r),e.C=0,n=e.j.J,e.h=new Ke,e.g=_n(e.j,n?t:null,!e.m),
20<e.O&&(e.M=new ge(l(e.Y,e,e.g),e.O)),t=e.U,n=e.g,r=e.ca;var i="readystatechange";Array.isArray(i)||(i&&(me[0]=i.toString()),i=me);for(var a=0;a<i.length;a++){var s=te(n,i[a],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}t=e.H?x(e.H):{},e.m?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.A,e.u,e.m,t)):(e.u="GET",e.g.ea(e.A,e.u,null,t)),Ne(),function(e,t,n,r,i,a){e.info(function(){if(e.g)if(a)for(var s="",o=a.split("&"),u=0;u<o.length;u++){var c=o[u].split("=");if(1<c.length){var l=c[0];c=c[1];var h=l.split("_");s=2<=h.length&&"type"==h[1]?s+(l+"=")+c+"&":s+(l+"=redacted&")}}else s=null;else s=a;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+t+"\n"+n+"\n"+s})}(e.i,e.u,e.A,e.l,e.R,e.m)}function Xe(e){return!!e.g&&("GET"==e.u&&2!=e.L&&e.j.Ca)}function Je(e,t){var n=e.C,r=t.indexOf("\n",n);return-1==r?We:(n=Number(t.substring(n,r)),isNaN(n)?Ge:(r+=1)+n>t.length?We:(t=t.slice(r,r+n),e.C=r+n,t))}function $e(e){e.S=Date.now()+e.I,Ze(e,e.I)}function Ze(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=Ue(l(e.ba,e),t)}function et(e){e.B&&(i.clearTimeout(e.B),e.B=null)}function tt(e){0==e.j.G||e.J||yn(e.j,e)}function nt(e){et(e);var t=e.M;t&&"function"==typeof t.ma&&t.ma(),e.M=null,ke(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.ma())}function rt(e,t){try{var n=e.j;if(0!=n.G&&(n.g==e||ut(n.h,e)))if(!e.K&&ut(n.h,e)&&3==n.G){try{var r=n.Da.g.parse(t)}catch(a){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){e:if(!n.u){if(n.g){if(!(n.g.F+3e3<e.F))break e;gn(n),sn(n)}dn(n),Le(18)}}else n.za=i[1],0<n.za-n.T&&37500>i[2]&&n.F&&0==n.v&&!n.C&&(n.C=Ue(l(n.Za,n),6e3));if(1>=ot(n.h)&&n.ca){try{n.ca()}catch(a){}n.ca=void 0}}else kn(n,11)}else if((e.K||n.g==e)&&gn(n),!k(t))for(i=n.Da.g.parse(t),t=0;t<i.length;t++){var a=i[t];if(n.T=a[0],a=a[1],2==n.G)if("c"==a[0]){n.K=a[1],n.ia=a[2];var s=a[3];null!=s&&(n.la=s,n.j.info("VER="+n.la));var o=a[4];null!=o&&(n.Aa=o,n.j.info("SVER="+n.Aa));var u=a[5];null!=u&&"number"==typeof u&&0<u&&(r=1.5*u,n.L=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var c=e.g;if(c){var h=c.g?c.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var f=r.h;f.g||-1==h.indexOf("spdy")&&-1==h.indexOf("quic")&&-1==h.indexOf("h2")||(f.j=f.l,f.g=new Set,f.h&&(ct(f,f.h),f.h=null))}if(r.D){var d=c.g?c.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.ya=d,kt(r.I,r.D,d))}}n.G=3,n.l&&n.l.ua(),n.ba&&(n.R=Date.now()-e.F,n.j.info("Handshake RTT: "+n.R+"ms"));var p=e;if((r=n).qa=bn(r,r.J?r.ia:null,r.W),p.K){lt(r.h,p);var v=p,g=r.L;g&&(v.I=g),v.B&&(et(v),$e(v)),r.g=p}else fn(r);0<n.i.length&&un(n)}else"stop"!=a[0]&&"close"!=a[0]||kn(n,7);else 3==n.G&&("stop"==a[0]||"close"==a[0]?"stop"==a[0]?kn(n,7):an(n):"noop"!=a[0]&&n.l&&n.l.ta(a),n.v=0)}Ne()}catch(a){}}He.prototype.ca=function(e){e=e.target;var t=this.M;t&&3==en(e)?t.j():this.Y(e)},He.prototype.Y=function(e){try{if(e==this.g)e:{var t=en(this.g),n=this.g.Ba();this.g.Z();if(!(3>t)&&(3!=t||this.g&&(this.h.h||this.g.oa()||tn(this.g)))){this.J||4!=t||7==n||Ne(),et(this);var r=this.g.Z();this.X=r;t:if(Xe(this)){var a=tn(this.g);e="";var s=a.length,o=4==en(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){nt(this),tt(this);var u="";break t}this.h.i=new i.TextDecoder}for(n=0;n<s;n++)this.h.h=!0,e+=this.h.i.decode(a[n],{stream:!(o&&n==s-1)});a.length=0,this.h.g+=e,this.C=0,u=this.h.g}else u=this.g.oa();if(this.o=200==r,function(e,t,n,r,i,a,s){e.info(function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+t+"\n"+n+"\n"+a+" "+s})}(this.i,this.u,this.A,this.l,this.R,t,r),this.o){if(this.T&&!this.K){t:{if(this.g){var c,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!k(c)){var h=c;break t}}h=null}if(!(r=h)){this.o=!1,this.s=3,Le(12),nt(this),tt(this);break e}je(this.i,this.l,r,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,rt(this,r)}if(this.P){var f;for(r=!0;!this.J&&this.C<u.length;){if((f=Je(this,u))==We){4==t&&(this.s=4,Le(14),r=!1),je(this.i,this.l,null,"[Incomplete Response]");break}if(f==Ge){this.s=4,Le(15),je(this.i,this.l,u,"[Invalid Chunk]"),r=!1;break}je(this.i,this.l,f,null),rt(this,f)}if(Xe(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=t||0!=u.length||this.h.h||(this.s=1,Le(16),r=!1),this.o=this.o&&r,r){if(0<u.length&&!this.W){this.W=!0;var d=this.j;d.g==this&&d.ba&&!d.M&&(d.j.info("Great, no buffering proxy detected. Bytes received: "+u.length),pn(d),d.M=!0,Le(11))}}else je(this.i,this.l,u,"[Invalid Chunked Response]"),nt(this),tt(this)}else je(this.i,this.l,u,null),rt(this,u);4==t&&nt(this),this.o&&!this.J&&(4==t?yn(this.j,this):(this.o=!1,$e(this)))}else(function(e){var t={};e=(e.g&&2<=en(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(var n=0;n<e.length;n++)if(!k(e[n])){var r=P(e[n]),i=r[0];if("string"==typeof(r=r[1])){r=r.trim();var a=t[i]||[];t[i]=a,a.push(r)}}!function(e,t){for(var n in e)t.call(void 0,e[n],n,e)}(t,function(e){return e.join(", ")})})(this.g),400==r&&0<u.indexOf("Unknown SID")?(this.s=3,Le(12)):(this.s=0,Le(13)),nt(this),tt(this)}}}catch(t){}},He.prototype.cancel=function(){this.J=!0,nt(this)},He.prototype.ba=function(){this.B=null;var e=Date.now();0<=e-this.S?(function(e,t){e.info(function(){return"TIMEOUT: "+t})}(this.i,this.A),2!=this.L&&(Ne(),Le(17)),nt(this),this.s=2,tt(this)):Ze(this,this.S-e)};var it=S(function e(t,n){E(this,e),this.g=t,this.map=n});function at(e){this.l=e||10,i.PerformanceNavigationTiming?e=0<(e=i.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(i.chrome&&i.chrome.loadTimes&&i.chrome.loadTimes()&&i.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function st(e){return!!e.h||!!e.g&&e.g.size>=e.j}function ot(e){return e.h?1:e.g?e.g.size:0}function ut(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function ct(e,t){e.g?e.g.add(t):e.h=t}function lt(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function ht(e){if(null!=e.h)return e.i.concat(e.h.D);if(null!=e.g&&0!==e.g.size){var t,n=e.i,r=Hc(e.g.values());try{for(r.s();!(t=r.n()).done;){var i=t.value;n=n.concat(i.D)}}catch(a){r.e(a)}finally{r.f()}return n}return v(e.i)}function ft(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(a(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.na&&"function"==typeof e.na)return e.na();if(!e.V||"function"!=typeof e.V){if("undefined"!=typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!=typeof Set&&e instanceof Set)){if(a(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}for(var r in t=[],n=0,e)t[n++]=r;return t}}}(e),r=function(e){if(e.V&&"function"==typeof e.V)return e.V();if("undefined"!=typeof Map&&e instanceof Map||"undefined"!=typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");
2if(a(e)){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t}for(r in t=[],n=0,e)t[n++]=e[r];return t}(e),i=r.length,s=0;s<i;s++)t.call(void 0,r[s],n&&n[s],e)}at.prototype.cancel=function(){if(this.i=ht(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){var e,t=Hc(this.g.values());try{for(t.s();!(e=t.n()).done;){e.value.cancel()}}catch(n){t.e(n)}finally{t.f()}this.g.clear()}};var dt=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function pt(e){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,e instanceof pt){this.h=e.h,gt(this,e.j),this.o=e.o,this.g=e.g,yt(this,e.s),this.l=e.l;var t=e.i,n=new Pt;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),mt(this,n),this.m=e.m}else e&&(t=String(e).match(dt))?(this.h=!1,gt(this,t[1]||"",!0),this.o=bt(t[2]||""),this.g=bt(t[3]||"",!0),yt(this,t[4]),this.l=bt(t[5]||"",!0),mt(this,t[6]||"",!0),this.m=bt(t[7]||"")):(this.h=!1,this.i=new Pt(null,this.h))}function vt(e){return new pt(e)}function gt(e,t,n){e.j=n?bt(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function yt(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.s=t}else e.s=null}function mt(e,t,n){t instanceof Pt?(e.i=t,function(e,t){t&&!e.j&&(Ot(e),e.i=null,e.g.forEach(function(e,t){var n=t.toLowerCase();t!=n&&(Rt(this,t),Dt(this,n,e))},e)),e.j=t}(e.i,e.h)):(n||(t=_t(t,At)),e.i=new Pt(t,e.h))}function kt(e,t,n){e.i.set(t,n)}function wt(e){return kt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function bt(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function _t(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,Et),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function Et(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}pt.prototype.toString=function(){var e=[],t=this.j;t&&e.push(_t(t,St,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(_t(t,St,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.s)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(_t(n,"/"==n.charAt(0)?xt:Tt,!0))
2),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",_t(n,Ct)),e.join("")};var It,St=/[#\/\?@]/g,Tt=/[#\?:]/g,xt=/[#\?]/g,At=/[#\?@]/g,Ct=/#/g;function Pt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Ot(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var r=e[n].indexOf("="),i=null;if(0<=r){var a=e[n].substring(0,r);i=e[n].substring(r+1)}else a=e[n];t(a,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function Rt(e,t){Ot(e),t=Lt(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function Nt(e,t){return Ot(e),t=Lt(e,t),e.g.has(t)}function Dt(e,t,n){Rt(e,t),0<n.length&&(e.i=null,e.g.set(Lt(e,t),v(n)),e.h+=n.length)}function Lt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function Mt(e,t,n,r,i){try{i&&(i.onload=null,i.onerror=null,i.onabort=null,i.ontimeout=null),r(n)}catch(a){}}function Ut(){this.g=new _e}function Ft(e,t,n){var r=n||"";try{ft(e,function(e,n){var i=e;s(e)&&(i=we(e)),t.push(r+n+"="+encodeURIComponent(i))})}catch(i){throw t.push(r+"type="+encodeURIComponent("_badmap")),i}}function jt(e){this.l=e.Ub||null,this.j=e.eb||!1}function Vt(e,t){he.call(this),this.D=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}function Bt(e){e.j.read().then(e.Pa.bind(e)).catch(e.ga.bind(e))}function qt(e){e.readyState=4,e.l=null,e.j=null,e.v=null,zt(e)}function zt(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function Ht(e){var t="";return T(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function Kt(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=Ht(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):kt(e,t,n))}function Gt(e){he.call(this),this.headers=new Map,this.o=e||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}(e=Pt.prototype).add=function(e,t){Ot(this),this.i=null,e=Lt(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},e.forEach=function(e,t){Ot(this),this.g.forEach(function(n,r){n.forEach(function(n){e.call(t,n,r,this)},this)},this)},e.na=function(){Ot(this);for(var e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[],r=0;r<t.length;r++)for(var i=e[r],a=0;a<i.length;a++)n.push(t[r]);return n},e.V=function(e){Ot(this);var t=[];if("string"==typeof e)Nt(this,e)&&(t=t.concat(this.g.get(Lt(this,e))));else{e=Array.from(this.g.values());for(var n=0;n<e.length;n++)t=t.concat(e[n])}return t},e.set=function(e,t){return Ot(this),this.i=null,Nt(this,e=Lt(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e&&0<(e=this.V(e)).length?String(e[0]):t},e.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var e=[],t=Array.from(this.g.keys()),n=0;n<t.length;n++){var r=t[n],i=encodeURIComponent(String(r)),a=this.V(r);for(r=0;r<a.length;r++){var s=i;""!==a[r]&&(s+="="+encodeURIComponent(String(a[r]))),e.push(s)}}return this.i=e.join("&")},p(jt,Ee),jt.prototype.g=function(){return new Vt(this.l,this.j)},jt.prototype.i=(It={},function(){return It}),p(Vt,he),(e=Vt.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.B=e,this.A=t,this.readyState=1,zt(this)},e.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var t={headers:this.u,method:this.B,credentials:this.m,cache:void 0};e&&(t.body=e),(this.D||i).fetch(new Request(this.A,t)).then(this.Sa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(function(){}),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,qt(this)),this.readyState=0},e.Sa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,zt(this)),this.g&&(this.readyState=3,zt(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(void 0!==i.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;Bt(this)}else e.text().then(this.Ra.bind(this),this.ga.bind(this))},e.Pa=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array(0);(t=this.v.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?qt(this):zt(this),3==this.readyState&&Bt(this)}},e.Ra=function(e){this.g&&(this.response=this.responseText=e,qt(this))},e.Qa=function(e){this.g&&(this.response=e,qt(this))},e.ga=function(){this.g&&qt(this)},e.setRequestHeader=function(e,t){this.u.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";for(var e=[],t=this.h.entries(),n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(Vt.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),p(Gt,he);var Wt=/^https?$/i,Qt=["POST","PUT"];function Yt(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.m=5,Xt(e),$t(e)}function Xt(e){e.A||(e.A=!0,fe(e,"complete"),fe(e,"error"))}function Jt(e){if(e.h&&void 0!==r&&(!e.v[1]||4!=en(e)||2!=e.Z()))if(e.u&&4==en(e))pe(e.Ea,0,e);else if(fe(e,"readystatechange"),4==en(e)){e.h=!1;try{var t,n=e.Z();e:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var a=!0;break e;default:a=!1}if(!(t=a)){var s;if(s=0===n){var o=String(e.D).match(dt)[1]||null;!o&&i.self&&i.self.location&&(o=i.self.location.protocol.slice(0,-1)),s=!Wt.test(o?o.toLowerCase():"")}t=s}if(t)fe(e,"complete"),fe(e,"success");else{e.m=6;try{var u=2<en(e)?e.g.statusText:""}catch(c){u=""}e.l=u+" ["+e.Z()+"]",Xt(e)}}finally{$t(e)}}}function $t(e,t){if(e.g){Zt(e);var n=e.g,r=e.v[0]?function(){}:null;e.g=null,e.v=null,t||fe(e,"ready");try{n.onreadystatechange=r}catch(i){}}}function Zt(e){e.I&&(i.clearTimeout(e.I),e.I=null)}function en(e){return e.g?e.g.readyState:0}function tn(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.H){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(ul){return null}}
2function nn(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function rn(e){this.Aa=0,this.i=[],this.j=new Fe,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=nn("failFast",!1,e),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=nn("baseRetryDelayMs",5e3,e),this.cb=nn("retryDelaySeedMs",1e4,e),this.Wa=nn("forwardChannelMaxRetries",2,e),this.wa=nn("forwardChannelRequestTimeoutMs",2e4,e),this.pa=e&&e.xmlHttpFactory||void 0,this.Xa=e&&e.Tb||void 0,this.Ca=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.h=new at(e&&e.concurrentRequestLimit),this.Da=new Ut,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=e&&e.Rb||!1,e&&e.xa&&this.j.xa(),e&&e.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&e&&e.detectBufferingProxy||!1,this.ja=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.ja=e.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}function an(e){if(on(e),3==e.G){var t=e.U++,n=vt(e.I);if(kt(n,"SID",e.K),kt(n,"RID",t),kt(n,"TYPE","terminate"),ln(e,n),(t=new He(e,e.j,t)).L=2,t.v=wt(vt(n)),n=!1,i.navigator&&i.navigator.sendBeacon)try{n=i.navigator.sendBeacon(t.v.toString(),"")}catch(r){}!n&&i.Image&&((new Image).src=t.v,n=!0),n||(t.g=_n(t.j,null),t.g.ea(t.v)),t.F=Date.now(),$e(t)}wn(e)}function sn(e){e.g&&(pn(e),e.g.cancel(),e.g=null)}function on(e){sn(e),e.u&&(i.clearTimeout(e.u),e.u=null),gn(e),e.h.cancel(),e.s&&("number"==typeof e.s&&i.clearTimeout(e.s),e.s=null)}function un(e){if(!st(e.h)&&!e.s){e.s=!0;var t=e.Ga;N||j(),U||(N(),U=!0),F.add(t,e),e.B=0}}function cn(e,t){var n;n=t?t.l:e.U++;var r=vt(e.I);kt(r,"SID",e.K),kt(r,"RID",n),kt(r,"AID",e.T),ln(e,r),e.m&&e.o&&Kt(r,e.m,e.o),n=new He(e,e.j,n,e.B+1),null===e.m&&(n.H=e.o),t&&(e.i=t.D.concat(e.i)),t=hn(e,n,1e3),n.I=Math.round(.5*e.wa)+Math.round(.5*e.wa*Math.random()),ct(e.h,n),Qe(n,r,t)}function ln(e,t){e.H&&T(e.H,function(e,n){kt(t,n,e)}),e.l&&ft({},function(e,n){kt(t,n,e)})}function hn(e,t,n){n=Math.min(e.i.length,n);var r=e.l?l(e.l.Na,e.l,e):null;e:for(var i=e.i,a=-1;;){var s=["count="+n];-1==a?0<n?(a=i[0].g,s.push("ofs="+a)):a=0:s.push("ofs="+a);for(var o=!0,u=0;u<n;u++){var c=i[u].g,h=i[u].map;if(0>(c-=a))a=Math.max(0,i[u].g-100),o=!1;else try{Ft(h,s,"req"+c+"_")}catch(f){r&&r(h)}}if(o){r=s.join("&");break e}}return e=e.i.splice(0,n),t.D=e,r}function fn(e){if(!e.g&&!e.u){e.Y=1;var t=e.Fa;N||j(),U||(N(),U=!0),F.add(t,e),e.v=0}}function dn(e){return!(e.g||e.u||3<=e.v)&&(e.Y++,e.u=Ue(l(e.Fa,e),mn(e,e.v)),e.v++,!0)}function pn(e){null!=e.A&&(i.clearTimeout(e.A),e.A=null)}function vn(e){e.g=new He(e,e.j,"rpc",e.Y),null===e.m&&(e.g.H=e.o),e.g.O=0;var t=vt(e.qa);kt(t,"RID","rpc"),kt(t,"SID",e.K),kt(t,"AID",e.T),kt(t,"CI",e.F?"0":"1"),!e.F&&e.ja&&kt(t,"TO",e.ja),kt(t,"TYPE","xmlhttp"),ln(e,t),e.m&&e.o&&Kt(t,e.m,e.o),e.L&&(e.g.I=e.L);var n=e.g;e=e.ia,n.L=1,n.v=wt(vt(t)),n.m=null,n.P=!0,Ye(n,e)}function gn(e){null!=e.C&&(i.clearTimeout(e.C),e.C=null)}function yn(e,t){var n=null;if(e.g==t){gn(e),pn(e),e.g=null;var r=2}else{if(!ut(e.h,t))return;n=t.D,lt(e.h,t),r=1}if(0!=e.G)if(t.o)if(1==r){n=t.m?t.m.length:0,t=Date.now()-t.F;var i=e.B;fe(r=Oe(),new Me(r,n)),un(e)}else fn(e);else if(3==(i=t.s)||0==i&&0<t.X||!(1==r&&function(e,t){return!(ot(e.h)>=e.h.j-(e.s?1:0)||(e.s?(e.i=t.D.concat(e.i),0):1==e.G||2==e.G||e.B>=(e.Va?0:e.Wa)||(e.s=Ue(l(e.Ga,e,t),mn(e,e.B)),e.B++,0)))}(e,t)||2==r&&dn(e)))switch(n&&0<n.length&&(t=e.h,t.i=t.i.concat(n)),i){case 1:kn(e,5);break;case 4:kn(e,10);break;case 3:kn(e,6);break;default:kn(e,2)}}function mn(e,t){var n=e.Ta+Math.floor(Math.random()*e.cb);return e.isActive()||(n*=2),n*t}function kn(e,t){if(e.j.info("Error code "+t),2==t){var n=l(e.fb,e),r=e.Xa,a=!r;r=new pt(r||"//www.google.com/images/cleardot.gif"),i.location&&"http"==i.location.protocol||gt(r,"https"),wt(r),a?function(e,t){var n=new Fe;if(i.Image){var r=new Image;r.onload=h(Mt,n,"TestLoadImage: loaded",!0,t,r),r.onerror=h(Mt,n,"TestLoadImage: error",!1,t,r),r.onabort=h(Mt,n,"TestLoadImage: abort",!1,t,r),r.ontimeout=h(Mt,n,"TestLoadImage: timeout",!1,t,r),i.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}(r.toString(),n):function(e,t){new Fe;var n=new AbortController,r=setTimeout(function(){n.abort(),Mt(0,0,!1,t)},1e4);fetch(e,{signal:n.signal}).then(function(e){clearTimeout(r),e.ok?Mt(0,0,!0,t):Mt(0,0,!1,t)}).catch(function(){clearTimeout(r),Mt(0,0,!1,t)})}(r.toString(),n)}else Le(2);e.G=0,e.l&&e.l.sa(t),wn(e),on(e)}function wn(e){if(e.G=0,e.ka=[],e.l){var t=ht(e.h);
20==t.length&&0==e.i.length||(y(e.ka,t),y(e.ka,e.i),e.h.i.length=0,v(e.i),e.i.length=0),e.l.ra()}}function bn(e,t,n){var r=n instanceof pt?vt(n):new pt(n);if(""!=r.g)t&&(r.g=t+"."+r.g),yt(r,r.s);else{var a=i.location;r=a.protocol,t=t?t+"."+a.hostname:a.hostname,a=+a.port;var s=new pt(null);r&>(s,r),t&&(s.g=t),a&&yt(s,a),n&&(s.l=n),r=s}return n=e.D,t=e.ya,n&&t&&kt(r,n,t),kt(r,"VER",e.la),ln(e,r),r}function _n(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Ca&&!e.pa?new Gt(new jt({eb:n})):new Gt(e.pa)).Ha(e.J),t}function En(){}function In(){}function Sn(e,t){he.call(this),this.g=new rn(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.va&&(e?e["X-WebChannel-Client-Profile"]=t.va:e={"X-WebChannel-Client-Profile":t.va}),this.g.S=e,(e=t&&t.Sb)&&!k(e)&&(this.g.m=e),this.v=t&&t.supportsCrossDomainXhr||!1,this.u=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!k(t)&&(this.g.D=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new An(this)}function Tn(e){xe.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(var n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function xn(){Ae.call(this),this.status=1}function An(e){this.g=e}(e=Gt.prototype).Ha=function(e){this.J=e},e.ea=function(e,t,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);t=t?t.toUpperCase():"GET",this.D=e,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Ve.g(),this.v=this.o?Ie(this.o):Ie(Ve),this.g.onreadystatechange=l(this.Ea,this);try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(u){return void Yt(this,u)}if(e=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var a in r)n.set(a,r[a]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));var s,o=Hc(r.keys());try{for(o.s();!(s=o.n()).done;){var u=s.value;n.set(u,r.get(u))}}catch(v){o.e(v)}finally{o.f()}}r=Array.from(n.keys()).find(function(e){return"content-type"==e.toLowerCase()}),a=i.FormData&&e instanceof i.FormData,!(0<=Array.prototype.indexOf.call(Qt,t,void 0))||r||a||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");var c,h=Hc(n);try{for(h.s();!(c=h.n()).done;){var f=w(c.value,2),d=f[0],p=f[1];this.g.setRequestHeader(d,p)}}catch(v){h.e(v)}finally{h.f()}this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{Zt(this),this.u=!0,this.g.send(e),this.u=!1}catch(u){Yt(this,u)}},e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=e||7,fe(this,"complete"),fe(this,"abort"),$t(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),$t(this,!0)),Gt.aa.N.call(this)},e.Ea=function(){this.s||(this.B||this.u||this.j?Jt(this):this.bb())},e.bb=function(){Jt(this)},e.isActive=function(){return!!this.g},e.Z=function(){try{return 2<en(this)?this.g.status:-1}catch(It){return-1}},e.oa=function(){try{return this.g?this.g.responseText:""}catch(It){return""}},e.Oa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),be(t)}},e.Ba=function(){return this.m},e.Ka=function(){return"string"==typeof this.l?this.l:String(this.l)},(e=rn.prototype).la=8,e.G=1,e.connect=function(e,t,n,r){Le(0),this.W=e,this.H=t||{},n&&void 0!==r&&(this.H.OSID=n,this.H.OAID=r),this.F=this.X,this.I=bn(this,null,this.W),un(this)},e.Ga=function(e){if(this.s)if(this.s=null,1==this.G){if(!e){this.U=Math.floor(1e5*Math.random()),e=this.U++;var t=new He(this,this.j,e),n=this.o;if(this.S&&(n?C(n=x(n),this.S):n=this.S),null!==this.m||this.O||(t.H=n,n=null),this.P)e:{for(var r=0,i=0;i<this.i.length;i++){var a=this.i[i];if(void 0===(a="__data__"in a.map&&"string"==typeof(a=a.map.__data__)?a.length:void 0))break;if(4096<(r+=a)){r=i;break e}if(4096===r||i===this.i.length-1){r=i+1;break e}}r=1e3}else r=1e3;
2r=hn(this,t,r),kt(i=vt(this.I),"RID",e),kt(i,"CVER",22),this.D&&kt(i,"X-HTTP-Session-Id",this.D),ln(this,i),n&&(this.O?r="headers="+encodeURIComponent(String(Ht(n)))+"&"+r:this.m&&Kt(i,this.m,n)),ct(this.h,t),this.Ua&&kt(i,"TYPE","init"),this.P?(kt(i,"$req",r),kt(i,"SID","null"),t.T=!0,Qe(t,i,null)):Qe(t,i,r),this.G=2}}else 3==this.G&&(e?cn(this,e):0==this.i.length||st(this.h)||cn(this))},e.Fa=function(){if(this.u=null,vn(this),this.ba&&!(this.M||null==this.g||0>=this.R)){var e=2*this.R;this.j.info("BP detection timer enabled: "+e),this.A=Ue(l(this.ab,this),e)}},e.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Le(10),sn(this),vn(this))},e.Za=function(){null!=this.C&&(this.C=null,sn(this),dn(this),Le(19))},e.fb=function(e){e?(this.j.info("Successfully pinged google.com"),Le(2)):(this.j.info("Failed to ping google.com"),Le(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=En.prototype).ua=function(){},e.ta=function(){},e.sa=function(){},e.ra=function(){},e.isActive=function(){return!0},e.Na=function(){},In.prototype.g=function(e,t){return new Sn(e,t)},p(Sn,he),Sn.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},Sn.prototype.close=function(){an(this.g)},Sn.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.u&&((n={}).__data__=we(e),e=n);t.i.push(new it(t.Ya++,e)),3==t.G&&un(t)},Sn.prototype.N=function(){this.g.l=null,delete this.j,an(this.g),delete this.g,Sn.aa.N.call(this)},p(Tn,xe),p(xn,Ae),p(An,En),An.prototype.ua=function(){fe(this.g,"a")},An.prototype.ta=function(e){fe(this.g,new Tn(e))},An.prototype.sa=function(e){fe(this.g,new xn)},An.prototype.ra=function(){fe(this.g,"b")},In.prototype.createWebChannel=In.prototype.g,Sn.prototype.send=Sn.prototype.o,Sn.prototype.open=Sn.prototype.m,Sn.prototype.close=Sn.prototype.close,tl=function(){return new In},el=function(){return Oe()},Zc=Ce,$c={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},Be.NO_ERROR=0,Be.TIMEOUT=8,Be.HTTP_ERROR=6,Jc=Be,qe.COMPLETE="complete",Xc=qe,Se.EventType=Te,Te.OPEN="a",Te.CLOSE="b",Te.ERROR="c",Te.MESSAGE="d",he.prototype.listen=he.prototype.K,Yc=Se,Qc=jt,Gt.prototype.listenOnce=Gt.prototype.L,Gt.prototype.getLastError=Gt.prototype.Ka,Gt.prototype.getLastErrorCode=Gt.prototype.Ba,Gt.prototype.getStatus=Gt.prototype.Z,Gt.prototype.getResponseJson=Gt.prototype.Oa,Gt.prototype.getResponseText=Gt.prototype.oa,Gt.prototype.send=Gt.prototype.ea,Gt.prototype.setWithCredentials=Gt.prototype.Ha,Wc=Gt}).apply(void 0!==nl?nl:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var sl="@firebase/firestore",ol=function(){function e(t){E(this,e),this.uid=t}return S(e,[{key:"isAuthenticated",value:function(){return null!=this.uid}},{key:"toKey",value:function(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}},{key:"isEqual",value:function(e){return e.uid===this.uid}}]),e}();ol.UNAUTHENTICATED=new ol(null),ol.GOOGLE_CREDENTIALS=new ol("google-credentials-uid"),ol.FIRST_PARTY=new ol("first-party-uid"),ol.MOCK_USER=new ol("mock-user");var ul="10.12.1",cl=new Ee("@firebase/firestore");function ll(){return cl.logLevel}function hl(e){if(cl.logLevel<=ve.DEBUG){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n.map(pl);cl.debug.apply(cl,["Firestore (".concat(ul,"): ").concat(e)].concat(T(i)))}}function fl(e){if(cl.logLevel<=ve.ERROR){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n.map(pl);cl.error.apply(cl,["Firestore (".concat(ul,"): ").concat(e)].concat(T(i)))}}function dl(e){if(cl.logLevel<=ve.WARN){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n.map(pl);cl.warn.apply(cl,["Firestore (".concat(ul,"): ").concat(e)].concat(T(i)))}}function pl(e){if("string"==typeof e)return e;try{return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}function vl(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Unexpected state",t="FIRESTORE (".concat(ul,") INTERNAL ASSERTION FAILED: ")+e;throw fl(t),new Error(t)}function gl(e,t){e||vl()}function yl(e,t){return e}
2var ml={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},kl=function(e){g(n,e);var t=al(n);function n(e,r){var i;return E(this,n),(i=t.call(this,e,r)).code=e,i.message=r,i.toString=function(){return"".concat(i.name,": [code=").concat(i.code,"]: ").concat(i.message)},i}return S(n)}(X),wl=S(function e(){var t=this;E(this,e),this.promise=new Promise(function(e,n){t.resolve=e,t.reject=n})}),bl=S(function e(t,n){E(this,e),this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization","Bearer ".concat(t))}),_l=function(){function e(){E(this,e)}return S(e,[{key:"getToken",value:function(){return Promise.resolve(null)}},{key:"invalidateToken",value:function(){}},{key:"start",value:function(e,t){e.enqueueRetryable(function(){return t(ol.UNAUTHENTICATED)})}},{key:"shutdown",value:function(){}}]),e}(),El=function(){function e(t){E(this,e),this.t=t,this.currentUser=ol.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}return S(e,[{key:"start",value:function(e,t){var n=this,r=this.i,i=function(e){return n.i!==r?(r=n.i,t(e)):Promise.resolve()},a=new wl;this.o=function(){n.i++,n.currentUser=n.u(),a.resolve(),a=new wl,e.enqueueRetryable(function(){return i(n.currentUser)})};var s=function(){var t=a;e.enqueueRetryable(_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.promise;case 2:return e.next=4,i(n.currentUser);case 4:case"end":return e.stop()}},e)})))},o=function(e){hl("FirebaseAuthCredentialsProvider","Auth detected"),n.auth=e,n.auth.addAuthTokenListener(n.o),s()};this.t.onInit(function(e){return o(e)}),setTimeout(function(){if(!n.auth){var e=n.t.getImmediate({optional:!0});e?o(e):(hl("FirebaseAuthCredentialsProvider","Auth not yet detected"),a.resolve(),a=new wl)}},0),s()}},{key:"getToken",value:function(){var e=this,t=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(function(n){return e.i!==t?(hl("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),e.getToken()):n?(gl("string"==typeof n.accessToken),new bl(n.accessToken,e.currentUser)):null}):Promise.resolve(null)}},{key:"invalidateToken",value:function(){this.forceRefresh=!0}},{key:"shutdown",value:function(){this.auth&&this.auth.removeAuthTokenListener(this.o)}},{key:"u",value:function(){var e=this.auth&&this.auth.getUid();return gl(null===e||"string"==typeof e),new ol(e)}}]),e}(),Il=function(){function e(t,n,r){E(this,e),this.l=t,this.h=n,this.P=r,this.type="FirstParty",this.user=ol.FIRST_PARTY,this.I=new Map}return S(e,[{key:"T",value:function(){return this.P?this.P():null}},{key:"headers",get:function(){this.I.set("X-Goog-AuthUser",this.l);var e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}]),e}(),Sl=function(){function e(t,n,r){E(this,e),this.l=t,this.h=n,this.P=r}return S(e,[{key:"getToken",value:function(){return Promise.resolve(new Il(this.l,this.h,this.P))}},{key:"start",value:function(e,t){e.enqueueRetryable(function(){return t(ol.FIRST_PARTY)})}},{key:"shutdown",value:function(){}},{key:"invalidateToken",value:function(){}}]),e}(),Tl=S(function e(t){E(this,e),this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}),xl=function(){function e(t){E(this,e),this.A=t,this.forceRefresh=!1,this.appCheck=null,this.R=null}return S(e,[{key:"start",value:function(e,t){var n=this,r=function(e){null!=e.error&&hl("FirebaseAppCheckTokenProvider","Error getting App Check token; using placeholder token instead. Error: ".concat(e.error.message));var r=e.token!==n.R;return n.R=e.token,hl("FirebaseAppCheckTokenProvider","Received ".concat(r?"new":"existing"," token.")),r?t(e.token):Promise.resolve()};this.o=function(t){e.enqueueRetryable(function(){return r(t)})};var i=function(e){hl("FirebaseAppCheckTokenProvider","AppCheck detected"),n.appCheck=e,n.appCheck.addTokenListener(n.o)};this.A.onInit(function(e){return i(e)}),setTimeout(function(){if(!n.appCheck){var e=n.A.getImmediate({optional:!0});e?i(e):hl("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}},{key:"getToken",value:function(){var e=this,t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then(function(t){return t?(gl("string"==typeof t.token),e.R=t.token,new Tl(t.token)):null}):Promise.resolve(null)}},{key:"invalidateToken",value:function(){this.forceRefresh=!0}},{key:"shutdown",value:function(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}]),e}();function Al(e){var t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(var r=0;r<e;
2r++)n[r]=Math.floor(256*Math.random());return n}var Cl=function(){function e(){E(this,e)}return S(e,null,[{key:"newId",value:function(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(256/62),n="";n.length<20;)for(var r=Al(40),i=0;i<r.length;++i)n.length<20&&r[i]<t&&(n+=e.charAt(r[i]%62));return n}}]),e}();function Pl(e,t){return e<t?-1:e>t?1:0}function Ol(e,t,n){return e.length===t.length&&e.every(function(e,r){return n(e,t[r])})}var Rl=function(){function e(t,n){if(E(this,e),this.seconds=t,this.nanoseconds=n,n<0)throw new kl(ml.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new kl(ml.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(t<-62135596800)throw new kl(ml.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new kl(ml.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}return S(e,[{key:"toDate",value:function(){return new Date(this.toMillis())}},{key:"toMillis",value:function(){return 1e3*this.seconds+this.nanoseconds/1e6}},{key:"_compareTo",value:function(e){return this.seconds===e.seconds?Pl(this.nanoseconds,e.nanoseconds):Pl(this.seconds,e.seconds)}},{key:"isEqual",value:function(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}},{key:"toString",value:function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}},{key:"toJSON",value:function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}},{key:"valueOf",value:function(){var e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}],[{key:"now",value:function(){return e.fromMillis(Date.now())}},{key:"fromDate",value:function(t){return e.fromMillis(t.getTime())}},{key:"fromMillis",value:function(t){var n=Math.floor(t/1e3);return new e(n,Math.floor(1e6*(t-1e3*n)))}}]),e}(),Nl=function(){function e(t){E(this,e),this.timestamp=t}return S(e,[{key:"compareTo",value:function(e){return this.timestamp._compareTo(e.timestamp)}},{key:"isEqual",value:function(e){return this.timestamp.isEqual(e.timestamp)}},{key:"toMicroseconds",value:function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}},{key:"toString",value:function(){return"SnapshotVersion("+this.timestamp.toString()+")"}},{key:"toTimestamp",value:function(){return this.timestamp}}],[{key:"fromTimestamp",value:function(t){return new e(t)}},{key:"min",value:function(){return new e(new Rl(0,0))}},{key:"max",value:function(){return new e(new Rl(253402300799,999999999))}}]),e}(),Dl=function(){function e(t,n,r){E(this,e),void 0===n?n=0:n>t.length&&vl(),void 0===r?r=t.length-n:r>t.length-n&&vl(),this.segments=t,this.offset=n,this.len=r}return S(e,[{key:"length",get:function(){return this.len}},{key:"isEqual",value:function(t){return 0===e.comparator(this,t)}},{key:"child",value:function(t){var n=this.segments.slice(this.offset,this.limit());return t instanceof e?t.forEach(function(e){n.push(e)}):n.push(t),this.construct(n)}},{key:"limit",value:function(){return this.offset+this.length}},{key:"popFirst",value:function(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}},{key:"popLast",value:function(){return this.construct(this.segments,this.offset,this.length-1)}},{key:"firstSegment",value:function(){return this.segments[this.offset]}},{key:"lastSegment",value:function(){return this.get(this.length-1)}},{key:"get",value:function(e){return this.segments[this.offset+e]}},{key:"isEmpty",value:function(){return 0===this.length}},{key:"isPrefixOf",value:function(e){if(e.length<this.length)return!1;for(var t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}},{key:"isImmediateParentOf",value:function(e){if(this.length+1!==e.length)return!1;for(var t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}},{key:"forEach",value:function(e){for(var t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}},{key:"toArray",value:function(){return this.segments.slice(this.offset,this.limit())}}],[{key:"comparator",value:function(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){var i=e.get(r),a=t.get(r);if(i<a)return-1;if(i>a)return 1}return e.length<t.length?-1:e.length>t.length?1:0}}]),e}(),Ll=function(e){g(n,e);var t=al(n);function n(){return E(this,n),t.apply(this,arguments)}
2return S(n,[{key:"construct",value:function(e,t,r){return new n(e,t,r)}},{key:"canonicalString",value:function(){return this.toArray().join("/")}},{key:"toString",value:function(){return this.canonicalString()}},{key:"toUriEncodedString",value:function(){return this.toArray().map(encodeURIComponent).join("/")}}],[{key:"fromString",value:function(){for(var e=[],t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];for(var a=0,s=r;a<s.length;a++){var o=s[a];if(o.indexOf("//")>=0)throw new kl(ml.INVALID_ARGUMENT,"Invalid segment (".concat(o,"). Paths must not contain // in them."));e.push.apply(e,T(o.split("/").filter(function(e){return e.length>0})))}return new n(e)}},{key:"emptyPath",value:function(){return new n([])}}]),n}(Dl),Ml=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Ul=function(e){g(n,e);var t=al(n);function n(){return E(this,n),t.apply(this,arguments)}return S(n,[{key:"construct",value:function(e,t,r){return new n(e,t,r)}},{key:"canonicalString",value:function(){return this.toArray().map(function(e){return e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),n.isValidIdentifier(e)||(e="`"+e+"`"),e}).join(".")}},{key:"toString",value:function(){return this.canonicalString()}},{key:"isKeyField",value:function(){return 1===this.length&&"__name__"===this.get(0)}}],[{key:"isValidIdentifier",value:function(e){return Ml.test(e)}},{key:"keyField",value:function(){return new n(["__name__"])}},{key:"fromServerFormat",value:function(e){for(var t=[],r="",i=0,a=function(){if(0===r.length)throw new kl(ml.INVALID_ARGUMENT,"Invalid field path (".concat(e,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"));t.push(r),r=""},s=!1;i<e.length;){var o=e[i];if("\\"===o){if(i+1===e.length)throw new kl(ml.INVALID_ARGUMENT,"Path has trailing escape character: "+e);var u=e[i+1];if("\\"!==u&&"."!==u&&"`"!==u)throw new kl(ml.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=u,i+=2}else"`"===o?(s=!s,i++):"."!==o||s?(r+=o,i++):(a(),i++)}if(a(),s)throw new kl(ml.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new n(t)}},{key:"emptyPath",value:function(){return new n([])}}]),n}(Dl),Fl=function(){function e(t){E(this,e),this.path=t}return S(e,[{key:"collectionGroup",get:function(){return this.path.popLast().lastSegment()}},{key:"hasCollectionId",value:function(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}},{key:"getCollectionGroup",value:function(){return this.path.get(this.path.length-2)}},{key:"getCollectionPath",value:function(){return this.path.popLast()}},{key:"isEqual",value:function(e){return null!==e&&0===Ll.comparator(this.path,e.path)}},{key:"toString",value:function(){return this.path.toString()}}],[{key:"fromPath",value:function(t){return new e(Ll.fromString(t))}},{key:"fromName",value:function(t){return new e(Ll.fromString(t).popFirst(5))}},{key:"empty",value:function(){return new e(Ll.emptyPath())}},{key:"comparator",value:function(e,t){return Ll.comparator(e.path,t.path)}},{key:"isDocumentKey",value:function(e){return e.length%2==0}},{key:"fromSegments",value:function(t){return new e(new Ll(t.slice()))}}]),e}();function jl(e){return new Vl(e.readTime,e.key,-1)}S(function e(t,n,r,i){E(this,e),this.indexId=t,this.collectionGroup=n,this.fields=r,this.indexState=i}).UNKNOWN_ID=-1;var Vl=function(){function e(t,n,r){E(this,e),this.readTime=t,this.documentKey=n,this.largestBatchId=r}return S(e,null,[{key:"min",value:function(){return new e(Nl.min(),Fl.empty(),-1)}},{key:"max",value:function(){return new e(Nl.max(),Fl.empty(),-1)}}]),e}();function Bl(e,t){var n=e.readTime.compareTo(t.readTime);return 0!==n?n:0!==(n=Fl.comparator(e.documentKey,t.documentKey))?n:Pl(e.largestBatchId,t.largestBatchId)}var ql=function(){function e(){E(this,e),this.onCommittedListeners=[]}return S(e,[{key:"addOnCommittedListener",value:function(e){this.onCommittedListeners.push(e)}},{key:"raiseOnCommittedEvent",value:function(){this.onCommittedListeners.forEach(function(e){return e()})}}]),e}();function zl(e){return Hl.apply(this,arguments)}function Hl(){return(Hl=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.code===ml.FAILED_PRECONDITION&&"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."===t.message){e.next=2;break}throw t;case 2:hl("LocalStore","Unexpectedly lost primary lease");case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}var Kl=function(){function e(t){var n=this;E(this,e),this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t(function(e){n.isDone=!0,n.result=e,n.nextCallback&&n.nextCallback(e)},function(e){n.isDone=!0,n.error=e,n.catchCallback&&n.catchCallback(e)})}return S(e,[{key:"catch",value:function(e){return this.next(void 0,e)}},{key:"next",value:function(t,n){var r=this;return this.callbackAttached&&vl(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(t,this.result):new e(function(e,i){r.nextCallback=function(n){r.wrapSuccess(t,n).next(e,i)},r.catchCallback=function(t){r.wrapFailure(n,t).next(e,i)}})}},{key:"toPromise",value:function(){var e=this;return new Promise(function(t,n){e.next(t,n)})}},{key:"wrapUserFunction",value:function(t){try{var n=t();return n instanceof e?n:e.resolve(n)}catch(t){return e.reject(t)}}},{key:"wrapSuccess",value:function(t,n){return t?this.wrapUserFunction(function(){return t(n)}):e.resolve(n)}},{key:"wrapFailure",value:function(t,n){return t?this.wrapUserFunction(function(){return t(n)}):e.reject(n)}}],[{key:"resolve",value:function(t){return new e(function(e,n){e(t)})}}
2,{key:"reject",value:function(t){return new e(function(e,n){n(t)})}},{key:"waitFor",value:function(t){return new e(function(e,n){var r=0,i=0,a=!1;t.forEach(function(t){++r,t.next(function(){++i,a&&i===r&&e()},function(e){return n(e)})}),a=!0,i===r&&e()})}},{key:"or",value:function(t){var n,r=e.resolve(!1),i=rl(t);try{var a=function(){var t=n.value;r=r.next(function(n){return n?e.resolve(n):t()})};for(i.s();!(n=i.n()).done;)a()}catch(s){i.e(s)}finally{i.f()}return r}},{key:"forEach",value:function(e,t){var n=this,r=[];return e.forEach(function(e,i){r.push(t.call(n,e,i))}),this.waitFor(r)}},{key:"mapArray",value:function(t,n){return new e(function(e,r){for(var i=t.length,a=new Array(i),s=0,o=function(o){var u=o;n(t[u]).next(function(t){a[u]=t,++s===i&&e(a)},function(e){return r(e)})},u=0;u<i;u++)o(u)})}},{key:"doWhile",value:function(t,n){return new e(function(e,r){!function i(){!0===t()?n().next(function(){i()},r):e()}()})}}]),e}();function Gl(e){return"IndexedDbTransactionError"===e.name}var Wl=function(){function e(t,n){var r=this;E(this,e),this.previousValue=t,n&&(n.sequenceNumberHandler=function(e){return r.ie(e)},this.se=function(e){return n.writeSequenceNumber(e)})}return S(e,[{key:"ie",value:function(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}},{key:"next",value:function(){var e=++this.previousValue;return this.se&&this.se(e),e}}]),e}();function Ql(e){return null==e}function Yl(e){return 0===e&&1/e==-1/0}Wl.oe=-1;var Xl=["mutationQueues","mutations","documentMutations","remoteDocuments","targets","owner","targetGlobal","targetDocuments"].concat(["clientMetadata"]).concat(["remoteDocumentGlobal"]).concat(["collectionParents"]).concat(["bundles","namedQueries"]);function Jl(e){var t=0;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function $l(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function Zl(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}[].concat(T(Xl),["documentOverlays"]);var eh=function(){function e(t,n){E(this,e),this.comparator=t,this.root=n||nh.EMPTY}return S(e,[{key:"insert",value:function(t,n){return new e(this.comparator,this.root.insert(t,n,this.comparator).copy(null,null,nh.BLACK,null,null))}},{key:"remove",value:function(t){return new e(this.comparator,this.root.remove(t,this.comparator).copy(null,null,nh.BLACK,null,null))}},{key:"get",value:function(e){for(var t=this.root;!t.isEmpty();){var n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}},{key:"indexOf",value:function(e){for(var t=0,n=this.root;!n.isEmpty();){var r=this.comparator(e,n.key);if(0===r)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}},{key:"isEmpty",value:function(){return this.root.isEmpty()}},{key:"size",get:function(){return this.root.size}},{key:"minKey",value:function(){return this.root.minKey()}},{key:"maxKey",value:function(){return this.root.maxKey()}},{key:"inorderTraversal",value:function(e){return this.root.inorderTraversal(e)}},{key:"forEach",value:function(e){this.inorderTraversal(function(t,n){return e(t,n),!1})}},{key:"toString",value:function(){var e=[];return this.inorderTraversal(function(t,n){return e.push("".concat(t,":").concat(n)),!1}),"{".concat(e.join(", "),"}")}},{key:"reverseTraversal",value:function(e){return this.root.reverseTraversal(e)}},{key:"getIterator",value:function(){return new th(this.root,null,this.comparator,!1)}},{key:"getIteratorFrom",value:function(e){return new th(this.root,e,this.comparator,!1)}},{key:"getReverseIterator",value:function(){return new th(this.root,null,this.comparator,!0)}},{key:"getReverseIteratorFrom",value:function(e){return new th(this.root,e,this.comparator,!0)}}]),e}(),th=function(){function e(t,n,r,i){E(this,e),this.isReverse=i,this.nodeStack=[];for(var a=1;!t.isEmpty();)if(a=n?r(t.key,n):1,n&&i&&(a*=-1),a<0)t=this.isReverse?t.left:t.right;else{if(0===a){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}return S(e,[{key:"getNext",value:function(){var e=this.nodeStack.pop(),t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}},{key:"hasNext",value:function(){return this.nodeStack.length>0}},{key:"peek",value:function(){if(0===this.nodeStack.length)return null;var e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}]),e}(),nh=function(){function e(t,n,r,i,a){E(this,e),this.key=t,this.value=n,this.color=null!=r?r:e.RED,this.left=null!=i?i:e.EMPTY,this.right=null!=a?a:e.EMPTY,this.size=this.left.size+1+this.right.size}
2return S(e,[{key:"copy",value:function(t,n,r,i,a){return new e(null!=t?t:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=a?a:this.right)}},{key:"isEmpty",value:function(){return!1}},{key:"inorderTraversal",value:function(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}},{key:"reverseTraversal",value:function(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}},{key:"min",value:function(){return this.left.isEmpty()?this:this.left.min()}},{key:"minKey",value:function(){return this.min().key}},{key:"maxKey",value:function(){return this.right.isEmpty()?this.key:this.right.maxKey()}},{key:"insert",value:function(e,t,n){var r=this,i=n(e,r.key);return(r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===i?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n))).fixUp()}},{key:"removeMin",value:function(){if(this.left.isEmpty())return e.EMPTY;var t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),(t=t.copy(null,null,null,t.left.removeMin(),null)).fixUp()}},{key:"remove",value:function(t,n){var r,i=this;if(n(t,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(t,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),0===n(t,i.key)){if(i.right.isEmpty())return e.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(t,n))}return i.fixUp()}},{key:"isRed",value:function(){return this.color}},{key:"fixUp",value:function(){var e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}},{key:"moveRedLeft",value:function(){var e=this.colorFlip();return e.right.left.isRed()&&(e=(e=(e=e.copy(null,null,null,null,e.right.rotateRight())).rotateLeft()).colorFlip()),e}},{key:"moveRedRight",value:function(){var e=this.colorFlip();return e.left.left.isRed()&&(e=(e=e.rotateRight()).colorFlip()),e}},{key:"rotateLeft",value:function(){var t=this.copy(null,null,e.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}},{key:"rotateRight",value:function(){var t=this.copy(null,null,e.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}},{key:"colorFlip",value:function(){var e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}},{key:"checkMaxDepth",value:function(){var e=this.check();return Math.pow(2,e)<=this.size+1}},{key:"check",value:function(){if(this.isRed()&&this.left.isRed())throw vl();if(this.right.isRed())throw vl();var e=this.left.check();if(e!==this.right.check())throw vl();return e+(this.isRed()?0:1)}}]),e}();nh.EMPTY=null,nh.RED=!0,nh.BLACK=!1,nh.EMPTY=new(function(){function e(){E(this,e),this.size=0}return S(e,[{key:"key",get:function(){throw vl()}},{key:"value",get:function(){throw vl()}},{key:"color",get:function(){throw vl()}},{key:"left",get:function(){throw vl()}},{key:"right",get:function(){throw vl()}},{key:"copy",value:function(e,t,n,r,i){return this}},{key:"insert",value:function(e,t,n){return new nh(e,t)}},{key:"remove",value:function(e,t){return this}},{key:"isEmpty",value:function(){return!0}},{key:"inorderTraversal",value:function(e){return!1}},{key:"reverseTraversal",value:function(e){return!1}},{key:"minKey",value:function(){return null}},{key:"maxKey",value:function(){return null}},{key:"isRed",value:function(){return!1}},{key:"checkMaxDepth",value:function(){return!0}},{key:"check",value:function(){return 0}}]),e}());var rh=function(){function e(t){E(this,e),this.comparator=t,this.data=new eh(this.comparator)}return S(e,[{key:"has",value:function(e){return null!==this.data.get(e)}},{key:"first",value:function(){return this.data.minKey()}},{key:"last",value:function(){return this.data.maxKey()}},{key:"size",get:function(){return this.data.size}},{key:"indexOf",value:function(e){return this.data.indexOf(e)}}
2,{key:"forEach",value:function(e){this.data.inorderTraversal(function(t,n){return e(t),!1})}},{key:"forEachInRange",value:function(e,t){for(var n=this.data.getIteratorFrom(e[0]);n.hasNext();){var r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}},{key:"forEachWhile",value:function(e,t){var n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}},{key:"firstAfterOrEqual",value:function(e){var t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}},{key:"getIterator",value:function(){return new ih(this.data.getIterator())}},{key:"getIteratorFrom",value:function(e){return new ih(this.data.getIteratorFrom(e))}},{key:"add",value:function(e){return this.copy(this.data.remove(e).insert(e,!0))}},{key:"delete",value:function(e){return this.has(e)?this.copy(this.data.remove(e)):this}},{key:"isEmpty",value:function(){return this.data.isEmpty()}},{key:"unionWith",value:function(e){var t=this;return t.size<e.size&&(t=e,e=this),e.forEach(function(e){t=t.add(e)}),t}},{key:"isEqual",value:function(t){if(!(t instanceof e))return!1;if(this.size!==t.size)return!1;for(var n=this.data.getIterator(),r=t.data.getIterator();n.hasNext();){var i=n.getNext().key,a=r.getNext().key;if(0!==this.comparator(i,a))return!1}return!0}},{key:"toArray",value:function(){var e=[];return this.forEach(function(t){e.push(t)}),e}},{key:"toString",value:function(){var e=[];return this.forEach(function(t){return e.push(t)}),"SortedSet("+e.toString()+")"}},{key:"copy",value:function(t){var n=new e(this.comparator);return n.data=t,n}}]),e}(),ih=function(){function e(t){E(this,e),this.iter=t}return S(e,[{key:"getNext",value:function(){return this.iter.getNext().key}},{key:"hasNext",value:function(){return this.iter.hasNext()}}]),e}(),ah=function(){function e(t){E(this,e),this.fields=t,t.sort(Ul.comparator)}return S(e,[{key:"unionWith",value:function(t){var n,r=new rh(Ul.comparator),i=rl(this.fields);try{for(i.s();!(n=i.n()).done;){var a=n.value;r=r.add(a)}}catch(c){i.e(c)}finally{i.f()}var s,o=rl(t);try{for(o.s();!(s=o.n()).done;){var u=s.value;r=r.add(u)}}catch(c){o.e(c)}finally{o.f()}return new e(r.toArray())}},{key:"covers",value:function(e){var t,n=rl(this.fields);try{for(n.s();!(t=n.n()).done;){if(t.value.isPrefixOf(e))return!0}}catch(r){n.e(r)}finally{n.f()}return!1}},{key:"isEqual",value:function(e){return Ol(this.fields,e.fields,function(e,t){return e.isEqual(t)})}}],[{key:"empty",value:function(){return new e([])}}]),e}(),sh=function(e){g(n,e);var t=al(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments)).name="Base64DecodeError",e}return S(n)}(R(Error)),oh=function(){function e(t){E(this,e),this.binaryString=t}return S(e,[{key:Symbol.iterator,value:function(){var e=this,t=0;return{next:function(){return t<e.binaryString.length?{value:e.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}}},{key:"toBase64",value:function(){return e=this.binaryString,btoa(e);var e}},{key:"toUint8Array",value:function(){return function(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(this.binaryString)}},{key:"approximateByteSize",value:function(){return 2*this.binaryString.length}},{key:"compareTo",value:function(e){return Pl(this.binaryString,e.binaryString)}},{key:"isEqual",value:function(e){return this.binaryString===e.binaryString}}],[{key:"fromBase64String",value:function(t){var n=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new sh("Invalid base64 string: "+e):e}}(t);return new e(n)}},{key:"fromUint8Array",value:function(t){var n=function(e){for(var t="",n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(t);return new e(n)}}]),e}();oh.EMPTY_BYTE_STRING=new oh("");var uh=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function ch(e){if(gl(!!e),"string"==typeof e){var t=0,n=uh.exec(e);if(gl(!!n),n[1]){var r=n[1];r=(r+"000000000").substr(0,9),t=Number(r)}var i=new Date(e);return{seconds:Math.floor(i.getTime()/1e3),nanos:t}}return{seconds:lh(e.seconds),nanos:lh(e.nanos)}}function lh(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function hh(e){return"string"==typeof e?oh.fromBase64String(e):oh.fromUint8Array(e)}function fh(e){var t,n;return"server_timestamp"===(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function dh(e){var t=e.mapValue.fields.__previous_value__;return fh(t)?dh(t):t}function ph(e){var t=ch(e.mapValue.fields.__local_write_time__.timestampValue);return new Rl(t.seconds,t.nanos)}var vh=S(function e(t,n,r,i,a,s,o,u,c){E(this,e),this.databaseId=t,this.appId=n,this.persistenceKey=r,this.host=i,this.ssl=a,this.forceLongPolling=s,this.autoDetectLongPolling=o,this.longPollingOptions=u,this.useFetchStreams=c}),gh=function(){function e(t,n){E(this,e),this.projectId=t,this.database=n||"(default)"}return S(e,[{key:"isDefaultDatabase",get:function(){return"(default)"===this.database}},{key:"isEqual",value:function(t){return t instanceof e&&t.projectId===this.projectId&&t.database===this.database}}],[{key:"empty",value:function(){return new e("","")}}]),e}(),yh={fields:{__type__:{stringValue:"__max__"}}};function mh(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?fh(e)?4:Oh(e)?9007199254740991:10:vl()}function kh(e,t){if(e===t)return!0;var n=mh(e);if(n!==mh(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return ph(e).isEqual(ph(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;var n=ch(e.timestampValue),r=ch(t.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return hh(e.bytesValue).isEqual(hh(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return lh(e.geoPointValue.latitude)===lh(t.geoPointValue.latitude)&&lh(e.geoPointValue.longitude)===lh(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return lh(e.integerValue)===lh(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){var n=lh(e.doubleValue),r=lh(t.doubleValue);return n===r?Yl(n)===Yl(r):isNaN(n)&&isNaN(r)}return!1}(e,t);case 9:return Ol(e.arrayValue.values||[],t.arrayValue.values||[],kh);case 10:return function(e,t){var n=e.mapValue.fields||{},r=t.mapValue.fields||{};if(Jl(n)!==Jl(r))return!1;for(var i in n)if(n.hasOwnProperty(i)&&(void 0===r[i]||!kh(n[i],r[i])))return!1;return!0}(e,t);default:return vl()}}function wh(e,t){return void 0!==(e.values||[]).find(function(e){return kh(e,t)})}function bh(e,t){if(e===t)return 0;var n=mh(e),r=mh(t);if(n!==r)return Pl(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Pl(e.booleanValue,t.booleanValue);case 2:return function(e,t){var n=lh(e.integerValue||e.doubleValue),r=lh(t.integerValue||t.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return _h(e.timestampValue,t.timestampValue);case 4:return _h(ph(e),ph(t));case 5:return Pl(e.stringValue,t.stringValue);case 6:return function(e,t){var n=hh(e),r=hh(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){for(var n=e.split("/"),r=t.split("/"),i=0;i<n.length&&i<r.length;i++){var a=Pl(n[i],r[i]);if(0!==a)return a}return Pl(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){var n=Pl(lh(e.latitude),lh(t.latitude));return 0!==n?n:Pl(lh(e.longitude),lh(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return function(e,t){for(var n=e.values||[],r=t.values||[],i=0;i<n.length&&i<r.length;++i){var a=bh(n[i],r[i]);if(a)return a}return Pl(n.length,r.length)}(e.arrayValue,t.arrayValue);case 10:return function(e,t){if(e===yh&&t===yh)return 0;if(e===yh)return 1;if(t===yh)return-1;var n=e.fields||{},r=Object.keys(n),i=t.fields||{},a=Object.keys(i);r.sort(),a.sort();for(var s=0;s<r.length&&s<a.length;++s){var o=Pl(r[s],a[s]);if(0!==o)return o;var u=bh(n[r[s]],i[a[s]]);if(0!==u)return u}return Pl(r.length,a.length)}(e.mapValue,t.mapValue);default:throw vl()}}function _h(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return Pl(e,t);var n=ch(e),r=ch(t),i=Pl(n.seconds,r.seconds);return 0!==i?i:Pl(n.nanos,r.nanos)}function Eh(e){return Ih(e)}function Ih(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){var t=ch(e);return"time(".concat(t.seconds,",").concat(t.nanos,")")}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(e){return hh(e).toBase64()}(e.bytesValue):"referenceValue"in e?function(e){return Fl.fromName(e).toString()}(e.referenceValue):"geoPointValue"in e?function(e){return"geo(".concat(e.latitude,",").concat(e.longitude,")")}(e.geoPointValue):"arrayValue"in e?function(e){var t,n="[",r=!0,i=rl(e.values||[]);try{for(i.s();!(t=i.n()).done;){var a=t.value;r?r=!1:n+=",",n+=Ih(a)}}catch(s){i.e(s)}finally{i.f()}return n+"]"}(e.arrayValue):"mapValue"in e?function(e){var t,n="{",r=!0,i=rl(Object.keys(e.fields||{}).sort());try{for(i.s();!(t=i.n()).done;){var a=t.value;r?r=!1:n+=",",n+="".concat(a,":").concat(Ih(e.fields[a]))}}catch(s){i.e(s)}finally{i.f()}return n+"}"}
2(e.mapValue):vl()}function Sh(e){return!!e&&"integerValue"in e}function Th(e){return!!e&&"arrayValue"in e}function xh(e){return!!e&&"nullValue"in e}function Ah(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function Ch(e){return!!e&&"mapValue"in e}function Ph(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==c(e.timestampValue))return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){var t={mapValue:{fields:{}}};return $l(e.mapValue.fields,function(e,n){return t.mapValue.fields[e]=Ph(n)}),t}if(e.arrayValue){for(var n={arrayValue:{values:[]}},r=0;r<(e.arrayValue.values||[]).length;++r)n.arrayValue.values[r]=Ph(e.arrayValue.values[r]);return n}return Object.assign({},e)}function Oh(e){return"__max__"===(((e.mapValue||{}).fields||{}).__type__||{}).stringValue}var Rh=function(){function e(t){E(this,e),this.value=t}return S(e,[{key:"field",value:function(e){if(e.isEmpty())return this.value;for(var t=this.value,n=0;n<e.length-1;++n)if(!Ch(t=(t.mapValue.fields||{})[e.get(n)]))return null;return(t=(t.mapValue.fields||{})[e.lastSegment()])||null}},{key:"set",value:function(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=Ph(t)}},{key:"setAll",value:function(e){var t=this,n=Ul.emptyPath(),r={},i=[];e.forEach(function(e,a){if(!n.isImmediateParentOf(a)){var s=t.getFieldsMap(n);t.applyChanges(s,r,i),r={},i=[],n=a.popLast()}e?r[a.lastSegment()]=Ph(e):i.push(a.lastSegment())});var a=this.getFieldsMap(n);this.applyChanges(a,r,i)}},{key:"delete",value:function(e){var t=this.field(e.popLast());Ch(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}},{key:"isEqual",value:function(e){return kh(this.value,e.value)}},{key:"getFieldsMap",value:function(e){var t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(var n=0;n<e.length;++n){var r=t.mapValue.fields[e.get(n)];Ch(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}},{key:"applyChanges",value:function(e,t,n){$l(t,function(t,n){return e[t]=n});var r,i=rl(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;delete e[a]}}catch(s){i.e(s)}finally{i.f()}}},{key:"clone",value:function(){return new e(Ph(this.value))}}],[{key:"empty",value:function(){return new e({mapValue:{}})}}]),e}();function Nh(e){var t=[];return $l(e.fields,function(e,n){var r=new Ul([e]);if(Ch(n)){var i=Nh(n.mapValue).fields;if(0===i.length)t.push(r);else{var a,s=rl(i);try{for(s.s();!(a=s.n()).done;){var o=a.value;t.push(r.child(o))}}catch(u){s.e(u)}finally{s.f()}}}else t.push(r)}),new ah(t)}var Dh=function(){function e(t,n,r,i,a,s,o){E(this,e),this.key=t,this.documentType=n,this.version=r,this.readTime=i,this.createTime=a,this.data=s,this.documentState=o}return S(e,[{key:"convertToFoundDocument",value:function(e,t){return!this.createTime.isEqual(Nl.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}},{key:"convertToNoDocument",value:function(e){return this.version=e,this.documentType=2,this.data=Rh.empty(),this.documentState=0,this}},{key:"convertToUnknownDocument",value:function(e){return this.version=e,this.documentType=3,this.data=Rh.empty(),this.documentState=2,this}},{key:"setHasCommittedMutations",value:function(){return this.documentState=2,this}},{key:"setHasLocalMutations",value:function(){return this.documentState=1,this.version=Nl.min(),this}},{key:"setReadTime",value:function(e){return this.readTime=e,this}},{key:"hasLocalMutations",get:function(){return 1===this.documentState}},{key:"hasCommittedMutations",get:function(){return 2===this.documentState}},{key:"hasPendingWrites",get:function(){return this.hasLocalMutations||this.hasCommittedMutations}},{key:"isValidDocument",value:function(){return 0!==this.documentType}},{key:"isFoundDocument",value:function(){return 1===this.documentType}},{key:"isNoDocument",value:function(){return 2===this.documentType}},{key:"isUnknownDocument",value:function(){return 3===this.documentType}},{key:"isEqual",value:function(t){return t instanceof e&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}},{key:"mutableCopy",value:function(){return new e(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}},{key:"toString",value:function(){return"Document(".concat(this.key,", ").concat(this.version,", ").concat(JSON.stringify(this.data.value),", {createTime: ").concat(this.createTime,"}), {documentType: ").concat(this.documentType,"}), {documentState: ").concat(this.documentState,"})")}}],[{key:"newInvalidDocument",value:function(t){return new e(t,0,Nl.min(),Nl.min(),Nl.min(),Rh.empty(),0)}},{key:"newFoundDocument",value:function(t,n,r,i){return new e(t,1,n,Nl.min(),r,i,0)}},{key:"newNoDocument",value:function(t,n){return new e(t,2,n,Nl.min(),Nl.min(),Rh.empty(),0)}},{key:"newUnknownDocument",value:function(t,n){return new e(t,3,n,Nl.min(),Nl.min(),Rh.empty(),2)}}]),e}(),Lh=S(function e(t,n){E(this,e),this.position=t,this.inclusive=n});function Mh(e,t,n){for(var r=0,i=0;i<e.position.length;i++){var a=t[i],s=e.position[i];if(r=a.field.isKeyField()?Fl.comparator(Fl.fromName(s.referenceValue),n.key):bh(s,n.data.field(a.field)),"desc"===a.dir&&(r*=-1),0!==r)break}return r}function Uh(e,t){if(null===e)return null===t;if(null===t)return!1;if(e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(var n=0;n<e.position.length;n++)if(!kh(e.position[n],t.position[n]))return!1;return!0}var Fh=S(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asc";E(this,e),this.field=t,this.dir=n});function jh(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}var Vh=S(function e(){E(this,e)}),Bh=function(e){g(n,e);var t=al(n);
2function n(e,r,i){var a;return E(this,n),(a=t.call(this)).field=e,a.op=r,a.value=i,a}return S(n,[{key:"matches",value:function(e){var t=e.data.field(this.field);return"!="===this.op?null!==t&&this.matchesComparison(bh(t,this.value)):null!==t&&mh(this.value)===mh(t)&&this.matchesComparison(bh(t,this.value))}},{key:"matchesComparison",value:function(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return vl()}}},{key:"isInequality",value:function(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}},{key:"getFlattenedFilters",value:function(){return[this]}},{key:"getFilters",value:function(){return[this]}}],[{key:"create",value:function(e,t,r){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,r):new Qh(e,t,r):"array-contains"===t?new $h(e,r):"in"===t?new Zh(e,r):"not-in"===t?new ef(e,r):"array-contains-any"===t?new tf(e,r):new n(e,t,r)}},{key:"createKeyFieldInFilter",value:function(e,t,n){return"in"===t?new Yh(e,n):new Xh(e,n)}}]),n}(Vh),qh=function(e){g(n,e);var t=al(n);function n(e,r){var i;return E(this,n),(i=t.call(this)).filters=e,i.op=r,i.ae=null,i}return S(n,[{key:"matches",value:function(e){return zh(this)?void 0===this.filters.find(function(t){return!t.matches(e)}):void 0!==this.filters.find(function(t){return t.matches(e)})}},{key:"getFlattenedFilters",value:function(){return null!==this.ae||(this.ae=this.filters.reduce(function(e,t){return e.concat(t.getFlattenedFilters())},[])),this.ae}},{key:"getFilters",value:function(){return Object.assign([],this.filters)}}],[{key:"create",value:function(e,t){return new n(e,t)}}]),n}(Vh);function zh(e){return"and"===e.op}function Hh(e){return function(e){var t,n=rl(e.filters);try{for(n.s();!(t=n.n()).done;){if(t.value instanceof qh)return!1}}catch(r){n.e(r)}finally{n.f()}return!0}(e)&&zh(e)}function Kh(e){if(e instanceof Bh)return e.field.canonicalString()+e.op.toString()+Eh(e.value);if(Hh(e))return e.filters.map(function(e){return Kh(e)}).join(",");var t=e.filters.map(function(e){return Kh(e)}).join(",");return"".concat(e.op,"(").concat(t,")")}function Gh(e,t){return e instanceof Bh?function(e,t){return t instanceof Bh&&e.op===t.op&&e.field.isEqual(t.field)&&kh(e.value,t.value)}(e,t):e instanceof qh?function(e,t){return t instanceof qh&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce(function(e,n,r){return e&&Gh(n,t.filters[r])},!0)}(e,t):void vl()}function Wh(e){return e instanceof Bh?function(e){return"".concat(e.field.canonicalString()," ").concat(e.op," ").concat(Eh(e.value))}(e):e instanceof qh?function(e){return e.op.toString()+" {"+e.getFilters().map(Wh).join(" ,")+"}"}(e):"Filter"}var Qh=function(e){g(n,e);var t=al(n);function n(e,r,i){var a;return E(this,n),(a=t.call(this,e,r,i)).key=Fl.fromName(i.referenceValue),a}return S(n,[{key:"matches",value:function(e){var t=Fl.comparator(e.key,this.key);return this.matchesComparison(t)}}]),n}(Bh),Yh=function(e){g(n,e);var t=al(n);function n(e,r){var i;return E(this,n),(i=t.call(this,e,"in",r)).keys=Jh("in",r),i}return S(n,[{key:"matches",value:function(e){return this.keys.some(function(t){return t.isEqual(e.key)})}}]),n}(Bh),Xh=function(e){g(n,e);var t=al(n);function n(e,r){var i;return E(this,n),(i=t.call(this,e,"not-in",r)).keys=Jh("not-in",r),i}return S(n,[{key:"matches",value:function(e){return!this.keys.some(function(t){return t.isEqual(e.key)})}}]),n}(Bh);function Jh(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map(function(e){return Fl.fromName(e.referenceValue)})}var $h=function(e){g(n,e);var t=al(n);function n(e,r){return E(this,n),t.call(this,e,"array-contains",r)}return S(n,[{key:"matches",value:function(e){var t=e.data.field(this.field);return Th(t)&&wh(t.arrayValue,this.value)}}]),n}(Bh),Zh=function(e){g(n,e);var t=al(n);function n(e,r){return E(this,n),t.call(this,e,"in",r)}return S(n,[{key:"matches",value:function(e){var t=e.data.field(this.field);return null!==t&&wh(this.value.arrayValue,t)}}]),n}(Bh),ef=function(e){g(n,e);var t=al(n);function n(e,r){return E(this,n),t.call(this,e,"not-in",r)}return S(n,[{key:"matches",value:function(e){if(wh(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;var t=e.data.field(this.field);return null!==t&&!wh(this.value.arrayValue,t)}}]),n}(Bh),tf=function(e){g(n,e);var t=al(n);function n(e,r){return E(this,n),t.call(this,e,"array-contains-any",r)}return S(n,[{key:"matches",value:function(e){var t=this,n=e.data.field(this.field);return!(!Th(n)||!n.arrayValue.values)&&n.arrayValue.values.some(function(e){return wh(t.value.arrayValue,e)})}}]),n}(Bh),nf=S(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;E(this,e),this.path=t,this.collectionGroup=n,this.orderBy=r,this.filters=i,this.limit=a,this.startAt=s,this.endAt=o,this.ue=null});function rf(e){return new nf(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,arguments.length>6&&void 0!==arguments[6]?arguments[6]:null)}function af(e){var t=yl(e);if(null===t.ue){var n=t.path.canonicalString();null!==t.collectionGroup&&(n+="|cg:"+t.collectionGroup),n+="|f:",n+=t.filters.map(function(e){return Kh(e)}).join(","),n+="|ob:",n+=t.orderBy.map(function(e){return function(e){return e.field.canonicalString()+e.dir}(e)}).join(","),Ql(t.limit)||(n+="|l:",n+=t.limit),t.startAt&&(n+="|lb:",n+=t.startAt.inclusive?"b:":"a:",n+=t.startAt.position.map(function(e){return Eh(e)}).join(",")),t.endAt&&(n+="|ub:",n+=t.endAt.inclusive?"a:":"b:",n+=t.endAt.position.map(function(e){return Eh(e)}).join(",")),t.ue=n}return t.ue}function sf(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(var n=0;n<e.orderBy.length;n++)if(!jh(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(var r=0;r<e.filters.length;r++)if(!Gh(e.filters[r],t.filters[r]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!Uh(e.startAt,t.startAt)&&Uh(e.endAt,t.endAt)}function of(e){return Fl.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}var uf=S(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"F",o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;E(this,e),this.path=t,this.collectionGroup=n,this.explicitOrderBy=r,this.filters=i,this.limit=a,this.limitType=s,this.startAt=o,this.endAt=u,this.ce=null,this.le=null,this.he=null,this.startAt,this.endAt});function cf(e){return new uf(e)}function lf(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function hf(e){var t=yl(e);if(null===t.ce){t.ce=[];var n,r=new Set,i=rl(t.explicitOrderBy);try{for(i.s();!(n=i.n()).done;){var a=n.value;t.ce.push(a),r.add(a.field.canonicalString())}}catch(u){i.e(u)}finally{i.f()}var s=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc",o=function(e){var t=new rh(Ul.comparator);
2return e.filters.forEach(function(e){e.getFlattenedFilters().forEach(function(e){e.isInequality()&&(t=t.add(e.field))})}),t}(t);o.forEach(function(e){r.has(e.canonicalString())||e.isKeyField()||t.ce.push(new Fh(e,s))}),r.has(Ul.keyField().canonicalString())||t.ce.push(new Fh(Ul.keyField(),s))}return t.ce}function ff(e){var t=yl(e);return t.le||(t.le=function(e,t){if("F"===e.limitType)return rf(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);t=t.map(function(e){var t="desc"===e.dir?"asc":"desc";return new Fh(e.field,t)});var n=e.endAt?new Lh(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new Lh(e.startAt.position,e.startAt.inclusive):null;return rf(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}(t,hf(e))),t.le}function df(e,t,n){return new uf(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function pf(e,t){return sf(ff(e),ff(t))&&e.limitType===t.limitType}function vf(e){return"".concat(af(ff(e)),"|lt:").concat(e.limitType)}function gf(e){return"Query(target=".concat(function(e){var t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=", filters: [".concat(e.filters.map(function(e){return Wh(e)}).join(", "),"]")),Ql(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=", orderBy: [".concat(e.orderBy.map(function(e){return function(e){return"".concat(e.field.canonicalString()," (").concat(e.dir,")")}(e)}).join(", "),"]")),e.startAt&&(t+=", startAt: ",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(function(e){return Eh(e)}).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(function(e){return Eh(e)}).join(",")),"Target(".concat(t,")")}(ff(e)),"; limitType=").concat(e.limitType,")")}function yf(e,t){return t.isFoundDocument()&&function(e,t){var n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):Fl.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){var n,r=rl(hf(e));try{for(r.s();!(n=r.n()).done;){var i=n.value;if(!i.field.isKeyField()&&null===t.data.field(i.field))return!1}}catch(a){r.e(a)}finally{r.f()}return!0}(e,t)&&function(e,t){var n,r=rl(e.filters);try{for(r.s();!(n=r.n()).done;){if(!n.value.matches(t))return!1}}catch(i){r.e(i)}finally{r.f()}return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){var r=Mh(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,hf(e),t))&&!(e.endAt&&!function(e,t,n){var r=Mh(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,hf(e),t))}(e,t)}function mf(e){return function(t,n){var r,i=!1,a=rl(hf(e));try{for(a.s();!(r=a.n()).done;){var s=r.value,o=kf(s,t,n);if(0!==o)return o;i=i||s.field.isKeyField()}}catch(u){a.e(u)}finally{a.f()}return 0}}function kf(e,t,n){var r=e.field.isKeyField()?Fl.comparator(t.key,n.key):function(e,t,n){var r=t.data.field(e),i=n.data.field(e);return null!==r&&null!==i?bh(r,i):vl()}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return-1*r;default:return vl()}}var wf=function(){function e(t,n){E(this,e),this.mapKeyFn=t,this.equalsFn=n,this.inner={},this.innerSize=0}return S(e,[{key:"get",value:function(e){var t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n){var r,i=rl(n);try{for(i.s();!(r=i.n()).done;){var a=w(r.value,2),s=a[0],o=a[1];if(this.equalsFn(s,e))return o}}catch(u){i.e(u)}finally{i.f()}}}},{key:"has",value:function(e){return void 0!==this.get(e)}},{key:"set",value:function(e,t){var n=this.mapKeyFn(e),r=this.inner[n];if(void 0===r)return this.inner[n]=[[e,t]],void this.innerSize++;for(var i=0;i<r.length;i++)if(this.equalsFn(r[i][0],e))return void(r[i]=[e,t]);r.push([e,t]),this.innerSize++}},{key:"delete",value:function(e){var t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return 1===n.length?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}},{key:"forEach",value:function(e){$l(this.inner,function(t,n){var r,i=rl(n);try{for(i.s();!(r=i.n()).done;){var a=w(r.value,2),s=a[0],o=a[1];e(s,o)}}catch(u){i.e(u)}finally{i.f()}})}},{key:"isEmpty",value:function(){return Zl(this.inner)}},{key:"size",value:function(){return this.innerSize}}]),e}(),bf=new eh(Fl.comparator);function _f(){return bf}var Ef=new eh(Fl.comparator);function If(){for(var e=Ef,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var i=0,a=n;i<a.length;i++){var s=a[i];e=e.insert(s.key,s)}return e}function Sf(e){var t=Ef;return e.forEach(function(e,n){return t=t.insert(e,n.overlayedDocument)}),t}function Tf(){return Af()}function xf(){return Af()}function Af(){return new wf(function(e){return e.toString()},function(e,t){return e.isEqual(t)})}var Cf=new eh(Fl.comparator),Pf=new rh(Fl.comparator);
2function Of(){for(var e=Pf,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var i=0,a=n;i<a.length;i++){var s=a[i];e=e.add(s)}return e}var Rf=new rh(Pl);function Nf(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Yl(t)?"-0":t}}function Df(e){return{integerValue:""+e}}function Lf(e,t){return function(e){return"number"==typeof e&&Number.isInteger(e)&&!Yl(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}(t)?Df(t):Nf(e,t)}var Mf=S(function e(){E(this,e),this._=void 0});function Uf(e,t,n){return e instanceof Vf?function(e,t){var n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&fh(t)&&(t=dh(t)),t&&(n.fields.__previous_value__=t),{mapValue:n}}(n,t):e instanceof Bf?qf(e,t):e instanceof zf?Hf(e,t):function(e,t){var n=jf(e,t),r=Gf(n)+Gf(e.Pe);return Sh(n)&&Sh(e.Pe)?Df(r):Nf(e.serializer,r)}(e,t)}function Ff(e,t,n){return e instanceof Bf?qf(e,t):e instanceof zf?Hf(e,t):n}function jf(e,t){return e instanceof Kf?function(e){return Sh(e)||function(e){return!!e&&"doubleValue"in e}(e)}(t)?t:{integerValue:0}:null}var Vf=function(e){g(n,e);var t=al(n);function n(){return E(this,n),t.apply(this,arguments)}return S(n)}(Mf),Bf=function(e){g(n,e);var t=al(n);function n(e){var r;return E(this,n),(r=t.call(this)).elements=e,r}return S(n)}(Mf);function qf(e,t){var n,r=Wf(t),i=rl(e.elements);try{var a=function(){var e=n.value;r.some(function(t){return kh(t,e)})||r.push(e)};for(i.s();!(n=i.n()).done;)a()}catch(s){i.e(s)}finally{i.f()}return{arrayValue:{values:r}}}var zf=function(e){g(n,e);var t=al(n);function n(e){var r;return E(this,n),(r=t.call(this)).elements=e,r}return S(n)}(Mf);function Hf(e,t){var n,r=Wf(t),i=rl(e.elements);try{var a=function(){var e=n.value;r=r.filter(function(t){return!kh(t,e)})};for(i.s();!(n=i.n()).done;)a()}catch(s){i.e(s)}finally{i.f()}return{arrayValue:{values:r}}}var Kf=function(e){g(n,e);var t=al(n);function n(e,r){var i;return E(this,n),(i=t.call(this)).serializer=e,i.Pe=r,i}return S(n)}(Mf);function Gf(e){return lh(e.integerValue||e.doubleValue)}function Wf(e){return Th(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}var Qf=S(function e(t,n){E(this,e),this.version=t,this.transformResults=n}),Yf=function(){function e(t,n){E(this,e),this.updateTime=t,this.exists=n}return S(e,[{key:"isNone",get:function(){return void 0===this.updateTime&&void 0===this.exists}},{key:"isEqual",value:function(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}],[{key:"none",value:function(){return new e}},{key:"exists",value:function(t){return new e(void 0,t)}},{key:"updateTime",value:function(t){return new e(t)}}]),e}();function Xf(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}var Jf=S(function e(){E(this,e)});function $f(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new ld(e.key,Yf.none()):new rd(e.key,e.data,Yf.none());var n,r=e.data,i=Rh.empty(),a=new rh(Ul.comparator),s=rl(t.fields);try{for(s.s();!(n=s.n()).done;){var o=n.value;if(!a.has(o)){var u=r.field(o);null===u&&o.length>1&&(o=o.popLast(),u=r.field(o)),null===u?i.delete(o):i.set(o,u),a=a.add(o)}}}catch(c){s.e(c)}finally{s.f()}return new id(e.key,i,new ah(a.toArray()),Yf.none())}function Zf(e,t,n){e instanceof rd?function(e,t,n){var r=e.value.clone(),i=sd(e.fieldTransforms,t,n.transformResults);r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof id?function(e,t,n){if(Xf(e.precondition,t)){var r=sd(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(ad(e)),i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}else t.convertToUnknownDocument(n.version)}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function ed(e,t,n,r){return e instanceof rd?function(e,t,n,r){if(!Xf(e.precondition,t))return n;var i=e.value.clone(),a=od(e.fieldTransforms,r,t);return i.setAll(a),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,n,r):e instanceof id?function(e,t,n,r){if(!Xf(e.precondition,t))return n;var i=od(e.fieldTransforms,r,t),a=t.data;return a.setAll(ad(e)),a.setAll(i),t.convertToFoundDocument(t.version,a).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(function(e){return e.field}))}(e,t,n,r):function(e,t,n){return Xf(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function td(e,t){var n,r=null,i=rl(e.fieldTransforms);try{for(i.s();!(n=i.n()).done;){var a=n.value,s=t.data.field(a.field),o=jf(a.transform,s||null);null!=o&&(null===r&&(r=Rh.empty()),r.set(a.field,o))}}catch(u){i.e(u)}finally{i.f()}return r||null}
2function nd(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&Ol(e,t,function(e,t){return function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof Bf&&t instanceof Bf||e instanceof zf&&t instanceof zf?Ol(e.elements,t.elements,kh):e instanceof Kf&&t instanceof Kf?kh(e.Pe,t.Pe):e instanceof Vf&&t instanceof Vf}(e.transform,t.transform)}(e,t)})}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}var rd=function(e){g(n,e);var t=al(n);function n(e,r,i){var a,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return E(this,n),(a=t.call(this)).key=e,a.value=r,a.precondition=i,a.fieldTransforms=s,a.type=0,a}return S(n,[{key:"getFieldMask",value:function(){return null}}]),n}(Jf),id=function(e){g(n,e);var t=al(n);function n(e,r,i,a){var s,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return E(this,n),(s=t.call(this)).key=e,s.data=r,s.fieldMask=i,s.precondition=a,s.fieldTransforms=o,s.type=1,s}return S(n,[{key:"getFieldMask",value:function(){return this.fieldMask}}]),n}(Jf);function ad(e){var t=new Map;return e.fieldMask.fields.forEach(function(n){if(!n.isEmpty()){var r=e.data.field(n);t.set(n,r)}}),t}function sd(e,t,n){var r=new Map;gl(e.length===n.length);for(var i=0;i<n.length;i++){var a=e[i],s=a.transform,o=t.data.field(a.field);r.set(a.field,Ff(s,o,n[i]))}return r}function od(e,t,n){var r,i=new Map,a=rl(e);try{for(a.s();!(r=a.n()).done;){var s=r.value,o=s.transform,u=n.data.field(s.field);i.set(s.field,Uf(o,u,t))}}catch(c){a.e(c)}finally{a.f()}return i}var ud,cd,ld=function(e){g(n,e);var t=al(n);function n(e,r){var i;return E(this,n),(i=t.call(this)).key=e,i.precondition=r,i.type=2,i.fieldTransforms=[],i}return S(n,[{key:"getFieldMask",value:function(){return null}}]),n}(Jf),hd=function(e){g(n,e);var t=al(n);function n(e,r){var i;return E(this,n),(i=t.call(this)).key=e,i.precondition=r,i.type=3,i.fieldTransforms=[],i}return S(n,[{key:"getFieldMask",value:function(){return null}}]),n}(Jf),fd=function(){function e(t,n,r,i){E(this,e),this.batchId=t,this.localWriteTime=n,this.baseMutations=r,this.mutations=i}return S(e,[{key:"applyToRemoteDocument",value:function(e,t){for(var n=t.mutationResults,r=0;r<this.mutations.length;r++){var i=this.mutations[r];i.key.isEqual(e.key)&&Zf(i,e,n[r])}}},{key:"applyToLocalView",value:function(e,t){var n,r=rl(this.baseMutations);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.key.isEqual(e.key)&&(t=ed(i,e,t,this.localWriteTime))}}catch(u){r.e(u)}finally{r.f()}var a,s=rl(this.mutations);try{for(s.s();!(a=s.n()).done;){var o=a.value;o.key.isEqual(e.key)&&(t=ed(o,e,t,this.localWriteTime))}}catch(u){s.e(u)}finally{s.f()}return t}},{key:"applyToLocalDocumentSet",value:function(e,t){var n=this,r=xf();return this.mutations.forEach(function(i){var a=e.get(i.key),s=a.overlayedDocument,o=n.applyToLocalView(s,a.mutatedFields),u=$f(s,o=t.has(i.key)?null:o);null!==u&&r.set(i.key,u),s.isValidDocument()||s.convertToNoDocument(Nl.min())}),r}},{key:"keys",value:function(){return this.mutations.reduce(function(e,t){return e.add(t.key)},Of())}},{key:"isEqual",value:function(e){return this.batchId===e.batchId&&Ol(this.mutations,e.mutations,function(e,t){return nd(e,t)})&&Ol(this.baseMutations,e.baseMutations,function(e,t){return nd(e,t)})}}]),e}(),dd=function(){function e(t,n,r,i){E(this,e),this.batch=t,this.commitVersion=n,this.mutationResults=r,this.docVersions=i}return S(e,null,[{key:"from",value:function(t,n,r){gl(t.mutations.length===r.length);for(var i=Cf,a=t.mutations,s=0;s<a.length;s++)i=i.insert(a[s].key,r[s].version);return new e(t,n,r,i)}}]),e}(),pd=function(){function e(t,n){E(this,e),this.largestBatchId=t,this.mutation=n}return S(e,[{key:"getKey",value:function(){return this.mutation.key}},{key:"isEqual",value:function(e){return null!==e&&this.mutation===e.mutation}},{key:"toString",value:function(){return"Overlay{\n largestBatchId: ".concat(this.largestBatchId,",\n mutation: ").concat(this.mutation.toString(),"\n }")}}]),e}(),vd=S(function e(t,n){E(this,e),this.count=t,this.unchangedNames=n}
2);function gd(e){switch(e){default:return vl();case ml.CANCELLED:case ml.UNKNOWN:case ml.DEADLINE_EXCEEDED:case ml.RESOURCE_EXHAUSTED:case ml.INTERNAL:case ml.UNAVAILABLE:case ml.UNAUTHENTICATED:return!1;case ml.INVALID_ARGUMENT:case ml.NOT_FOUND:case ml.ALREADY_EXISTS:case ml.PERMISSION_DENIED:case ml.FAILED_PRECONDITION:case ml.ABORTED:case ml.OUT_OF_RANGE:case ml.UNIMPLEMENTED:case ml.DATA_LOSS:return!0}}function yd(e){if(void 0===e)return fl("GRPC error has no .code"),ml.UNKNOWN;switch(e){case ud.OK:return ml.OK;case ud.CANCELLED:return ml.CANCELLED;case ud.UNKNOWN:return ml.UNKNOWN;case ud.DEADLINE_EXCEEDED:return ml.DEADLINE_EXCEEDED;case ud.RESOURCE_EXHAUSTED:return ml.RESOURCE_EXHAUSTED;case ud.INTERNAL:return ml.INTERNAL;case ud.UNAVAILABLE:return ml.UNAVAILABLE;case ud.UNAUTHENTICATED:return ml.UNAUTHENTICATED;case ud.INVALID_ARGUMENT:return ml.INVALID_ARGUMENT;case ud.NOT_FOUND:return ml.NOT_FOUND;case ud.ALREADY_EXISTS:return ml.ALREADY_EXISTS;case ud.PERMISSION_DENIED:return ml.PERMISSION_DENIED;case ud.FAILED_PRECONDITION:return ml.FAILED_PRECONDITION;case ud.ABORTED:return ml.ABORTED;case ud.OUT_OF_RANGE:return ml.OUT_OF_RANGE;case ud.UNIMPLEMENTED:return ml.UNIMPLEMENTED;case ud.DATA_LOSS:return ml.DATA_LOSS;default:return vl()}}(cd=ud||(ud={}))[cd.OK=0]="OK",cd[cd.CANCELLED=1]="CANCELLED",cd[cd.UNKNOWN=2]="UNKNOWN",cd[cd.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",cd[cd.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",cd[cd.NOT_FOUND=5]="NOT_FOUND",cd[cd.ALREADY_EXISTS=6]="ALREADY_EXISTS",cd[cd.PERMISSION_DENIED=7]="PERMISSION_DENIED",cd[cd.UNAUTHENTICATED=16]="UNAUTHENTICATED",cd[cd.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",cd[cd.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",cd[cd.ABORTED=10]="ABORTED",cd[cd.OUT_OF_RANGE=11]="OUT_OF_RANGE",cd[cd.UNIMPLEMENTED=12]="UNIMPLEMENTED",cd[cd.INTERNAL=13]="INTERNAL",cd[cd.UNAVAILABLE=14]="UNAVAILABLE",cd[cd.DATA_LOSS=15]="DATA_LOSS";var md=new Bc([4294967295,4294967295],0);function kd(e){var t=(new TextEncoder).encode(e),n=new qc;return n.update(t),new Uint8Array(n.digest())}function wd(e){var t=new DataView(e.buffer),n=t.getUint32(0,!0),r=t.getUint32(4,!0),i=t.getUint32(8,!0),a=t.getUint32(12,!0);return[new Bc([n,r],0),new Bc([i,a],0)]}var bd=function(){function e(t,n,r){if(E(this,e),this.bitmap=t,this.padding=n,this.hashCount=r,n<0||n>=8)throw new _d("Invalid padding: ".concat(n));if(r<0)throw new _d("Invalid hash count: ".concat(r));if(t.length>0&&0===this.hashCount)throw new _d("Invalid hash count: ".concat(r));if(0===t.length&&0!==n)throw new _d("Invalid padding when bitmap length is 0: ".concat(n));this.Ie=8*t.length-n,this.Te=Bc.fromNumber(this.Ie)}return S(e,[{key:"Ee",value:function(e,t,n){var r=e.add(t.multiply(Bc.fromNumber(n)));return 1===r.compare(md)&&(r=new Bc([r.getBits(0),r.getBits(1)],0)),r.modulo(this.Te).toNumber()}},{key:"de",value:function(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}},{key:"mightContain",value:function(e){if(0===this.Ie)return!1;for(var t=w(wd(kd(e)),2),n=t[0],r=t[1],i=0;i<this.hashCount;i++){var a=this.Ee(n,r,i);if(!this.de(a))return!1}return!0}},{key:"insert",value:function(e){if(0!==this.Ie)for(var t=w(wd(kd(e)),2),n=t[0],r=t[1],i=0;i<this.hashCount;i++){var a=this.Ee(n,r,i);this.Ae(a)}}},{key:"Ae",value:function(e){var t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}}],[{key:"create",value:function(t,n,r){var i=t%8==0?0:8-t%8,a=new e(new Uint8Array(Math.ceil(t/8)),i,n);return r.forEach(function(e){return a.insert(e)}),a}}]),e}(),_d=function(e){g(n,e);var t=al(n);function n(){var e;return E(this,n),(e=t.apply(this,arguments)).name="BloomFilterError",e}return S(n)}(R(Error)),Ed=function(){function e(t,n,r,i,a){E(this,e),this.snapshotVersion=t,this.targetChanges=n,this.targetMismatches=r,this.documentUpdates=i,this.resolvedLimboDocuments=a}return S(e,null,[{key:"createSynthesizedRemoteEventForCurrentChange",value:function(t,n,r){var i=new Map;return i.set(t,Id.createSynthesizedTargetChangeForCurrentChange(t,n,r)),new e(Nl.min(),i,new eh(Pl),_f(),Of())}}]),e}(),Id=function(){function e(t,n,r,i,a){E(this,e),this.resumeToken=t,this.current=n,this.addedDocuments=r,this.modifiedDocuments=i,this.removedDocuments=a}return S(e,null,[{key:"createSynthesizedTargetChangeForCurrentChange",value:function(t,n,r){return new e(r,n,Of(),Of(),Of())}}]),e}(),Sd=S(function e(t,n,r,i){E(this,e),this.Re=t,this.removedTargetIds=n,this.key=r,this.Ve=i}),Td=S(function e(t,n){E(this,e),this.targetId=t,this.me=n}),xd=S(function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:oh.EMPTY_BYTE_STRING,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;E(this,e),this.state=t,this.targetIds=n,this.resumeToken=r,this.cause=i}),Ad=function(){function e(){E(this,e),this.fe=0,this.ge=Od(),this.pe=oh.EMPTY_BYTE_STRING,this.ye=!1,this.we=!0}return S(e,[{key:"current",get:function(){return this.ye}},{key:"resumeToken",get:function(){return this.pe}},{key:"Se",get:function(){return 0!==this.fe}},{key:"be",get:function(){return this.we}},{key:"De",value:function(e){e.approximateByteSize()>0&&(this.we=!0,this.pe=e)}},{key:"Ce",value:function(){var e=Of(),t=Of(),n=Of();return this.ge.forEach(function(r,i){switch(i){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:vl()}}),new Id(this.pe,this.ye,e,t,n)}},{key:"ve",value:function(){this.we=!1,this.ge=Od()}},{key:"Fe",value:function(e,t){this.we=!0,this.ge=this.ge.insert(e,t)}},{key:"Me",value:function(e){this.we=!0,this.ge=this.ge.remove(e)}},{key:"xe",value:function(){this.fe+=1}},{key:"Oe",value:function(){this.fe-=1,gl(this.fe>=0)}},{key:"Ne",value:function(){this.we=!0,this.ye=!0}}]),e}(),Cd=function(){function e(t){E(this,e),this.Le=t,this.Be=new Map,this.ke=_f(),this.qe=Pd(),this.Qe=new eh(Pl)}return S(e,[{key:"Ke",value:function(e){var t,n=rl(e.Re);try{for(n.s();!(t=n.n()).done;){var r=t.value;e.Ve&&e.Ve.isFoundDocument()?this.$e(r,e.Ve):this.Ue(r,e.key,e.Ve)}}catch(o){n.e(o)}finally{n.f()}var i,a=rl(e.removedTargetIds);try{for(a.s();!(i=a.n()).done;){var s=i.value;this.Ue(s,e.key,e.Ve)}}catch(o){a.e(o)}finally{a.f()}}},{key:"We",value:function(e){var t=this;this.forEachTarget(e,function(n){var r=t.Ge(n);switch(e.state){case 0:t.ze(n)&&r.De(e.resumeToken);break;
2case 1:r.Oe(),r.Se||r.ve(),r.De(e.resumeToken);break;case 2:r.Oe(),r.Se||t.removeTarget(n);break;case 3:t.ze(n)&&(r.Ne(),r.De(e.resumeToken));break;case 4:t.ze(n)&&(t.je(n),r.De(e.resumeToken));break;default:vl()}})}},{key:"forEachTarget",value:function(e,t){var n=this;e.targetIds.length>0?e.targetIds.forEach(t):this.Be.forEach(function(e,r){n.ze(r)&&t(r)})}},{key:"He",value:function(e){var t=e.targetId,n=e.me.count,r=this.Je(t);if(r){var i=r.target;if(of(i))if(0===n){var a=new Fl(i.path);this.Ue(t,a,Dh.newNoDocument(a,Nl.min()))}else gl(1===n);else{var s=this.Ye(t);if(s!==n){var o=this.Ze(e),u=o?this.Xe(o,e,s):1;if(0!==u){this.je(t);var c=2===u?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Qe=this.Qe.insert(t,c)}}}}}},{key:"Ze",value:function(e){var t=e.me.unchangedNames;if(!t||!t.bits)return null;var n,r,i=t.bits,a=i.bitmap,s=void 0===a?"":a,o=i.padding,u=void 0===o?0:o,c=t.hashCount,l=void 0===c?0:c;try{n=hh(s).toUint8Array()}catch(e){if(e instanceof sh)return dl("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{r=new bd(n,u,l)}catch(e){return dl(e instanceof _d?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===r.Ie?null:r}},{key:"Xe",value:function(e,t,n){return t.me.count===n-this.nt(e,t.targetId)?0:2}},{key:"nt",value:function(e,t){var n=this,r=this.Le.getRemoteKeysForTarget(t),i=0;return r.forEach(function(r){var a=n.Le.tt(),s="projects/".concat(a.projectId,"/databases/").concat(a.database,"/documents/").concat(r.path.canonicalString());e.mightContain(s)||(n.Ue(t,r,null),i++)}),i}},{key:"rt",value:function(e){var t=this,n=new Map;this.Be.forEach(function(r,i){var a=t.Je(i);if(a){if(r.current&&of(a.target)){var s=new Fl(a.target.path);null!==t.ke.get(s)||t.it(i,s)||t.Ue(i,s,Dh.newNoDocument(s,e))}r.be&&(n.set(i,r.Ce()),r.ve())}});var r=Of();this.qe.forEach(function(e,n){var i=!0;n.forEachWhile(function(e){var n=t.Je(e);return!n||"TargetPurposeLimboResolution"===n.purpose||(i=!1,!1)}),i&&(r=r.add(e))}),this.ke.forEach(function(t,n){return n.setReadTime(e)});var i=new Ed(e,n,this.Qe,this.ke,r);return this.ke=_f(),this.qe=Pd(),this.Qe=new eh(Pl),i}},{key:"$e",value:function(e,t){if(this.ze(e)){var n=this.it(e,t.key)?2:0;this.Ge(e).Fe(t.key,n),this.ke=this.ke.insert(t.key,t),this.qe=this.qe.insert(t.key,this.st(t.key).add(e))}}},{key:"Ue",value:function(e,t,n){if(this.ze(e)){var r=this.Ge(e);this.it(e,t)?r.Fe(t,1):r.Me(t),this.qe=this.qe.insert(t,this.st(t).delete(e)),n&&(this.ke=this.ke.insert(t,n))}}},{key:"removeTarget",value:function(e){this.Be.delete(e)}},{key:"Ye",value:function(e){var t=this.Ge(e).Ce();return this.Le.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}},{key:"xe",value:function(e){this.Ge(e).xe()}},{key:"Ge",value:function(e){var t=this.Be.get(e);return t||(t=new Ad,this.Be.set(e,t)),t}},{key:"st",value:function(e){var t=this.qe.get(e);return t||(t=new rh(Pl),this.qe=this.qe.insert(e,t)),t}},{key:"ze",value:function(e){var t=null!==this.Je(e);return t||hl("WatchChangeAggregator","Detected inactive target",e),t}},{key:"Je",value:function(e){var t=this.Be.get(e);return t&&t.Se?null:this.Le.ot(e)}},{key:"je",value:function(e){var t=this;this.Be.set(e,new Ad),this.Le.getRemoteKeysForTarget(e).forEach(function(n){t.Ue(e,n,null)})}},{key:"it",value:function(e,t){return this.Le.getRemoteKeysForTarget(e).has(t)}}]),e}();function Pd(){return new eh(Fl.comparator)}function Od(){return new eh(Fl.comparator)}var Rd={asc:"ASCENDING",desc:"DESCENDING"},Nd={"<":"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"},Dd={and:"AND",or:"OR"},Ld=S(function e(t,n){E(this,e),this.databaseId=t,this.useProto3Json=n});function Md(e,t){return e.useProto3Json||Ql(t)?t:{value:t}}function Ud(e,t){return e.useProto3Json?"".concat(new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z",""),".").concat(("000000000"+t.nanoseconds).slice(-9),"Z"):{seconds:""+t.seconds,nanos:t.nanoseconds}}function Fd(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}
2function jd(e,t){return Ud(e,t.toTimestamp())}function Vd(e){return gl(!!e),Nl.fromTimestamp(function(e){var t=ch(e);return new Rl(t.seconds,t.nanos)}(e))}function Bd(e,t){return qd(e,t).canonicalString()}function qd(e,t){var n=function(e){return new Ll(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function zd(e){var t=Ll.fromString(e);return gl(op(t)),t}function Hd(e,t){return Bd(e.databaseId,t.path)}function Kd(e,t){var n=zd(t);if(n.get(1)!==e.databaseId.projectId)throw new kl(ml.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new kl(ml.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new Fl(Qd(n))}function Gd(e,t){return Bd(e.databaseId,t)}function Wd(e){return new Ll(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function Qd(e){return gl(e.length>4&&"documents"===e.get(4)),e.popFirst(5)}function Yd(e,t,n){return{name:Hd(e,t),fields:n.value.mapValue.fields}}function Xd(e,t){return{documents:[Gd(e,t.path)]}}function Jd(e,t){var n,r={structuredQuery:{}},i=t.path;null!==t.collectionGroup?(n=i,r.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(n=i.popLast(),r.structuredQuery.from=[{collectionId:i.lastSegment()}]),r.parent=Gd(e,n);var a=function(e){if(0!==e.length)return ap(qh.create(e,"and"))}(t.filters);a&&(r.structuredQuery.where=a);var s=function(e){if(0!==e.length)return e.map(function(e){return function(e){return{field:rp(e.field),direction:ep(e.dir)}}(e)})}(t.orderBy);s&&(r.structuredQuery.orderBy=s);var o=Md(e,t.limit);return null!==o&&(r.structuredQuery.limit=o),t.startAt&&(r.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(r.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),{_t:r,parent:n}}function $d(e){var t=function(e){var t=zd(e);return 4===t.length?Ll.emptyPath():Qd(t)}(e.parent),n=e.structuredQuery,r=n.from?n.from.length:0,i=null;if(r>0){gl(1===r);var a=n.from[0];a.allDescendants?i=a.collectionId:t=t.child(a.collectionId)}var s=[];n.where&&(s=function(e){var t=Zd(e);return t instanceof qh&&Hh(t)?t.getFilters():[t]}(n.where));var o=[];n.orderBy&&(o=function(e){return e.map(function(e){return function(e){return new Fh(ip(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e)})}(n.orderBy));var u=null;n.limit&&(u=function(e){var t;return Ql(t="object"==c(e)?e.value:e)?null:t}(n.limit));var l=null;n.startAt&&(l=function(e){var t=!!e.before,n=e.values||[];return new Lh(n,t)}(n.startAt));var h=null;return n.endAt&&(h=function(e){var t=!e.before,n=e.values||[];return new Lh(n,t)}(n.endAt)),function(e,t,n,r,i,a,s,o){return new uf(e,t,n,r,i,a,s,o)}(t,i,o,s,u,"F",l,h)}function Zd(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":var t=ip(e.unaryFilter.field);return Bh.create(t,"==",{doubleValue:NaN});case"IS_NULL":var n=ip(e.unaryFilter.field);return Bh.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var r=ip(e.unaryFilter.field);return Bh.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":var i=ip(e.unaryFilter.field);return Bh.create(i,"!=",{nullValue:"NULL_VALUE"});default:return vl()}}(e):void 0!==e.fieldFilter?function(e){return Bh.create(ip(e.fieldFilter.field),function(e){switch(e){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 vl()}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return qh.create(e.compositeFilter.filters.map(function(e){return Zd(e)}),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return vl()}}(e.compositeFilter.op))}(e):vl()}function ep(e){return Rd[e]}function tp(e){return Nd[e]}function np(e){return Dd[e]}function rp(e){return{fieldPath:e.canonicalString()}}function ip(e){return Ul.fromServerFormat(e.fieldPath)}function ap(e){return e instanceof Bh?function(e){if("=="===e.op){if(Ah(e.value))return{unaryFilter:{field:rp(e.field),op:"IS_NAN"}};if(xh(e.value))return{unaryFilter:{field:rp(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(Ah(e.value))return{unaryFilter:{field:rp(e.field),op:"IS_NOT_NA
2N"}};if(xh(e.value))return{unaryFilter:{field:rp(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:rp(e.field),op:tp(e.op),value:e.value}}}(e):e instanceof qh?function(e){var t=e.getFilters().map(function(e){return ap(e)});return 1===t.length?t[0]:{compositeFilter:{op:np(e.op),filters:t}}}(e):vl()}function sp(e){var t=[];return e.fields.forEach(function(e){return t.push(e.canonicalString())}),{fieldPaths:t}}function op(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}var up=function(){function e(t,n,r,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Nl.min(),s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Nl.min(),o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:oh.EMPTY_BYTE_STRING,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;E(this,e),this.target=t,this.targetId=n,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=a,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=o,this.expectedCount=u}return S(e,[{key:"withSequenceNumber",value:function(t){return new e(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}},{key:"withResumeToken",value:function(t,n){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,t,null)}},{key:"withExpectedCount",value:function(t){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,t)}},{key:"withLastLimboFreeSnapshotVersion",value:function(t){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken,this.expectedCount)}}]),e}(),cp=S(function e(t){E(this,e),this.ct=t});function lp(e){var t=$d({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?df(t,t.limit,"L"):t}var hp=function(){function e(){E(this,e)}return S(e,[{key:"Pt",value:function(e,t){this.It(e,t),t.Tt()}},{key:"It",value:function(e,t){if("nullValue"in e)this.Et(t,5);else if("booleanValue"in e)this.Et(t,10),t.dt(e.booleanValue?1:0);else if("integerValue"in e)this.Et(t,15),t.dt(lh(e.integerValue));else if("doubleValue"in e){var n=lh(e.doubleValue);isNaN(n)?this.Et(t,13):(this.Et(t,15),Yl(n)?t.dt(0):t.dt(n))}else if("timestampValue"in e){var r=e.timestampValue;this.Et(t,20),"string"==typeof r&&(r=ch(r)),t.At("".concat(r.seconds||"")),t.dt(r.nanos||0)}else if("stringValue"in e)this.Rt(e.stringValue,t),this.Vt(t);else if("bytesValue"in e)this.Et(t,30),t.ft(hh(e.bytesValue)),this.Vt(t);else if("referenceValue"in e)this.gt(e.referenceValue,t);else if("geoPointValue"in e){var i=e.geoPointValue;this.Et(t,45),t.dt(i.latitude||0),t.dt(i.longitude||0)}else"mapValue"in e?Oh(e)?this.Et(t,Number.MAX_SAFE_INTEGER):(this.yt(e.mapValue,t),this.Vt(t)):"arrayValue"in e?(this.wt(e.arrayValue,t),this.Vt(t)):vl()}},{key:"Rt",value:function(e,t){this.Et(t,25),this.St(e,t)}},{key:"St",value:function(e,t){t.At(e)}},{key:"yt",value:function(e,t){var n=e.fields||{};this.Et(t,55);for(var r=0,i=Object.keys(n);r<i.length;r++){var a=i[r];this.Rt(a,t),this.It(n[a],t)}}},{key:"wt",value:function(e,t){var n=e.values||[];this.Et(t,50);var r,i=rl(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;this.It(a,t)}}catch(s){i.e(s)}finally{i.f()}}},{key:"gt",value:function(e,t){var n=this;this.Et(t,37),Fl.fromName(e).path.forEach(function(e){n.Et(t,60),n.St(e,t)})}},{key:"Et",value:function(e,t){e.dt(t)}},{key:"Vt",value:function(e){e.dt(2)}}]),e}();hp.bt=new hp;var fp=function(){function e(){E(this,e),this._n=new dp}return S(e,[{key:"addToCollectionParentIndex",value:function(e,t){return this._n.add(t),Kl.resolve()}},{key:"getCollectionParents",value:function(e,t){return Kl.resolve(this._n.getEntries(t))}},{key:"addFieldIndex",value:function(e,t){return Kl.resolve()}},{key:"deleteFieldIndex",value:function(e,t){return Kl.resolve()}},{key:"deleteAllFieldIndexes",value:function(e){return Kl.resolve()}},{key:"createTargetIndexes",value:function(e,t){return Kl.resolve()}},{key:"getDocumentsMatchingTarget",value:function(e,t){return Kl.resolve(null)}},{key:"getIndexType",value:function(e,t){return Kl.resolve(0)}},{key:"getFieldIndexes",value:function(e,t){return Kl.resolve([])}},{key:"getNextCollectionGroupToUpdate",value:function(e){return Kl.resolve(null)}},{key:"getMinOffset",value:function(e,t){return Kl.resolve(Vl.min())}},{key:"getMinOffsetFromCollectionGroup",value:function(e,t){return Kl.resolve(Vl.min())}},{key:"updateCollectionGroup",value:function(e,t,n){return Kl.resolve()}},{key:"updateIndexEntries",value:function(e,t){return Kl.resolve()}}]),e}(),dp=function(){function e(){E(this,e),this.index={}}return S(e,[{key:"add",value:function(e){var t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new rh(Ll.comparator),i=!r.has(n);return this.index[t]=r.add(n),i}},{key:"has",value:function(e){var t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}},{key:"getEntries",value:function(e){return(this.index[e]||new rh(Ll.comparator)).toArray()}}]),e}(),pp=function(){function e(t,n,r){E(this,e),this.cacheSizeCollectionThreshold=t,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=r}return S(e,null,[{key:"withCacheSize",value:function(t){return new e(t,e.DEFAULT_COLLECTION_PE
2RCENTILE,e.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}}]),e}();pp.DEFAULT_COLLECTION_PERCENTILE=10,pp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,pp.DEFAULT=new pp(41943040,pp.DEFAULT_COLLECTION_PERCENTILE,pp.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),pp.DISABLED=new pp(-1,0,0);var vp=function(){function e(t){E(this,e),this.On=t}return S(e,[{key:"next",value:function(){return this.On+=2,this.On}}],[{key:"Nn",value:function(){return new e(0)}},{key:"Ln",value:function(){return new e(-1)}}]),e}(),gp=function(){function e(){E(this,e),this.changes=new wf(function(e){return e.toString()},function(e,t){return e.isEqual(t)}),this.changesApplied=!1}return S(e,[{key:"addEntry",value:function(e){this.assertNotApplied(),this.changes.set(e.key,e)}},{key:"removeEntry",value:function(e,t){this.assertNotApplied(),this.changes.set(e,Dh.newInvalidDocument(e).setReadTime(t))}},{key:"getEntry",value:function(e,t){this.assertNotApplied();var n=this.changes.get(t);return void 0!==n?Kl.resolve(n):this.getFromCache(e,t)}},{key:"getEntries",value:function(e,t){return this.getAllFromCache(e,t)}},{key:"apply",value:function(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}},{key:"assertNotApplied",value:function(){}}]),e}(),yp=S(function e(t,n){E(this,e),this.overlayedDocument=t,this.mutatedFields=n}),mp=function(){function e(t,n,r,i){E(this,e),this.remoteDocumentCache=t,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=i}return S(e,[{key:"getDocument",value:function(e,t){var n=this,r=null;return this.documentOverlayCache.getOverlay(e,t).next(function(i){return r=i,n.remoteDocumentCache.getEntry(e,t)}).next(function(e){return null!==r&&ed(r.mutation,e,ah.empty(),Rl.now()),e})}},{key:"getDocuments",value:function(e,t){var n=this;return this.remoteDocumentCache.getEntries(e,t).next(function(t){return n.getLocalViewOfDocuments(e,t,Of()).next(function(){return t})})}},{key:"getLocalViewOfDocuments",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Of(),i=Tf();return this.populateOverlays(e,i,t).next(function(){return n.computeViews(e,t,i,r).next(function(e){var t=If();return e.forEach(function(e,n){t=t.insert(e,n.overlayedDocument)}),t})})}},{key:"getOverlayedDocuments",value:function(e,t){var n=this,r=Tf();return this.populateOverlays(e,r,t).next(function(){return n.computeViews(e,t,r,Of())})}},{key:"populateOverlays",value:function(e,t,n){var r=[];return n.forEach(function(e){t.has(e)||r.push(e)}),this.documentOverlayCache.getOverlays(e,r).next(function(e){e.forEach(function(e,n){t.set(e,n)})})}},{key:"computeViews",value:function(e,t,n,r){var i=_f(),a=Af(),s=Af();return t.forEach(function(e,t){var s=n.get(t.key);r.has(t.key)&&(void 0===s||s.mutation instanceof id)?i=i.insert(t.key,t):void 0!==s?(a.set(t.key,s.mutation.getFieldMask()),ed(s.mutation,t,s.mutation.getFieldMask(),Rl.now())):a.set(t.key,ah.empty())}),this.recalculateAndSaveOverlays(e,i).next(function(e){return e.forEach(function(e,t){return a.set(e,t)}),t.forEach(function(e,t){var n;return s.set(e,new yp(t,null!==(n=a.get(e))&&void 0!==n?n:null))}),s})}},{key:"recalculateAndSaveOverlays",value:function(e,t){var n=this,r=Af(),i=new eh(function(e,t){return e-t}),a=Of();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(function(e){var n,a=rl(e);try{var s=function(){var e=n.value;e.keys().forEach(function(n){var a=t.get(n);if(null!==a){var s=r.get(n)||ah.empty();s=e.applyToLocalView(a,s),r.set(n,s);var o=(i.get(e.batchId)||Of()).add(n);i=i.insert(e.batchId,o)}})};for(a.s();!(n=a.n()).done;)s()}catch(o){a.e(o)}finally{a.f()}}).next(function(){for(var s=[],o=i.getReverseIterator(),u=function(){var i=o.getNext(),u=i.key,c=i.value,l=xf();c.forEach(function(e){if(!a.has(e)){var n=$f(t.get(e),r.get(e));null!==n&&l.set(e,n),a=a.add(e)}}),s.push(n.documentOverlayCache.saveOverlays(e,u,l))};o.hasNext();)u();return Kl.waitFor(s)}).next(function(){return r})}},{key:"recalculateAndSaveOverlaysForDocumentKeys",value:function(e,t){var n=this;return this.remoteDocumentCache.getEntries(e,t).next(function(t){return n.recalculateAndSaveOverlays(e,t)})}},{key:"getDocumentsMatchingQuery",value:function(e,t,n,r){return function(e){return Fl.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):function(e){return null!==e.collectionGroup}(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,r):this.getDocumentsMatchingCollectionQuery(e,t,n,r)}},{key:"getNextDocuments",value:function(e,t,n,r){var i=this;return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next(function(a){var s=r-a.size>0?i.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-a.size):Kl.resolve(Tf()),o=-1,u=a;return s.next(function(t){return Kl.forEach(t,function(t,n){return o<n.largestBatchId&&(o=n.largestBatchId),a.get(t)?Kl.resolve():i.remoteDocumentCache.getEntry(e,t).next(function(e){u=u.insert(t,e)})}).next(function(){return i.populateOverlays(e,t,a)}).next(function(){return i.computeViews(e,u,t,Of())}).next(function(e){return{batchId:o,changes:Sf(e)}})})})}},{key:"getDocumentsMatchingDocumentQuery",value:function(e,t){return this.getDocument(e,new Fl(t)).next(function(e){var t=If();
2return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}},{key:"getDocumentsMatchingCollectionGroupQuery",value:function(e,t,n,r){var i=this,a=t.collectionGroup,s=If();return this.indexManager.getCollectionParents(e,a).next(function(o){return Kl.forEach(o,function(o){var u=function(e,t){return new uf(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,o.child(a));return i.getDocumentsMatchingCollectionQuery(e,u,n,r).next(function(e){e.forEach(function(e,t){s=s.insert(e,t)})})}).next(function(){return s})})}},{key:"getDocumentsMatchingCollectionQuery",value:function(e,t,n,r){var i,a=this;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(function(s){return i=s,a.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r)}).next(function(e){i.forEach(function(t,n){var r=n.getKey();null===e.get(r)&&(e=e.insert(r,Dh.newInvalidDocument(r)))});var n=If();return e.forEach(function(e,r){var a=i.get(e);void 0!==a&&ed(a.mutation,r,ah.empty(),Rl.now()),yf(t,r)&&(n=n.insert(e,r))}),n})}}]),e}(),kp=function(){function e(t){E(this,e),this.serializer=t,this.cr=new Map,this.lr=new Map}return S(e,[{key:"getBundleMetadata",value:function(e,t){return Kl.resolve(this.cr.get(t))}},{key:"saveBundleMetadata",value:function(e,t){return this.cr.set(t.id,function(e){return{id:e.id,version:e.version,createTime:Vd(e.createTime)}}(t)),Kl.resolve()}},{key:"getNamedQuery",value:function(e,t){return Kl.resolve(this.lr.get(t))}},{key:"saveNamedQuery",value:function(e,t){return this.lr.set(t.name,function(e){return{name:e.name,query:lp(e.bundledQuery),readTime:Vd(e.readTime)}}(t)),Kl.resolve()}}]),e}(),wp=function(){function e(){E(this,e),this.overlays=new eh(Fl.comparator),this.hr=new Map}return S(e,[{key:"getOverlay",value:function(e,t){return Kl.resolve(this.overlays.get(t))}},{key:"getOverlays",value:function(e,t){var n=this,r=Tf();return Kl.forEach(t,function(t){return n.getOverlay(e,t).next(function(e){null!==e&&r.set(t,e)})}).next(function(){return r})}},{key:"saveOverlays",value:function(e,t,n){var r=this;return n.forEach(function(n,i){r.ht(e,t,i)}),Kl.resolve()}},{key:"removeOverlaysForBatchId",value:function(e,t,n){var r=this,i=this.hr.get(n);return void 0!==i&&(i.forEach(function(e){return r.overlays=r.overlays.remove(e)}),this.hr.delete(n)),Kl.resolve()}},{key:"getOverlaysForCollection",value:function(e,t,n){for(var r=Tf(),i=t.length+1,a=new Fl(t.child("")),s=this.overlays.getIteratorFrom(a);s.hasNext();){var o=s.getNext().value,u=o.getKey();if(!t.isPrefixOf(u.path))break;u.path.length===i&&o.largestBatchId>n&&r.set(o.getKey(),o)}return Kl.resolve(r)}},{key:"getOverlaysForCollectionGroup",value:function(e,t,n,r){for(var i=new eh(function(e,t){return e-t}),a=this.overlays.getIterator();a.hasNext();){var s=a.getNext().value;if(s.getKey().getCollectionGroup()===t&&s.largestBatchId>n){var o=i.get(s.largestBatchId);null===o&&(o=Tf(),i=i.insert(s.largestBatchId,o)),o.set(s.getKey(),s)}}for(var u=Tf(),c=i.getIterator();c.hasNext()&&(c.getNext().value.forEach(function(e,t){return u.set(e,t)}),!(u.size()>=r)););return Kl.resolve(u)}},{key:"ht",value:function(e,t,n){var r=this.overlays.get(n.key);if(null!==r){var i=this.hr.get(r.largestBatchId).delete(n.key);this.hr.set(r.largestBatchId,i)}this.overlays=this.overlays.insert(n.key,new pd(t,n));var a=this.hr.get(t);void 0===a&&(a=Of(),this.hr.set(t,a)),this.hr.set(t,a.add(n.key))}}]),e}(),bp=function(){function e(){E(this,e),this.Pr=new rh(_p.Ir),this.Tr=new rh(_p.Er)}return S(e,[{key:"isEmpty",value:function(){return this.Pr.isEmpty()}},{key:"addReference",value:function(e,t){var n=new _p(e,t);this.Pr=this.Pr.add(n),this.Tr=this.Tr.add(n)}},{key:"dr",value:function(e,t){var n=this;e.forEach(function(e){return n.addReference(e,t)})}},{key:"removeReference",value:function(e,t){this.Ar(new _p(e,t))}},{key:"Rr",value:function(e,t){var n=this;e.forEach(function(e){return n.removeReference(e,t)})}},{key:"Vr",value:function(e){var t=this,n=new Fl(new Ll([])),r=new _p(n,e),i=new _p(n,e+1),a=[];return this.Tr.forEachInRange([r,i],function(e){t.Ar(e),a.push(e.key)}),a}},{key:"mr",value:function(){var e=this;this.Pr.forEach(function(t){return e.Ar(t)})}},{key:"Ar",value:function(e){this.Pr=this.Pr.delete(e),this.Tr=this.Tr.delete(e)}},{key:"gr",value:function(e){var t=new Fl(new Ll([])),n=new _p(t,e),r=new _p(t,e+1),i=Of();return this.Tr.forEachInRange([n,r],function(e){i=i.add(e.key)}),i}},{key:"containsKey",value:function(e){var t=new _p(e,0),n=this.Pr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}]),e}(),_p=function(){function e(t,n){E(this,e),this.key=t,this.pr=n}return S(e,null,[{key:"Ir",value:function(e,t){return Fl.comparator(e.key,t.key)||Pl(e.pr,t.pr)}},{key:"Er",value:function(e,t){return Pl(e.pr,t.pr)||Fl.comparator(e.key,t.key)}}]),e}(),Ep=function(){function e(t,n){E(this,e),this.indexManager=t,this.referenceDelegate=n,this.mutation
2Queue=[],this.yr=1,this.wr=new rh(_p.Ir)}return S(e,[{key:"checkEmpty",value:function(e){return Kl.resolve(0===this.mutationQueue.length)}},{key:"addMutationBatch",value:function(e,t,n,r){var i=this.yr;this.yr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];var a=new fd(i,t,n,r);this.mutationQueue.push(a);var s,o=rl(r);try{for(o.s();!(s=o.n()).done;){var u=s.value;this.wr=this.wr.add(new _p(u.key,i)),this.indexManager.addToCollectionParentIndex(e,u.key.path.popLast())}}catch(c){o.e(c)}finally{o.f()}return Kl.resolve(a)}},{key:"lookupMutationBatch",value:function(e,t){return Kl.resolve(this.Sr(t))}},{key:"getNextMutationBatchAfterBatchId",value:function(e,t){var n=t+1,r=this.br(n),i=r<0?0:r;return Kl.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}},{key:"getHighestUnacknowledgedBatchId",value:function(){return Kl.resolve(0===this.mutationQueue.length?-1:this.yr-1)}},{key:"getAllMutationBatches",value:function(e){return Kl.resolve(this.mutationQueue.slice())}},{key:"getAllMutationBatchesAffectingDocumentKey",value:function(e,t){var n=this,r=new _p(t,0),i=new _p(t,Number.POSITIVE_INFINITY),a=[];return this.wr.forEachInRange([r,i],function(e){var t=n.Sr(e.pr);a.push(t)}),Kl.resolve(a)}},{key:"getAllMutationBatchesAffectingDocumentKeys",value:function(e,t){var n=this,r=new rh(Pl);return t.forEach(function(e){var t=new _p(e,0),i=new _p(e,Number.POSITIVE_INFINITY);n.wr.forEachInRange([t,i],function(e){r=r.add(e.pr)})}),Kl.resolve(this.Dr(r))}},{key:"getAllMutationBatchesAffectingQuery",value:function(e,t){var n=t.path,r=n.length+1,i=n;Fl.isDocumentKey(i)||(i=i.child(""));var a=new _p(new Fl(i),0),s=new rh(Pl);return this.wr.forEachWhile(function(e){var t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(s=s.add(e.pr)),!0)},a),Kl.resolve(this.Dr(s))}},{key:"Dr",value:function(e){var t=this,n=[];return e.forEach(function(e){var r=t.Sr(e);null!==r&&n.push(r)}),n}},{key:"removeMutationBatch",value:function(e,t){var n=this;gl(0===this.Cr(t.batchId,"removed")),this.mutationQueue.shift();var r=this.wr;return Kl.forEach(t.mutations,function(i){var a=new _p(i.key,t.batchId);return r=r.delete(a),n.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(function(){n.wr=r})}},{key:"Mn",value:function(e){}},{key:"containsKey",value:function(e,t){var n=new _p(t,0),r=this.wr.firstAfterOrEqual(n);return Kl.resolve(t.isEqual(r&&r.key))}},{key:"performConsistencyCheck",value:function(e){return this.mutationQueue.length,Kl.resolve()}},{key:"Cr",value:function(e,t){return this.br(e)}},{key:"br",value:function(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}},{key:"Sr",value:function(e){var t=this.br(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}]),e}(),Ip=function(){function e(t){E(this,e),this.vr=t,this.docs=new eh(Fl.comparator),this.size=0}return S(e,[{key:"setIndexManager",value:function(e){this.indexManager=e}},{key:"addEntry",value:function(e,t){var n=t.key,r=this.docs.get(n),i=r?r.size:0,a=this.vr(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:a}),this.size+=a-i,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}},{key:"removeEntry",value:function(e){var t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}},{key:"getEntry",value:function(e,t){var n=this.docs.get(t);return Kl.resolve(n?n.document.mutableCopy():Dh.newInvalidDocument(t))}},{key:"getEntries",value:function(e,t){var n=this,r=_f();return t.forEach(function(e){var t=n.docs.get(e);r=r.insert(e,t?t.document.mutableCopy():Dh.newInvalidDocument(e))}),Kl.resolve(r)}},{key:"getDocumentsMatchingQuery",value:function(e,t,n,r){for(var i=_f(),a=t.path,s=new Fl(a.child("")),o=this.docs.getIteratorFrom(s);o.hasNext();){var u=o.getNext(),c=u.key,l=u.value.document;if(!a.isPrefixOf(c.path))break;c.path.length>a.length+1||Bl(jl(l),n)<=0||(r.has(l.key)||yf(t,l))&&(i=i.insert(l.key,l.mutableCopy()))}return Kl.resolve(i)}},{key:"getAllFromCollectionGroup",value:function(e,t,n,r){vl()}},{key:"Fr",value:function(e,t){return Kl.forEach(this.docs,function(e){return t(e)})}},{key:"newChangeBuffer",value:function(e){return new Sp(this)}},{key:"getSize",value:function(e){return Kl.resolve(this.size)}}]),e}(),Sp=function(e){g(n,e);var t=al(n);function n(e){var r;return E(this,n),(r=t.call(this)).ar=e,r}return S(n,[{key:"applyChanges",value:function(e){var t=this,n=[];
2return this.changes.forEach(function(r,i){i.isValidDocument()?n.push(t.ar.addEntry(e,i)):t.ar.removeEntry(r)}),Kl.waitFor(n)}},{key:"getFromCache",value:function(e,t){return this.ar.getEntry(e,t)}},{key:"getAllFromCache",value:function(e,t){return this.ar.getEntries(e,t)}}]),n}(gp),Tp=function(){function e(t){E(this,e),this.persistence=t,this.Mr=new wf(function(e){return af(e)},sf),this.lastRemoteSnapshotVersion=Nl.min(),this.highestTargetId=0,this.Or=0,this.Nr=new bp,this.targetCount=0,this.Lr=vp.Nn()}return S(e,[{key:"forEachTarget",value:function(e,t){return this.Mr.forEach(function(e,n){return t(n)}),Kl.resolve()}},{key:"getLastRemoteSnapshotVersion",value:function(e){return Kl.resolve(this.lastRemoteSnapshotVersion)}},{key:"getHighestSequenceNumber",value:function(e){return Kl.resolve(this.Or)}},{key:"allocateTargetId",value:function(e){return this.highestTargetId=this.Lr.next(),Kl.resolve(this.highestTargetId)}},{key:"setTargetsMetadata",value:function(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.Or&&(this.Or=t),Kl.resolve()}},{key:"qn",value:function(e){this.Mr.set(e.target,e);var t=e.targetId;t>this.highestTargetId&&(this.Lr=new vp(t),this.highestTargetId=t),e.sequenceNumber>this.Or&&(this.Or=e.sequenceNumber)}},{key:"addTargetData",value:function(e,t){return this.qn(t),this.targetCount+=1,Kl.resolve()}},{key:"updateTargetData",value:function(e,t){return this.qn(t),Kl.resolve()}},{key:"removeTargetData",value:function(e,t){return this.Mr.delete(t.target),this.Nr.Vr(t.targetId),this.targetCount-=1,Kl.resolve()}},{key:"removeTargets",value:function(e,t,n){var r=this,i=0,a=[];return this.Mr.forEach(function(s,o){o.sequenceNumber<=t&&null===n.get(o.targetId)&&(r.Mr.delete(s),a.push(r.removeMatchingKeysForTargetId(e,o.targetId)),i++)}),Kl.waitFor(a).next(function(){return i})}},{key:"getTargetCount",value:function(e){return Kl.resolve(this.targetCount)}},{key:"getTargetData",value:function(e,t){var n=this.Mr.get(t)||null;return Kl.resolve(n)}},{key:"addMatchingKeys",value:function(e,t,n){return this.Nr.dr(t,n),Kl.resolve()}},{key:"removeMatchingKeys",value:function(e,t,n){this.Nr.Rr(t,n);var r=this.persistence.referenceDelegate,i=[];return r&&t.forEach(function(t){i.push(r.markPotentiallyOrphaned(e,t))}),Kl.waitFor(i)}},{key:"removeMatchingKeysForTargetId",value:function(e,t){return this.Nr.Vr(t),Kl.resolve()}},{key:"getMatchingKeysForTargetId",value:function(e,t){var n=this.Nr.gr(t);return Kl.resolve(n)}},{key:"containsKey",value:function(e,t){return Kl.resolve(this.Nr.containsKey(t))}}]),e}(),xp=function(){function e(t,n){var r=this;E(this,e),this.Br={},this.overlays={},this.kr=new Wl(0),this.qr=!1,this.qr=!0,this.referenceDelegate=t(this),this.Qr=new Tp(this),this.indexManager=new fp,this.remoteDocumentCache=function(e){return new Ip(e)}(function(e){return r.referenceDelegate.Kr(e)}),this.serializer=new cp(n),this.$r=new kp(this.serializer)}return S(e,[{key:"start",value:function(){return Promise.resolve()}},{key:"shutdown",value:function(){return this.qr=!1,Promise.resolve()}},{key:"started",get:function(){return this.qr}},{key:"setDatabaseDeletedListener",value:function(){}},{key:"setNetworkEnabled",value:function(){}},{key:"getIndexManager",value:function(e){return this.indexManager}},{key:"getDocumentOverlayCache",value:function(e){var t=this.overlays[e.toKey()];return t||(t=new wp,this.overlays[e.toKey()]=t),t}},{key:"getMutationQueue",value:function(e,t){var n=this.Br[e.toKey()];return n||(n=new Ep(t,this.referenceDelegate),this.Br[e.toKey()]=n),n}},{key:"getTargetCache",value:function(){return this.Qr}},{key:"getRemoteDocumentCache",value:function(){return this.remoteDocumentCache}},{key:"getBundleCache",value:function(){return this.$r}},{key:"runTransaction",value:function(e,t,n){var r=this;hl("MemoryPersistence","Starting transaction:",e);var i=new Ap(this.kr.next());return this.referenceDelegate.Ur(),n(i).next(function(e){return r.referenceDelegate.Wr(i).next(function(){return e})}).toPromise().then(function(e){return i.raiseOnCommittedEvent(),e})}},{key:"Gr",value:function(e,t){return Kl.or(Object.values(this.Br).map(function(n){return function(){return n.containsKey(e,t)}}))}}]),e}(),Ap=function(e){g(n,e);var t=al(n);function n(e){var r;return E(this,n),(r=t.call(this)).currentSequenceNumber=e,r}return S(n)}(ql),Cp=function(){function e(t){E(this,e),this.persistence=t,this.zr=new bp,this.jr=null}return S(e,[{key:"Jr",get:function(){if(this.jr)return this.jr;throw vl()}},{key:"addReference",value:function(e,t,n){return this.zr.addReference(n,t),this.Jr.delete(n.toString()),Kl.resolve()}},{key:"removeReference",value:function(e,t,n){return this.zr.removeReference(n,t),this.Jr.add(n.toString()),Kl.resolve()}},{key:"markPotentiallyOrphaned",value:function(e,t){return this.Jr.add(t.toString()),Kl.resolve()}},{key:"removeTarget",value:function(e,t){var n=this;
2this.zr.Vr(t.targetId).forEach(function(e){return n.Jr.add(e.toString())});var r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next(function(e){e.forEach(function(e){return n.Jr.add(e.toString())})}).next(function(){return r.removeTargetData(e,t)})}},{key:"Ur",value:function(){this.jr=new Set}},{key:"Wr",value:function(e){var t=this,n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Kl.forEach(this.Jr,function(r){var i=Fl.fromPath(r);return t.Yr(e,i).next(function(e){e||n.removeEntry(i,Nl.min())})}).next(function(){return t.jr=null,n.apply(e)})}},{key:"updateLimboDocument",value:function(e,t){var n=this;return this.Yr(e,t).next(function(e){e?n.Jr.delete(t.toString()):n.Jr.add(t.toString())})}},{key:"Kr",value:function(e){return 0}},{key:"Yr",value:function(e,t){var n=this;return Kl.or([function(){return Kl.resolve(n.zr.containsKey(t))},function(){return n.persistence.getTargetCache().containsKey(e,t)},function(){return n.persistence.Gr(e,t)}])}}],[{key:"Hr",value:function(t){return new e(t)}}]),e}(),Pp=function(){function e(t,n,r,i){E(this,e),this.targetId=t,this.fromCache=n,this.qi=r,this.Qi=i}return S(e,null,[{key:"Ki",value:function(t,n){var r,i=Of(),a=Of(),s=rl(n.docChanges);try{for(s.s();!(r=s.n()).done;){var o=r.value;switch(o.type){case 0:i=i.add(o.doc.key);break;case 1:a=a.add(o.doc.key)}}}catch(u){s.e(u)}finally{s.f()}return new e(t,n.fromCache,i,a)}}]),e}(),Op=function(){function e(){E(this,e),this._documentReadCount=0}return S(e,[{key:"documentReadCount",get:function(){return this._documentReadCount}},{key:"incrementDocumentReadCount",value:function(e){this._documentReadCount+=e}}]),e}(),Rp=function(){function e(){var t,n,r;E(this,e),this.$i=!1,this.Ui=!1,this.Wi=100,this.Gi=W()?8:(t=G(),n=t.match(/Android ([\d.]+)/i),r=n?n[1].split(".").slice(0,2).join("."):"-1",Number(r)>0?6:4)}return S(e,[{key:"initialize",value:function(e,t){this.zi=e,this.indexManager=t,this.$i=!0}},{key:"getDocumentsMatchingQuery",value:function(e,t,n,r){var i=this,a={result:null};return this.ji(e,t).next(function(e){a.result=e}).next(function(){if(!a.result)return i.Hi(e,t,r,n).next(function(e){a.result=e})}).next(function(){if(!a.result){var n=new Op;return i.Ji(e,t,n).next(function(r){if(a.result=r,i.Ui)return i.Yi(e,t,n,r.size)})}}).next(function(){return a.result})}},{key:"Yi",value:function(e,t,n,r){return n.documentReadCount<this.Wi?(ll()<=ve.DEBUG&&hl("QueryEngine","SDK will not create cache indexes for query:",gf(t),"since it only creates cache indexes for collection contains","more than or equal to",this.Wi,"documents"),Kl.resolve()):(ll()<=ve.DEBUG&&hl("QueryEngine","Query:",gf(t),"scans",n.documentReadCount,"local documents and returns",r,"documents as results."),n.documentReadCount>this.Gi*r?(ll()<=ve.DEBUG&&hl("QueryEngine","The SDK decides to create cache indexes for query:",gf(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,ff(t))):Kl.resolve())}},{key:"ji",value:function(e,t){var n=this;if(lf(t))return Kl.resolve(null);var r=ff(t);return this.indexManager.getIndexType(e,r).next(function(i){return 0===i?null:(null!==t.limit&&1===i&&(t=df(t,null,"F"),r=ff(t)),n.indexManager.getDocumentsMatchingTarget(e,r).next(function(i){var a=Of.apply(void 0,T(i));return n.zi.getDocuments(e,a).next(function(i){return n.indexManager.getMinOffset(e,r).next(function(r){var s=n.Zi(t,i);return n.Xi(t,s,a,r.readTime)?n.ji(e,df(t,null,"F")):n.es(e,s,t,r)})})}))})}},{key:"Hi",value:function(e,t,n,r){var i=this;return lf(t)||r.isEqual(Nl.min())?Kl.resolve(null):this.zi.getDocuments(e,n).next(function(a){var s=i.Zi(t,a);return i.Xi(t,s,n,r)?Kl.resolve(null):(ll()<=ve.DEBUG&&hl("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),gf(t)),i.es(e,s,t,function(e,t){var n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1,i=Nl.fromTimestamp(1e9===r?new Rl(n+1,0):new Rl(n,r));return new Vl(i,Fl.empty(),t)}(r,-1)).next(function(e){return e}))})}},{key:"Zi",value:function(e,t){var n=new rh(mf(e));return t.forEach(function(t,r){yf(e,r)&&(n=n.add(r))}),n}},{key:"Xi",value:function(e,t,n,r){if(null===e.limit)return!1;if(n.size!==t.size)return!0;var i="F"===e.limitType?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}},{key:"Ji",value:function(e,t,n){return ll()<=ve.DEBUG&&hl("QueryEngine","Using full collection scan to execute query:",gf(t)),this.zi.getDocumentsMatchingQuery(e,t,Vl.min(),n)}},{key:"es",value:function(e,t,n,r){return this.zi.getDocumentsMatchingQuery(e,n,r).next(function(e){return t.forEach(function(t){e=e.insert(t.key,t)}),e})}}]),e}(),Np=function(){function e(t,n,r,i){E(this,e),this.persistence=t,this.ts=n,this.serializer
2=i,this.ns=new eh(Pl),this.rs=new wf(function(e){return af(e)},sf),this.ss=new Map,this.os=t.getRemoteDocumentCache(),this.Qr=t.getTargetCache(),this.$r=t.getBundleCache(),this._s(r)}return S(e,[{key:"_s",value:function(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new mp(this.os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.os.setIndexManager(this.indexManager),this.ts.initialize(this.localDocuments,this.indexManager)}},{key:"collectGarbage",value:function(e){var t=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(n){return e.collect(n,t.ns)})}}]),e}();function Dp(e,t){return Lp.apply(this,arguments)}function Lp(){return(Lp=_(P.mark(function e(t,n){var r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=yl(t),e.next=3,r.persistence.runTransaction("Handle user change","readonly",function(e){var t;return r.mutationQueue.getAllMutationBatches(e).next(function(i){return t=i,r._s(n),r.mutationQueue.getAllMutationBatches(e)}).next(function(n){var i,a=[],s=[],o=Of(),u=rl(t);try{for(u.s();!(i=u.n()).done;){var c=i.value;a.push(c.batchId);var l,h=rl(c.mutations);try{for(h.s();!(l=h.n()).done;){var f=l.value;o=o.add(f.key)}}catch(k){h.e(k)}finally{h.f()}}}catch(k){u.e(k)}finally{u.f()}var d,p=rl(n);try{for(p.s();!(d=p.n()).done;){var v=d.value;s.push(v.batchId);var g,y=rl(v.mutations);try{for(y.s();!(g=y.n()).done;){var m=g.value;o=o.add(m.key)}}catch(k){y.e(k)}finally{y.f()}}}catch(k){p.e(k)}finally{p.f()}return r.localDocuments.getDocuments(e,o).next(function(e){return{us:e,removedBatchIds:a,addedBatchIds:s}})})});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Mp(e,t){var n=yl(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",function(e){var r=t.batch.keys(),i=n.os.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){var i=n.batch,a=i.keys(),s=Kl.resolve();return a.forEach(function(e){s=s.next(function(){return r.getEntry(t,e)}).next(function(t){var a=n.docVersions.get(e);gl(null!==a),t.version.compareTo(a)<0&&(i.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))})}),s.next(function(){return e.mutationQueue.removeMutationBatch(t,i)})}(n,e,t,i).next(function(){return i.apply(e)}
2).next(function(){return n.mutationQueue.performConsistencyCheck(e)}).next(function(){return n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId)}).next(function(){return n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){for(var t=Of(),n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t))}).next(function(){return n.localDocuments.getDocuments(e,r)})})}function Up(e){var t=yl(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",function(e){return t.Qr.getLastRemoteSnapshotVersion(e)})}function Fp(e,t){var n=yl(e),r=t.snapshotVersion,i=n.ns;return n.persistence.runTransaction("Apply remote event","readwrite-primary",function(e){var a=n.os.newChangeBuffer({trackRemovals:!0});i=n.ns;var s=[];t.targetChanges.forEach(function(a,o){var u=i.get(o);if(u){s.push(n.Qr.removeMatchingKeys(e,a.removedDocuments,o).next(function(){return n.Qr.addMatchingKeys(e,a.addedDocuments,o)}));var c=u.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(o)?c=c.withResumeToken(oh.EMPTY_BYTE_STRING,Nl.min()).withLastLimboFreeSnapshotVersion(Nl.min()):a.resumeToken.approximateByteSize()>0&&(c=c.withResumeToken(a.resumeToken,r)),i=i.insert(o,c),function(e,t,n){return 0===e.resumeToken.approximateByteSize()||(t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(u,c,a)&&s.push(n.Qr.updateTargetData(e,c))}});var o=_f(),u=Of();if(t.documentUpdates.forEach(function(r){t.resolvedLimboDocuments.has(r)&&s.push(n.persistence.referenceDelegate.updateLimboDocument(e,r))}),s.push(function(e,t,n){var r=Of(),i=Of();return n.forEach(function(e){return r=r.add(e)}),t.getEntries(e,r).next(function(e){var r=_f();return n.forEach(function(n,a){var s=e.get(n);a.isFoundDocument()!==s.isFoundDocument()&&(i=i.add(n)),a.isNoDocument()&&a.version.isEqual(Nl.min())?(t.removeEntry(n,a.readTime),r=r.insert(n,a)):!s.isValidDocument()||a.version.compareTo(s.version)>0||0===a.version.compareTo(s.version)&&s.hasPendingWrites?(t.addEntry(a),r=r.insert(n,a)):hl("LocalStore","Ignoring outdated watch update for ",n,". Current version:",s.version," Watch version:",a.version)}),{cs:r,ls:i}})}(e,a,t.documentUpdates).next(function(e){o=e.cs,u=e.ls})),!r.isEqual(Nl.min())){var c=n.Qr.getLastRemoteSnapshotVersion(e).next(function(t){return n.Qr.setTargetsMetadata(e,e.currentSequenceNumber,r)});s.push(c)}return Kl.waitFor(s).next(function(){return a.apply(e)}).next(function(){return n.localDocuments.getLocalViewOfDocuments(e,o,u)}).next(function(){return o})}).then(function(e){return n.ns=i,e})}function jp(e,t){var n=yl(e);return n.persistence.runTransaction("Get next mutation batch","readonly",function(e){return void 0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t)})}function Vp(e,t){var n=yl(e);return n.persistence.runTransaction("Allocate target","readwrite",function(e){var r;return n.Qr.getTargetData(e,t).next(function(i){return i?(r=i,Kl.resolve(r)):n.Qr.allocateTargetId(e).next(function(i){return r=new up(t,i,"TargetPurposeListen",e.currentSequenceNumber),n.Qr.addTargetData(e,r).next(function(){return r})})})}).then(function(e){var r=n.ns.get(e.targetId);return(null===r||e.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.ns=n.ns.insert(e.targetId,e),n.rs.set(t,e.targetId)),e})}function Bp(e,t,n){return qp.apply(this,arguments)}function qp(){return(qp=_(P.mark(function e(t,n,r){var i,a,s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=yl(t),a=i.ns.get(n),s=r?"readwrite":"readwrite-primary",e.prev=1,e.t0=r,e.t0){e.next=6;break}return e.next=6,i.persistence.runTransaction("Release target",s,function(e){return i.persistence.referenceDelegate.removeTarget(e,a)});case 6:e.next=13;break;case 8:if(e.prev=8,e.t1=e.catch(1),Gl(e.t1)){e.next=12;break}throw e.t1;case 12:hl("LocalStore","Failed to update sequence numbers for target ".concat(n,": ").concat(e.t1));case 13:i.ns=i.ns.remove(n),i.rs.delete(a.target);case 14:case"end":return e.stop()}},e,null,[[1,8]])}))).apply(this,arguments)}function zp(e,t,n){var r=yl(e),i=Nl.min(),a=Of();
2return r.persistence.runTransaction("Execute query","readwrite",function(e){return function(e,t,n){var r=yl(e),i=r.rs.get(n);return void 0!==i?Kl.resolve(r.ns.get(i)):r.Qr.getTargetData(t,n)}(r,e,ff(t)).next(function(t){if(t)return i=t.lastLimboFreeSnapshotVersion,r.Qr.getMatchingKeysForTargetId(e,t.targetId).next(function(e){a=e})}).next(function(){return r.ts.getDocumentsMatchingQuery(e,t,n?i:Nl.min(),n?a:Of())}).next(function(e){return function(e,t,n){var r=e.ss.get(t)||Nl.min();n.forEach(function(e,t){t.readTime.compareTo(r)>0&&(r=t.readTime)}),e.ss.set(t,r)}(r,function(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}(t),e),{documents:e,hs:a}})})}var Hp=function(){function e(){E(this,e),this.activeTargetIds=Rf}return S(e,[{key:"As",value:function(e){this.activeTargetIds=this.activeTargetIds.add(e)}},{key:"Rs",value:function(e){this.activeTargetIds=this.activeTargetIds.delete(e)}},{key:"ds",value:function(){var e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}]),e}(),Kp=function(){function e(){E(this,e),this.no=new Hp,this.ro={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}return S(e,[{key:"addPendingMutation",value:function(e){}},{key:"updateMutationState",value:function(e,t,n){}},{key:"addLocalQueryTarget",value:function(e){return this.no.As(e),this.ro[e]||"not-current"}},{key:"updateQueryState",value:function(e,t,n){this.ro[e]=t}},{key:"removeLocalQueryTarget",value:function(e){this.no.Rs(e)}},{key:"isLocalQueryTarget",value:function(e){return this.no.activeTargetIds.has(e)}},{key:"clearQueryState",value:function(e){delete this.ro[e]}},{key:"getAllActiveQueryTargets",value:function(){return this.no.activeTargetIds}},{key:"isActiveQueryTarget",value:function(e){return this.no.activeTargetIds.has(e)}},{key:"start",value:function(){return this.no=new Hp,Promise.resolve()}},{key:"handleUserChange",value:function(e,t,n){}},{key:"setOnlineState",value:function(e){}},{key:"shutdown",value:function(){}},{key:"writeSequenceNumber",value:function(e){}},{key:"notifyBundleLoaded",value:function(e){}}]),e}(),Gp=function(){function e(){E(this,e)}return S(e,[{key:"io",value:function(e){}},{key:"shutdown",value:function(){}}]),e}(),Wp=function(){function e(){var t=this;E(this,e),this.so=function(){return t.oo()},this._o=function(){return t.ao()},this.uo=[],this.co()}return S(e,[{key:"io",value:function(e){this.uo.push(e)}},{key:"shutdown",value:function(){window.removeEventListener("online",this.so),window.removeEventListener("offline",this._o)}},{key:"co",value:function(){window.addEventListener("online",this.so),window.addEventListener("offline",this._o)}},{key:"oo",value:function(){hl("ConnectivityMonitor","Network connectivity changed: AVAILABLE");var e,t=rl(this.uo);try{for(t.s();!(e=t.n()).done;){(0,e.value)(0)}}catch(n){t.e(n)}finally{t.f()}}},{key:"ao",value:function(){hl("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");var e,t=rl(this.uo);try{for(t.s();!(e=t.n()).done;){(0,e.value)(1)}}catch(n){t.e(n)}finally{t.f()}}}],[{key:"D",value:function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}]),e}(),Qp=null;function Yp(){return null===Qp?Qp=268435456+Math.round(2147483648*Math.random()):Qp++,"0x"+Qp.toString(16)}var Xp={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"},Jp=function(){function e(t){E(this,e),this.lo=t.lo,this.ho=t.ho}return S(e,[{key:"Po",value:function(e){this.Io=e}},{key:"To",value:function(e){this.Eo=e}},{key:"Ao",value:function(e){this.Ro=e}},{key:"onMessage",value:function(e){this.Vo=e}},{key:"close",value:function(){this.ho()}},{key:"send",value:function(e){this.lo(e)}},{key:"mo",value:function(){this.Io()}},{key:"fo",value:function(){this.Eo()}},{key:"po",value:function(e){this.Ro(e)}},{key:"yo",value:function(e){this.Vo(e)}}]),e}(),$p="WebChannelConnection",Zp=function(e){g(n,e);var t=al(n);function n(e){var r;return E(this,n),(r=t.call(this,e)).forceLongPolling=e.forceLongPolling,r.autoDetectLongPolling=e.autoDetectLongPolling,r.useFetchStreams=e.useFetchStreams,r.longPollingOptions=e.longPollingOptions,r}return S(n,[{key:"Mo",value:function(e,t,n,r){var i=Yp();return new Promise(function(a,s){var o=new Wc;o.setWithCredentials(!0),o.listenOnce(Xc.COMPLETE,function(){try{
2switch(o.getLastErrorCode()){case Jc.NO_ERROR:var t=o.getResponseJson();hl($p,"XHR for RPC '".concat(e,"' ").concat(i," received:"),JSON.stringify(t)),a(t);break;case Jc.TIMEOUT:hl($p,"RPC '".concat(e,"' ").concat(i," timed out")),s(new kl(ml.DEADLINE_EXCEEDED,"Request time out"));break;case Jc.HTTP_ERROR:var n=o.getStatus();if(hl($p,"RPC '".concat(e,"' ").concat(i," failed with status:"),n,"response text:",o.getResponseText()),n>0){var r=o.getResponseJson();Array.isArray(r)&&(r=r[0]);var u=null==r?void 0:r.error;if(u&&u.status&&u.message){var c=function(e){var t=e.toLowerCase().replace(/_/g,"-");return Object.values(ml).indexOf(t)>=0?t:ml.UNKNOWN}(u.status);s(new kl(c,u.message))}else s(new kl(ml.UNKNOWN,"Server responded with status "+o.getStatus()))}else s(new kl(ml.UNAVAILABLE,"Connection failed."));break;default:vl()}}finally{hl($p,"RPC '".concat(e,"' ").concat(i," completed."))}});var u=JSON.stringify(r);hl($p,"RPC '".concat(e,"' ").concat(i," sending request:"),r),o.send(t,"POST",u,n,15)})}},{key:"Oo",value:function(e,t,n){var r=Yp(),i=[this.wo,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=tl(),s=el(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/".concat(this.databaseId.projectId,"/databases/").concat(this.databaseId.database)},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},u=this.longPollingOptions.timeoutSeconds;void 0!==u&&(o.longPollingTimeout=Math.round(1e3*u)),this.useFetchStreams&&(o.xmlHttpFactory=new Qc({})),this.Fo(o.initMessageHeaders,t,n),o.encodeInitMessageHeaders=!0;var c=i.join("");hl($p,"Creating RPC '".concat(e,"' stream ").concat(r,": ").concat(c),o);var l=a.createWebChannel(c,o),h=!1,f=!1,d=new Jp({lo:function(t){f?hl($p,"Not sending because RPC '".concat(e,"' stream ").concat(r," is closed:"),t):(h||(hl($p,"Opening RPC '".concat(e,"' stream ").concat(r," transport.")),l.open(),h=!0),hl($p,"RPC '".concat(e,"' stream ").concat(r," sending:"),t),l.send(t))},ho:function(){return l.close()}}),p=function(e,t,n){e.listen(t,function(e){try{n(e)}catch(e){setTimeout(function(){throw e},0)}})};return p(l,Yc.EventType.OPEN,function(){f||(hl($p,"RPC '".concat(e,"' stream ").concat(r," transport opened.")),d.mo())}),p(l,Yc.EventType.CLOSE,function(){f||(f=!0,hl($p,"RPC '".concat(e,"' stream ").concat(r," transport closed")),d.po())}),p(l,Yc.EventType.ERROR,function(t){f||(f=!0,dl($p,"RPC '".concat(e,"' stream ").concat(r," transport errored:"),t),d.po(new kl(ml.UNAVAILABLE,"The operation could not be completed")))}),p(l,Yc.EventType.MESSAGE,function(t){var n;if(!f){var i=t.data[0];gl(!!i);var a=i,s=a.error||(null===(n=a[0])||void 0===n?void 0:n.error);if(s){hl($p,"RPC '".concat(e,"' stream ").concat(r," received error:"),s);var o=s.status,u=function(e){var t=ud[e];if(void 0!==t)return yd(t)}(o),c=s.message;void 0===u&&(u=ml.INTERNAL,c="Unknown error status: "+o+" with message "+s.message),f=!0,d.po(new kl(u,c)),l.close()}else hl($p,"RPC '".concat(e,"' stream ").concat(r," received:"),i),d.yo(i)}}),p(s,Zc.STAT_EVENT,function(t){t.stat===$c.PROXY?hl($p,"RPC '".concat(e,"' stream ").concat(r," detected buffering proxy")):t.stat===$c.NOPROXY&&hl($p,"RPC '".concat(e,"' stream ").concat(r," detected no buffering proxy"))}),setTimeout(function(){d.fo()},0),d}}]),n}(function(){function e(t){E(this,e),this.databaseInfo=t,this.databaseId=t.databaseId;var n=t.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.wo=n+"://"+t.host,this.So="projects/".concat(r,"/databases/").concat(i),this.bo="(default)"===this.databaseId.database?"project_id=".concat(r):"project_id=".concat(r,"&database_id=").concat(i)}return S(e,[{key:"Do",get:function(){return!1}},{key:"Co",value:function(e,t,n,r,i){var a=Yp(),s=this.vo(e,t.toUriEncodedString());hl("RestConnection","Sending RPC '".concat(e,"' ").concat(a,":"),s,n);var o={"google-cloud-resource-prefix":this.So,"x-goog-request-params":this.bo};return this.Fo(o,r,i),this.Mo(e,s,o,n).then(function(t){return hl("RestConnection","Received RPC '".concat(e,"' ").concat(a,": "),t),t},function(t){throw dl("RestConnection","RPC '".concat(e,"' ").concat(a," failed with error: "),t,"url: ",s,"request:",n),t})}},{key:"xo",value:function(e,t,n,r,i,a){return this.Co(e,t,n,r,i)}},{key:"Fo",value:function(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+ul,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEac
2h(function(t,n){return e[n]=t}),n&&n.headers.forEach(function(t,n){return e[n]=t})}},{key:"vo",value:function(e,t){var n=Xp[e];return"".concat(this.wo,"/v1/").concat(t,":").concat(n)}},{key:"terminate",value:function(){}}]),e}());function ev(){return"undefined"!=typeof document?document:null}function tv(e){return new Ld(e,!0)}var nv=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.5,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:6e4;E(this,e),this.oi=t,this.timerId=n,this.No=r,this.Lo=i,this.Bo=a,this.ko=0,this.qo=null,this.Qo=Date.now(),this.reset()}return S(e,[{key:"reset",value:function(){this.ko=0}},{key:"Ko",value:function(){this.ko=this.Bo}},{key:"$o",value:function(e){var t=this;this.cancel();var n=Math.floor(this.ko+this.Uo()),r=Math.max(0,Date.now()-this.Qo),i=Math.max(0,n-r);i>0&&hl("ExponentialBackoff","Backing off for ".concat(i," ms (base delay: ").concat(this.ko," ms, delay with jitter: ").concat(n," ms, last attempt: ").concat(r," ms ago)")),this.qo=this.oi.enqueueAfterDelay(this.timerId,i,function(){return t.Qo=Date.now(),e()}),this.ko*=this.Lo,this.ko<this.No&&(this.ko=this.No),this.ko>this.Bo&&(this.ko=this.Bo)}},{key:"Wo",value:function(){null!==this.qo&&(this.qo.skipDelay(),this.qo=null)}},{key:"cancel",value:function(){null!==this.qo&&(this.qo.cancel(),this.qo=null)}},{key:"Uo",value:function(){return(Math.random()-.5)*this.ko}}]),e}(),rv=function(){function e(t,n,r,i,a,s,o,u){E(this,e),this.oi=t,this.Go=r,this.zo=i,this.connection=a,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=o,this.listener=u,this.state=0,this.jo=0,this.Ho=null,this.Jo=null,this.stream=null,this.Yo=new nv(t,n)}var t,n,r;return S(e,[{key:"Zo",value:function(){return 1===this.state||5===this.state||this.Xo()}},{key:"Xo",value:function(){return 2===this.state||3===this.state}},{key:"start",value:function(){4!==this.state?this.auth():this.e_()}},{key:"stop",value:(r=_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.Zo(),!e.t0){e.next=4;break}return e.next=4,this.close(0);case 4:case"end":return e.stop()}},e,this)})),function(){return r.apply(this,arguments)})},{key:"t_",value:function(){this.state=0,this.Yo.reset()}},{key:"n_",value:function(){var e=this;this.Xo()&&null===this.Ho&&(this.Ho=this.oi.enqueueAfterDelay(this.Go,6e4,function(){return e.r_()}))}},{key:"i_",value:function(e){this.s_(),this.stream.send(e)}},{key:"r_",value:(n=_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.Xo()){e.next=2;break}return e.abrupt("return",this.close(0));case 2:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"s_",value:function(){this.Ho&&(this.Ho.cancel(),this.Ho=null)}},{key:"o_",value:function(){this.Jo&&(this.Jo.cancel(),this.Jo=null)}},{key:"close",value:(t=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.s_(),this.o_(),this.Yo.cancel(),this.jo++,4!==t?this.Yo.reset():n&&n.code===ml.RESOURCE_EXHAUSTED?(fl(n.toString()),fl("Using maximum backoff delay to prevent overloading the backend."),this.Yo.Ko()):n&&n.code===ml.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.__(),this.stream.close(),this.stream=null),this.state=t,e.next=9,this.listener.Ao(n);case 9:case"end":return e.stop()}},e,this)})),function(e,n){return t.apply(this,arguments)})},{key:"__",value:function(){}},{key:"auth",value:function(){var e=this;this.state=1;var t=this.a_(this.jo),n=this.jo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(function(t){var r=w(t,2),i=r[0],a=r[1];e.jo===n&&e.u_(i,a)},function(n){t(function(){var t=new kl(ml.UNKNOWN,"Fetching auth token failed: "+n.message);return e.c_(t)})})}},{key:"u_",value:function(e,t){var n=this,r=this.a_(this.jo);this.stream=this.l_(e,t),this.stream.Po(function(){r(function(){return n.listener.Po()})}),this.stream.To(function(){r(function(){return n.state=2,n.Jo=n.oi.enqueueAfterDelay(n.zo,1e4,function(){return n.Xo()&&(n.state=3),Promise.resolve()}),n.listener.To()})}),this.stream.Ao(function(e){r(function(){return n.c_(e)})}),this.stream.onMessage(function(e){r(function(){return n.onMessage(e)})})}},{key:"e_",value:function(){var e=this;this.state=5,this.Yo.$o(_(P.mark(function t(){return P.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e.state=0,e.start();case 1:case"end":return t.stop()}},t)})))}},{key:"c_",value:function(e){return hl("PersistentStream","close with error: ".concat(e)),this.stream=null,this.close(4,e)}},{key:"a_",value:function(e){var t=this;return function(n){t.oi.enqueueAndForget(function(){return t.jo===e?n():(hl("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}}}]),e}(),iv=function(e){g(n,e);var t=al(n);function n(e,r,i,a,s,o){var u;return E(this,n),(u=t.call(this,e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",r,i,a,o)).serializer
2=s,u}return S(n,[{key:"l_",value:function(e,t){return this.connection.Oo("Listen",e,t)}},{key:"onMessage",value:function(e){this.Yo.reset();var t=function(e,t){var n;if("targetChange"in t){t.targetChange;var r=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:vl()}(t.targetChange.targetChangeType||"NO_CHANGE"),i=t.targetChange.targetIds||[],a=function(e,t){return e.useProto3Json?(gl(void 0===t||"string"==typeof t),oh.fromBase64String(t||"")):(gl(void 0===t||t instanceof Buffer||t instanceof Uint8Array),oh.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),s=t.targetChange.cause,o=s&&function(e){var t=void 0===e.code?ml.UNKNOWN:yd(e.code);return new kl(t,e.message||"")}(s);n=new xd(r,i,a,o||null)}else if("documentChange"in t){t.documentChange;var u=t.documentChange;u.document,u.document.name,u.document.updateTime;var c=Kd(e,u.document.name),l=Vd(u.document.updateTime),h=u.document.createTime?Vd(u.document.createTime):Nl.min(),f=new Rh({mapValue:{fields:u.document.fields}}),d=Dh.newFoundDocument(c,l,h,f),p=u.targetIds||[],v=u.removedTargetIds||[];n=new Sd(p,v,d.key,d)}else if("documentDelete"in t){t.documentDelete;var g=t.documentDelete;g.document;var y=Kd(e,g.document),m=g.readTime?Vd(g.readTime):Nl.min(),k=Dh.newNoDocument(y,m),w=g.removedTargetIds||[];n=new Sd([],w,k.key,k)}else if("documentRemove"in t){t.documentRemove;var b=t.documentRemove;b.document;var _=Kd(e,b.document),E=b.removedTargetIds||[];n=new Sd([],E,_,null)}else{if(!("filter"in t))return vl();t.filter;var I=t.filter;I.targetId;var S=I.count,T=void 0===S?0:S,x=I.unchangedNames,A=new vd(T,x),C=I.targetId;n=new Td(C,A)}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return Nl.min();var t=e.targetChange;return t.targetIds&&t.targetIds.length?Nl.min():t.readTime?Vd(t.readTime):Nl.min()}(e);return this.listener.h_(t,n)}},{key:"P_",value:function(e){var t={};t.database=Wd(this.serializer),t.addTarget=function(e,t){var n,r=t.target;if((n=of(r)?{documents:Xd(e,r)}:{query:Jd(e,r)._t}).targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=Fd(e,t.resumeToken);var i=Md(e,t.expectedCount);null!==i&&(n.expectedCount=i)}else if(t.snapshotVersion.compareTo(Nl.min())>0){n.readTime=Ud(e,t.snapshotVersion.toTimestamp());var a=Md(e,t.expectedCount);null!==a&&(n.expectedCount=a)}return n}(this.serializer,e);var n=function(e,t){var n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return vl()}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.i_(t)}},{key:"I_",value:function(e){var t={};t.database=Wd(this.serializer),t.removeTarget=e,this.i_(t)}}]),n}(rv),av=function(e){g(n,e);var t=al(n);function n(e,r,i,a,s,o){var u;return E(this,n),(u=t.call(this,e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",r,i,a,o)).serializer=s,u.T_=!1,u}return S(n,[{key:"E_",get:function(){return this.T_}},{key:"start",value:function(){this.T_=!1,this.lastStreamToken=void 0,d(f(n.prototype),"start",this).call(this)}},{key:"__",value:function(){this.T_&&this.d_([])}},{key:"l_",value:function(e,t){return this.connection.Oo("Write",e,t)}},{key:"onMessage",value:function(e){if(gl(!!e.streamToken),this.lastStreamToken=e.streamToken,this.T_){this.Yo.reset();var t=function(e,t){return e&&e.length>0?(gl(void 0!==t),e.map(function(e){return function(e,t){var n=e.updateTime?Vd(e.updateTime):Vd(t);return n.isEqual(Nl.min())&&(n=Vd(t)),new Qf(n,e.transformResults||[])}(e,t)})):[]}(e.writeResults,e.commitTime),n=Vd(e.commitTime);return this.listener.A_(n,t)}return gl(!e.writeResults||0===e.writeResults.length),this.T_=!0,this.listener.R_()}},{key:"V_",value:function(){var e={};e.database=Wd(this.serializer),this.i_(e)}},{key:"d_",value:function(e){var t=this,n={streamToken:this.lastStreamToken,writes:e.map(function(e){return function(e,t){var n;if(t instanceof rd)n={update:Yd(e,t.key,t.value)};else if(t instanceof ld)n={delete:Hd(e,t.key)};else if(t instanceof id)n={update:Yd(e,t.key,t.data),updateMask:sp(t.fieldMask)};else{if(!(t instanceof hd))return vl();n={verify:Hd(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map(function(e){return function(e,t){var n=t.transform;if(n instanceof Vf)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Bf)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof zf)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Kf)return{fieldPath:t.field.canonicalString(),increment:n.Pe};throw vl()}(0,e)})),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:jd(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:vl()}(e,t.precondition)),n}(t.serializer,e)})};this.i_(n)}}]),n}(rv),sv=function(e){g(n,e);var t=al(n);function n(e,r,i,a){var s;return E(this,n),(s=t.call(this)).authCredentials=e,s.appCheckCredentials=r,s.connection=i,s.serializer
2=a,s.m_=!1,s}return S(n,[{key:"f_",value:function(){if(this.m_)throw new kl(ml.FAILED_PRECONDITION,"The client has already been terminated.")}},{key:"Co",value:function(e,t,n,r){var i=this;return this.f_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(function(a){var s=w(a,2),o=s[0],u=s[1];return i.connection.Co(e,qd(t,n),r,o,u)}).catch(function(e){throw"FirebaseError"===e.name?(e.code===ml.UNAUTHENTICATED&&(i.authCredentials.invalidateToken(),i.appCheckCredentials.invalidateToken()),e):new kl(ml.UNKNOWN,e.toString())})}},{key:"xo",value:function(e,t,n,r,i){var a=this;return this.f_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(function(s){var o=w(s,2),u=o[0],c=o[1];return a.connection.xo(e,qd(t,n),r,u,c,i)}).catch(function(e){throw"FirebaseError"===e.name?(e.code===ml.UNAUTHENTICATED&&(a.authCredentials.invalidateToken(),a.appCheckCredentials.invalidateToken()),e):new kl(ml.UNKNOWN,e.toString())})}},{key:"terminate",value:function(){this.m_=!0,this.connection.terminate()}}]),n}(S(function e(){E(this,e)})),ov=function(){function e(t,n){E(this,e),this.asyncQueue=t,this.onlineStateHandler=n,this.state="Unknown",this.g_=0,this.p_=null,this.y_=!0}return S(e,[{key:"w_",value:function(){var e=this;0===this.g_&&(this.S_("Unknown"),this.p_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,function(){return e.p_=null,e.b_("Backend didn't respond within 10 seconds."),e.S_("Offline"),Promise.resolve()}))}},{key:"D_",value:function(e){"Online"===this.state?this.S_("Unknown"):(this.g_++,this.g_>=1&&(this.C_(),this.b_("Connection failed 1 times. Most recent error: ".concat(e.toString())),this.S_("Offline")))}},{key:"set",value:function(e){this.C_(),this.g_=0,"Online"===e&&(this.y_=!1),this.S_(e)}},{key:"S_",value:function(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}},{key:"b_",value:function(e){var t="Could not reach Cloud Firestore backend. ".concat(e,"\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.y_?(fl(t),this.y_=!1):hl("OnlineStateTracker",t)}},{key:"C_",value:function(){null!==this.p_&&(this.p_.cancel(),this.p_=null)}}]),e}(),uv=S(function e(t,n,r,i,a){var s=this;E(this,e),this.localStore=t,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.v_=[],this.F_=new Map,this.M_=new Set,this.x_=[],this.O_=a,this.O_.io(function(e){r.enqueueAndForget(_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=kv(s),!e.t0){e.next=5;break}return hl("RemoteStore","Restarting streams for network reachability change."),e.next=5,function(){var e=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(n=yl(t)).M_.add(4),e.next=4,hv(n);case 4:return n.N_.set("Unknown"),n.M_.delete(4),e.next=8,cv(n);case 8:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()(s);case 5:case"end":return e.stop()}},e)})))}),this.N_=new ov(r,i)});function cv(e){return lv.apply(this,arguments)}function lv(){return(lv=_(P.mark(function e(t){var n,r,i;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!kv(t)){e.next=18;break}n=rl(t.x_),e.prev=2,n.s();case 4:if((r=n.n()).done){e.next=10;break}return i=r.value,e.next=8,i(!0);case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),n.e(e.t0);case 15:return e.prev=15,n.f(),e.finish(15);case 18:case"end":return e.stop()}},e,null,[[2,12,15,18]])}))).apply(this,arguments)}function hv(e){return fv.apply(this,arguments)}function fv(){return(fv=_(P.mark(function e(t){var n,r,i;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=rl(t.x_),e.prev=1,n.s();case 3:if((r=n.n()).done){e.next=9;break}return i=r.value,e.next=7,i(!1);case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),n.e(e.t0);case 14:return e.prev=14,n.f(),e.finish(14);case 17:case"end":return e.stop()}},e,null,[[1,11,14,17]])}))).apply(this,arguments)}function dv(e,t){var n=yl(e);n.F_.has(t.targetId)||(n.F_.set(t.targetId,t),mv(n)?yv(n):Xv(n).Xo()&&vv(n,t))}function pv(e,t){var n=yl(e),r=Xv(n);n.F_.delete(t),r.Xo()&&gv(n,t),0===n.F_.size&&(r.Xo()?r.n_():kv(n)&&n.N_.set("Unknown"))}function vv(e,t){if(e.L_.xe(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(Nl.min())>0){var n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}Xv(e).P_(t)}
2function gv(e,t){e.L_.xe(t),Xv(e).I_(t)}function yv(e){e.L_=new Cd({getRemoteKeysForTarget:function(t){return e.remoteSyncer.getRemoteKeysForTarget(t)},ot:function(t){return e.F_.get(t)||null},tt:function(){return e.datastore.serializer.databaseId}}),Xv(e).start(),e.N_.w_()}function mv(e){return kv(e)&&!Xv(e).Zo()&&e.F_.size>0}function kv(e){return 0===yl(e).M_.size}function wv(e){e.L_=void 0}function bv(e){return _v.apply(this,arguments)}function _v(){return(_v=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.N_.set("Online");case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ev(e){return Iv.apply(this,arguments)}function Iv(){return(Iv=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.F_.forEach(function(e,n){vv(t,e)});case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Sv(e,t){return Tv.apply(this,arguments)}function Tv(){return(Tv=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:wv(t),mv(t)?(t.N_.D_(n),yv(t)):t.N_.set("Unknown");case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function xv(e,t,n){return Av.apply(this,arguments)}function Av(){return Av=_(P.mark(function e(t,n,r){var i;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.N_.set("Online"),!(n instanceof xd&&2===n.state&&n.cause)){e.next=13;break}return e.prev=1,e.next=4,function(){var e=_(P.mark(function e(t,n){var r,i,a,s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=n.cause,i=rl(n.targetIds),e.prev=2,i.s();case 4:if((a=i.n()).done){e.next=14;break}if(s=a.value,e.t0=t.F_.has(s),!e.t0){e.next=12;break}return e.next=10,t.remoteSyncer.rejectListen(s,r);case 10:t.F_.delete(s),t.L_.removeTarget(s);case 12:e.next=4;break;case 14:e.next=19;break;case 16:e.prev=16,e.t1=e.catch(2),i.e(e.t1);case 19:return e.prev=19,i.f(),e.finish(19);case 22:case"end":return e.stop()}},e,null,[[2,16,19,22]])}));return function(t,n){return e.apply(this,arguments)}}()(t,n);case 4:e.next=11;break;case 6:return e.prev=6,e.t0=e.catch(1),hl("RemoteStore","Failed to remove targets %s: %s ",n.targetIds.join(","),e.t0),e.next=11,Cv(t,e.t0);case 11:case 22:e.next=29;break;case 13:if(n instanceof Sd?t.L_.Ke(n):n instanceof Td?t.L_.He(n):t.L_.We(n),r.isEqual(Nl.min())){e.next=29;break}return e.prev=14,e.next=17,Up(t.localStore);case 17:if(i=e.sent,e.t1=r.compareTo(i)>=0,!e.t1){e.next=22;break}return e.next=22,function(e,t){var n=e.L_.rt(t);
2return n.targetChanges.forEach(function(n,r){if(n.resumeToken.approximateByteSize()>0){var i=e.F_.get(r);i&&e.F_.set(r,i.withResumeToken(n.resumeToken,t))}}),n.targetMismatches.forEach(function(t,n){var r=e.F_.get(t);if(r){e.F_.set(t,r.withResumeToken(oh.EMPTY_BYTE_STRING,r.snapshotVersion)),gv(e,t);var i=new up(r.target,t,n,r.sequenceNumber);vv(e,i)}}),e.remoteSyncer.applyRemoteEvent(n)}(t,r);case 24:return e.prev=24,e.t2=e.catch(14),hl("RemoteStore","Failed to raise snapshot:",e.t2),e.next=29,Cv(t,e.t2);case 29:case"end":return e.stop()}},e,null,[[1,6],[14,24]])})),Av.apply(this,arguments)}function Cv(e,t,n){return Pv.apply(this,arguments)}function Pv(){return(Pv=_(P.mark(function e(t,n,r){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Gl(n)){e.next=2;break}throw n;case 2:return t.M_.add(1),e.next=5,hv(t);case 5:t.N_.set("Offline"),r||(r=function(){return Up(t.localStore)}),t.asyncQueue.enqueueRetryable(_(P.mark(function e(){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return hl("RemoteStore","Retrying IndexedDB access"),e.next=3,r();case 3:return t.M_.delete(1),e.next=6,cv(t);case 6:case"end":return e.stop()}},e)})));case 8:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ov(e,t){return t().catch(function(n){return Cv(e,n,t)})}function Rv(e){return Nv.apply(this,arguments)}function Nv(){return(Nv=_(P.mark(function e(t){var n,r,i,a;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=yl(t),r=Jv(n),i=n.v_.length>0?n.v_[n.v_.length-1].batchId:-1;case 2:if(!Dv(n)){e.next=19;break}return e.prev=3,e.next=6,jp(n.localStore,i);case 6:if(null!==(a=e.sent)){e.next=10;break}return 0===n.v_.length&&r.n_(),e.abrupt("break",19);case 10:i=a.batchId,Lv(n,a),e.next=17;break;case 13:return e.prev=13,e.t0=e.catch(3),e.next=17,Cv(n,e.t0);case 17:e.next=2;break;case 19:Mv(n)&&Uv(n);case 20:case"end":return e.stop()}},e,null,[[3,13]])}))).apply(this,arguments)}function Dv(e){return kv(e)&&e.v_.length<10}function Lv(e,t){e.v_.push(t);var n=Jv(e);n.Xo()&&n.E_&&n.d_(t.mutations)}function Mv(e){return kv(e)&&!Jv(e).Zo()&&e.v_.length>0}function Uv(e){Jv(e).start()}function Fv(e){return jv.apply(this,arguments)}function jv(){return(jv=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:Jv(t).V_();case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Vv(e){return Bv.apply(this,arguments)}function Bv(){return(Bv=_(P.mark(function e(t){var n,r,i,a;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=Jv(t),r=rl(t.v_);try{for(r.s();!(i=r.n()).done;)a=i.value,n.d_(a.mutations)}catch(s){r.e(s)}finally{r.f()}case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function qv(e,t,n){return zv.apply(this,arguments)}function zv(){return(zv=_(P.mark(function e(t,n,r){var i,a;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.v_.shift(),a=dd.from(i,n,r),e.next=3,Ov(t,function(){return t.remoteSyncer.applySuccessfulWrite(a)});case 3:return e.next=5,Rv(t);case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Hv(e,t){return Kv.apply(this,arguments)}function Kv(){return Kv=_(P.mark(function e(t,n){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=n&&Jv(t).E_,!e.t0){e.next=4;break}return e.next=4,function(){var e=_(P.mark(function e(t,n){var r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!function(e){return gd(e)&&e!==ml.ABORTED}(n.code)){e.next=7;break}return r=t.v_.shift(),Jv(t).t_(),e.next=5,Ov(t,function(){return t.remoteSyncer.rejectFailedWrite(r.batchId,n)});case 5:return e.next=7,Rv(t);case 7:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}()(t,n);case 4:Mv(t)&&Uv(t);case 5:case"end":return e.stop()}},e)})),Kv.apply(this,arguments)}function Gv(e,t){return Wv.apply(this,arguments)}function Wv(){return(Wv=_(P.mark(function e(t,n){var r,i;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(r=yl(t)).asyncQueue.verifyOperationInProgress(),hl("RemoteStore","RemoteStore received new credentials"),i=kv(r),r.M_.add(3),e.next=6,hv(r);case 6:return i&&r.N_.set("Unknown"),e.next=9,r.remoteSyncer.handleCredentialChange(n);case 9:return r.M_.delete(3),e.next=12,cv(r);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Qv(e,t){return Yv.apply(this,arguments)}function Yv(){return(Yv=_(P.mark(function e(t,n){var r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=yl(t),!n){e.next=7;break}return r.M_.delete(2),e.next=5,cv(r);case 5:e.next=13;break;case 7:if(e.t0=n,e.t0){e.next=13;break}return r.M_.add(2),e.next=12,hv(r);case 12:r.N_.set("Unknown");case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Xv(e){return e.B_||(e.B_=function(e,t,n){var r=yl(e);return r.f_(),new iv(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Po:bv.bind(null,e),To:Ev.bind(null,e),Ao:Sv.bind(null,e),h_:xv.bind(null,e)}),e.x_.push(function(){var t=_(P.mark(function t(n){return P.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!n){t.next=4;break}e.B_.t_(),mv(e)?yv(e):e.N_.set("Unknown"),t.next=7;break;case 4:return t.next=6,e.B_.stop();case 6:wv(e);case 7:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())),e.B_}function Jv(e){return e.k_||(e.k_=function(e,t,n){var r=yl(e);return r.f_(),new av(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Po:function(){return Promise.resolve()},To:Fv.bind(null,e),Ao:Hv.bind(null,e),R_:Vv.bind(null,e),A_:qv.bind(null,e)}),e.x_.push(function(){var t=_(P.mark(function t(n){return P.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!n){t.next=6;break}return e.k_.t_(),t.next=4,Rv(e);case 4:t.next=9;break;case 6:return t.next=8,e.k_.stop();case 8:e.v_.length>0&&(hl("RemoteStore","Stopping write stream with ".concat(e.v_.length," pending writes")),e.v_=[]);case 9:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())),e.k_}var $v=function(){function e(t,n,r,i,a){E(this,e),this.asyncQueue=t,this.timerId=n,this.targetTimeMs=r,this.op=i,this.removalCallback=a,this.deferred=new wl,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(function(e){})}return S(e,[{key:"promise",get:function(){return this.deferred.promise}},{key:"start",value:function(e){var t=this;this.timerHandle=setTimeout(function(){return t.handleDelayElapsed()},e)}},{key:"skipDelay",value:function(){return this.handleDelayElapsed()}},{key:"cancel",value:function(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new kl(ml.CA
2NCELLED,"Operation cancelled"+(e?": "+e:""))))}},{key:"handleDelayElapsed",value:function(){var e=this;this.asyncQueue.enqueueAndForget(function(){return null!==e.timerHandle?(e.clearTimeout(),e.op().then(function(t){return e.deferred.resolve(t)})):Promise.resolve()})}},{key:"clearTimeout",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)})}],[{key:"createAndSchedule",value:function(t,n,r,i,a){var s=new e(t,n,Date.now()+r,i,a);return s.start(r),s}}]),e}();function Zv(e,t){if(fl("AsyncQueue","".concat(t,": ").concat(e)),Gl(e))return new kl(ml.UNAVAILABLE,"".concat(t,": ").concat(e));throw e}var eg,tg,ng=function(){function e(t){E(this,e),this.comparator=t?function(e,n){return t(e,n)||Fl.comparator(e.key,n.key)}:function(e,t){return Fl.comparator(e.key,t.key)},this.keyedMap=If(),this.sortedSet=new eh(this.comparator)}return S(e,[{key:"has",value:function(e){return null!=this.keyedMap.get(e)}},{key:"get",value:function(e){return this.keyedMap.get(e)}},{key:"first",value:function(){return this.sortedSet.minKey()}},{key:"last",value:function(){return this.sortedSet.maxKey()}},{key:"isEmpty",value:function(){return this.sortedSet.isEmpty()}},{key:"indexOf",value:function(e){var t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}},{key:"size",get:function(){return this.sortedSet.size}},{key:"forEach",value:function(e){this.sortedSet.inorderTraversal(function(t,n){return e(t),!1})}},{key:"add",value:function(e){var t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}},{key:"delete",value:function(e){var t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}},{key:"isEqual",value:function(t){if(!(t instanceof e))return!1;if(this.size!==t.size)return!1;for(var n=this.sortedSet.getIterator(),r=t.sortedSet.getIterator();n.hasNext();){var i=n.getNext().key,a=r.getNext().key;if(!i.isEqual(a))return!1}return!0}},{key:"toString",value:function(){var e=[];return this.forEach(function(t){e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}},{key:"copy",value:function(t,n){var r=new e;return r.comparator=this.comparator,r.keyedMap=t,r.sortedSet=n,r}}],[{key:"emptySet",value:function(t){return new e(t.comparator)}}]),e}(),rg=function(){function e(){E(this,e),this.q_=new eh(Fl.comparator)}return S(e,[{key:"track",value:function(e){var t=e.doc.key,n=this.q_.get(t);n?0!==e.type&&3===n.type?this.q_=this.q_.insert(t,e):3===e.type&&1!==n.type?this.q_=this.q_.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.q_=this.q_.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.q_=this.q_.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.q_=this.q_.remove(t):1===e.type&&2===n.type?this.q_=this.q_.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.q_=this.q_.insert(t,{type:2,doc:e.doc}):vl():this.q_=this.q_.insert(t,e)}},{key:"Q_",value:function(){var e=[];return this.q_.inorderTraversal(function(t,n){e.push(n)}),e}}]),e}(),ig=function(){function e(t,n,r,i,a,s,o,u,c){E(this,e),this.query=t,this.docs=n,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=a,this.fromCache=s,this.syncStateChanged=o,this.excludesMetadataChanges=u,this.hasCachedResults=c}return S(e,[{key:"hasPendingWrites",get:function(){return!this.mutatedKeys.isEmpty()}},{key:"isEqual",value:function(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&pf(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;var t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(var r=0;r<t.length;r++)if(t[r].type!==n[r].type||!t[r].doc.isEqual(n[r].doc))return!1;return!0}}],[{key:"fromInitialDocuments",value:function(t,n,r,i,a){var s=[];return n.forEach(function(e){s.push({type:0,doc:e})}),new e(t,n,ng.emptySet(n),s,r,i,!0,!1,a)}}]),e}(),ag=function(){function e(){E(this,e),this.K_=void 0,this.U_=[]}return S(e,[{key:"W_",value:function(){return this.U_.some(function(e){return e.G_()})}}]),e}(),sg=S(function e(){E(this,e),this.queries=new wf(function(e){return vf(e)},pf),this.onlineState="Unknown",this.z_=new Set});function og(e,t){return ug.apply(this,arguments)}function ug(){return(ug=_(P.mark(function e(t,n){var r,i,a,s,o;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=yl(t),i=3,a=n.query,(s=r.queries.get(a))?!s.W_()&&n.G_()&&(i=2):(s=new ag,i=n.G_()?0:1),e.prev=5,e.t0=i,e.next=0===e.t0?9:1===e.t0?13:2===e.t0?17:19;break;case 9:return e.next=11,r.onListen(a,!0);case 11:return s.K_=e.sent,e.abrupt("break",19);case 13:return e.next=15,r.onListen(a,!1);case 15:return s.K_=e.sent,e.abrupt("break",19);case 17:return e.next=19,r.onFirstRemoteStoreListen(a);case 19:e.next=25;break;case 21:return e.prev=21,e.t1=e.catch(5),o=Zv(e.t1,"Initialization of query '".concat(gf(n.query),"' failed")),e.abrupt("return",void n.onError(o));
2case 25:r.queries.set(a,s),s.U_.push(n),n.j_(r.onlineState),s.K_&&n.H_(s.K_)&&dg(r);case 26:case"end":return e.stop()}},e,null,[[5,21]])}))).apply(this,arguments)}function cg(e,t){return lg.apply(this,arguments)}function lg(){return(lg=_(P.mark(function e(t,n){var r,i,a,s,o;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=yl(t),i=n.query,a=3,(s=r.queries.get(i))&&(o=s.U_.indexOf(n))>=0&&(s.U_.splice(o,1),0===s.U_.length?a=n.G_()?0:1:!s.W_()&&n.G_()&&(a=2)),e.t0=a,e.next=0===e.t0?7:1===e.t0?8:2===e.t0?9:10;break;case 7:return e.abrupt("return",(r.queries.delete(i),r.onUnlisten(i,!0)));case 8:return e.abrupt("return",(r.queries.delete(i),r.onUnlisten(i,!1)));case 9:return e.abrupt("return",r.onLastRemoteStoreUnlisten(i));case 10:return e.abrupt("return");case 11:case"end":return e.stop()}},e)}))).apply(this,arguments)}function hg(e,t){var n,r=yl(e),i=!1,a=rl(t);try{for(a.s();!(n=a.n()).done;){var s=n.value,o=s.query,u=r.queries.get(o);if(u){var c,l=rl(u.U_);try{for(l.s();!(c=l.n()).done;){c.value.H_(s)&&(i=!0)}}catch(h){l.e(h)}finally{l.f()}u.K_=s}}}catch(h){a.e(h)}finally{a.f()}i&&dg(r)}function fg(e,t,n){var r=yl(e),i=r.queries.get(t);if(i){var a,s=rl(i.U_);try{for(s.s();!(a=s.n()).done;){a.value.onError(n)}}catch(o){s.e(o)}finally{s.f()}}r.queries.delete(t)}function dg(e){e.z_.forEach(function(e){e.next()})}(tg=eg||(eg={})).J_="default",tg.Cache="cache";var pg=function(){function e(t,n,r){E(this,e),this.query=t,this.Y_=n,this.Z_=!1,this.X_=null,this.onlineState="Unknown",this.options=r||{}}return S(e,[{key:"H_",value:function(e){if(!this.options.includeMetadataChanges){var t,n=[],r=rl(e.docChanges);try{for(r.s();!(t=r.n()).done;){var i=t.value;3!==i.type&&n.push(i)}}catch(s){r.e(s)}finally{r.f()}e=new ig(e.query,e.docs,e.oldDocs,n,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}var a=!1;return this.Z_?this.ea(e)&&(this.Y_.next(e),a=!0):this.ta(e,this.onlineState)&&(this.na(e),a=!0),this.X_=e,a}},{key:"onError",value:function(e){this.Y_.error(e)}},{key:"j_",value:function(e){this.onlineState=e;var t=!1;return this.X_&&!this.Z_&&this.ta(this.X_,e)&&(this.na(this.X_),t=!0),t}},{key:"ta",value:function(e,t){if(!e.fromCache)return!0;if(!this.G_())return!0;var n="Offline"!==t;return(!this.options.ra||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}},{key:"ea",value:function(e){if(e.docChanges.length>0)return!0;var t=this.X_&&this.X_.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}},{key:"na",value:function(e){e=ig.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Z_=!0,this.Y_.next(e)}},{key:"G_",value:function(){return this.options.source!==eg.Cache}}]),e}(),vg=S(function e(t){E(this,e),this.key=t}),gg=S(function e(t){E(this,e),this.key=t}),yg=function(){function e(t,n){E(this,e),this.query=t,this.la=n,this.ha=null,this.hasCachedResults=!1,this.current=!1,this.Pa=Of(),this.mutatedKeys=Of(),this.Ia=mf(t),this.Ta=new ng(this.Ia)}return S(e,[{key:"Ea",get:function(){return this.la}},{key:"da",value:function(e,t){var n=this,r=t?t.Aa:new rg,i=t?t.Ta:this.Ta,a=t?t.mutatedKeys:this.mutatedKeys,s=i,o=!1,u="F"===this.query.limitType&&i.size===this.query.limit?i.last():null,c="L"===this.query.limitType&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal(function(e,t){var l=i.get(e),h=yf(n.query,t)?t:null,f=!!l&&n.mutatedKeys.has(l.key),d=!!h&&(h.hasLocalMutations||n.mutatedKeys.has(h.key)&&h.hasCommittedMutations),p=!1;l&&h?l.data.isEqual(h.data)?f!==d&&(r.track({type:3,doc:h}),p=!0):n.Ra(l,h)||(r.track({type:2,doc:h}),p=!0,(u&&n.Ia(h,u)>0||c&&n.Ia(h,c)<0)&&(o=!0)):!l&&h?(r.track({type:0,doc:h}),p=!0):l&&!h&&(r.track({type:1,doc:l}),p=!0,(u||c)&&(o=!0)),p&&(h?(s=s.add(h),a=d?a.add(e):a.delete(e)):(s=s.delete(e),a=a.delete(e)))}),null!==this.query.limit)for(;s.size>this.query.limit;){var l="F"===this.query.limitType?s.last():s.first();s=s.delete(l.key),a=a.delete(l.key),r.track({type:1,doc:l})}return{Ta:s,Aa:r,Xi:o,mutatedKeys:a}}},{key:"Ra",value:function(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}},{key:"applyChanges",value:function(e,t,n,r){var i=this,a=this.Ta;this.Ta=e.Ta,this.mutatedKeys=e.mutatedKeys;var s=e.Aa.Q_();s.sort(function(e,t){return function(e,t){var n=function(e){switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return vl()}};return n(e)-n(t)}(e.type,t.type)||i.Ia(e.doc,t.doc)}),this.Va(n),r=null!=r&&r;var o=t&&!r?this.ma():[],u=0===this.Pa.size&&this.current&&!r?1:0,c=u!==this.ha;return this.ha=u,0!==s.length||c?{snapshot:new ig(this.query,e.Ta,a,s,e.mutatedKeys,0===u,c,!1,!!n&&n.resumeToken.approximateByteSize()>0),fa:o}:{fa:o}}},{key:"j_",value:function(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({Ta:this.Ta,Aa:new rg,mutatedKeys:this.mutatedKeys,Xi:!1},!1)):{fa:[]}}},{key:"ga",value:function(e){return!this.la.has(e)&&!!this.Ta.has(e)&&!this.Ta.get(e).hasLocalMutations}},{key:"Va",value:function(e){var t=this;
2e&&(e.addedDocuments.forEach(function(e){return t.la=t.la.add(e)}),e.modifiedDocuments.forEach(function(e){}),e.removedDocuments.forEach(function(e){return t.la=t.la.delete(e)}),this.current=e.current)}},{key:"ma",value:function(){var e=this;if(!this.current)return[];var t=this.Pa;this.Pa=Of(),this.Ta.forEach(function(t){e.ga(t.key)&&(e.Pa=e.Pa.add(t.key))});var n=[];return t.forEach(function(t){e.Pa.has(t)||n.push(new gg(t))}),this.Pa.forEach(function(e){t.has(e)||n.push(new vg(e))}),n}},{key:"pa",value:function(e){this.la=e.hs,this.Pa=Of();var t=this.da(e.documents);return this.applyChanges(t,!0)}},{key:"ya",value:function(){return ig.fromInitialDocuments(this.query,this.Ta,this.mutatedKeys,0===this.ha,this.hasCachedResults)}}]),e}(),mg=S(function e(t,n,r){E(this,e),this.query=t,this.targetId=n,this.view=r}),kg=S(function e(t){E(this,e),this.key=t,this.wa=!1}),wg=function(){function e(t,n,r,i,a,s){E(this,e),this.localStore=t,this.remoteStore=n,this.eventManager=r,this.sharedClientState=i,this.currentUser=a,this.maxConcurrentLimboResolutions=s,this.Sa={},this.ba=new wf(function(e){return vf(e)},pf),this.Da=new Map,this.Ca=new Set,this.va=new eh(Fl.comparator),this.Fa=new Map,this.Ma=new bp,this.xa={},this.Oa=new Map,this.Na=vp.Ln(),this.onlineState="Unknown",this.La=void 0}return S(e,[{key:"isPrimaryClient",get:function(){return!0===this.La}}]),e}();function bg(e,t){return _g.apply(this,arguments)}function _g(){return _g=_(P.mark(function e(t,n){var r,i,a,s,o=arguments;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(o.length>2&&void 0!==o[2])||o[2],i=ny(t),!(s=i.ba.get(n))){e.next=7;break}i.sharedClientState.addLocalQueryTarget(s.targetId),a=s.view.ya(),e.next=10;break;case 7:return e.next=9,Sg(i,n,r,!0);case 9:a=e.sent;case 10:return e.abrupt("return",a);case 11:case"end":return e.stop()}},e)})),_g.apply(this,arguments)}function Eg(e,t){return Ig.apply(this,arguments)}function Ig(){return(Ig=_(P.mark(function e(t,n){var r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=ny(t),e.next=3,Sg(r,n,!0,!1);case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Sg(e,t,n,r){return Tg.apply(this,arguments)}function Tg(){return(Tg=_(P.mark(function e(t,n,r,i){var a,s,o,u;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Vp(t.localStore,ff(n));case 2:if(a=e.sent,s=a.targetId,o=r?t.sharedClientState.addLocalQueryTarget(s):"not-current",e.t0=i,!e.t0){e.next=10;break}return e.next=9,xg(t,n,s,"current"===o,a.resumeToken);case 9:u=e.sent;case 10:return t.isPrimaryClient&&r&&dv(t.remoteStore,a),e.abrupt("return",u);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function xg(e,t,n,r,i){return Ag.apply(this,arguments)}function Ag(){return Ag=_(P.mark(function e(t,n,r,i,a){var s,o,u,c,l,h;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.Ba=function(e,n,r){return(i=_(P.mark(function e(t,n,r,i){var a,s,o,u;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=n.view.da(r),e.t0=a.Xi,!e.t0){e.next=6;break}return e.next=5,zp(t.localStore,n.query,!1).then(function(e){var t=e.documents;return n.view.da(t,a)});case 5:a=e.sent;case 6:return s=i&&i.targetChanges.get(n.targetId),o=i&&null!=i.targetMismatches.get(n.targetId),u=n.view.applyChanges(a,t.isPrimaryClient,s,o),e.abrupt("return",(Qg(t,n.targetId,u.fa),u.snapshot));case 8:case"end":return e.stop()}},e)})),function(e,t,n,r){return i.apply(this,arguments)})(t,e,n,r);var i},e.next=3,zp(t.localStore,n,!0);case 3:return s=e.sent,o=new yg(n,s.hs),u=o.da(s.documents),c=Id.createSynthesizedTargetChangeForCurrentChange(r,i&&"Offline"!==t.onlineState,a),l=o.applyChanges(u,t.isPrimaryClient,c),Qg(t,r,l.fa),h=new mg(n,r,o),e.abrupt("return",(t.ba.set(n,h),t.Da.has(r)?t.Da.get(r).push(n):t.Da.set(r,[n]),l.snapshot));case 11:case"end":return e.stop()}},e)})),Ag.apply(this,arguments)}function Cg(e,t,n){return Pg.apply(this,arguments)}function Pg(){return(Pg=_(P.mark(function e(t,n,r){var i,a,s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=yl(t),a=i.ba.get(n),!((s=i.Da.get(a.targetId)).length>1)){e.next=3;break}return e.abrupt("return",(i.Da.set(a.targetId,s.filter(function(e){return!pf(e,n)})),void i.ba.delete(n)));case 3:if(!i.isPrimaryClient){e.next=11;break}
2if(i.sharedClientState.removeLocalQueryTarget(a.targetId),e.t0=i.sharedClientState.isActiveQueryTarget(a.targetId),e.t0){e.next=9;break}return e.next=9,Bp(i.localStore,a.targetId,!1).then(function(){i.sharedClientState.clearQueryState(a.targetId),r&&pv(i.remoteStore,a.targetId),Gg(i,a.targetId)}).catch(zl);case 9:e.next=14;break;case 11:return Gg(i,a.targetId),e.next=14,Bp(i.localStore,a.targetId,!0);case 14:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Og(e,t){return Rg.apply(this,arguments)}function Rg(){return(Rg=_(P.mark(function e(t,n){var r,i,a;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=yl(t),i=r.ba.get(n),a=r.Da.get(i.targetId),r.isPrimaryClient&&1===a.length&&(r.sharedClientState.removeLocalQueryTarget(i.targetId),pv(r.remoteStore,i.targetId));case 2:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Ng(e,t,n){return Dg.apply(this,arguments)}function Dg(){return(Dg=_(P.mark(function e(t,n,r){var i,a,s;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=ry(t),e.prev=1,e.next=4,function(e,t){var n,r,i=yl(e),a=Rl.now(),s=t.reduce(function(e,t){return e.add(t.key)},Of());return i.persistence.runTransaction("Locally write mutations","readwrite",function(e){var o=_f(),u=Of();return i.os.getEntries(e,s).next(function(e){(o=e).forEach(function(e,t){t.isValidDocument()||(u=u.add(e))})}).next(function(){return i.localDocuments.getOverlayedDocuments(e,o)}).next(function(r){n=r;var s,o=[],u=rl(t);try{for(u.s();!(s=u.n()).done;){var c=s.value,l=td(c,n.get(c.key).overlayedDocument);null!=l&&o.push(new id(c.key,l,Nh(l.value.mapValue),Yf.exists(!0)))}}catch(h){u.e(h)}finally{u.f()}
2return i.mutationQueue.addMutationBatch(e,a,o,t)}).next(function(t){r=t;var a=t.applyToLocalDocumentSet(n,u);return i.documentOverlayCache.saveOverlays(e,t.batchId,a)})}).then(function(){return{batchId:r.batchId,changes:Sf(n)}})}(i.localStore,n);case 4:return a=e.sent,i.sharedClientState.addPendingMutation(a.batchId),function(e,t,n){var r=e.xa[e.currentUser.toKey()];r||(r=new eh(Pl)),r=r.insert(t,n),e.xa[e.currentUser.toKey()]=r}(i,a.batchId,r),e.next=9,Jg(i,a.changes);case 9:return e.next=11,Rv(i.remoteStore);case 11:e.next=17;break;case 13:e.prev=13,e.t0=e.catch(1),s=Zv(e.t0,"Failed to persist write"),r.reject(s);case 17:case"end":return e.stop()}},e,null,[[1,13]])}))).apply(this,arguments)}function Lg(e,t){return Mg.apply(this,arguments)}function Mg(){return(Mg=_(P.mark(function e(t,n){var r,i;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=yl(t),e.prev=1,e.next=4,Fp(r.localStore,n);case 4:return i=e.sent,n.targetChanges.forEach(function(e,t){var n=r.Fa.get(t);n&&(gl(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1),e.addedDocuments.size>0?n.wa=!0:e.modifiedDocuments.size>0?gl(n.wa):e.removedDocuments.size>0&&(gl(n.wa),n.wa=!1))}),e.next=8,Jg(r,i,n);case 8:e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(1),e.next=14,zl(e.t0);case 14:case"end":return e.stop()}},e,null,[[1,10]])}))).apply(this,arguments)}function Ug(e,t,n){var r=yl(e);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){var i=[];r.ba.forEach(function(e,n){var r=n.view.j_(t);r.snapshot&&i.push(r.snapshot)}),function(e,t){var n=yl(e);n.onlineState=t;var r=!1;n.queries.forEach(function(e,n){var i,a=rl(n.U_);try{for(a.s();!(i=a.n()).done;){i.value.j_(t)&&(r=!0)}}catch(s){a.e(s)}finally{a.f()}}),r&&dg(n)}(r.eventManager,t),i.length&&r.Sa.h_(i),r.onlineState=t,r.isPrimaryClient&&r.sharedCl
2ientState.setOnlineState(t)}}function Fg(e,t,n){return jg.apply(this,arguments)}function jg(){return(jg=_(P.mark(function e(t,n,r){var i,a,s,o,u,c;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((i=yl(t)).sharedClientState.updateQueryState(n,"rejected",r),a=i.Fa.get(n),!(s=a&&a.key)){e.next=14;break}return o=(o=new eh(Fl.comparator)).insert(s,Dh.newNoDocument(s,Nl.min())),u=Of().add(s),c=new Ed(Nl.min(),new Map,new eh(Pl),o,u),e.next=9,Lg(i,c);case 9:i.va=i.va.remove(s),i.Fa.delete(n),Xg(i),e.next=16;break;case 14:return e.next=16,Bp(i.localStore,n,!1).then(function(){return Gg(i,n,r)}).catch(zl);case 16:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Vg(e,t){return Bg.apply(this,arguments)}function Bg(){return(Bg=_(P.mark(function e(t,n){var r,i,a;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=yl(t),i=n.batch.batchId,e.prev=1,e.next=4,Mp(r.localStore,n);case 4:return a=e.sent,Kg(r,i,null),Hg(r,i),r.sharedClientState.updateMutationState(i,"acknowledged"),e.next=10,Jg(r,a);case 10:e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(1),e.next=16,zl(e.t0);case 16:case"end":return e.stop()}},e,null,[[1,12]])}))).apply(this,arguments)}function qg(e,t,n){return zg.apply(this,arguments)}function zg(){return(zg=_(P.mark(function e(t,n,r){var i,a;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=yl(t),e.prev=1,e.next=4,function(e,t){var n=yl(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",function(e){var r;
2return n.mutationQueue.lookupMutationBatch(e,t).next(function(t){return gl(null!==t),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t)}).next(function(){return n.mutationQueue.performConsistencyCheck(e)}).next(function(){return n.documentOverlayCache.removeOverlaysForBatchId(e,r,t)}).next(function(){return n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r)}).next(function(){return n.localDocuments.getDocuments(e,r)})})}(i.localStore,n);case 4:return a=e.sent,Kg(i,n,r),Hg(i,n),i.sharedClientState.updateMutationState(n,"rejected",r),e.next=10,Jg(i,a);case 10:e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(1),e.next=16,zl(e.t0);case 16:case"end":return e.stop()}},e,null,[[1,12]])}))).apply(this,arguments)}function Hg(e,t){(e.Oa.get(t)||[]).forEach(function(e){e.resolve()}),e.Oa.delete(t)}function Kg(e,t,n){var r=yl(e),i=r.xa[r.currentUser.toKey()];if(i){var a=i.get(t);a&&(n?a.reject(n):a.resolve(),i=i.remove(t)),r.xa[r.currentUser.toKey()]=i}}function Gg(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.sharedClientState.removeLocalQueryTarget(t);var r,i=rl(e.Da.get(t));try{for(i.s();!(r=i.n()).done;){var a=r.value;e.ba.delete(a),n&&e.Sa.ka(a,n)}}catch(s){i.e(s)}finally{i.f()}e.Da.delete(t),e.isPrimaryClient&&e.Ma.Vr(t).forEach(function(t){e.Ma.containsKey(t)||Wg(e,t)})}function Wg(e,t){e.Ca.delete(t.path.canonicalString());var n=e.va.get(t);null!==n&&(pv(e.remoteStore,n),e.va=e.va.remove(t),e.Fa.delete(n),Xg(e))}function Qg(e,t,n){var r,i=rl(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;a instanceof vg?(e.Ma.addReference(a.key,t),Yg(e,a)):a instanceof gg?(hl("SyncEngine","Document no longer in limbo: "+a.key),e.Ma.removeReference(a.key,t),e.Ma.containsKey(a.key)||Wg(e,a.key)):vl()}}catch(s){i.e(s)}finally{i.f()}}function Yg(e,t){var n=t.key,r=n.path.canonicalString();e.va.get(n)||e.Ca.has(r)||(hl("SyncEngine","New document in limbo: "+n),e.Ca.add(r),Xg(e))}function Xg(e){for(;e.Ca.size>0&&e.va.size<e.maxConcurrentLimboResolutions;){var t=e.Ca.values().next().value;e.Ca.delete(t);var n=new Fl(Ll.fromString(t)),r=e.Na.next();e.Fa.set(r,new kg(n)),e.va=e.va.insert(n,r),dv(e.remoteStore,new up(ff(cf(n.path)),r,"TargetPurposeLimboResolution",Wl.oe))}}function Jg(e,t,n){return $g.apply(this,arguments)}function $g(){return $g=_(P.mark(function e(t,n,r){var i,a,s,o;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=yl(t),a=[],s=[],o=[],e.t0=i.ba.isEmpty(),e.t0){e.next=9;break}return i.ba.forEach(function(e,t){o.push(i.Ba(t,n,r).then(function(e){if((e||r)&&i.isPrimaryClient){var n=e&&!e.fromCache;i.sharedClientState.updateQueryState(t.targetId,n?"current":"not-current")}if(e){a.push(e);var o=Pp.Ki(t.targetId,e);s.push(o)}}))}),e.next=6,Promise.all(o);case 6:return i.Sa.h_(a),e.next=9,function(){var e=_(P.mark(function e(t,n){var r,i,a,s,o,u,c,l;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=yl(t),e.prev=1,e.next=4,r.persistence.runTransaction("notifyLocalViewChanges","readwrite",function(e){return Kl.forEach(n,function(t){return Kl.forEach(t.qi,function(n){return r.persistence.referenceDelegate.addReference(e,t.targetId,n)}).next(function(){return Kl.forEach(t.Qi,function(n){return r.persistence.referenceDelegate.removeReference(e,t.targetId,n)})})})});case 4:e.next=11;break;case 6:if(e.prev=6,e.t0=e.catch(1),Gl(e.t0)){e.next=10;break}throw e.t0;case 10:hl("LocalStore","Failed to update sequence numbers: "+e.t0);case 11:i=rl(n);try{for(i.s();!(a=i.n()).done;)s=a.value,o=s.targetId,s.fromCache||(u=r.ns.get(o),c=u.snapshotVersion,l=u.withLastLimboFreeSnapshotVersion(c),r.ns=r.ns.insert(o,l))}catch(h){i.e(h)}finally{i.f()}case 13:case"end":return e.stop()}},e,null,[[1,6]])}));return function(t,n){return e.apply(this,arguments)}}()(i.localStore,s);case 9:case"end":return e.stop()}},e)})),$g.apply(this,arguments)}function Zg(e,t){return ey.apply(this,arguments)}function ey(){return(ey=_(P.mark(function e(t,n){var r,i;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((r=yl(t)).currentUser.isEqual(n)){e.next=11;break}
2return hl("SyncEngine","User change. New user:",n.toKey()),e.next=5,Dp(r.localStore,n);case 5:return i=e.sent,r.currentUser=n,function(e,t){e.Oa.forEach(function(e){e.forEach(function(e){e.reject(new kl(ml.CANCELLED,t))})}),e.Oa.clear()}(r,"'waitForPendingWrites' promise is rejected due to a user change."),r.sharedClientState.handleUserChange(n,i.removedBatchIds,i.addedBatchIds),e.next=11,Jg(r,i.us);case 11:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ty(e,t){var n=yl(e),r=n.Fa.get(t);if(r&&r.wa)return Of().add(r.key);var i=Of(),a=n.Da.get(t);if(!a)return i;var s,o=rl(a);try{for(o.s();!(s=o.n()).done;){var u=s.value,c=n.ba.get(u);i=i.unionWith(c.view.Ea)}}catch(l){o.e(l)}finally{o.f()}return i}function ny(e){var t=yl(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=Lg.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=ty.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=Fg.bind(null,t),t.Sa.h_=hg.bind(null,t.eventManager),t.Sa.ka=fg.bind(null,t.eventManager),t}function ry(e){var t=yl(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=Vg.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=qg.bind(null,t),t}var iy=function(){function e(){E(this,e),this.synchronizeTabs=!1}var t,n;return S(e,[{key:"initialize",value:(n=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.serializer=tv(t.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(t),this.persistence=this.createPersistence(t),e.next=5,this.persistence.start();case 5:this.localStore=this.createLocalStore(t),this.gcScheduler=this.createGarbageCollectionScheduler(t,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(t,this.localStore);case 8:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"createGarbageCollectionScheduler",value:function(e,t){return null}},{key:"createIndexBackfillerScheduler",value:function(e,t){return null}},{key:"createLocalStore",value:function(e){return function(e,t,n,r){return new Np(e,t,n,r)}(this.persistence,new Rp,e.initialUser,this.serializer)}},{key:"createPersistence",value:function(e){return new xp(Cp.Hr,this.serializer)}},{key:"createSharedClientState",value:function(e){return new Kp}},{key:"terminate",value:(t=_(P.mark(function e(){var t,n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return null===(t=this.gcScheduler)||void 0===t||t.stop(),null===(n=this.indexBackfillerScheduler)||void 0===n||n.stop(),this.sharedClientState.shutdown(),e.next=5,this.persistence.shutdown();case 5:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})}]),e}(),ay=function(){function e(){E(this,e)}var t,n;return S(e,[{key:"initialize",value:(n=_(P.mark(function e(t,n){var r=this;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.localStore,e.t0){e.next=12;break}return this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=function(e){return Ug(r.syncEngine,e,1)},this.remoteStore.remoteSyncer.handleCredentialChange=Zg.bind(null,this.syncEngine),e.next=12,Qv(this.remoteStore,this.syncEngine.isPrimaryClient);case 12:case"end":return e.stop()}},e,this)})),function(e,t){return n.apply(this,arguments)})},{key:"createEventManager",value:function(e){return new sg}},{key:"createDatastore",value:function(e){var t=tv(e.databaseInfo.databaseId),n=function(e){return new Zp(e)}(e.databaseInfo);return function(e,t,n,r){return new sv(e,t,n,r)}(e.authCredentials,e.appCheckCredentials,n,t)}},{key:"createRemoteStore",value:function(e){var t=this;return function(e,t,n,r,i){return new uv(e,t,n,r,i)}(this.localStore,this.datastore,e.asyncQueue,function(e){return Ug(t.syncEngine,e,0)},Wp.D()?new Wp:new Gp)}},{key:"createSyncEngine",value:function(e,t){return function(e,t,n,r,i,a,s){var o=new wg(e,t,n,r,i,a);return s&&(o.La=!0),o}(this.localStore,this.remoteStore,this.eventManager,this.sharedCl
2ientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}},{key:"terminate",value:(t=_(P.mark(function e(){var t;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,function(){var e=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=yl(t),hl("RemoteStore","RemoteStore shutting down."),n.M_.add(5),e.next=5,hv(n);case 5:n.O_.shutdown(),n.N_.set("Unknown");case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()(this.remoteStore);case 2:null===(t=this.datastore)||void 0===t||t.terminate();case 3:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})}]),e}(),sy=function(){function e(t){E(this,e),this.observer=t,this.muted=!1}return S(e,[{key:"next",value:function(e){this.observer.next&&this.Ka(this.observer.next,e)}},{key:"error",value:function(e){this.observer.error?this.Ka(this.observer.error,e):fl("Uncaught Error in snapshot listener:",e.toString())}},{key:"$a",value:function(){this.muted=!0}},{key:"Ka",value:function(e,t){var n=this;this.muted||setTimeout(function(){n.muted||e(t)},0)}}]),e}(),oy=function(){function e(t,n,r,i){var a=this;E(this,e),this.authCredentials=t,this.appCheckCredentials=n,this.asyncQueue=r,this.databaseInfo=i,this.user=ol.UNAUTHENTICATED,this.clientId=Cl.newId(),this.authCredentialListener=function(){return Promise.resolve()},this.appCheckCredentialListener=function(){return Promise.resolve()},this.authCredentials.start(r,function(){var e=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return hl("FirestoreClient","Received user=",t.uid),e.next=3,a.authCredentialListener(t);case 3:a.user=t;case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),this.appCheckCredentials.start(r,function(e){return hl("FirestoreClient","Received new app check token=",e),a.appCheckCredentialListener(e,a.user)})}return S(e,[{key:"configuration",get:function(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}},{key:"setCredentialChangeListener",value:function(e){this.authCredentialListener=e}},{key:"setAppCheckTokenChangeListener",value:function(e){this.appCheckCredentialListener=e}},{key:"verifyNotTerminated",value:function(){if(this.asyncQueue.isShuttingDown)throw new kl(ml.FAILED_PRECONDITION,"The client has already been terminated.")}},{key:"terminate",value:function(){var e=this;this.asyncQueue.enterRestrictedMode();var t=new wl;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(_(P.mark(function n(){var r;return P.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,n.t0=e._onlineComponents,!n.t0){n.next=5;break}return n.next=5,e._onlineComponents.terminate();case 5:if(n.t1=e._offlineComponents,!n.t1){n.next=9;break}return n.next=9,e._offlineComponents.terminate();case 9:e.authCredentials.shutdown(),e.appCheckCredentials.shutdown(),t.resolve(),n.next=18;break;case 14:n.prev=14,n.t2=n.catch(0),r=Zv(n.t2,"Failed to shutdown persistence"),t.reject(r);case 18:case"end":return n.stop()}},n,null,[[0,14]])}))),t.promise}}]),e}();function uy(e,t){return cy.apply(this,arguments)}function cy(){return cy=_(P.mark(function e(t,n){var r,i;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.asyncQueue.verifyOperationInProgress(),hl("FirestoreClient","Initializing OfflineComponentProvider"),r=t.configuration,e.next=4,n.initialize(r);case 4:i=r.initialUser,t.setCredentialChangeListener(function(){var e=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=i.isEqual(t),e.t0){e.next=5;break}return e.next=4,Dp(n.localStore,t);case 4:i=t;case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),n.persistence.setDatabaseDeletedListener(function(){return t.terminate()}),t._offlineComponents=n;case 6:case"end":return e.stop()}},e)})),cy.apply(this,arguments)}function ly(e,t){return hy.apply(this,arguments)}
2function hy(){return(hy=_(P.mark(function e(t,n){var r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.asyncQueue.verifyOperationInProgress(),e.next=3,dy(t);case 3:return r=e.sent,hl("FirestoreClient","Initializing OnlineComponentProvider"),e.next=7,n.initialize(r,t.configuration);case 7:t.setCredentialChangeListener(function(e){return Gv(n.remoteStore,e)}),t.setAppCheckTokenChangeListener(function(e,t){return Gv(n.remoteStore,t)}),t._onlineComponents=n;case 10:case"end":return e.stop()}},e)}))).apply(this,arguments)}function fy(e){return"FirebaseError"===e.name?e.code===ml.FAILED_PRECONDITION||e.code===ml.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}function dy(e){return py.apply(this,arguments)}function py(){return(py=_(P.mark(function e(t){var n;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t._offlineComponents){e.next=21;break}if(!t._uninitializedComponentsProvider){e.next=18;break}return hl("FirestoreClient","Using user provided OfflineComponentProvider"),e.prev=3,e.next=6,uy(t,t._uninitializedComponentsProvider._offline);case 6:e.next=16;break;case 8:if(e.prev=8,e.t0=e.catch(3),fy(n=e.t0)){e.next=13;break}throw n;case 13:return dl("Error using user provided cache. Falling back to memory cache: "+n),e.next=16,uy(t,new iy);case 16:e.next=21;break;case 18:return hl("FirestoreClient","Using default OfflineComponentProvider"),e.next=21,uy(t,new iy);case 21:return e.abrupt("return",t._offlineComponents);case 22:case"end":return e.stop()}},e,null,[[3,8]])}))).apply(this,arguments)}function vy(e){return gy.apply(this,arguments)}function gy(){return(gy=_(P.mark(function e(t){return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=t._onlineComponents,e.t0){e.next=11;break}if(!t._uninitializedComponentsProvider){e.next=8;break}return hl("FirestoreClient","Using user provided OnlineComponentProvider"),e.next=6,ly(t,t._uninitializedComponentsProvider._online);case 6:e.next=11;break;case 8:return hl("FirestoreClient","Using default OnlineComponentProvider"),e.next=11,ly(t,new ay);case 11:return e.abrupt("return",t._onlineComponents);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function yy(e){return vy(e).then(function(e){return e.syncEngine})}function my(e){return ky.apply(this,arguments)}function ky(){return(ky=_(P.mark(function e(t){var n,r;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vy(t);case 2:return n=e.sent,r=n.eventManager,e.abrupt("return",(r.onListen=bg.bind(null,n.syncEngine),r.onUnlisten=Cg.bind(null,n.syncEngine),r.onFirstRemoteStoreListen=Eg.bind(null,n.syncEngine),r.onLastRemoteStoreUnlisten=Og.bind(null,n.syncEngine),r));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function wy(e){var t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}var by=new Map;function _y(e){if(!Fl.isDocumentKey(e))throw new kl(ml.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but ".concat(e," has ").concat(e.length,"."))}function Ey(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e="".concat(e.substring(0,20),"...")),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==c(e)){if(e instanceof Array)return"an array";var t=function(e){return e.constructor?e.constructor.name:null}(e);return t?"a custom ".concat(t," object"):"an object"}return"function"==typeof e?"a function":vl()}function Iy(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new kl(ml.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");var n=Ey(e);throw new kl(ml.INVALID_ARGUMENT,"Expected type '".concat(t.name,"', but it was: ").concat(n))}return e}var Sy=function(){function e(t){var n,r;if(E(this,e),void 0===t.host){if(void 0!==t.ssl)throw new kl(ml.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===(n=t.ssl)||void 0===n||n;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,this.localCache=t.localCache,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new kl(ml.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}(function(e,t,n,r){if(!0===t&&!0===r)throw new kl(ml.INVALID_ARGUMENT,"".concat(e," and ").concat(n," cannot be used together."))})("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===t.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=wy(null!==(r=t.experimentalLongPollingOptions)&&void 0!==r?r:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new kl(ml.INVALID_ARGUMENT,"invali
2d long polling timeout: ".concat(e.timeoutSeconds," (must not be NaN)"));if(e.timeoutSeconds<5)throw new kl(ml.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (minimum allowed value is 5)"));if(e.timeoutSeconds>30)throw new kl(ml.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (maximum allowed value is 30)"))}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!t.useFetchStreams}return S(e,[{key:"isEqual",value:function(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}]),e}(),Ty=function(){function e(t,n,r,i){E(this,e),this._authCredentials=t,this._appCheckCredentials=n,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Sy({}),this._settingsFrozen=!1}return S(e,[{key:"app",get:function(){if(!this._app)throw new kl(ml.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}},{key:"_initialized",get:function(){return this._settingsFrozen}},{key:"_terminated",get:function(){return void 0!==this._terminateTask}},{key:"_setSettings",value:function(e){if(this._settingsFrozen)throw new kl(ml.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Sy(e),void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new _l;switch(e.type){case"firstParty":return new Sl(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new kl(ml.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}},{key:"_getSettings",value:function(){return this._settings}},{key:"_freezeSettings",value:function(){return this._settingsFrozen=!0,this._settings}},{key:"_delete",value:function(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}},{key:"toJSON",value:function(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}},{key:"_terminate",value:function(){return e=this,(t=by.get(e))&&(hl("ComponentProvider","Removing Datastore"),by.delete(e),t.terminate()),Promise.resolve();var e,t}}]),e}(),xy=function(){function e(t,n,r){E(this,e),this.converter=n,this._query=r,this.type="query",this.firestore=t}return S(e,[{key:"withConverter",value:function(t){return new e(this.firestore,t,this._query)}}]),e}(),Ay=function(){function e(t,n,r){E(this,e),this.converter=n,this._key=r,this.type="document",this.firestore=t}return S(e,[{key:"_path",get:function(){return this._key.path}},{key:"id",get:function(){return this._key.path.lastSegment()}},{key:"path",get:function(){return this._key.path.canonicalString()}},{key:"parent",get:function(){return new Cy(this.firestore,this.converter,this._key.path.popLast())}},{key:"withConverter",value:function(t){return new e(this.firestore,t,this._key)}}]),e}(),Cy=function(e){g(n,e);var t=al(n);function n(e,r,i){var a;return E(this,n),(a=t.call(this,e,r,cf(i)))._path=i,a.type="collection",a}return S(n,[{key:"id",get:function(){return this._query.path.lastSegment()}},{key:"path",get:function(){return this._query.path.canonicalString()}},{key:"parent",get:function(){var e=this._path.popLast();return e.isEmpty()?null:new Ay(this.firestore,null,new Fl(e))}},{key:"withConverter",value:function(e){return new n(this.firestore,e,this._path)}}]),n}(xy);function Py(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if(e=ue(e),1===arguments.length&&(t=Cl.newId()),function(e,t,n){if(!n)throw new kl(ml.INVALID_ARGUMENT,"Function ".concat(e,"() cannot be called with an empty ").concat(t,"."))}("doc","path",t),e instanceof Ty){var a=Ll.fromString.apply(Ll,[t].concat(r));return _y(a),new Ay(e,null,new Fl(a))}if(!(e instanceof Ay||e instanceof Cy))throw new kl(ml.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");var s=e._path.child(Ll.fromString.apply(Ll,[t].concat(r)));return _y(s),new Ay(e.firestore,e instanceof Cy?e.converter:null,new Fl(s))}var Oy=function(){function e(){var t=this;E(this,e),this.iu=Promise.resolve(),this.su=[],this.ou=!1,this._u=[],this.au=null,this.uu=!1,this.cu=!1,this.lu=[],this.Yo=new nv(this,"async_queue_retry"),this.hu=function(){var e=ev();e&&hl("AsyncQueue","Visibility state changed to "+e.visibilityState),t.Yo.Wo()};var n=ev();n&&"function"==typeof n.addEventListener&&n.addEventListener("visibilitychange",this.hu)}var t,n;return S(e,[{key:"isShuttingDown",get:function(){return this.ou}},{key:"enqueueAndForget",value:function(e){this.enqueue(e)}},{key:"enqueueAndForgetEvenWhileRestricted",value:function(e){this.Pu(),this.Iu(e)}},{key:"enterRestrictedMode",value:function(e){if(!this.ou){this.ou=!0,this.cu=e||!1;var t=ev();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.hu)}}},{key:"enqueue",value:function(e){var t=this;if(this.Pu(),this.ou)return new Promise(function(){});var n=new wl;return this.Iu(function(){return t.ou&&t.cu?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)}).then(function(){return n.promise})}},{key:"enqueueRetryable",value:function(e){var t=this;this.enqueueAndForget(function(){return t.su.push(e),t.Tu()})}},{key:"Tu",value:(n=_(P.mark(function e(){var t=this;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(0===this.su.length){e.next=14;break}return e.prev=1,e.next=4,this.su[0]();case 4:this.su.shift(),this.Yo.reset(),e.next=13;break;case 8:if(e.prev=8,e.t0=e.catch(1),Gl(e.t0)){e.next=12;break}throw e.t0;case 12:hl("AsyncQueue","Operation failed with retryable error: "+e.t0);case 13:this.su.length>0&&this.Yo.$o(function(){return t.Tu()});case 14:case"end":return e.stop()}},e,this,[[1,8]])})),function(){return n.apply(this,arguments)})},{key:"Iu",value:function(e){var t=this,n=this.iu.then(function(){return t.uu=!0,e().catch(function(e){t.au=e,t.uu=!1;var n=function(e){var t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}(e);
2throw fl("INTERNAL UNHANDLED ERROR: ",n),e}).then(function(e){return t.uu=!1,e})});return this.iu=n,n}},{key:"enqueueAfterDelay",value:function(e,t,n){var r=this;this.Pu(),this.lu.indexOf(e)>-1&&(t=0);var i=$v.createAndSchedule(this,e,t,n,function(e){return r.Eu(e)});return this._u.push(i),i}},{key:"Pu",value:function(){this.au&&vl()}},{key:"verifyOperationInProgress",value:function(){}},{key:"du",value:(t=_(P.mark(function e(){var t;return P.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.iu,e.next=3,t;case 3:if(t!==this.iu){e.next=0;break}case 4:case"end":return e.stop()}},e,this)})),function(){return t.apply(this,arguments)})},{key:"Au",value:function(e){var t,n=rl(this._u);try{for(n.s();!(t=n.n()).done;){if(t.value.timerId===e)return!0}}catch(r){n.e(r)}finally{n.f()}return!1}},{key:"Ru",value:function(e){var t=this;return this.du().then(function(){t._u.sort(function(e,t){return e.targetTimeMs-t.targetTimeMs});var n,r=rl(t._u);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.skipDelay(),"all"!==e&&i.timerId===e)break}}catch(a){r.e(a)}finally{r.f()}return t.du()})}},{key:"Vu",value:function(e){this.lu.push(e)}},{key:"Eu",value:function(e){var t=this._u.indexOf(e);this._u.splice(t,1)}}]),e}(),Ry=function(e){g(n,e);var t=al(n);function n(e,r,i,a){var s;return E(this,n),(s=t.call(this,e,r,i,a)).type="firestore",s._queue=new Oy,s._persistenceKey=(null==a?void 0:a.name)||"[DEFAULT]",s}return S(n,[{key:"_terminate",value:function(){return this._firestoreClient||Dy(this),this._firestoreClient.terminate()}}]),n}(Ty);function Ny(e){return e._firestoreClient||Dy(e),e._firestoreClient.verifyNotTerminated(),e._firestoreClient}function Dy(e){var t,n,r,i=e._freezeSettings(),a=function(e,t,n,r){return new vh(e,t,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,wy(r.experimentalLongPollingOptions),r.useFetchStreams)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,i);e._firestoreClient=new oy(e._authCredentials,e._appCheckCredentials,e._queue,a),(null===(n=i.localCache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(r=i.localCache)||void 0===r?void 0:r._onlineComponentProvider)&&(e._firestoreClient._uninitializedComponentsProvider={_offlineKind:i.localCache.kind,_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider})}var Ly=function(){function e(t){E(this,e),this._byteString=t}return S(e,[{key:"toBase64",value:function(){return this._byteString.toBase64()}},{key:"toUint8Array",value:function(){return this._byteString.toUint8Array()}},{key:"toString",value:function(){return"Bytes(base64: "+this.toBase64()+")"}},{key:"isEqual",value:function(e){return this._byteString.isEqual(e._byteString)}}],[{key:"fromBase64String",value:function(t){try{return new e(oh.fromBase64String(t))}catch(t){throw new kl(ml.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}},{key:"fromUint8Array",value:function(t){return new e(oh.fromUint8Array(t))}}]),e}(),My=function(){function e(){E(this,e);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var i=0;i<n.length;++i)if(0===n[i].length)throw new kl(ml.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Ul(n)}return S(e,[{key:"isEqual",value:function(e){return this._internalPath.isEqual(e._internalPath)}}]),e}(),Uy=S(function e(t){E(this,e),this._methodName=t}),Fy=function(){function e(t,n){if(E(this,e),!isFinite(t)||t<-90||t>90)throw new kl(ml.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(n)||n<-180||n>180)throw new kl(ml.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=t,this._long=n}return S(e,[{key:"latitude",get:function(){return this._lat}},{key:"longitude",get:function(){return this._long}},{key:"isEqual",value:function(e){return this._lat===e._lat&&this._long===e._long}},{key:"toJSON",value:function(){return{latitude:this._lat,longitude:this._long}}},{key:"_compareTo",value:function(e){return Pl(this._lat,e._lat)||Pl(this._long,e._long)}}]),e}(),jy=/^__.*__$/,Vy=function(){function e(t,n,r){E(this,e),this.data=t,this.fieldMask=n,this.fieldTransforms=r}return S(e,[{key:"toMutation",value:function(e,t){return null!==this.fieldMask?new id(e,this.data,this.fieldMask,t,this.fieldTransforms):new rd(e,this.data,t,this.fieldTransforms)}}]),e}(),By=function(){function e(t,n,r){E(this,e),this.data=t,this.fieldMask=n,this.fieldTransforms=r}return S(e,[{key:"toMutation",value:function(e,t){return new id(e,this.data,this.fieldMask,t,this.fieldTransforms)}}]),e}();function qy(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw vl()}}var zy=function(){function e(t,n,r,i,a,s){E(this,e),this.settings=t,this.databaseId=n,this.serializer
2=r,this.ignoreUndefinedProperties=i,void 0===a&&this.mu(),this.fieldTransforms=a||[],this.fieldMask=s||[]}return S(e,[{key:"path",get:function(){return this.settings.path}},{key:"fu",get:function(){return this.settings.fu}},{key:"gu",value:function(t){return new e(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}},{key:"pu",value:function(e){var t,n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.gu({path:n,yu:!1});return r.wu(e),r}},{key:"Su",value:function(e){var t,n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.gu({path:n,yu:!1});return r.mu(),r}},{key:"bu",value:function(e){return this.gu({path:void 0,yu:!0})}},{key:"Du",value:function(e){return tm(e,this.settings.methodName,this.settings.Cu||!1,this.path,this.settings.vu)}},{key:"contains",value:function(e){return void 0!==this.fieldMask.find(function(t){return e.isPrefixOf(t)})||void 0!==this.fieldTransforms.find(function(t){return e.isPrefixOf(t.field)})}},{key:"mu",value:function(){if(this.path)for(var e=0;e<this.path.length;e++)this.wu(this.path.get(e))}},{key:"wu",value:function(e){if(0===e.length)throw this.Du("Document fields must not be empty");if(qy(this.fu)&&jy.test(e))throw this.Du('Document fields cannot begin and end with "__"')}}]),e}(),Hy=function(){function e(t,n,r){E(this,e),this.databaseId=t,this.ignoreUndefinedProperties=n,this.serializer=r||tv(t)}return S(e,[{key:"Fu",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return new zy({fu:e,methodName:t,vu:n,path:Ul.emptyPath(),yu:!1,Cu:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}]),e}();function Ky(e){var t=e._freezeSettings(),n=tv(e._databaseId);return new Hy(e._databaseId,!!t.ignoreUndefinedProperties,n)}function Gy(e,t,n,r,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=e.Fu(a.merge||a.mergeFields?2:0,t,n,i);Jy("Data must be an object, but it was:",s,r);var o,u,c=Yy(r,s);if(a.merge)o=new ah(s.fieldMask),u=s.fieldTransforms;else if(a.mergeFields){var l,h=[],f=rl(a.mergeFields);try{for(f.s();!(l=f.n()).done;){var d=$y(t,l.value,n);if(!s.contains(d))throw new kl(ml.INVALID_ARGUMENT,"Field '".concat(d,"' is specified in your field mask but missing from your input data."));nm(h,d)||h.push(d)}}catch(p){f.e(p)}finally{f.f()}o=new ah(h),u=s.fieldTransforms.filter(function(e){return o.covers(e.field)})}else o=null,u=s.fieldTransforms;return new Vy(new Rh(c),o,u)}var Wy=function(e){g(n,e);var t=al(n);function n(){return E(this,n),t.apply(this,arguments)}return S(n,[{key:"_toFieldTransform",value:function(e){if(2!==e.fu)throw 1===e.fu?e.Du("".concat(this._methodName,"() can only appear at the top level of your update data")):e.Du("".concat(this._methodName,"() cannot be used with set() unless you pass {merge:true}"));return e.fieldMask.push(e.path),null}},{key:"isEqual",value:function(e){return e instanceof n}}]),n}(Uy);function Qy(e,t){if(Xy(e=ue(e)))return Jy("Unsupported field value:",t,e),Yy(e,t);if(e instanceof Uy)return function(e,t){if(!qy(t.fu))throw t.Du("".concat(e._methodName,"() can only be used with update() and set()"));if(!t.path)throw t.Du("".concat(e._methodName,"() is not currently supported inside arrays"));var n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.yu&&4!==t.fu)throw t.Du("Nested arrays are not supported");return function(e,t){var n,r=[],i=0,a=rl(e);try{for(a.s();!(n=a.n()).done;){var s=Qy(n.value,t.bu(i));null==s&&(s={nullValue:"NULL_VALUE"}),r.push(s),i++}}catch(o){a.e(o)}finally{a.f()}return{arrayValue:{values:r}}}(e,t)}return function(e,t){if(null===(e=ue(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return Lf(t.serializer,e);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){var n=Rl.fromDate(e);return{timestampValue:Ud(t.serializer,n)}}if(e instanceof Rl){var r=new Rl(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:Ud(t.serializer,r)}}if(e instanceof Fy)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof Ly)return{bytesValue:Fd(t.serializer,e._byteString)};if(e instanceof Ay){var i=t.databaseId,a=e.firestore._databaseId;if(!a.isEqual(i))throw t.Du("Document reference is for database ".concat(a.projectId,"/").concat(a.database," but should be for database ").concat(i.projectId,"/").concat(i.database));return{referenceValue:Bd(e.firestore._databaseId||t.databaseId,e._key.path)}}throw t.Du("Unsupported field value: ".concat(Ey(e)))}(e,t)}function Yy(e,t){var n={};return Zl(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):$l(e,function(e,r){var i=Qy(r,t.pu(e));null!=i&&(n[e]=i)}),{mapValue:{fields:n}}}function Xy(e){return!("object"!=c(e)||null===e||e instanceof Array||e instanceof Date||e instanceof Rl||e instanceof Fy||e instanceof Ly||e instanceof Ay||e instanceof Uy)}
2function Jy(e,t,n){if(!Xy(n)||!function(e){return"object"==c(e)&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}(n)){var r=Ey(n);throw"an object"===r?t.Du(e+" a custom object"):t.Du(e+" "+r)}}function $y(e,t,n){if((t=ue(t))instanceof My)return t._internalPath;if("string"==typeof t)return em(e,t);throw tm("Field path arguments must be of type string or ",e,!1,void 0,n)}var Zy=new RegExp("[~\\*/\\[\\]]");function em(e,t,n){if(t.search(Zy)>=0)throw tm("Invalid field path (".concat(t,"). Paths must not contain '~', '*', '/', '[', or ']'"),e,!1,void 0,n);try{return O(My,T(t.split(".")))._internalPath}catch(r){throw tm("Invalid field path (".concat(t,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"),e,!1,void 0,n)}}function tm(e,t,n,r,i){var a=r&&!r.isEmpty(),s=void 0!==i,o="Function ".concat(t,"() called with invalid data");n&&(o+=" (via `toFirestore()`)"),o+=". ";var u="";return(a||s)&&(u+=" (found",a&&(u+=" in field ".concat(r)),s&&(u+=" in document ".concat(i)),u+=")"),new kl(ml.INVALID_ARGUMENT,o+e+u)}function nm(e,t){return e.some(function(e){return e.isEqual(t)})}var rm=function(){function e(t,n,r,i,a){E(this,e),this._firestore=t,this._userDataWriter=n,this._key=r,this._document=i,this._converter=a}return S(e,[{key:"id",get:function(){return this._key.path.lastSegment()}},{key:"ref",get:function(){return new Ay(this._firestore,this._converter,this._key)}},{key:"exists",value:function(){return null!==this._document}},{key:"data",value:function(){if(this._document){if(this._converter){var e=new im(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}},{key:"get",value:function(e){if(this._document){var t=this._document.data.field(am("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}]),e}(),im=function(e){g(n,e);var t=al(n);function n(){return E(this,n),t.apply(this,arguments)}return S(n,[{key:"data",value:function(){return d(f(n.prototype),"data",this).call(this)}}]),n}(rm);function am(e,t){return"string"==typeof t?em(e,t):t instanceof My?t._internalPath:t._delegate._internalPath}var sm=function(){function e(){E(this,e)}return S(e,[{key:"convertValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";switch(mh(e)){case 0:return null;case 1:return e.booleanValue;case 2:return lh(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(hh(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 10:return this.convertObject(e.mapValue,t);default:throw vl()}}},{key:"convertObject",value:function(e,t){return this.convertObjectMap(e.fields,t)}},{key:"convertObjectMap",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none",r={};
2return $l(e,function(e,i){r[e]=t.convertValue(i,n)}),r}},{key:"convertGeoPoint",value:function(e){return new Fy(lh(e.latitude),lh(e.longitude))}},{key:"convertArray",value:function(e,t){var n=this;return(e.values||[]).map(function(e){return n.convertValue(e,t)})}},{key:"convertServerTimestamp",value:function(e,t){switch(t){case"previous":var n=dh(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(ph(e));default:return null}}},{key:"convertTimestamp",value:function(e){var t=ch(e);return new Rl(t.seconds,t.nanos)}},{key:"convertDocumentKey",value:function(e,t){var n=Ll.fromString(e);gl(op(n));var r=new gh(n.get(1),n.get(3)),i=new Fl(n.popFirst(5));return r.isEqual(t)||fl("Document ".concat(i," contains a document reference within a different database (").concat(r.projectId,"/").concat(r.database,") which is not supported. It will be treated as a reference in the current database (").concat(t.projectId,"/").concat(t.database,") instead.")),i}}]),e}();var om=function(){function e(t,n){E(this,e),this.hasPendingWrites=t,this.fromCache=n}return S(e,[{key:"isEqual",value:function(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}]),e}(),um=function(e){g(n,e);var t=al(n);function n(e,r,i,a,s,o){var u;return E(this,n),(u=t.call(this,e,r,i,a,o))._firestore=e,u._firestoreImpl=e,u.metadata=s,u}return S(n,[{key:"exists",value:function(){return d(f(n.prototype),"exists",this).call(this)}},{key:"data",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._document){if(this._converter){var t=new cm(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._document){var n=this._document.data.field(am("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}}]),n}(rm),cm=function(e){g(n,e);var t=al(n);function n(){return E(this,n),t.apply(this,arguments)}return S(n,[{key:"data",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d(f(n.prototype),"data",this).call(this,e)}}]),n}(um);function lm(e){e=Iy(e,Ay);var t=Iy(e.firestore,Ry);return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new wl;return e.asyncQueue.enqueueAndForget(_(P.mark(function i(){return P.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.t0=function(e,t,n,r,i){var a=new sy({next:function(a){t.enqueueAndForget(function(){return cg(e,s)});var o=a.docs.has(n);!o&&a.fromCache?i.reject(new kl(ml.UNAVAILABLE,"Failed to get document because the client is offline.")):o&&a.fromCache&&r&&"server"===r.source?i.reject(new kl(ml.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(a)},error:function(e){return i.reject(e)}}),s=new pg(cf(n.path),a,{includeMetadataChanges:!0,ra:!0});return og(e,s)},i.next=3,my(e);case 3:return i.t1=i.sent,i.t2=e.asyncQueue,i.t3=t,i.t4=n,i.t5=r,i.abrupt("return",(0,i.t0)(i.t1,i.t2,i.t3,i.t4,i.t5));case 9:case"end":return i.stop()}},i)}))),r.promise}(Ny(t),e._key).then(function(n){return function(e,t,n){var r=n.docs.get(t._key),i=new hm(e);return new um(e,i,t._key,r,new om(n.hasPendingWrites,n.fromCache),t.converter)}(t,e,n)})}var hm=function(e){g(n,e);var t=al(n);function n(e){var r;return E(this,n),(r=t.call(this)).firestore=e,r}return S(n,[{key:"convertBytes",value:function(e){return new Ly(e)}},{key:"convertReference",value:function(e){var t=this.convertDocumentKey(e,this.firestore._databaseId);return new Ay(this.firestore,null,t)}}]),n}(sm);function fm(e,t,n){e=Iy(e,Ay);var r=Iy(e.firestore,Ry),i=function(e,t,n){return e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t}(e.converter,t,n);return pm(r,[Gy(Ky(r),"setDoc",e._key,i,null!==e.converter,n).toMutation(e._key,Yf.none())])}function dm(e,t,n){e=Iy(e,Ay);for(var r,i=Iy(e.firestore,Ry),a=Ky(i),s=arguments.length,o=new Array(s>3?s-3:0),u=3;u<s;u++)o[u-3]=arguments[u];return r="string"==typeof(t=ue(t))||t instanceof My?function(e,t,n,r,i,a){var s=e.Fu(1,t,n),o=[$y(t,r,n)],u=[i];if(a.length%2!=0)throw new kl(ml.INVALID_ARGUMENT,"Function ".concat(t,"() needs to be called with an even number of arguments that alternate between field names and values."));for(var c=0;c<a.length;c+=2)o.push($y(t,a[c])),u.push(a[c+1]);for(var l=[],h=Rh.empty(),f=o.length-1;f>=0;--f)if(!nm(l,o[f])){var d=o[f],p=u[f];p=ue(p);var v=s.Su(d);if(p instanceof Wy)l.push(d);else{var g=Qy(p,v);null!=g&&(l.push(d),h.set(d,g))}}var y=new ah(l);return new By(h,y,s.fieldTransforms)}(a,"updateDoc",e._key,t,n,o):function(e,t,n,r){var i=e.Fu(1,t,n);Jy("Data must be an object, but it was:",i,r);var a=[],s=Rh.empty();$l(r,function(e,r){var o=em(t,e,n);r=ue(r);var u=i.Su(o);if(r instanceof Wy)a.push(o);else{var c=Qy(r,u);null!=c&&(a.push(o),s.set(o,c))}});var o=new ah(a);return new By(s,o,i.fieldTransforms)}(a,"updateDoc",e._key,t),pm(i,[r.toMutation(e._key,Yf.exists(!0))])}function pm(e,t){return function(e,t){var n=new wl;return e.asyncQueue.enqueueAndForget(_(P.mark(function r(){return P.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.t0=Ng,r.next=3,yy(e);case 3:return r.t1=r.sent,r.t2=t,r.t3=n,r.abrupt("return",(0,r.t0)(r.t1,r.t2,r.t3));case 7:case"end":return r.stop()}},r)}))),n.promise}(Ny(e),t)}!function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];!function(e){ul=e}
2(st),et(new he("firestore",function(e,n){var r=n.instanceIdentifier,i=n.options,a=e.getProvider("app").getImmediate(),s=new Ry(new El(e.getProvider("auth-internal")),new xl(e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new kl(ml.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new gh(e.options.projectId,t)}(a,r),a);return i=Object.assign({useFetchStreams:t},i),s._setSettings(i),s},"PUBLIC").setMultipleInstances(!0)),ct(sl,"4.6.3",e),ct(sl,"4.6.3","esm2017")}();class vm{constructor(e){if(this.config=e,this.authObjectInitialized=!1,this.isUserDeletionInProgress=!1,this.updateUserDisplayName=(e,t)=>h(this,void 0,void 0,function*(){return this.handleResponse(()=>h(this,void 0,void 0,function*(){return e.displayName!==t?function(e,t){return Oi.apply(this,arguments)}(e,{displayName:t}):{}}))}),this.signUp=({email:e="",password:t,attributes:n})=>h(this,void 0,void 0,function*(){let r=null;try{return r=yield function(e,t,n){return Ii.apply(this,arguments)}(this.auth,e,t),yield fm(Py(this.userDataStore,this.config.userAttrCollectionName,r.user.uid),Object.assign({},n)),yield Ti(r.user),yield this.updateUserDisplayName(r.user,(null==n?void 0:n.given_name)||""),Object.assign({success:!0},r)}catch(i){return r&&(yield this.deleteUser(r.user)),{success:!1,message:i.message,code:i.code}}}),this.signIn=e=>h(this,void 0,void 0,function*(){return this.handleResponse(()=>h(this,void 0,void 0,function*(){return this.getCurrentUser()&&(yield this.signOut(),"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(Iu.onAuthStateChange))),Si(this.auth,e.email,e.password)}))}),this.federatedSignIn=({provider:e,userAttributes:t})=>h(this,void 0,void 0,function*(){return this.handleResponse(()=>h(this,void 0,void 0,function*(){const n=this.getAuthProvider(e),r=yield function(e,t,n){return Ta.apply(this,arguments)}(this.auth,n),i=Vi(r);return(null==i?void 0:i.isNewUser)&&(yield fm(Py(this.userDataStore,this.config.userAttrCollectionName,r.user.uid),null!=t?t:{})),r}))}),this.signOut=()=>h(this,void 0,void 0,function*(){return this.handleResponse(()=>h(this,void 0,void 0,function*(){return ue(this.auth).signOut()}))}),this.getUserProvidersId=e=>e.providerData.map(e=>e.providerId),this.reauthenticateCurrentUser=e=>h(this,void 0,void 0,function*(){const t=this.getCurrentUser();return t?this.handleResponse(()=>h(this,void 0,void 0,function*(){const n=this.getUserProvider(t);if(n===Pt){if(e.password)return this.reauthenticateWithPassword(t,e.password||"");throw new Error("Missing password parameter")}return this.reauthenticateExternalProvider(t,n)})):{success:!1,code:"auth-custom/reauthentication-impossible"}}),this.getCurrentUser=()=>this.authObjectInitialized?this.auth.currentUser:void 0,this.deleteUser=e=>h(this,void 0,void 0,function*(){const t=()=>{this.isUserDeletionInProgress=!1};return this.handleResponse(()=>h(this,void 0,void 0,function*(){var t;this.isUserDeletionInProgress=!0,yield(t=Py(this.userDataStore,this.config.userAttrCollectionName,e.uid),pm(Iy(t.firestore,Ry),[new ld(t._key,Yf.none())])),yield e.delete()}),t,t)}),this.reloadUser=()=>h(this,void 0,void 0,function*(){const e=this.getCurrentUser();yield null==e?void 0:e.reload()}),this.confirmSignUp=({verificationCode:e})=>h(this,void 0,void 0,function*(){return this.handleResponse(()=>h(this,void 0,void 0,function*(){yield _i(this.auth,e),yield this.reloadUser(),"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(Iu.onAuthStateChange,{detail:{user:this.getCurrentUser()}}))}))}),this.authStateChangedObserver=e=>{const{customSignInEvent:t}=e||{};var n,r,i,a;n=this.auth,r=e=>{this.authObjectInitialized=!0,"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(Iu.onAuthStateChange,{detail:{user:e,suppressUserAccessValidation:this.isUserDeletionInProgress}})),(null==e?void 0:e.emailVerified)&&"function"==typeof t&&t()},ue(n).onAuthStateChanged(r,i,a)},this.forgotPassword=e=>h(this,void 0,void 0,function*(){return this.handleResponse(()=>h(this,void 0,void 0,function*(){if(e.userIdentifier.type===Tu.Email)return function(e,t,n){return wi.apply(this,arguments)}(this.auth,e.userIdentifier.value);throw new Error("Invalid user identifier type")}))}),this.resetPassword=e=>h(this,void 0,void 0,function*(){return this.handleResponse(()=>h(this,void 0,void 0,function*(){return function(e,t,n){return bi.apply(this,arguments)}(this.auth,e.oobCode,e.newPassword)}))}),this.getUserAttributes=()=>h(this,void 0,void 0,function*(){return this.handleResponse(()=>h(this,void 0,void 0,function*(){const e=this.getCurrentUser();return{attributes:(yield lm(Py(this.userDataStore,this.config.userAttrCollectionName,(null==e?void 0:e.uid)||""))).data()}}))}),this.getCurrentUserStatus=()=>h(this,void 0,void 0,function*(){return this.handleResponse(()=>h(this,void 0,void 0,function*(){var e;const t=this.getCurrentUser();if(!t)throw new Error("No user is currently signed in");return{status:null===(e=(yield lm(Py(this.userDataStore,this.config.userAttrCollectionName,t.uid))).data())||void 0===e?void 0:e.status}}))}),this.setUserAttributes=e=>h(this,void 0,void 0,function*(){return this.handleResponse(()=>h(this,void 0,void 0,function*(){const t=this.getCurrentUser();yield dm(Py(this.userDataStore,this.config.userAttrCollectionName,(null==t?void 0:t.uid)||""),e)}))}),this.changePassword=e=>h(this,void 0,void 0,function*(){return this.handleResponse(()=>h(this,void 0,void 0,function*(){const{user:t,password:n,currentPassword:r}=e;yield this.reauthenticateWithPassword(t,r),yield Ri(t,n)}))}),this.resendSignUp=()=>h(this,void 0,void 0,function*(){return this.handleResponse(()=>h(this,void 0,void 0,function*(){const e=this.getCurrentUser();if(!e)throw new Error("Missing user data");return Ti(e)}))}),this.getAvailableSocialSignIn=()=>({[Su.Facebook]:Boolean(this.config.hasFacebookSignIn),[Su.Google]:Boolean(this.config.hasGoogleSignIn)}),this.getRememberMeConfig=()=>this.config.rememberMeConfig||{show:!1,defaultValue:!1},this.setAuthStatePersistence=e=>h(this,void 0,void 0,function*(){return this.handleResponse(()=>h(this,void 0,void 0,function*(){const t=e?ya:Gi;var n,r;yield(n=this.auth,r=t,ue(n).setPersistence(r))}))}),this.changeEmail=(e,t)=>this.handleResponse(()=>h(this,void 0,void 0,function*(){return function(e,t,n){return Ai.apply(this,arguments)}(e,t)})),this.verifyCodeForEmailChange=({verificationCode:e})=>h(this,void 0,void 0,function*(){return this.handleResponse(()=>h(this,void 0,void 0,function*(){yield _i(this.auth,e),yield this.signOut()}))}),this.getUserProvider=e=>{const t=new Set(this.getUserProvidersId(e));if(t.has(Pt))return Pt;if(t.has(At))return Su.Facebook;if(t.has(Ct))return Su.Google;throw Error(`Unknown user provider: ${JSON.stringify(t)}`)},this.reauthenticateWithPassword=(e,t)=>function(e,t){return gi.apply(this,arguments)}
2(e,$r.credential(e.email||"",t)),this.reauthenticateExternalProvider=(e,t)=>function(e,t,n){return xa.apply(this,arguments)}(e,this.getAuthProvider(t)),this.handleResponse=(e,t,n)=>h(this,void 0,void 0,function*(){try{const t=yield e();return null==n||n(),Object.assign(Object.assign({},t),{success:!0})}catch(r){return null==t||t(),Object.assign(Object.assign({},r),{success:!1})}}),this.getAuthProvider=e=>{switch(e){case Su.Google:return new ni;case Su.Facebook:return new ti;default:throw Error(`No provider with name: ${e}`)}},this.app=ot(this.config.firebaseOptions),this.auth=ws(this.app),this.userDataStore=function(e,t,n){n||(n="(default)");var r=tt(e,"firestore");if(r.isInitialized(n)){var i=r.getImmediate({identifier:n});if(ee(r.getOptions(n),t))return i;throw new kl(ml.FAILED_PRECONDITION,"initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.")}if(void 0!==t.cacheSizeBytes&&void 0!==t.localCache)throw new kl(ml.INVALID_ARGUMENT,"cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");if(void 0!==t.cacheSizeBytes&&-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new kl(ml.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return r.initialize({options:t,instanceIdentifier:n})}(this.app,{ignoreUndefinedProperties:!0}),"undefined"!=typeof window){const e={}.GATSBY_FIREBASE_RECAPTCHA_PUBLIC_KEY,t="true"==={}.FIREBASE_RECAPTCHA_USE_DEBUG_TOKEN,n={}.APP_CHECK_DEBUG_TOKEN_FROM_CI;e&&(n?window.FIREBASE_APPCHECK_DEBUG_TOKEN=n:t&&(window.FIREBASE_APPCHECK_DEBUG_TOKEN=!0),jc(this.app,{provider:new Mc(e),isTokenAutoRefreshEnabled:!0}))}}}var gm=function(){this.__data__=[],this.size=0};var ym=function(e,t){return e===t||e!=e&&t!=t},mm=ym;var km=function(e,t){for(var n=e.length;n--;)if(mm(e[n][0],t))return n;return-1},wm=km,bm=Array.prototype.splice;var _m=km;var Em=km;var Im=km;var Sm=gm,Tm=function(e){var t=this.__data__,n=wm(t,e);return!(n<0)&&(n==t.length-1?t.pop():bm.call(t,n,1),--this.size,!0)},xm=function(e){var t=this.__data__,n=_m(t,e);return n<0?void 0:t[n][1]},Am=function(e){return Em(this.__data__,e)>-1},Cm=function(e,t){var n=this.__data__,r=Im(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function Pm(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Pm.prototype.clear=Sm,Pm.prototype.delete=Tm,Pm.prototype.get=xm,Pm.prototype.has=Am,Pm.prototype.set=Cm;var Om=Pm,Rm=Om;var Nm=function(){this.__data__=new Rm,this.size=0};var Dm=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var Lm=function(e){return this.__data__.get(e)};var Mm=function(e){return this.__data__.has(e)},Um=po(Object,"create"),Fm=Um;var jm=function(){this.__data__=Fm?Fm(null):{},this.size=0};var Vm=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Bm=Um,qm=Object.prototype.hasOwnProperty;var zm=function(e){var t=this.__data__;if(Bm){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return qm.call(t,e)?t[e]:void 0},Hm=Um,Km=Object.prototype.hasOwnProperty;var Gm=Um;var Wm=jm,Qm=Vm,Ym=zm,Xm=function(e){var t=this.__data__;return Hm?void 0!==t[e]:Km.call(t,e)},Jm=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Gm&&void 0===t?"__lodash_hash_undefined__":t,this};function $m(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}$m.prototype.clear=Wm,$m.prototype.delete=Qm,$m.prototype.get=Ym,$m.prototype.has=Xm,$m.prototype.set=Jm;var Zm=$m,ek=Om,tk=go;var nk=function(e){var t=c(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var rk=function(e,t){var n=e.__data__;return nk(t)?n["string"==typeof t?"string":"hash"]:n.map},ik=rk;var ak=rk;var sk=rk;var ok=rk;var uk=function(){this.size=0,this.__data__={hash:new Zm,map:new(tk||ek),string:new Zm}},ck=function(e){var t=ik(this,e).delete(e);return this.size-=t?1:0,t},lk=function(e){return ak(this,e).get(e)},hk=function(e){return sk(this,e).has(e)},fk=function(e,t){var n=ok(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function dk(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}dk.prototype.clear=uk,dk.prototype.delete=ck,dk.prototype.get=lk,dk.prototype.has=hk,dk.prototype.set=fk;var pk=dk,vk=Om,gk=go,yk=pk;var mk=Om,kk=Nm,wk=Dm,bk=Lm,_k=Mm,Ek=function(e,t){var n=this.__data__;if(n instanceof vk){var r=n.__data__;if(!gk||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new yk(r)}return n.set(e,t),this.size=n.size,this};function Ik(e){var t=this.__data__=new mk(e);this.size=t.size}Ik.prototype.clear=kk,Ik.prototype.delete=wk,Ik.prototype.get=bk,Ik.prototype.has=_k,Ik.prototype.set=Ek;var Sk=Ik;var Tk=function(e,t){for(var n=-1,r=null==e?0:e.length;
vendor: 9,421 bytes, line 2
2++n<r&&!1!==t(e[n],n,e););return e},xk=po,Ak=function(){try{var e=xk(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();var Ck=function(e,t,n){"__proto__"==t&&Ak?Ak(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},Pk=Ck,Ok=ym,Rk=Object.prototype.hasOwnProperty;var Nk=function(e,t,n){var r=e[t];Rk.call(e,t)&&Ok(r,n)&&(void 0!==n||t in e)||Pk(e,t,n)},Dk=Nk,Lk=Ck;var Mk=function(e,t,n,r){var i=!n;n||(n={});for(var a=-1,s=t.length;++a<s;){var o=t[a],u=r?r(n[o],e[o],o,n,e):void 0;void 0===u&&(u=e[o]),i?Lk(n,o,u):Dk(n,o,u)}return n};var Uk=/^(?:0|[1-9]\d*)$/;var Fk=function(e,t){var n=c(e);return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Uk.test(e))&&e>-1&&e%1==0&&e<t},jk=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r},Vk=Ko,Bk=Go,qk=Jo.exports,zk=Fk,Hk=lu,Kk=Object.prototype.hasOwnProperty;var Gk=function(e,t){var n=Bk(e),r=!n&&Vk(e),i=!n&&!r&&qk(e),a=!n&&!r&&!i&&Hk(e),s=n||r||i||a,o=s?jk(e.length,String):[],u=o.length;for(var c in e)!t&&!Kk.call(e,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||a&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||zk(c,u))||o.push(c);return o},Wk=Gk,Qk=As,Yk=Xo;var Xk=function(e){return Yk(e)?Wk(e):Qk(e)},Jk=Mk,$k=Xk;var Zk=function(e,t){return e&&Jk(t,$k(t),e)};var ew=Ks,tw=_s,nw=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},rw=Object.prototype.hasOwnProperty;var iw=Gk,aw=function(e){if(!ew(e))return nw(e);var t=tw(e),n=[];for(var r in e)("constructor"!=r||!t&&rw.call(e,r))&&n.push(r);return n},sw=Xo;var ow=function(e){return sw(e)?iw(e,!0):aw(e)},uw=Mk,cw=ow;var lw=function(e,t){return e&&uw(t,cw(t),e)},hw={exports:{}};!function(e,t){var n=Rs,r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,a=i&&i.exports===r?n.Buffer:void 0,s=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=s?s(n):new e.constructor(n);return e.copy(r),r}}(hw,hw.exports);var fw=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t};var dw=function(){return[]},pw=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var s=e[n];t(s,n,e)&&(a[i++]=s)}return a},vw=dw,gw=Object.prototype.propertyIsEnumerable,yw=Object.getOwnPropertySymbols,mw=yw?function(e){return null==e?[]:(e=Object(e),pw(yw(e),function(t){return gw.call(e,t)}))}:vw,kw=Mk,ww=mw;var bw=function(e,t){return kw(e,ww(e),t)};var _w=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e},Ew=Es(Object.getPrototypeOf,Object),Iw=_w,Sw=Ew,Tw=mw,xw=dw,Aw=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Iw(t,Tw(e)),e=Sw(e);return t}:xw,Cw=Mk,Pw=Aw;var Ow=function(e,t){return Cw(e,Pw(e),t)},Rw=_w,Nw=Go;var Dw=function(e,t,n){var r=t(e);return Nw(e)?r:Rw(r,n(e))},Lw=Dw,Mw=mw,Uw=Xk;var Fw=function(e){return Lw(e,Uw,Mw)},jw=Dw,Vw=Aw,Bw=ow;var qw=function(e){return jw(e,Bw,Vw)},zw=Object.prototype.hasOwnProperty;var Hw=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&zw.call(e,"index")&&(n.index=e.index,n.input=e.input),n},Kw=Rs.Uint8Array,Gw=Kw;var Ww=function(e){var t=new e.constructor(e.byteLength);return new Gw(t).set(new Gw(e)),t},Qw=Ww;var Yw=function(e,t){var n=t?Qw(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)},Xw=/\w*$/;var Jw=function(e){var t=new e.constructor(e.source,Xw.exec(e));return t.lastIndex=e.lastIndex,t},$w=Ns?Ns.prototype:void 0,Zw=$w?$w.valueOf:void 0;var eb=Ww;var tb=Ww,nb=Yw,rb=Jw,ib=function(e){return Zw?Object(Zw.call(e)):{}},ab=function(e,t){var n=t?eb(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)};var sb=function(e,t,n){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return tb(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return nb(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ab(e,n);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return rb(e);case"[object Symbol]":return ib(e)}},ob=Ks,ub=Object.create,cb=function(){function e(){}return function(t){if(!ob(t))return{};if(ub)return ub(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),lb=Ew,hb=_s;var fb=function(e){return"function"!=typeof e.constructor||hb(e)?{}:cb(lb(e))},db=Lo,pb=Mo;var vb=function(e){return pb(e)&&"[object Map]"==db(e)},gb=iu,yb=au.exports,mb=yb&&yb.isMap,kb=mb?gb(mb):vb,wb=Lo,bb=Mo;var _b=function(e){return bb(e)&&"[object Set]"==wb(e)},Eb=iu,Ib=au.exports,Sb=Ib&&Ib.isSet,Tb=Sb?Eb(Sb):_b,xb=Sk,Ab=Tk,Cb=Nk,Pb=Zk,Ob=lw,Rb=hw.exports,Nb=fw,Db=bw,Lb=Ow,Mb=Fw,Ub=qw,Fb=Lo,jb=Hw,Vb=sb,Bb=fb,qb=Go,zb=Jo.exports,Hb=kb,Kb=Ks,Gb=Tb,Wb=Xk,Qb=ow,Yb="[object Arguments]",Xb="[object Function]",Jb="[object Object]",$b={};$b[Yb]=$b["[object Array]"]=$b["[object ArrayBuffer]"]=$b["[object DataView]"]=$b["[object Boolean]"]=$b["[object Date]"]=$b["[object Float32Array]"]=$b["[object Float64Array]"]=$b["[object Int8Array]"]=$b["[object Int16Array]"]=$b["[object Int32Array]"]=$b["[object Map]"]=$b["[object Number]"]=$b[Jb]=$b["[object RegExp]"]=$b["[object Set]"]=$b["[object String]"]=$b["[object Symbol]"]=$b["[object Uint8Array]"]=$b["[object Uint8ClampedArray]"]=$b["[object Uint16Array]"]=$b["[object Uint32Array]"]=!0,$b["[object Error]"]=$b[Xb]=$b["[object WeakMap]"]=!1;var Zb=function e(t,n,r,i,a,s){var o,u=1&n,c=2&n,l=4&n;if(r&&(o=a?r(t,i,a,s):r(t)),void 0!==o)return o;if(!Kb(t))return t;var h=qb(t);if(h){if(o=jb(t),!u)return Nb(t,o)}else{var f=Fb(t),d=f==Xb||"[object GeneratorFunction]"==f;if(zb(t))return Rb(t,u);if(f==Jb||f==Yb||d&&!a){if(o=c||d?{}:Bb(t),!u)return c?Lb(t,Ob(o,t)):Db(t,Pb(o,t))}else{if(!$b[f])return a?t:{};o=Vb(t,f,u)}}s||(s=new xb);var p=s.get(t);if(p)return p;s.set(t,o),Gb(t)?t.forEach(function(i){o.add(e(i,n,r,i,t,s))}):Hb(t)&&t.forEach(function(i,a){o.set(a,e(i,n,r,a,t,s))});var v=h?void 0:(l?c?Ub:Mb:c?Qb:Wb)(t);return Ab(v||t,function(i,a){v&&(i=t[a=i]),Cb(o,a,e(i,n,r,a,t,s))}),o},e_=Zb;var t_=function(e){return e_(e,5)},n_=Hs,r_=Mo;var i_=function(e){return"symbol"==c(e)||r_(e)&&"[object Symbol]"==n_(e)},a_=Go,s_=i_,o_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,u_=/^\w*$/;var c_=function(e,t){if(a_(e))return!1;var n=c(e);return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!s_(e))||(u_.test(e)||!o_.test(e)||null!=t&&e in Object(t))},l_=pk;function h_(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function n(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var s=e.apply(this,r);return n.cache=a.set(i,s)||a,s};return n.cache=new(h_.Cache||l_),n}h_.Cache=l_;var f_=h_;var d_=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,p_=/\\(\\)?/g,v_=function(e){var t=f_(e,function(e){return 500===n.size&&n.clear(),e}),n=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(d_,function(e,n,r,i){t.push(r?i.replace(p_,"$1"):n||e)}),t});var g_=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i},y_=Go,m_=i_,k_=Ns?Ns.prototype:void 0,w_=k_?k_.toString:void 0;var b_=function e(t){if("string"==typeof t)return t;if(y_(t))return g_(t,e)+"";if(m_(t))return w_?w_.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n},__=b_;var E_=Go,I_=c_,S_=v_,T_=function(e){return null==e?"":__(e)};var x_=function(e,t){return E_(e)?e:I_(e,t)?[e]:S_(T_(e))},A_=i_;var C_=function(e){if("string"==typeof e||A_(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},P_=x_,O_=C_;var R_=function(e,t){for(var n=0,r=(t=P_(t,e)).length;null!=e&&n<r;)e=e[O_(t[n++])];return n&&n==r?e:void 0};var N_=function(e,t,n){var r=null==e?void 0:R_(e,t);return void 0===r?n:r},D_=Object.prototype.hasOwnProperty;var L_=x_,M_=Ko,U_=Go,F_=Fk,j_=Wo,V_=C_;var B_=function(e,t){return null!=e&&D_.call(e,t)},q_=function(e,t,n){for(var r=-1,i=(t=L_(t,e)).length,a=!1;++r<i;){var s=V_(t[r]);if(!(a=null!=e&&n(e,s)))break;e=e[s]}return a||++r!=i?a:!!(i=null==e?0:e.length)&&j_(i)&&F_(s,i)&&(U_(e)||M_(e))};var z_=function(e,t){return null!=e&&q_(e,t,B_)};var H_=pk,K_=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},G_=function(e){return this.__data__.has(e)};function W_(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new H_;++t<n;)this.add(e[t])}W_.prototype.add=W_.prototype.push=K_,W_.prototype.has=G_;var Q_=W_,Y_=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1},X_=function(e,t){return e.has(t)};var J_=function(e,t,n,r,i,a){var s=1&n,o=e.length,u=t.length;if(o!=u&&!(s&&u>o))return!1;var c=a.get(e),l=a.get(t);if(c&&l)return c==t&&l==e;var h=-1,f=!0,d=2&n?new Q_:void 0;for(a.set(e,t),a.set(t,e);++h<o;){var p=e[h],v=t[h];if(r)var g=s?r(v,p,h,t,e,a):r(p,v,h,e,t,a);if(void 0!==g){if(g)continue;f=!1;break}if(d){if(!Y_(t,function(e,t){if(!X_(d,t)&&(p===e||i(p,e,n,r,a)))return d.push(t)})){f=!1;break}}else if(p!==v&&!i(p,v,n,r,a)){f=!1;break}}return a.delete(e),a.delete(t),f};var $_=Kw,Z_=ym,eE=J_,tE=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n},nE=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}
vendor: 1,880 bytes, line 2
2,rE=Ns?Ns.prototype:void 0,iE=rE?rE.valueOf:void 0;var aE=function(e,t,n,r,i,a,s){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new $_(e),new $_(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Z_(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var o=tE;case"[object Set]":var u=1&r;if(o||(o=nE),e.size!=t.size&&!u)return!1;var c=s.get(e);if(c)return c==t;r|=2,s.set(e,t);var l=eE(o(e),o(t),r,i,a,s);return s.delete(e),l;case"[object Symbol]":if(iE)return iE.call(e)==iE.call(t)}return!1},sE=Fw,oE=Object.prototype.hasOwnProperty;var uE=Sk,cE=J_,lE=aE,hE=function(e,t,n,r,i,a){var s=1&n,o=sE(e),u=o.length;if(u!=sE(t).length&&!s)return!1;for(var c=u;c--;){var l=o[c];if(!(s?l in t:oE.call(t,l)))return!1}var h=a.get(e),f=a.get(t);if(h&&f)return h==t&&f==e;var d=!0;a.set(e,t),a.set(t,e);for(var p=s;++c<u;){var v=e[l=o[c]],g=t[l];if(r)var y=s?r(g,v,l,t,e,a):r(v,g,l,e,t,a);if(!(void 0===y?v===g||i(v,g,n,r,a):y)){d=!1;break}p||(p="constructor"==l)}if(d&&!p){var m=e.constructor,k=t.constructor;m==k||!("constructor"in e)||!("constructor"in t)||"function"==typeof m&&m instanceof m&&"function"==typeof k&&k instanceof k||(d=!1)}return a.delete(e),a.delete(t),d},fE=Lo,dE=Go,pE=Jo.exports,vE=lu,gE="[object Arguments]",yE="[object Array]",mE="[object Object]",kE=Object.prototype.hasOwnProperty;var wE=function(e,t,n,r,i,a){var s=dE(e),o=dE(t),u=s?yE:fE(e),c=o?yE:fE(t),l=(u=u==gE?mE:u)==mE,h=(c=c==gE?mE:c)==mE,f=u==c;if(f&&pE(e)){if(!pE(t))return!1;s=!0,l=!1}if(f&&!l)return a||(a=new uE),s||vE(e)?cE(e,t,n,r,i,a):lE(e,t,u,n,r,i,a);if(!(1&n)){var d=l&&kE.call(e,"__wrapped__"),p=h&&kE.call(t,"__wrapped__");
2if(d||p){var v=d?e.value():e,g=p?t.value():t;return a||(a=new uE),i(v,g,n,r,a)}}return!!f&&(a||(a=new uE),hE(e,t,n,r,i,a))},bE=Mo;var _E=function e(t,n,r,i,a){return t===n||(null==t||null==n||!bE(t)&&!bE(n)?t!=t&&n!=n:wE(t,n,r,i,e,a))},EE=_E;var IE=function(e,t){return EE(e,t)};const SE={email:{id:"email",type:_u.textbox,showInSignUp:!0,showInProfile:!0,showInSignIn:!0,isRequired:!0,regex:/^[a-z0-9.!#$%&â*+\/=?^_`{|}~-]+@[a-z0-9-]+(?:\.[a-z0-9-]+)+$/,category:wu.UserDetails,showInEdit:!0,showInPreview:!0,isRequiredInEdit:!0,order:{signUp:1,signIn:1,profile:3}},currentPassword:{id:"currentPassword",type:_u.password,showInSignUp:!1,showInProfile:!0,showInSignIn:!1,isRequired:!1,category:wu.Security,showInEdit:!0,showInPreview:!1,isRequiredInEdit:!0,requiredIf:["password"]},loginPassword:{id:"loginPassword",type:_u.password,showInSignUp:!1,showInProfile:!0,showInSignIn:!0,isRequired:!0,category:wu.Security,showInEdit:!0,showInPreview:!1,isRequiredInEdit:!0,order:{signIn:2}},password:{id:"password",type:_u.password,showInSignUp:!0,showInProfile:!0,isRequired:!0,showInSignIn:!1,regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[+=^$*.[\]{}()?\-â!@#%&/,><':;|_~`])\S{8,99}$/,category:wu.Security,showInEdit:!0,showInPreview:!0,isRequiredInEdit:!0,requiredIf:["currentPassword"],order:{signUp:2}},confirmPassword:{id:"confirmPassword",type:_u.password,showInSignUp:!0,showInProfile:!1,isRequired:!0,showInSignIn:!1,category:wu.Security,sameAs:"password",showInEdit:!0,showInPreview:!1,isRequiredInEdit:!0,requiredIf:["password","currentPassword"],order:{signUp:3}},legals:{id:"legals",type:_u.checkbox,options:[],requiredOptions:[],defaultValue:[],category:wu.Security,showInSignUp:!0,showInSignIn:!1,showInProfile:!0,showInEdit:!0,showInPreview:!1,isLegal:!0,order:{signUp:10}},"address.street_address":{id:"streetAddress",type:_u.textbox,showInSignUp:!1,showInSignIn:!1,showInProfile:!0,isRequired:!1,category:wu.DeliveryAddresses,showInEdit:!0,showInPreview:!0,regex:/^.{1,85}$/,requiredIf:["address.locality","address.region","address.postal_code","address.country"]},"address.locality":{id:"locality",type:_u.textbox,showInSignUp:!1,showInProfile:!1,showInSignIn:!1,isRequired:!1,category:wu.DeliveryAddresses,showInEdit:!1,showInPreview:!1,requiredIf:["address.street_address","address.region","address.postal_code","address.country"]},"address.region":{id:"region",type:_u.textbox,showInSignUp:!1,showInProfile:!0,showInSignIn:!1,isRequired:!1,category:wu.DeliveryAddresses,showInEdit:!0,showInPreview:!0,regex:/^.{1,65}$/,requiredIf:["address.street_address","address.locality","address.postal_code","address.country"]},"address.postal_code":{id:"postalCode",type:_u.textbox,showInSignUp:!1,showInProfile:!0,showInSignIn:!1,isRequired:!1,regex:/^.{1,12}$/,category:wu.DeliveryAddresses,showInEdit:!0,showInPreview:!0,requiredIf:["address.street_address","address.locality","address.region","address.country"]},"address.country":{id:"country",type:_u.textbox,showInSignUp:!1,showInSignIn:!1,showInProfile:!0,isRequired:!1,category:wu.DeliveryAddresses,showInEdit:!0,showInPreview:!0,regex:/^.{1,65}$/,requiredIf:["address.street_address","address.locality","address.region","address.postal_code"]},name:{id:"name",type:_u.textbox,showInSignUp:!1,showInProfile:!1,showInSignIn:!1,isRequired:!1,category:wu.UserDetails,showInEdit:!1,showInPreview:!1},given_name:{id:"givenName",type:_u.textbox,showInSignUp:!1,showInProfile:!0,showInSignIn:!1,isRequired:!1,category:wu.UserDetails,showInEdit:!0,showInPreview:!0,regex:/^.{1,60}$/,order:{profile:1}},family_name:{id:"familyName",type:_u.textbox,showInSignUp:!1,showInProfile:!0,showInSignIn:!1,isRequired:!1,category:wu.UserDetails,showInEdit:!0,showInPreview:!0,regex:/^.{1,60}$/,order:{profile:2}},birthdate:{id:"birthdate",type:_u.date,showInSignUp:!1,showInSignIn:!1,showInProfile:!1,isRequired:!1,regex:/^([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))$/,category:wu.UserDetails,showInEdit:!1,showInPreview:!0,maxValue:new Date},gender:{id:"gender",type:_u.radio,options:[{key:"male",translationKey:"male"},{key:"female",translationKey:"female"},{key:"other",translationKey:"other"}],showInSignUp:!1,showInProfile:!1,showInSignIn:!1,isRequired:!1,category:wu.UserDetails,showInEdit:!0,showInPreview:!0},middle_name:{id:"middleName",type:_u.textbox,category:wu.UserDetails,showInSignUp:!1,showInProfile:!1,isRequired:!1,showInSignIn:!1},nickname:{id:"nickname",type:_u.textbox,category:wu.UserDetails,showInSignUp:!1,showInProfile:!1,isRequired:!1,showInSignIn:!1},phone_number:{id:"phoneNumber",type:_u.textbox,showInSignUp:!1,showInProfile:!0,isRequired:!1,category:wu.UserDetails,showInEdit:!0,showInSignIn:!1,showInPreview:!0,customValidator:(e,t,n
2)=>{var r,i;const a=!((null===(r=e.value)||void 0===r?void 0:r.length)>0)||(0,s.g)((null===(i=e.value)||void 0===i?void 0:i.toString())||"");return{valid:a,message:a?null:n.translate("phone_numberRegexErrorMessage")}},order:{profile:4}},preferred_username:{id:"preferredUsername",type:_u.textbox,category:wu.UserDetails,showInSignUp:!1,showInProfile:!1,showInSignIn:!1,isRequired:!1},website:{id:"website",type:_u.textbox,showInSignUp:!1,showInProfile:!1,isRequired:!1,showInSignIn:!1,category:wu.UserDetails,showInEdit:!1,showInPreview:!1},deleteAccountStatement:{id:"deleteAccountStatement",type:_u.checkbox,showInSignUp:!1,showInProfile:!0,showInSignIn:!1,isRequired:!0,category:wu.Security,showInEdit:!0,showInPreview:!1,isRequiredInEdit:!0,defaultValue:[],requiredOptions:["agreement"],options:[{key:"agreement",translationKey:"confirmAccountDelete",hideCheckbox:!1}]}},TE={validationNotConfigured:"No validation method configured for {1} field ",sameAsNeedsReferrer:"When using sameAs parameter you must pass also referenced field for validation",defaultErrorMessage:"An error occurred. Please try again.",requiredErrorMessage:"{1} is required.",notSameErrorMessage:"{2} and {1} do not match.",regexErrorMessage:"Please enter a valid {1}.",emailRequiredErrorMessage:"Email is required.",emailRegexErrorMessage:"Please enter a valid email address.",passwordRequiredErrorMessage:"Password is required.",passwordRegexErrorMessage:"Password must have at least 8 characters and contain uppercase letters, lowercase letters, numbers and special characters.",deleteAccountStatementRequiredErrorMessage:"Please fill out all required fields.",currentPasswordRequiredErrorMessage:"Password is required.",confirmPasswordRequiredErrorMessage:"Confirm password is required.",confirmPasswordNotSameErrorMessage:"Password and Confirm password do not match.",phone_numberRegexErrorMessage:"Phone number must start with a plus sign, followed by a number. Do not use spaces or any other characters.",legalsRequiredErrorMessage:"All required legal fields must be accepted.",maxDateErrorMessage:"The selected date is after the allowed date.",birthdateMaxDateErrorMessage:"Please be sure to use your real birthday.",minDateErrorMessage:"The selected date is before the allowed date.",birthdateMinDateErrorMessage:"Please be sure to use your real birthday.",email:"Email",emailProfile:"Email",password:"Password",passwordProfile:"New password",currentPasswordProfile:"Old password",loginPasswordProfile:"Password",confirmPassword:"Confirm password",gender:"Gender",genderProfile:"Gender",male:"Male",maleProfile:"Male",female:"Female",femaleProfile:"Female",other:"Other",otherProfile:"Other",family_name:"Last name",family_nameProfile:"Last name",given_name:"First name",given_nameProfile:"First name",website:"Website",websiteProfile:"Website",name:"Full name",nameProfile:"Full name",birthdate:"Birthday",birthdateProfile:"Birthday",phone_number:"Phone",nicknameProfile:"Nickname",preferred_usernameProfile:"Preferred username",phone_numberProfile:"Phone","address.region":"City","address.regionProfile":"City","address.postal_code":"Postal code","address.postal_codeProfile":"Postal code","address.country":"Country","address.countryProfile":"Country","address.birthdate":"Birthdate","address.birthdateProfile":"Birthdate","address.phone_number":"Phone number","address.phone_numberProfile":"Phone number","address.locality":"Locality","address.localityProfile":"Locality","address.street_address":"Street and Number","address.street_addressProfile":"Street and Number",legals:"Legal",termsTextDefault:"By creating an account you agree to {1}.",termsTextDefault_1:"Terms & Conditions",termsTextDefaultSocialSignIn:"You must agree with the {1} to continue. Please read them carefully.",termsTextDefaultSocialSignIn_1:"Terms & Conditions",termsTextDefaultHasChanged:"We're updating our {1}. Please read them carefully.",termsTextDefaultHasChanged_1:"Terms & Conditions",privacyPolicyLegal:"You also need to accept {1}.",privacyPolicyLegal_1:"Privacy Policy",privacyPolicyLegalSocialSignIn:"You must agree with the {1} to continue. Please read them carefully.",privacyPolicyLegalSocialSignIn_1:"Privacy Policy",privacyPolicyLegalHasChanged:"We're updating our {1}. Please read them carefully.",privacyPolicyLegalHasChanged_1:"Privacy Policy",confirmLdsTitle:"Privacy & Data",confirmLdsDescription:"To add or modify data please accept our:",confirmLdsCloseButton:"Not now",confirmLdsCloseSubmit:"Accept",continueUsing:"Or continue using",missingLdsError:"Before changing user data you need to agree with Terms & Conditions",linkResendPossibleIn:"Resend confirmation link possible in {1} seconds.",loginTitle:"Log in to {brandname} shop",loginDescription:"To log-in in to our {brandname} shop please enter email and password.",loginPassword:"Password",loginRememberMe:"Remember me",loginSignUpInformationSubtitle:"Don't have account yet?",loginSignUpInformationButton:"ð Sign up",loginForgotPasswordButton:"Forgot your password?",loginSubmitButton:"Log in",registerTitle:"Please register",registerSignInInformationButton:"ð Log in",registerSignInInformationSubtitle:"Already have account?",registerDescription:"To register to our {brandname} shop please enter all obligatory data.",registerSubmitButton:"Continue",registerConfirmTitle:"Confirm registration",registerConfirmButton:"Confirm registration",registerConfirmationCheckInfoEmail:"Please click on confirmation link in a message that was sent to you by email on:",registerConfirmationCheckInfoSMS:"Please provide a confirmation code that was sent to you by SMS on:",resendButton:"Resend link",registerCongratulationTitle:"Congratulations",registerCongratulationText:"The account has been successfully created and verified ð. Please log in ð.",registerCongratulationButton:"Log in",forgotPasswordTitle:"Forgot the password?",forgotPasswordFormSuccessInfoTitle:"Check your email inbox",forgotPasswordFormSuccessInfoMessage:"If an account associated with the provided email address exists, you will receive an email with further instructions on resetting your password. If you do not receive an email, please ensure you've entered the correct email address or register for a new account if you haven't already.",forgotPasswordProvideEmail:"No worries, please enter the associated email address and we will send you a confirmation code for the password change.",forgotPasswordProvidePassword:"Please provide a new password:",forgotPassword:"Password",forgotPasswordConfirmPassword:"Confirm password",forgotPasswordSignInInformationSubtitle:"
2ð Go back to",forgotPasswordSignInInformationButton:"Log in",forgotPasswordSendResetLinkButton:"Send reset password link",forgotPasswordConfirmButton:"Submit changes",forgotPasswordCongratulationText:"Your password has been successfully changed ð. Please log in ð.",forgotPasswordCongratulationTitle:"Congratulations",forgotPasswordCongratulationButton:"Log in",changeAttributeTitleEMAIL:"Confirm email",changeAttributeTitleSMS:"Confirm phone number",changeAttributeCheckInfoEMAIL:"Email has been changed. Please provide a confirmation code that was sent to you by email on: ",changeAttributeCheckInfoSMS:"Phone number has been changed. Please provide a confirmation code that was sent to you by SMS on: ",userAttributesSubmitTitle:"Account confirmation",userAttributesSubmitConfirmButton:"Confirm account",accountConfirmationTitle:"Account confirmation",accountConfirmationCheckInfoEmail:"Account was not confirmed. Please provide a confirmation code that was sent to you by email on:",accountConfirmationCheckInfoSMS:"Account was not confirmed. Please provide a confirmation code that was sent to you by SMS on:",accountConfirmationConfirmButton:"Confirm account",accountConfirmationCongratulationText:"The account has been successfully confirmed and verified ð. Please log in ð.",accountConfirmationCongratulationTitle:"Congratulations",accountConfirmationCongratulationCloseButton:"Log in",updatedLdsTitle:"Legals have been changed",updatedLdsDescription:"To add or modify data please accept our:",updatedLdsSubmitButton:"Accept",security:"Security",securityDeleteAccountSubmitButton:"Delete account",securityDeleteAccountCancelButton:"Cancel",confirmAccountDeleteProfile:"Yes, I'm sure. Please delete my account.",securityDeleteDescription:"Permanently delete your account and all of your content",securityDeleteTitle:"Delete your account",securityDeleteSuccessModalMessage:"Your account was successfully deleted",securityDeleteSuccessModalTitle:"Success",securityDeleteSuccessModalButton:"Close",securityPasswordSectionTitle:"Password",securityLegalsSectionTitle:"Consents",securityPasswordEditSuccessModalTitle:"Success",securityPasswordEditSuccessModalButton:"Accept",securityPasswordChangeSuccessModalMessage:"You password has been successfuly changed.",securityPasswordEditTitle:"Edit password",securityPasswordEditCancelButton:"Cancel",securityPasswordEditSubmitButton:"Change password",securityLegalsEditSubmitButton:"Save changes",securityPasswordCurrentPasswordTooltipLabel:"Label describing old password field",securityPasswordPasswordTooltipLabel:"Label describing new password field",securityPasswordCurrentPasswordTooltipText:'{"blocks":[{"text":"Your current password","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}',securityPasswordPasswordTooltipText:'{"blocks":[{"text":"Your new password","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}',userDetails:"User details",userDetailsChangeEmailSubmitButton:"Change email",userDetailsChangeEmailCancelButton:"Cancel",userDetailsChangeEmailDescription:"Change your email address",userDetailsChangeEmailTitle:"Change email address",userDetailsChangeEmailSuccessModalTitle:"Success",userDetailsChangeEmailSuccessModalMessage:"Verification mail has been sent to your new e-mail. Please check your inbox.",userDetailsChangeEmailSuccessModalButton:"Accept",userDetailsEditTitle:"Edit personal information",userDetailsEditSubmitButton:"Save changes",userDetailsEditButton:"Edit details",userDetailsEditCancelButton:"Cancel",userDetailsGiven_nameTooltipLabel:"Label describing first name field",userDetailsGiven_nameTooltipText:'{"blocks":[{"text":"Your first name","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}',userDetailsFamily_nameTooltipLabel:"Label describing last name field",userDetailsFamily_nameTooltipText:'{"blocks":[{"text":"Your last name","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}',userDetailsPhone_numberTooltipLabel:"Label describing phone number field",userDetailsPhone_numberTooltipText:'{"blocks":[{"text":"Your phone number","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}',contactInformation:"Contact information",contactInformationEditTitle:"Edit contact information",contactInformationEditSubmitButton:"Save changes",deliveryAddresses:"Delivery addresses",deliveryAddressesEditTitle:"Edit contact information",deliveryAddressesEditSubmitButton:"Save",deliveryAddressesEditCancelButton:"Cancel",profileSecurityButton:"Change password",phoneNumberChangeSubmitCongratulationText:"Phone number has been changed successfully",federatedSignInFailure:"Social media login failed",editPasswordEqualErrorMessage:"Your new password cannot be the same as the current one.",multipassAPIConfigurationError:"Env is missing: ",multipassAuthReturnToMissing:"MultipassAuthReturnTo parameter in config is missing ",orderHistory:"Order history",additionalDeliveryAddresses:"Shipping addresses",addAdditionalDeliveryAddresses:"Add new address",addNewAddressEditTitle:"New address",addNewAddressEditSubmitButton:"Save New Address",addNewAddressEditCancelButton:"Cancel",additionalDeliveryAddressesEditTitle:"Address editing",additionalDeliveryAddressesEditCancelButton:"Cancel",additionalDeliveryAddressesEditSubmitButton:"Save",editAddress:"Edit",deleteAddress:"Delete",setDefaultAddress:"Set as Default",profileHeadingPrefix:"Hello",profileHeadingSuffix:"!",profileHeadingDescription:"Here you may review and edit all your details, addresses, security settings and orders.",verificationTimeout:"
2Verification timeout!",missingUserDataWhileEmailVerification:"Missing user data for verification, try to login to your account to resolve this issue",errorInformationBoxTitle:"Something went wrong!",userAlreadyVerified:"User already verified",canNotChangePasswordOfExternalProviderError:"Can't change password when user signed in with external provider",validationError:"Invalid params",deleteAddressTitle:"Delete address",deleteAddressText:"Are you sure you want to delete address? It will be deleted permanently.",deleteAddressConfirm:"Confirm",deleteAddressCancel:"Cancel",confirmLdsInfo:'Please accept to allow editing of your personal data; click "Not Now" to decline.',changeEmailEqualErrorMessage:"Your new email cannot be the same as the current one.",changeEmailMissingErrorMessage:"Can't change email",verifyAndChangeEmailCongratulationTitle:"Congratulations",verifyAndChangeEmailCongratulationText:"The new e-mail address has been verified ð. Please log in with your new mail ð.",verifyAndChangeEmailCongratulationButton:"Log in",recoverEmailCongratulationTitle:"Congratulations",recoverEmailCongratulationText:"Your e-mail address has been recovered ð. Please log in ð.",recoverEmailCongratulationButton:"Log in",deniedAccessUserRejected:"Your account has been rejected by the administrator. Please contact support for more information.",deniedAccessUserPending:"Your account is awaiting approval by the administrator. If you experience any issues, please contact support for more information.",postMigrationPasswordResetHeadline:"It looks like your account is locked.",postMigrationPasswordResetDescription:"Please reset your password for security reasons. After clicking the link, you'll be directed to a simple form to complete the process. If you have any trouble, donât hesitate to ask for help.",postMigrationPasswordResetButton:"Reset"},xE={"auth/email-already-in-use":"An account with the given email already exists","auth/expired-action-code":"This confirmation link is already expired","auth/invalid-action-code":"This confirmation link is invalid or already used","auth/invalid-credential":"Invalid credentials","invalid-argument":"Internal error, please try again later","auth/firebase-app-check-token-is-invalid":"There was an error processing the form, please try again","auth-custom/reauthentication-impossible":"Reauthentication impossible due to missing data","auth/requires-recent-login":"User reuthentication required","auth/too-many-requests":"Attempt limit exceeded, please try again later","auth/weak-password":"Password must have at least 6 characters","auth/wrong-password":"Your current password is incorrect","auth/user-mismatch":"Invalid credentials","auth/user-token-expired":"You session has expired, please sign in and try again","auth/api-key-not-valid-please-pass-a-valid-api-key":"The login and register are currently unavailable, please try again later"};function AE(e){return!e.success}class CE{constructor(e,t,n){this.translationService=e,this.ldsService=t,this.fieldsSetup=n,this.fields={},this.resetupLegalFields=e=>h(this,void 0,void 0,function*(){yield this.setupFields(e,this.fieldsSetup)}),this.setupFields=(e,t)=>h(this,void 0,void 0,function*(){const n=t_(SE),r=this.setupAdditionalSignUpFields(n,null==t?void 0:t.slice());this.fieldsReady=new Promise(t=>{(()=>{h(this,void 0,void 0,function*(){this.fields=yield this.setupLegalFields(r,e),t()})})()}),yield this.fieldsReady}),this.filterChangedAttributes=(e,t)=>Object.entries(e).reduce((e,[n,r])=>((!t||!IE(t[n],r)&&!(xu(t[n])&&xu(r)))&&(e[n]=r),e),{}),this.createFormattedAddressAttributes=e=>{const{"address.street_address":t,"address.locality":n,"address.region":r,"address.postal_code":i,"address.country":a}=e,s=l(e,["address.street_address","address.locality","address.region","address.postal_code","address.country"]),o={street_address:t,locality:n,region:r,postal_code:i,country:a},u=this.areAnyFieldsExisting(...Object.values(o));return Object.assign(Object.assign({},s),u&&{address:o})},this.groupByCategory=e=>Object.entries(e).reduce((e,[t,n])=>{const{category:r}=n;return Object.assign(Object.assign({},e),r?{[r]:Object.assign(Object.assign({},e[r]||{}),{[t]:n})}:{})},{}),this.fillLegalsField=(e,t)=>{var n;const r=(null===(n=null==t?void 0:t.options)||void 0===n?void 0:n.filter(e=>e.isRequired).map(e=>e.key))||[];
2null==e||e.forEach(e=>{r.includes(e.businessId)||r.push(e.businessId)});const i=t.options?t.options.map(e=>Object.assign(Object.assign({},e),{isDisabled:e.isRequired})):[];return{legals:Object.assign(Object.assign({},t),{defaultValue:r,options:i})}},this.fillFieldsWithUserData=({profileFields:e,userFields:t,filterExistingFields:n})=>Object.entries(e).reduce((e,[r,i])=>n&&t&&!z_(t,r)?Object.assign({},e):Object.assign(Object.assign({},e),{[r]:Object.assign(Object.assign({},i),{defaultValue:N_(t,r)})}),{}),this.fillAdditionalDeliveryAddressesFields=(e,t=[])=>t.map(t=>this.fillFieldsWithUserData({profileFields:e,userFields:t,filterExistingFields:!0})).map(e=>Object.assign(Object.assign({},e),{id:Math.random().toString(36).substring(2,8)})),this.setFieldValidation=(e,t)=>h(this,void 0,void 0,function*(){yield this.fieldsReady,this.fields[e]=Object.assign(Object.assign({},this.fields[e]),t)}),this.getFields=()=>h(this,void 0,void 0,function*(){return yield this.fieldsReady,this.fields}),this.sortFieldsAscending=(e,t)=>(void 0===e?Number.MAX_SAFE_INTEGER:e)-(void 0===t?Number.MAX_SAFE_INTEGER:t),this.getSignUpFields=()=>h(this,void 0,void 0,function*(){return yield this.fieldsReady,Object.entries(this.fields).filter(([,{showInSignUp:e}])=>e).sort(([,{order:e}],[,{order:t}])=>this.sortFieldsAscending(null==e?void 0:e.signUp,null==t?void 0:t.signUp)).reduce(this.mapFieldsToShow(!1),Promise.resolve({}))}),this.getSignInFields=()=>h(this,void 0,void 0,function*(){return yield this.fieldsReady,Object.entries(this.fields).filter(([,{showInSignIn:e}])=>e).sort(([,{order:e}],[,{order:t}])=>this.sortFieldsAscending(null==e?void 0:e.signIn,null==t?void 0:t.signIn)).reduce(this.mapFieldsToShow(!1),Promise.resolve({}))}),this.getLegalsFields=(e,t,n)=>h(this,void 0,void 0,function*(){return yield this.fieldsReady,Object.entries(this.fields).filter(([,{isLegal:e}])=>e).reduce(this.mapFieldsToShow(e,t,n),Promise.resolve({}))}),this.getProfileFields=()=>h(this,void 0,void 0,function*(){yield this.fieldsReady;return Object.entries(this.fields).filter(([,{showInProfile:e}])=>e).sort(([,{order:e}],[,{order:t}])=>this.sortFieldsAscending(null==e?void 0:e.profile,null==t?void 0:t.profile)).reduce(this.mapFieldsToShow(!1,"Profile"),Promise.resolve({}))}),this.areAllFieldsFilled=(...e)=>e.every(e=>(null==e?void 0:e.length)>0),this.areAllFieldsExisting=(...e)=>e.every(e=>void 0!==e),this.areAnyFieldsFilled=(...e)=>e.some(e=>(null==e?void 0:e.length)>0),this.areAnyFieldsExisting=(...e)=>e.some(e=>void 0!==e),this.mapFieldsToShow=(e,t,n)=>(r,[i,a])=>h(this,void 0,void 0,function*(){const{translate:s}=this.translationService,o=yield r,u=yield this.handleOptions(Object.assign(Object.assign({},a),{translationPostfix:t,isExternalProviderUser:e}));return o[i]=Object.assign(Object.assign({},a),{label:s(`${i}${t||""}`),options:null==u?void 0:u.filter(e=>!n||e.isRequired)}),o}),this.setupAdditionalSignUpFields=(e,t)=>{const n=null==t?void 0:t.filter(e=>e.customField).reduce((e,t)=>(e[t.id]=t,e),{});return Object.entries(e).reduce((e,[r,i])=>{const a=null==t?void 0:t.find(e=>e.name===r);return Object.assign(Object.assign(Object.assign({},e),{[r]:Object.assign(Object.assign({},i),a||{})}),n)},{})},this.setupLegalFields=(e,t)=>h(this,void 0,void 0,function*(){var n,r;const i=yield this.ldsService.getLds(),a=(null===(n=e.legals.options)||void 0===n?void 0:n.slice())||[],s=(null===(r=e.legals.requiredOptions)||void 0===r?void 0:r.slice())||[];return i.forEach(({businessId:n,isRequired:r,hideCheckbox:i,translationKey:o,customLabel:u,socialTerm:c})=>{var l;const h=a.find(({key:e})=>e===n);h?(h.hideCheckbox=i,h.socialTerm=c):a.push({key:n,customLabel:u,translationKey:o||"termsTextDefault",hideCheckbox:i,socialTerm:c}),i&&!(null===(l=e.legals.defaultValue)||void 0===l?void 0:l.includes(n))&&e.legals.defaultValue.push(n);!((r||i)&&!s.includes(n))||!t&&c||s.push(n)}),Object.assign(Object.assign({},e),{legals:Object.assign(Object.assign({},e.legals),{options:a,requiredOptions:s})})}),this.handleOptions=({options:e,requiredOptions:t,type:n,translationPostfix:r,isExternalProviderUser:i}
2)=>h(this,void 0,void 0,function*(){if(!(null==e?void 0:e.length))return Promise.resolve(null);const a=e.filter(({socialTerm:e})=>i||!e),s={checkbox:this.handleCheckbox(a,t,r),radio:this.handleRadio(a,r),select:this.handleSelect(a,r)};return Promise.all(s[n]())}),this.handleRadio=(e,t)=>()=>{const{translate:n}=this.translationService;return e.map(({key:e,translationKey:r})=>h(this,void 0,void 0,function*(){return{key:e,label:n(`${r}${t||""}`)}}))},this.handleSelect=(e,t)=>()=>{const{translate:n}=this.translationService;return e.map(({key:e,translationKey:r})=>h(this,void 0,void 0,function*(){return{value:e,label:n(`${r}${t||""}`)}}))},this.handleCheckbox=(e,t,n)=>()=>e.map(({key:e,translationKey:r,hideCheckbox:i,customLabel:a})=>h(this,void 0,void 0,function*(){const s=`${r}${n||""}`,o=yield this.prepareActionArray({translationKey:s,businessId:e,customLabel:a});return{key:e,labels:o,hideCheckbox:i,isRequired:void 0!==t&&t.includes(e)}})),this.splitLabelForLinks=e=>e.split(/(\[.*?\]|\.)\s*/g).filter(Boolean),this.prepareActionArray=({businessId:e,translationKey:t,customLabel:n})=>h(this,void 0,void 0,function*(){const{translate:r,getTranslationArray:i}=this.translationService,a=n?"custom":"default",s={custom:{splitter:this.splitLabelForLinks,regex:/\[.*?\]/},default:{splitter:i,regex:/\{([0-9]+)\}/}},{splitter:o,regex:u}=s[a],c=o(n||t),l=yield this.ldsService.getLdsByBusinessId(e),h=l?()=>{l.onLegalLinkClickAction&&l.onLegalLinkClickAction()}:null;return c.map(e=>{const i=e.match(u);return(null==i?void 0:i.length)?{value:n?i[0].slice(1,i[0].length-1):r(`${t}_${i[1]}`),onClick:h}:{value:e,onClick:null}})}),this.setupFields(!1,this.fieldsSetup)}}class PE{log(e,...t){console.log(e,t)}warn(e,...t){console.warn(e,t)}error(e,...t){console.error(e,t)}}class OE{constructor(e,t){this.loggerService=e,this.translate=(e,t,...n)=>{let r=this.translations[e];return r?(null==n||n.forEach((e,t)=>{r=r.replace(`{${t+1}}`,e||"")}),r):t||e},this.getTranslationArray=e=>{const t=this.translations[e];return t?t.split(/(\{[0-9]+\})([a-zA-Z0-9 .,-_&()]+)/g).filter(e=>e.length):(this.loggerService.warn("Translation key not provided",e),[])},this.translations=Object.assign(Object.assign(Object.assign({},TE),xE),t||{})}}class RE{constructor(e,t,n,r){this.translationService=e,this.fieldsService=t,this.loggerService=n,this.fieldsSetup=r,this.defaultValidators={},this.resetupValidation=()=>this.setup(),this.setup=()=>h(this,void 0,void 0,function*(){this.validatorsReady=new Promise(e=>{(()=>{h(this,void 0,void 0,function*(){var t;this.defaultValidators=yield this.createDefaultValidation(),yield this.createValidation(null===(t=this.fieldsSetup)||void 0===t?void 0:t.slice()),e()})})()}),yield this.validatorsReady}),this.validate=(e,t)=>h(this,void 0,void 0,function*(){yield this.validatorsReady;const{translate:n}=this.translationService,r={};return Object.entries(e).forEach(([i,a])=>{const s=this.defaultValidators[i];s?r[i]=s({name:i,value:a,fields:e},t,this.translationService):this.loggerService.warn(n("validationNotConfigured",i))}),{valid:Object.values(r).every(({valid:e})=>e),validation:r}}),this.requiredValidator=({isRequired:e,isRequiredInEdit:t,requiredIf:n,type:r,requiredOptions:i},{name:a,value:s,fields:o},u)=>{const{translate:c}=this.translationService,l={textbox:this.stringRequiredValidator,date:this.stringRequiredValidator,textarea:this.stringRequiredValidator,password:this.stringRequiredValidator,checkbox:this.checkboxRequiredValidator,radio:this.radioRequiredValidator,phone:this.stringRequiredValidator,select:this.selectRequiredValidator},h=e&&!u||t&&u||(null==n?void 0:n.some(e=>{var t;return(null===(t=o[e])||void 0===t?void 0:t.length)>0}));return r!==_u.checkbox||l[r.toString()](s,i)?h&&!l[r.toString()](s)?{valid:!1,message:c(`${a}RequiredErrorMessage`,c("requiredErrorMessage",void 0,c(a)))}:{valid:!0,message:null}:{valid:!1,message:c(`${a}RequiredErrorMessage`,c("requiredErrorMessage",void 0,c(a)))}},this.validator=(e,{name:t,value:n,fields:r},i)=>{var a,s;const{regex:o,sameAs:u,type:c,maxValue:l,minValue:h}=e,{translate:f}=this.translationService,d=this.requiredValidator(e,{name:t,value:n,fields:r},i);if(!d.valid)return d;const p={date:this.rangeValidator},v=null===(a=p[c.toString()])||void 0===a?void 0:a.call(p,{min:h,max:l,name:t,val:n});if(null==v?void 0:v.error)return{valid:!1,message:v.message};if("string"==typeof n&&o&&(null==n?void 0:n.length)&&!(null===(s=n.match(o)
2)||void 0===s?void 0:s.length))return{valid:!1,message:f(`${t}RegexErrorMessage`,f("regexErrorMessage",void 0,f(t)))};if(u){const e=r[u];if(void 0===e)return this.loggerService.error(f("sameAsNeedsReferrer")),{valid:!0,message:null};const i=e===n;return{valid:i,message:i?null:f(`${t}${u}NotSameErrorMessage`,f("notSameErrorMessage",void 0,f(t),f(u)))}}return{valid:!0,message:null}},this.customValidator=(e,t,{name:n,value:r,fields:i},a)=>{const s=this.requiredValidator(t,{name:n,value:r,fields:i},a);return s.valid?e.bind(t,{name:n,value:r,fields:i},a,this.translationService)():s},this.createDefaultValidation=()=>h(this,void 0,void 0,function*(){const e=yield this.fieldsService.getFields();return Object.keys(e).reduce((t,n)=>{const{customValidator:r}=e[n];return Object.assign(Object.assign({},t),{[n]:"function"==typeof r?this.customValidator.bind(this,r,e[n]):this.validator.bind(this,e[n])})},{})}),this.stringRequiredValidator=e=>(null==e?void 0:e.length)>0,this.radioRequiredValidator=e=>(null==e?void 0:e.length)>0,this.selectRequiredValidator=e=>"string"==typeof e?e.length>0:e.value.length>0,this.rangeValidator=({val:e,max:t,min:n,name:r})=>{const{translate:i}=this.translationService;return t&&(0,o.A)(new Date(e),t)?{error:!0,message:i(`${r}MaxDateErrorMessage`,i("maxDateErrorMessage",void 0,i(r)))}:n&&(0,u.A)(new Date(e),n)?{error:!0,message:i(`${r}MinDateErrorMessage`,i("minDateErrorMessage",void 0,i(r)))}:{error:!1,message:null}},this.checkboxRequiredValidator=(e,t)=>(null==t?void 0:t.length)?null==t?void 0:t.every(t=>null==e?void 0:e.includes(t)):(null==e?void 0:e.length)>0,this.createValidation=e=>h(this,void 0,void 0,function*(){(null==e?void 0:e.length)&&(yield Promise.all(null==e?void 0:e.map(e=>h(this,void 0,void 0,function*(){if(e){const{name:t}=e,{customValidator:n}=e,r=l(e,["customValidator"]);this.fieldsService.setFieldValidation(t,r);const i=yield this.fieldsService.getFields();"function"==typeof n?this.defaultValidators[t]=n.bind(i[t]):this.defaultValidators[t].bind(i[t])}return!0}))))}),this.setup()}}class NE{constructor({userAuthService:e,ldsService:t,ecommerceService:n},a){this.signUp=e=>h(this,void 0,void 0,function*(){const{email:t,password:n}=e,r=l(e,["email","password"]),i=yield this.validate(Object.assign(Object.assign({},r),{email:t,password:n}));if(!i.valid)return this.loggerService.error(i),{success:!1,message:this.translationService.translate("validationError"),lastModified:(new Date).toISOString()};const a=Array.isArray(r.legals)?yield this.ldsService.createLdsFields(r.legals):[],s=this.cleanAttributes(r,!0,["confirmPassword","legals"]),o=this.fieldsService.createFormattedAddressAttributes(s),u=yield this.userAuthService.signUp({email:t,password:n,attributes:Object.assign(Object.assign({},o),{lds:a})});return window.localStorage.setItem(Iu.onConfirmSignUp,"false"),this.formatServiceResult(u)}),this.signIn=e=>h(this,void 0,void 0,function*(){var{email:t}=e,n=l(e,["email"]);let r;if(this.ecommerceService&&this.ecommerceService.isMultipassEnabled()&&(r=yield this.ecommerceService.generateMultipassLink(t),AE(r))){const e=r.code?this.translate(`${r.code}`)+r.message:this.translate("defaultErrorMessage");return Object.assign(Object.assign({},r),{message:e})}const i=yield this.userAuthService.signIn(Object.assign(Object.assign({},n),{email:t}));return i.success?(this.ecommerceService&&r&&r.url&&this.ecommerceService.signIn(r.url),i):this.formatServiceResult(i)}),this.federatedSignIn=e=>h(this,void 0,void 0,function*(){const t=yield this.ldsService.getSocialLds();return this.userAuthService.federatedSignIn(Object.assign(Object.assign({},e),{userAttributes:{lds:t}}))}),this.dispatchEventIfLegalsUpdated=()=>h(this,void 0,void 0,function*(){var e,t;const n=yield this.userAuthService.getUserAttributes();AE(n)||(yield this.ldsService.dispatchEventIfLegalsUpdated(null!==(t=null===(e=n.attributes)||void 0===e?void 0:e.lds)&&void 0!==t?t:[],this.isExternalProviderUser()))}),this.getAcceptedLegals=()=>h(this,void 0,void 0,function*(){const e=yield this.userAuthService.getUserAttributes();
2return e.success&&e.attributes?this.ldsService.getAcceptedLegals(e.attributes):{}}),this.translate=(e,t,...n)=>this.translationService.translate(e,t,...n),this.signOut=()=>this.userAuthService.signOut(),this.getAvailableSocialSignIn=()=>this.userAuthService.getAvailableSocialSignIn(),this.getCurrentUser=()=>this.userAuthService.getCurrentUser(),this.getCurrentUserStatus=()=>this.userAuthService.getCurrentUserStatus(),this.deleteCurrentUser=e=>h(this,void 0,void 0,function*(){const t=yield this.userAuthService.reauthenticateCurrentUser(e);if(t.success&&t.user){const e=yield this.userAuthService.deleteUser(t.user);return e.success?e:this.formatServiceResult(e)}return this.formatServiceResult(t)}),this.getRememberMeConfig=()=>this.userAuthService.getRememberMeConfig(),this.confirmSignUp=e=>h(this,void 0,void 0,function*(){const t=yield this.userAuthService.confirmSignUp(e),n=AE(t),r=n&&(0,i.Gv)(t.message)&&[Dt.EXPIRED_OOB_CODE,Dt.INVALID_OOB_CODE].includes(t.message);return n||window.localStorage.setItem(Iu.onConfirmSignUp,"true"),this.formatServiceResult(Object.assign(Object.assign({},t),{allowForAnotherResend:r}))}),this.verifyCodeForEmailChange=e=>h(this,void 0,void 0,function*(){const t=yield this.userAuthService.verifyCodeForEmailChange(e);return this.formatServiceResult(t)}),this.validate=(e,t=!1)=>this.validationService.validate(e,t),this.getSignUpFields=()=>
2this.fieldsService.getSignUpFields(),this.getSignInFields=()=>this.fieldsService.getSignInFields(),this.getProfileFields=()=>h(this,void 0,void 0,function*(){var e,t;const[n,r]=yield Promise.all([this.fieldsService.getProfileFields(),this.userAuthService.getUserAttributes()]);if(!r.success)return this.fieldsService.groupByCategory(n);const i=this.fieldsService.fillAdditionalDeliveryAddressesFields(n,null===(e=r.attributes)||void 0===e?void 0:e.deliveryAddresses),a=this.getCurrentUser(),s=this.fieldsService.fillFieldsWithUserData({profileFields:n,userFields:Object.assign(Object.assign({},r.attributes),{email:(null==a?void 0:a.email)||""})}),o=this.fieldsService.fillLegalsField((null===(t=r.attributes)||void 0===t?void 0:t.lds)||[],n.legals);return Object.assign(Object.assign({},this.fieldsService.groupByCategory(Object.assign(Object.assign({},s),o))),i&&{[wu.AdditionalDeliveryAddresses]:i})}),this.changePassword=e=>h(this,void 0,void 0,function*(){const t=this.getCurrentUser();if(t&&this.isPasswordProviderUser()){const{password:n,currentPassword:r}=e;if(n===r)return{success:!1,message:this.translationService.translate("editPasswordEqualErrorMessage")};const i=yield this.userAuthService.changePassword({user:t,password:n,currentPassword:r});return AE(i)?this.formatServiceResult(i):i}return{success:!1,message:this.translationService.translate("canNotChangePasswordOfExternalProviderError")}}),this.updateUserLegals=({legals:e},t)=>h(this,void 0,void 0,function*(){var n,r,i;if(!Array.isArray(e))return{success:!1,message:this.translationService.translate("validationError")};const a=yield this.ldsService.createLdsFields(e);if(t){const t=yield this.userAuthService.getUserAttributes();if(AE(t))return this.formatServiceResult(t);const s=null!==(i=null===(r=null===(n=t.attributes)||void 0===n?void 0:n.lds)||void 0===r?void 0:r.filter(t=>!e.includes(t.businessId)))&&void 0!==i?i:[];a.push(...s)}const s=yield this.userAuthService.setUserAttributes({lds:a,lastModified:(new Date).toISOString()});return this.formatServiceResult(s)}),this.setUserAttributes=e=>h(this,void 0,void 0,function*(){var t;const n=yield this.getUserProfileEditRights();if(!n.success)return n;if(n.success&&!n.canEditProfile)return{success:!1,message:this.translationService.translate("missingLdsError")};const i=yield this.validationService.validate(e,!0);if(!i.valid)return this.loggerService.error(i),{success:!1,message:this.translationService.translate("validationError")};const a=this.cleanAttributes(e,!1,["confirmPassword","password","currentPassword","email","legals"]),s=this.fieldsService.createFormattedAddressAttributes(a),o=yield this.userAuthService.getUserAttributes(),u=this.fieldsService.filterChangedAttributes(s,o.attributes);if((0,r.R)(u))return{success:!0};const c=yield this.userAuthService.setUserAttributes(Object.assign(Object.assign({},u),{deliveryAddresses:null===(t=null==u?void 0:u.deliveryAddresses)||void 0===t?void 0:t.filter(e=>[...e.address?Object.values(e.address):[]].some(e=>!xu(e))),lastModified:(new Date).toISOString()}));return c.success?this.shouldUpdateUserDisplayName(u)?this.updateUserDisplayName({preferredUsername:s.preferred_username,nickname:s.nickname,givenName:s.given_name}):{success:!0}:this.formatServiceResult(c)}),this.getUserProfileEditRights=()=>h(this,void 0,void 0,function*(){const e=yield this.userAuthService.getUserAttributes();if(e.success){const t=yield this.ldsService.getMissingLegalsForProfileEdit(e.attributes);return(null==t?void 0:t.length)?{success:!0,canEditProfile:!1}:{success:!0,canEditProfile:!0}}return this.formatServiceResult(e)}),this.getLegalsFields=(e,t)=>h(this,void 0,void 0,function*(){return this.fieldsService.getLegalsFields(this.isExternalProviderUser(),e,t)}),this.resendSignUp=()=>this.userAuthService.resendSignUp(),this.forgotPassword=e=>h(this,void 0,void 0,function*(){const t=yield this.userAuthService.forgotPassword(e);return this.formatServiceResult(t)}),this.resetPassword=e=>h(this,void 0,void 0,function*(){const t=yield this.userAuthService.resetPassword(e);return this.formatServiceResult(t)}),this.getLds=()=>this.ldsService.getLds(),this.getUserName=()=>{const e=this.userAuthService.getCurrentUser(),t=e?(null==e?void 0:e.displayName)||"":void 0;return{success:Boolean(e),userName:t}},this.isPasswordProviderUser=()=>{try{return this.isPasswordProviderLoggedUser()}catch(e){return!1}},this.isExternalProviderUser=()=>{try{return!this.isPasswordProviderLoggedUser()}catch(e){return!1}},this.getUserOrders=()=>h(this,void 0,void 0,function*(){if(!this.ecommerceService)return;const e=yield this.getProfileFields(),t=yield this.ecommerceService.getUserIdByEmail({clientEmail:e.security.email.defaultValue});return t.success&&t.id?this.ecommerceService.getUserData({clientId:t.id,scope:"orders"}):t}),this.setRememberMe=e=>h(this,void 0,void 0,function*(){return this.userAuthService.setAuthStatePersistence(e)}),this.createFormattedAddressAttributes=e=>this.fieldsService.createFormattedAddressAttributes(e),this.changeEmail=e=>h(this,void 0,void 0,function*(){var{newEmail:t}=e,n=l(e,["newEmail"]);const{email:r}=this.getCurrentUser()||{};if((0,i.z3)(r)||t===r)return{success:!1,message:this.translationService.translate((0,i.z3)(r)?"changeEmailMissingErrorMessage":"changeEmailEqualErrorMessage")};const a=yield this.userAuthService.reauthenticateCurrentUser(n);if(a.success&&a.user){const e=yield this.userAuthService.changeEmail(a.user,t);return e.success?e:this.formatServiceResult(e)}return this.formatServiceResult(a)}),this.customSignInEvent=()=>h(this,void 0,void 0,function*(){this.checkUserStatus(),this.dispatchEventIfLegalsUpdated()}),this.checkUserStatus=()=>{this.fieldsService.resetupLegalFields(this.isExternalProviderUser()),this.validationService.resetupValidation()},this.cleanAttributes=(e,t,n)=>Object.entries(e).reduce((e,[r,i])=>{const a=null!=i&&(!t||(null==i?void 0:i.length))&&!(null==n?void 0:n.includes(r));return Object.assign(Object.assign({},e),a?{[r]:i}:{})},{}),this.shouldUpdateUserDisplayName=e=>{const t=["preferred_username","nickname","given_name"];return Object.keys(e).some(e=>t.includes(e))},this.updateUserDisplayName=e=>h(this,void 0,void 0,function*(){let t;const n=this.getCurrentUser();if(n){const{preferredUsername:r,nickname:i,givenName:a}=e,s=r||i||a||"";if(t=yield this.userAuthService.updateUserDisplayName(n,s),t.success)return t}return{success:!1,message:this.getErrorMessage(t)}}),this.isPasswordProviderLoggedUser=()=>{const e=this.userAuthService.getCurrentUser();if(e){return this.userAuthService.getUserProvidersId(e).includes(Pt)}throw new Error("not logged")},this.getErrorMessage=e=>{const{code:t,message:n}=e;return t?this.translationService.translate(t,n):n};const{translations:s,fieldsSetup:o}=a||{};this.loggerService=new PE,this.translationService=new OE(this.loggerService,s),this.ldsService=new t.Class(t.params),n&&(this.ecommerceService=new n.Class(n.params)),this.fieldsService=new CE(this.translationService,this.ldsService,o),this.userAuthService=new e.Class(e.params),this.validationService=new RE(this.translationService,this.fieldsService,this.loggerService,o),this.checkUserStatus(),this.userAuthService.authStateChangedObserver({customSignInEvent:this.customSignInEvent})}formatServiceResult(e){return Object.assign(Object.assign({},e),{message:this.getErrorMessage(e)})}}NE.getInstance=(e,t)=>(NE.instance||(NE.instance=new NE(e,t)),NE.instance)}}]); 3//# sourceMappingURL=d6a94a9f-54fb89e432f2d45cf8b1.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.